Interface ObjectAttributeBeanFactory

All Known Implementing Classes:
ObjectAttributeBeanFactoryImpl

@PublicApi public interface ObjectAttributeBeanFactory
Factory component used to create ObjectAttributeBean.
Since:
5.0
Author:
Ola Melin
  • Method Details

    • createObjectAttributeBeanForObject

      @Nonnull MutableObjectAttributeBean createObjectAttributeBeanForObject(@Nonnull ObjectBean objectBean, @Nonnull ObjectTypeAttributeBean ota, String... values) throws InsightException
      Creates an object attribute bean of the given ObjectTypeAttributeBean 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 to createObjectAttributeBeanForObject(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 bean
      ota - the attribute type to create
      values - 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 the ObjectTypeAttributeBean 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 bean
      ota - the attribute type to create
      dateFormat - a java date format used to parse date values if the ObjectTypeAttributeBean is of a date type
      dateTimeFormat - a java date time format used to parse date values if the ObjectTypeAttributeBean is of a date time type
      values - 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 uses createObjectAttributeBean(ObjectTypeAttributeBean, DateFormat, DateFormat, String...) internally but with JIRA default dateFormat and dateTimeFormat for the date format parameters
      Parameters:
      ota - the attribute type to create
      values - 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 of
      dateFormat - a date format used to parse date values if the object type attribute is of a date type
      dateTimeFormat - a date time format used to parse date time values if the object type attribute is of a date time type
      values - 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 values
      IllegalArgumentException - 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 null
      userKeys - 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 null
      userNames - 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 deterministic
      valueList - the predicate to match if a user should be included as a value
      includeInactiveUsers - if inactive users should be included or not.
      Returns:
      the created MutableObjectAttributeBean with the corresponding MutableObjectAttributeValueBean(s)
    • createUserTypeAttribute

      MutableObjectAttributeBean createUserTypeAttribute(ObjectTypeAttributeBean ota, String userKey)
      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 deterministic
      userKey - 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 deterministic
      userKeys - 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 null
      groupNames - 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 null
      groupPredicate - 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

      Throws:
      InsightException
    • createReferenceAttributeValue

      MutableObjectAttributeBean createReferenceAttributeValue(ObjectTypeAttributeBean ota, Predicate<ObjectBean> predicate) throws InsightException
      Throws:
      InsightException
    • createDefaultTypeValues

      MutableObjectAttributeBean createDefaultTypeValues(ObjectTypeAttributeBean ota, Object... values)
      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 null
      values - the values that should be added as the attributes
      Returns:
      a created (not persisted) object attribute bean with object attribute bean value(s) populated