Class Property


  • public class Property
    extends Object
    Together with Entity, the Property is the main part of the in-memory model. A property can be a primitive type, a reference or a list (one-to-many) property.
    Author:
    mtaal
    • Constructor Detail

      • Property

        public Property()
    • Method Detail

      • initializeFromColumn

        public void initializeFromColumn​(Column fromColumn)
        Initializes this Property using the information from the Column.
        Parameters:
        fromColumn - the column used to initialize this Property.
      • initializeName

        protected void initializeName()
        Initializes the name of the property. This is done separately from the initializeFromColumn method because to initialize the name also information from other properties is required.
      • isBoolean

        public boolean isBoolean()
      • getEntity

        public Entity getEntity()
      • setEntity

        public void setEntity​(Entity entity)
      • isId

        public boolean isId()
      • setId

        public void setId​(boolean id)
      • isPrimitive

        public boolean isPrimitive()
      • getReferencedProperty

        public Property getReferencedProperty()
        In case of an association, returns the property in the associated Entity to which this property refers. Returns null if there is no referenced property this occurs in case of a reference to the primary key of the referenced Entity.
        Returns:
        the associated property on the other side of the association.
      • setReferencedProperty

        public void setReferencedProperty​(Property referencedProperty)
        Sets the referenced property and also the targetEntity .
        Parameters:
        referencedProperty - the property referenced by this property
      • getTargetEntity

        public Entity getTargetEntity()
      • setTargetEntity

        public void setTargetEntity​(Entity targetEntity)
      • getColumnName

        public String getColumnName()
      • setColumnName

        public void setColumnName​(String columnName)
      • getFormattedDefaultValue

        public String getFormattedDefaultValue()
        Is used by the code generation of entities. It will return a String which can be used to set in the generated source code to initialize a property. For example if this is a boolean and the default value in the database for the column is 'Y' then this method will return "true". Will set the default value for a boolean in case it has not yet been set.
        Returns:
        the java-valid default
      • isNumericType

        public boolean isNumericType()
        Returns:
        true if the class of the primitive type (getPrimitiveObjectType()) is a number (extends Number).
      • isTextualType

        public boolean isTextualType()
        Returns:
        true if the class of the primitive type (getPrimitiveObjectType()) is a textual type (extends Number).
      • getActualDefaultValue

        public Object getActualDefaultValue()
        Returns the Object value of the default, for example a Date property with default value of today will return a new Date() object.
        Returns:
        the java object which can be used to initialize the java member corresponding to this property.
      • allowDerivedRead

        public boolean allowDerivedRead()
        Identifier, Id, audit info, active, client/organization properties are derived readable, in addition properties which are referenced by other properties are derived readable, all other properties are not derived readable.
        Returns:
        true if derived readable for the current user, false otherwise.
        See Also:
        isActiveColumn(), isAuditInfo(), isBeingReferenced(), isClientOrOrganization(), isIdentifier(), isId()
      • hasDefaultValue

        public boolean hasDefaultValue()
      • setDefaultValue

        public void setDefaultValue​(String defaultValue)
      • isMandatory

        public boolean isMandatory()
      • setMandatory

        public void setMandatory​(boolean mandatory)
      • isIdentifier

        public boolean isIdentifier()
      • setIdentifier

        public void setIdentifier​(boolean identifier)
      • isParent

        public boolean isParent()
      • setParent

        public void setParent​(boolean parent)
      • isChild

        public boolean isChild()
      • setChild

        public void setChild​(boolean child)
      • getTypeName

        public String getTypeName()
        Returns the primitive type name or the class name of the referenced type. Used by the entity code generation.
        Returns:
        a String denoting the class name of values of this property
      • getShorterTypeName

        public String getShorterTypeName()
        Used during generate.entities to generate short java type-names if a corresponding java import statement is generated for this type.
      • getShorterNameTargetEntity

        public String getShorterNameTargetEntity()
        Used during generate.entities to generate short java type-names if a corresponding java import statement is generated for this type.
      • getSimpleTypeName

        public String getSimpleTypeName()
        The last part of the class name of the type of the property. Used by the entity code generation.
      • getObjectTypeName

        public String getObjectTypeName()
        Returns the typename of the object type of this property. So a property with type int will return "java.lang.Integer". Used by the entity code generation.
        Returns:
        the class name of the object type of this property.
      • getPrimitiveObjectType

        public Class<?> getPrimitiveObjectType()
        Returns the class of the type of this property, will translate primitive type classes (int) to their object type (java.lang.Long for example). Used by the entity code generation.
        Returns:
        the Object class for the primitive type
      • allowNullValues

        public boolean allowNullValues()
        Returns:
        true if the property potentially allows null values because it is an object type. Used by code generation of entities.
      • getName

        public String getName()
      • getGetterSetterName

        public String getGetterSetterName()
        Returns:
        the name used for creating a getter/setter in generated code.
      • checkIsWritable

        public void checkIsWritable()
        Checks if for an instance of the Entity a value can be written in this property. If not then a ValidationException is thrown.
        Throws:
        ValidationException
      • checkIsValidValue

        public void checkIsValidValue​(Object value)
        Checks if the value of the object is of the correct type and it is not null if the property is mandatory. Throws a ValidationException if the value does not fit the definition of the property.
        Parameters:
        value - the value to check
        Throws:
        ValidationException
      • setName

        public void setName​(String name)
      • getMinValue

        public String getMinValue()
      • setMinValue

        public void setMinValue​(String minValue)
      • getMaxValue

        public String getMaxValue()
      • setMaxValue

        public void setMaxValue​(String maxValue)
      • getIdBasedOnProperty

        public Property getIdBasedOnProperty()
      • setIdBasedOnProperty

        public void setIdBasedOnProperty​(Property idBasedOnProperty)
      • isOneToOne

        public boolean isOneToOne()
      • setOneToOne

        public void setOneToOne​(boolean oneToOne)
      • isOneToMany

        public boolean isOneToMany()
      • setOneToMany

        public void setOneToMany​(boolean oneToMany)
      • isUuid

        public boolean isUuid()
      • setUuid

        public void setUuid​(boolean isUuid)
      • isUpdatable

        public boolean isUpdatable()
      • setUpdatable

        public void setUpdatable​(boolean isUpdatable)
      • isCompositeId

        public boolean isCompositeId()
      • setCompositeId

        public void setCompositeId​(boolean isCompositeId)
      • isComputedColumn

        public boolean isComputedColumn()
        A property is a computed column when it has sql logic, in this case it is calculated based on a sql formula and is accessed through a proxy.
      • isProxy

        public boolean isProxy()
        Proxy properties are used to access to computed columns. Computed columns are not directly within the entity they are defined in, but in a extra entity that is accessed through a proxy, in this way computed columns are lazily calculated.
      • setProxy

        public void setProxy​(boolean isProxy)
      • isPartOfCompositeId

        public boolean isPartOfCompositeId()
      • setPartOfCompositeId

        public void setPartOfCompositeId​(boolean isPartOfCompositeId)
      • getFieldLength

        public int getFieldLength()
      • setFieldLength

        public void setFieldLength​(int fieldLength)
      • doCheckAllowedValue

        public boolean doCheckAllowedValue()
      • isAllowedValue

        public boolean isAllowedValue​(String value)
      • concatenatedAllowedValues

        public String concatenatedAllowedValues()
        Returns:
        a comma delimited list of allowed values, is used for enums.
      • isTransient

        public boolean isTransient​(BaseOBObjectDef bob)
        Checks if the property is transient. It uses the business object and the transientCondition to compute if the property is transient (won't be exported to xml).
        Parameters:
        bob - the business object used to compute if the property is transient
        Returns:
        true if the property is transient and does not need to be exported
      • getAllowedValues

        public Set<String> getAllowedValues()
      • setAllowedValues

        public void setAllowedValues​(Set<String> allowedValues)
      • getJavaName

        public String getJavaName()
      • setOrderByProperty

        public void setOrderByProperty​(boolean isOrderByProperty)
      • isOrderByProperty

        public boolean isOrderByProperty()
      • isTransient

        public boolean isTransient()
      • setTransient

        public void setTransient​(boolean isTransient)
      • isAuditInfo

        public boolean isAuditInfo()
      • setAuditInfo

        public void setAuditInfo​(boolean isAuditInfo)
      • getTransientCondition

        public String getTransientCondition()
      • setTransientCondition

        public void setTransientCondition​(String transientCondition)
      • isClientOrOrganization

        public boolean isClientOrOrganization()
      • setClientOrOrganization

        public void setClientOrOrganization​(boolean isClientOrOrganization)
      • isInactive

        public boolean isInactive()
      • setInactive

        public void setInactive​(boolean isInactive)
      • getModule

        public Module getModule()
      • setModule

        public void setModule​(Module module)
      • getNameOfColumn

        public String getNameOfColumn()
      • setNameOfColumn

        public void setNameOfColumn​(String nameOfColumn)
      • getIndexInEntity

        public int getIndexInEntity()
      • setIndexInEntity

        public void setIndexInEntity​(int indexInEntity)
      • isDatetime

        public boolean isDatetime()
      • isAbsoluteDateTime

        public boolean isAbsoluteDateTime()
      • isTime

        public boolean isTime()
      • isAbsoluteTime

        public boolean isAbsoluteTime()
      • isDate

        public boolean isDate()
      • isActiveColumn

        public boolean isActiveColumn()
      • setActiveColumn

        public void setActiveColumn​(boolean isActiveColumn)
      • getDomainType

        public DomainType getDomainType()
      • setDomainType

        public void setDomainType​(DomainType domainType)
      • setDate

        public void setDate​(boolean isDate)
        Deprecated not used anymore, is computed on the basis of the getDomainType().
      • setDatetime

        public void setDatetime​(boolean isDatetime)
        Deprecated not used anymore, is computed on the basis of the getDomainType().
      • setPrimitive

        public void setPrimitive​(boolean primitive)
        Deprecated not used anymore, is computed on the basis of the getDomainType().
      • setPrimitiveType

        public void setPrimitiveType​(Class<?> primitiveType)
        Deprecated not used anymore, is computed on the basis of the getDomainType().
      • getColumnId

        public String getColumnId()
      • setColumnId

        public void setColumnId​(String columnId)
      • isBeingReferenced

        public boolean isBeingReferenced()
        Is this a property which is referenced by another property if this === otherProperty.referencedProperty then this method returns true. Referenced properties are also accessible in derived read mode.
        Returns:
        true if this property is being referenced by another property in the model.
        See Also:
        getReferencedProperty()
      • setBeingReferenced

        public void setBeingReferenced​(boolean isBeingReferenced)
      • isEncrypted

        public boolean isEncrypted()
      • setEncrypted

        public void setEncrypted​(boolean encrypted)
      • hasDisplayColumn

        public boolean hasDisplayColumn()
        Returns:
        true if the property is a table reference which defines an explicit display column. This display column is then used as the identifier of objects referenced through this property.
      • isDisplayValue

        public boolean isDisplayValue()
        Returns:
        true if the property is a table reference which defines an explicit display column. This display column is then used as the identifier of objects referenced through this property.
      • getDisplayPropertyName

        public String getDisplayPropertyName()
      • isTranslatable

        public boolean isTranslatable()
        Returns whether a property is translatable to other languages. A property can be translated in case it has been marked in AD and there are translations installed in the system.
      • getTranslationProperty

        public Property getTranslationProperty()
      • getTrlParentProperty

        public Property getTrlParentProperty()
      • isStoredInSession

        public boolean isStoredInSession()
      • setStoredInSession

        public void setStoredInSession​(boolean storedInSession)
      • getSeqno

        public Integer getSeqno()
      • setSeqno

        public void setSeqno​(Integer seqno)
      • isUsedSequence

        public boolean isUsedSequence()
      • setUsedSequence

        public void setUsedSequence​(boolean usedSequence)
      • getSqlLogic

        public String getSqlLogic()
      • setSqlLogic

        public void setSqlLogic​(String sqlLogic)
      • isAllowedCrossOrgReference

        public boolean isAllowedCrossOrgReference()
        Foreign key properties allowing cross organization references can define a link to an object which organization is not in the same organization's natural tree when context is in setCrossOrgReferenceAdminMode.
      • setAllowedCrossOrgReference

        public void setAllowedCrossOrgReference​(boolean allowedCrossOrgReference)
        See Also:
        isAllowedCrossOrgReference()
      • isImage

        public boolean isImage()
        This method is used to determine if this is an image property.
        Returns:
        true if this property references an AD_Image_ID record. Otherwise, this method returns false.
      • isChildPropertyInParent

        public boolean isChildPropertyInParent()
        For FK properties, this flag indicates whether a new property in referenced entity will be created referencing this one.
      • setChildPropertyInParent

        public void setChildPropertyInParent​(boolean isChildPropertyInParent)
        See Also:
        isChildPropertyInParent()
      • getHelp

        public String getHelp()
      • setHelp

        public void setHelp​(String help)
        Adds help to this property from corresponding column Removes comment escape character sequence and wraps comments over 100 characters. Makes sure it doesn't generate warnings by escaping "@"
        Parameters:
        help - Help comment to add to this property
      • removeHelp

        public void removeHelp()
        Removes help comment from this property
      • isDeprecated

        public Boolean isDeprecated()
      • setDeprecated

        public void setDeprecated​(Boolean deprecated)