Class ExtendedProperty

    • Field Detail

      • valid

        private static final Pattern valid
        A regexp checking for invalid characters.
      • name

        private final String name
      • type

        private final Type type
      • column

        private final String column
      • title

        private final String title
      • description

        private final String description
      • length

        private final int length
      • nullable

        private final boolean nullable
      • insertable

        private final boolean insertable
      • updateable

        private final boolean updateable
      • restrictedEdit

        private final boolean restrictedEdit
      • hidden

        private final boolean hidden
    • Constructor Detail

      • ExtendedProperty

        ExtendedProperty​(String name,
                         String title,
                         String description,
                         String column,
                         Type type,
                         int length,
                         boolean nullable,
                         boolean insertable,
                         boolean updateable,
                         boolean restrictedEdit,
                         boolean hidden,
                         Formula.AverageMethod averageMethod,
                         List<ExtendedPropertyLinker> linkers)
        Create a new extended property. See the getter methods for a description of the parameters.
    • Method Detail

      • isValidName

        public static boolean isValidName​(String name)
        Check that the name only contains a-zA-Z0-9_ and starts with a letter or underscore.
        Parameters:
        name - Name to check
        Returns:
        TRUE if valid, FALSE otherwise
        Since:
        2.4
      • getName

        public String getName()
        Get the name of the extended property. This is the name that is used in queries and for the name parameter of the getExtended/setExtended methods to get or set the value of the property of an Extendable item.
        Returns:
        A string with the name
        See Also:
        ExtendableData.getExtended, ExtendableData.setExtended
      • getTitle

        public String getTitle()
        Get the title of the extended property. The title is not used by the core but can be used by client applications for example to display a column header.
        Returns:
        A string with the title
      • getDescription

        public String getDescription()
        Get a description of the extended property. The description is not used by the core but can be used by client applications.
        Returns:
        A string with the description
      • getColumn

        public String getColumn()
        Get the database column of the extended property. This is the name of the column in the database which holds the value.
        Returns:
        a String
      • getType

        public Type getType()
        Get the type of the extended property. The value returned is one of the defined constants by the Type enumeration.
        Returns:
        a Type enumeration.
      • getLength

        public int getLength()
        Get the maximum allowed length of the property value. This is only useful if it a string property.
        Returns:
        The maximum allowed length
      • isNullable

        public boolean isNullable()
        Check if the property allows null values or not.
        Returns:
        TRUE if null values are allowed, FALSE otherwise
      • isInsertable

        public boolean isInsertable()
        Check if the value of this property should be inserted into the datbase when creating new items.
        Returns:
        TRUE if the value should be inserted, FALSE otherwise
      • isUpdateable

        public boolean isUpdateable()
        Check if the value of this property should be updated in the database when an item is updated.
        Returns:
        TRUE if the value should be updated, FALSE otherwise
      • isRestrictedEdit

        public boolean isRestrictedEdit()
        Check if the value of this property is restricted for editing or not. This typically means that the logged in user must have a specific permission in order to change the value. To begin with restricted editing is only used for User items to lock some properties for non-administrator editing.
        Since:
        3.3
      • isHidden

        public boolean isHidden()
        Check if the value of this property is hidden or not. Hidden properties should normally not show up in user interfaces that have not been specifically designed to work with the property.
        Since:
        3.13
      • isAveragable

        public boolean isAveragable()
        If it makes sense to take the average of multiple values for this property or not. For example, it doesn't make sense to average over position coordinates, but it does make sense to average over intensity values. By default all numerical values are averagable.
        Returns:
        TRUE if it makes sense to take the average, FALSE otherwise
        See Also:
        getAverageMethod()
      • getAverageMethod

        public Formula.AverageMethod getAverageMethod()
        Which method to use when calculating the average of a set of values. Prior to 2.4 only arithmetic mean was supported.
        Returns:
        The average method to use
        Since:
        2.4
      • parseString

        public Object parseString​(String value)
                           throws InvalidDataException
        Parse a string and return an object of the correct type for this property.
        Parameters:
        value - The value to parse
        Returns:
        An object
        Throws:
        InvalidDataException - If the string cannot be converted to the correct type
        See Also:
        getType()
      • parseString

        public Object parseString​(String value,
                                  NumberFormat numberFormat,
                                  boolean nullIfException)
        Parse a string and return an object of the correct type for this property. Numeric properties are parsed with the specified number format. If the nullIfException parameter is TRUE null is returned if the string can't be parsed. Otherwise an exception is thrown.
        Parameters:
        value - The value to parse
        numberFormat - The number format, or null to use Double.valueOf
        nullIfException - TRUE to return null in case the string can't be parsed, FALSE to throw an exception
        Returns:
        An object or null
        Throws:
        InvalidDataException - If the string cannot be converted to the correct type and the nullIfException parameter is false
        Since:
        2.4
        See Also:
        getType()
      • validateValue

        public void validateValue​(Object value)
                           throws InvalidDataException
        Check if an object is valid according to the specifications of this property. The checks include checking for null values if the property not isNullable(), check that the object is of the correct getType() and the maximum getLength() of a string.
        Parameters:
        value - The value to check
        Throws:
        InvalidDataException
      • getUrl

        public String getUrl​(Object value)
        Create a link for this extended property. This method checks the linkers in the order they are defined. The first one to return a non-null value is the winner.
        Parameters:
        value - The value to link
        Returns:
        The URL, or null if no matching linker could be found