Interface ObjectAttributeBeanFactory
- All Known Implementing Classes:
ObjectAttributeBeanFactoryImpl
@PublicApi
public interface ObjectAttributeBeanFactory
Factory component used to create
ObjectAttributeBean
.- Since:
- 5.0
- Author:
- Ola Melin
-
Method Summary
Modifier and TypeMethodDescriptioncreateConfluenceAttributeValue
(ObjectTypeAttributeBean ota, Long... pageIds) createDefaultTypeValues
(ObjectTypeAttributeBean ota, Object... values) Creates default type values from the specified values.createGroupAttributeValue
(ObjectTypeAttributeBean ota, Predicate<InsightGroup> groupPredicate) Create an object attribute bean with all groups matching the predicatecreateGroupAttributeValueByNames
(ObjectTypeAttributeBean ota, String... groupNames) Create an object attribute bean with one or more group namescreateObjectAttributeBean
(ObjectTypeAttributeBean ota, String... values) Creates an object attribute bean by using the jira default date format as well as the jira date time format if the object type attribute supplied is of date or date time format respectively.createObjectAttributeBean
(ObjectTypeAttributeBean ota, DateFormat dateFormat, DateFormat dateTimeFormat, String... values) Creates an object attribute bean of the type specified by the object type supplied.createObjectAttributeBeanForObject
(ObjectBean objectBean, ObjectTypeAttributeBean ota, String... values) Creates an object attribute bean of the givenObjectTypeAttributeBean
type and with the supplied values.createObjectAttributeBeanForObject
(ObjectBean objectBean, ObjectTypeAttributeBean ota, DateFormat dateFormat, DateFormat dateTimeFormat, String... values) Creates an object attribute bean with the specified date format and date time format for the supplied object bean.createProjectAttributeValue
(ObjectTypeAttributeBean ota, Predicate<InsightProject> predicate) createReferenceAttributeValue
(ObjectTypeAttributeBean ota, Predicate<ObjectBean> predicate) createStatusAttributeValue
(ObjectTypeAttributeBean ota, Predicate<StatusTypeBean> predicate) createUserAttributeValueByKey
(ObjectTypeAttributeBean ota, String... userKeys) Create a user attribute by supplying one or more user keys convenient method when you have one or more user keys.createUserAttributeValueByName
(ObjectTypeAttributeBean ota, String... userNames) Create a user attribute by one or more user namescreateUserTypeAttribute
(ObjectTypeAttributeBean ota, String userKey) Creates an ObjectAttributeBean with values with user matching the given user keycreateUserTypeAttribute
(ObjectTypeAttributeBean ota, List<String> valueList, boolean includeInactiveUsers, Integer maxUserSearchValue) Creates an ObjectAttributeBean with values with all users matching the given userPredicate.createUserTypeAttributeByKeyOrUsername
(ObjectTypeAttributeBean ota, List<String> userKeys) Creates an ObjectAttributeBean with values with user matching the given user keyscreateVersionAttributeValue
(ObjectTypeAttributeBean ota, Predicate<InsightVersion> predicate)
-
Method Details
-
createObjectAttributeBeanForObject
@Nonnull MutableObjectAttributeBean createObjectAttributeBeanForObject(@Nonnull ObjectBean objectBean, @Nonnull ObjectTypeAttributeBean ota, String... values) throws InsightException Creates an object attribute bean of the givenObjectTypeAttributeBean
type and with the supplied values. The created object attribute is not appended to the supplied object bean. The caller will have to append the object attribute to the object and persist the same. The method will create all information needed for the object attribute together with object attribute values. A call to this method is the same as tocreateObjectAttributeBeanForObject(ObjectBean, ObjectTypeAttributeBean, DateFormat, DateFormat, String...)
with JIRAs default date format and date time format- Parameters:
objectBean
- the object bean that are supposed to have the object attribute. I.e. the value for object id will be used from the object beanota
- the attribute type to createvalues
- a vararg of values.- Returns:
- the created object attribute bean (not persisted) and not added to the object beans attribute list
- Throws:
InsightException
- if the ota is of object type reference and when trying to find the reference objects fails in some way.IllegalArgumentException
- if no matching type is found for the ObjectTypeAttributeBean or if the values supplied are null
-
createObjectAttributeBeanForObject
MutableObjectAttributeBean createObjectAttributeBeanForObject(ObjectBean objectBean, ObjectTypeAttributeBean ota, DateFormat dateFormat, DateFormat dateTimeFormat, String... values) throws InsightException Creates an object attribute bean with the specified date format and date time format for the supplied object bean. The values supplied will be used to fetch the relevant information that should be stored as a value. In the case of theObjectTypeAttributeBean
is of the type User the values supplied will be used to match users based on display name, email or user key. This method uses- Parameters:
objectBean
- the object bean that are supposed to have the object attribute. I.e. the value for object id will be used from the object beanota
- the attribute type to createdateFormat
- a java date format used to parse date values if theObjectTypeAttributeBean
is of a date typedateTimeFormat
- a java date time format used to parse date values if theObjectTypeAttributeBean
is of a date time typevalues
- a vararg of values.- Returns:
- the created object attribute bean (not persisted)
- Throws:
InsightException
- if the ota is of object type reference and when trying to find the reference objects fails in some way.IllegalArgumentException
- if no matching type is found for the ObjectTypeAttributeBean or if the values supplied are null
-
createObjectAttributeBean
@Nonnull MutableObjectAttributeBean createObjectAttributeBean(@Nonnull ObjectTypeAttributeBean ota, String... values) throws InsightException Creates an object attribute bean by using the jira default date format as well as the jira date time format if the object type attribute supplied is of date or date time format respectively. This method usescreateObjectAttributeBean(ObjectTypeAttributeBean, DateFormat, DateFormat, String...)
internally but with JIRA default dateFormat and dateTimeFormat for the date format parameters- Parameters:
ota
- the attribute type to createvalues
- a vararg of values- Returns:
- a created (not persisted) object attribute bean with object attribute bean value(s) populated
- Throws:
InsightException
- if the ota is of object type reference and when trying to find the reference objects fails in some way.IllegalArgumentException
- if no matching type is found for the ObjectTypeAttributeBean or if the values supplied are null
-
createObjectAttributeBean
MutableObjectAttributeBean createObjectAttributeBean(ObjectTypeAttributeBean ota, DateFormat dateFormat, DateFormat dateTimeFormat, String... values) throws InsightException Creates an object attribute bean of the type specified by the object type supplied. If the attribute type is of a date type the dateFormat will be used on order to parsed the supplied values. The values will be used differently based on the type of attribute. The following will happen based on the object type attribute supplied- Default
- The value(s) will be parsed as the relevant type. If not possible an
IllegalArgumentException
will be thrown - Object reference
- The value(s) supplied will be compared to objects matching the object key, the id or the label for objects of the object type specified by the object type attribute
- Status
- The supplied value(s) is matched with the status name
- User
- The supplied value(s) is first matched with users based on user name if no user is found based on user name the user is matched with user key, display name, e-mail address or username
- Group
- The value(s) is matched with group names
- Project
- The value(s) supplied can contain JIRA project keys or project names
- Confluence
- The supplied value(s) must be confluence page id's
- Version
- Value(s) is matched with version names
- Parameters:
ota
- the object type attribute bean that the object attribute created should be ofdateFormat
- a date format used to parse date values if the object type attribute is of a date typedateTimeFormat
- a date time format used to parse date time values if the object type attribute is of a date time typevalues
- a vararg of string values. See the above description for what is expected for each value- Returns:
- a created (not persisted) object attribute bean with object attribute bean value(s) populated
- Throws:
InsightException
- if the object type attribute is of a object reference type and Insight fails to load the object referenced by the supplied valuesIllegalArgumentException
- if no matching type is found for the ObjectTypeAttributeBean or if the values supplied are null
-
createUserAttributeValueByKey
MutableObjectAttributeBean createUserAttributeValueByKey(ObjectTypeAttributeBean ota, String... userKeys) Create a user attribute by supplying one or more user keys convenient method when you have one or more user keys.- Parameters:
ota
- the object type attribute determining the type that should be created, can not be nulluserKeys
- the value(s) that should be used to search jira for users by key- Returns:
- a created (not persisted) object attribute bean with object attribute bean value(s) populated
-
createUserAttributeValueByName
MutableObjectAttributeBean createUserAttributeValueByName(ObjectTypeAttributeBean ota, String... userNames) Create a user attribute by one or more user names- Parameters:
ota
- the object type attribute determining the type that should be created, can not be nulluserNames
- the user names that should be used to query user service for users- Returns:
- the created MutableObjectAttributeBean with the corresponding
MutableObjectAttributeValueBean
(s)
-
createUserTypeAttribute
MutableObjectAttributeBean createUserTypeAttribute(ObjectTypeAttributeBean ota, List<String> valueList, boolean includeInactiveUsers, Integer maxUserSearchValue) Creates an ObjectAttributeBean with values with all users matching the given userPredicate.- Parameters:
ota
- the object type attribute bean. The maximum cardinality will be used from this parameter and only find that many users. If multiple users match the predicate only the maximum cardinality will be included. This may not be deterministicvalueList
- the predicate to match if a user should be included as a valueincludeInactiveUsers
- if inactive users should be included or not.- Returns:
- the created MutableObjectAttributeBean with the corresponding
MutableObjectAttributeValueBean
(s)
-
createUserTypeAttribute
Creates an ObjectAttributeBean with values with user matching the given user key- Parameters:
ota
- the object type attribute bean. The maximum cardinality will be used from this parameter and only find that many users. If multiple users match the predicate only the maximum cardinality will be included. This may not be deterministicuserKey
- the user key- Returns:
- the created MutableObjectAttributeBean with the corresponding
MutableObjectAttributeValueBean
(s)
-
createUserTypeAttributeByKeyOrUsername
MutableObjectAttributeBean createUserTypeAttributeByKeyOrUsername(ObjectTypeAttributeBean ota, List<String> userKeys) Creates an ObjectAttributeBean with values with user matching the given user keys- Parameters:
ota
- the object type attribute bean. The maximum cardinality will be used from this parameter and only find that many users. If multiple users match the predicate only the maximum cardinality will be included. This may not be deterministicuserKeys
- the list of user keys- Returns:
- the created MutableObjectAttributeBean with the corresponding
MutableObjectAttributeValueBean
(s)
-
createGroupAttributeValueByNames
MutableObjectAttributeBean createGroupAttributeValueByNames(ObjectTypeAttributeBean ota, String... groupNames) Create an object attribute bean with one or more group names- Parameters:
ota
- the object type attribute determining the type that should be created, can not be nullgroupNames
- used to query the JIRA for groups matching the given name(s)- Returns:
- the created MutableObjectAttributeBean with the corresponding
MutableObjectAttributeValueBean
(s)
-
createGroupAttributeValue
MutableObjectAttributeBean createGroupAttributeValue(ObjectTypeAttributeBean ota, Predicate<InsightGroup> groupPredicate) Create an object attribute bean with all groups matching the predicate- Parameters:
ota
- the object type attribute determining the type that should be created, can not be nullgroupPredicate
- a predicate that is used to determine which groups that should be matched when creating the group attributes- Returns:
- the created MutableObjectAttributeBean with the corresponding
MutableObjectAttributeValueBean
(s)
-
createProjectAttributeValue
MutableObjectAttributeBean createProjectAttributeValue(ObjectTypeAttributeBean ota, Predicate<InsightProject> predicate) -
createConfluenceAttributeValue
MutableObjectAttributeBean createConfluenceAttributeValue(ObjectTypeAttributeBean ota, Long... pageIds) -
createVersionAttributeValue
MutableObjectAttributeBean createVersionAttributeValue(ObjectTypeAttributeBean ota, Predicate<InsightVersion> predicate) -
createStatusAttributeValue
MutableObjectAttributeBean createStatusAttributeValue(ObjectTypeAttributeBean ota, Predicate<StatusTypeBean> predicate) throws InsightException - Throws:
InsightException
-
createReferenceAttributeValue
MutableObjectAttributeBean createReferenceAttributeValue(ObjectTypeAttributeBean ota, Predicate<ObjectBean> predicate) throws InsightException - Throws:
InsightException
-
createDefaultTypeValues
Creates default type values from the specified values. Will use JIRA default dateFormatter and dateTimeFormatter if the specified object type attribute is of date or date time type- Parameters:
ota
- the object type attribute determining the type that should be created, can not be nullvalues
- the values that should be added as the attributes- Returns:
- a created (not persisted) object attribute bean with object attribute bean value(s) populated
-