Class ModelEntity

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ModelEntity>
    Direct Known Subclasses:
    ModelViewEntity

    public class ModelEntity
    extends java.lang.Object
    implements java.lang.Comparable<ModelEntity>, java.io.Serializable
    An object that models the <entity> element.
    See Also:
    Serialized Form
    • Field Detail

      • module

        public static final java.lang.String module
      • STAMP_FIELD

        public static final java.lang.String STAMP_FIELD
        The name of the time stamp field for locking/synchronization
        See Also:
        Constant Field Values
      • CREATE_STAMP_FIELD

        public static final java.lang.String CREATE_STAMP_FIELD
        See Also:
        Constant Field Values
      • CREATE_STAMP_TX_FIELD

        public static final java.lang.String CREATE_STAMP_TX_FIELD
        See Also:
        Constant Field Values
      • entityName

        protected java.lang.String entityName
        The entity-name of the Entity
      • tableName

        protected java.lang.String tableName
        The table-name of the Entity
      • packageName

        protected java.lang.String packageName
        The package-name of the Entity
      • dependentOn

        protected java.lang.String dependentOn
        The entity-name of the Entity that this Entity is dependent on, if empty then no dependency
      • sequenceBankSize

        protected java.lang.Integer sequenceBankSize
        The sequence-bank-size of the Entity
      • relations

        protected java.util.concurrent.CopyOnWriteArrayList<ModelRelation> relations
        relations defining relationships between this entity and other entities
      • specializationOfModelEntity

        protected ModelEntity specializationOfModelEntity
        The reference of the dependentOn entity model
      • specializedEntities

        protected java.util.Map<java.lang.String,​ModelEntity> specializedEntities
        The list of entities that are specialization of on this entity
      • doLock

        protected boolean doLock
        An indicator to specify if this entity requires locking for updates
      • noAutoStamp

        protected boolean noAutoStamp
        Can be used to disable automatically creating update stamp fields and populating them on inserts and updates
      • neverCache

        protected boolean neverCache
        An indicator to specify if this entity is never cached. If true causes the delegator to not clear caches on write and to not get from cache on read showing a warning messages to that effect
      • neverCheck

        protected boolean neverCheck
      • autoClearCache

        protected boolean autoClearCache
      • location

        protected java.lang.String location
        The location of this entity's definition
    • Method Detail

      • populateBasicInfo

        protected void populateBasicInfo​(org.w3c.dom.Element entityElement)
      • populateRelated

        protected void populateRelated​(ModelReader reader,
                                       org.w3c.dom.Element entityElement)
      • populateIndexes

        protected void populateIndexes​(org.w3c.dom.Element entityElement)
      • containsAllPkFieldNames

        public boolean containsAllPkFieldNames​(java.util.Set<java.lang.String> fieldNames)
      • addExtendEntity

        public void addExtendEntity​(ModelReader reader,
                                    org.w3c.dom.Element extendEntityElement)
      • getEntityName

        public java.lang.String getEntityName()
        The entity-name of the Entity
      • setEntityName

        public void setEntityName​(java.lang.String entityName)
      • getPlainTableName

        public java.lang.String getPlainTableName()
        The plain table-name of the Entity without a schema name prefix
      • getTableName

        public java.lang.String getTableName​(java.lang.String helperName)
        The table-name of the Entity including a Schema name if specified in the datasource config
      • getTableName

        public java.lang.String getTableName​(Datasource datasourceInfo)
        The table-name of the Entity including a Schema name if specified in the datasource config
      • setTableName

        public void setTableName​(java.lang.String tableName)
      • getPackageName

        public java.lang.String getPackageName()
        The package-name of the Entity
      • setPackageName

        public void setPackageName​(java.lang.String packageName)
      • getDependentOn

        public java.lang.String getDependentOn()
        The entity-name of the Entity that this Entity is dependent on, if empty then no dependency
      • setDependentOn

        public void setDependentOn​(java.lang.String dependentOn)
      • getNeverCache

        public boolean getNeverCache()
        An indicator to specify if this entity is never cached. If true causes the delegator to not clear caches on write and to not get from cache on read showing a warning messages to that effect
      • setNeverCache

        public void setNeverCache​(boolean neverCache)
      • getNeverCheck

        public boolean getNeverCheck()
        An indicator to specific if this entity should ignore automatic DB checks. This should be set when the entity is mapped to a database view to prevent warnings and attempts to modify the schema.
      • setNeverCheck

        public void setNeverCheck​(boolean neverCheck)
      • getAutoClearCache

        public boolean getAutoClearCache()
      • setAutoClearCache

        public void setAutoClearCache​(boolean autoClearCache)
      • getHasFieldWithAuditLog

        public boolean getHasFieldWithAuditLog()
      • getLocation

        public java.lang.String getLocation()
      • setLocation

        public void setLocation​(java.lang.String location)
      • getDoLock

        public boolean getDoLock()
        An indicator to specify if this entity requires locking for updates
      • setDoLock

        public void setDoLock​(boolean doLock)
      • lock

        public boolean lock()
      • getSequenceBankSize

        public java.lang.Integer getSequenceBankSize()
      • isField

        public boolean isField​(java.lang.String fieldName)
      • areFields

        public boolean areFields​(java.util.Collection<java.lang.String> fieldNames)
      • getPksSize

        public int getPksSize()
      • getPksIterator

        public java.util.Iterator<ModelField> getPksIterator()
      • getPkFields

        public java.util.List<ModelField> getPkFields()
      • getPkFieldsUnmodifiable

        public java.util.List<ModelField> getPkFieldsUnmodifiable()
      • getFirstPkFieldName

        public java.lang.String getFirstPkFieldName()
      • getNopksSize

        public int getNopksSize()
      • getNopksIterator

        public java.util.Iterator<ModelField> getNopksIterator()
      • getNopksCopy

        public java.util.List<ModelField> getNopksCopy()
      • getFieldsSize

        public int getFieldsSize()
      • getFieldsIterator

        public java.util.Iterator<ModelField> getFieldsIterator()
      • getFieldsUnmodifiable

        public java.util.List<ModelField> getFieldsUnmodifiable()
      • getColNameOrAlias

        public java.lang.String getColNameOrAlias​(java.lang.String fieldName)
        The col-name of the Field, the alias of the field if this is on a view-entity
      • getField

        public ModelField getField​(java.lang.String fieldName)
      • addField

        public void addField​(ModelField field)
      • removeField

        public ModelField removeField​(java.lang.String fieldName)
      • getAllFieldNames

        public java.util.List<java.lang.String> getAllFieldNames()
      • getPkFieldNames

        public java.util.List<java.lang.String> getPkFieldNames()
      • getNoPkFieldNames

        public java.util.List<java.lang.String> getNoPkFieldNames()
      • getAutomaticFieldNames

        public java.util.List<java.lang.String> getAutomaticFieldNames()
        Returns:
        field names list, managed by entity-engine
      • getRelationsSize

        public int getRelationsSize()
      • getRelationsOneSize

        public int getRelationsOneSize()
      • getRelationsIterator

        public java.util.Iterator<ModelRelation> getRelationsIterator()
      • getRelationsList

        public java.util.List<ModelRelation> getRelationsList​(boolean includeOne,
                                                              boolean includeOneNoFk,
                                                              boolean includeMany)
      • getRelationsOneList

        public java.util.List<ModelRelation> getRelationsOneList()
      • getRelationsManyList

        public java.util.List<ModelRelation> getRelationsManyList()
      • getRelation

        public ModelRelation getRelation​(java.lang.String relationName)
      • addRelation

        public void addRelation​(ModelRelation relation)
      • removeRelation

        public ModelRelation removeRelation​(int index)
      • getIndexesSize

        public int getIndexesSize()
      • getIndex

        public ModelIndex getIndex​(int index)
      • getIndexesIterator

        public java.util.Iterator<ModelIndex> getIndexesIterator()
      • getIndex

        public ModelIndex getIndex​(java.lang.String indexName)
      • addIndex

        public void addIndex​(ModelIndex index)
      • removeIndex

        public ModelIndex removeIndex​(int index)
      • getViewEntitiesSize

        public int getViewEntitiesSize()
      • getViewConvertorsIterator

        public java.util.Iterator<java.lang.String> getViewConvertorsIterator()
      • convertToViewValues

        public java.util.List<? extends java.util.Map<java.lang.String,​java.lang.Object>> convertToViewValues​(java.lang.String viewEntityName,
                                                                                                                    GenericEntity entity)
      • removeViewEntity

        public boolean removeViewEntity​(java.lang.String viewEntityName)
      • removeViewEntity

        public boolean removeViewEntity​(ModelViewEntity viewEntity)
      • nameString

        public java.lang.String nameString​(java.util.List<ModelField> flds)
      • nameString

        public java.lang.String nameString​(java.util.List<ModelField> flds,
                                           java.lang.String separator,
                                           java.lang.String afterLast)
      • typeNameString

        public java.lang.String typeNameString​(ModelField... flds)
      • typeNameString

        public java.lang.String typeNameString​(java.util.List<ModelField> flds)
      • fieldNameString

        public java.lang.String fieldNameString()
      • fieldNameString

        public java.lang.String fieldNameString​(java.lang.String separator,
                                                java.lang.String afterLast)
      • fieldTypeNameString

        public java.lang.String fieldTypeNameString()
      • primKeyClassNameString

        public java.lang.String primKeyClassNameString()
      • pkNameString

        public java.lang.String pkNameString()
      • pkNameString

        public java.lang.String pkNameString​(java.lang.String separator,
                                             java.lang.String afterLast)
      • nonPkNullList

        public java.lang.String nonPkNullList()
      • fieldsStringList

        @Deprecated
        public java.lang.String fieldsStringList​(java.lang.String eachString,
                                                 java.lang.String separator,
                                                 ModelField... flds)
        Deprecated.
      • fieldsStringList

        public java.lang.StringBuilder fieldsStringList​(java.lang.StringBuilder sb,
                                                        java.lang.String eachString,
                                                        java.lang.String separator,
                                                        ModelField... flds)
      • fieldsStringList

        @Deprecated
        public java.lang.String fieldsStringList​(java.util.List<ModelField> flds,
                                                 java.lang.String eachString,
                                                 java.lang.String separator)
        Deprecated.
      • fieldsStringList

        public java.lang.StringBuilder fieldsStringList​(java.util.List<ModelField> flds,
                                                        java.lang.StringBuilder sb,
                                                        java.lang.String eachString,
                                                        java.lang.String separator)
      • fieldsStringList

        @Deprecated
        public java.lang.String fieldsStringList​(java.lang.String eachString,
                                                 java.lang.String separator,
                                                 boolean appendIndex,
                                                 ModelField... flds)
        Deprecated.
      • fieldsStringList

        public java.lang.StringBuilder fieldsStringList​(java.lang.StringBuilder sb,
                                                        java.lang.String eachString,
                                                        java.lang.String separator,
                                                        boolean appendIndex,
                                                        ModelField... flds)
      • fieldsStringList

        @Deprecated
        public java.lang.String fieldsStringList​(java.util.List<ModelField> flds,
                                                 java.lang.String eachString,
                                                 java.lang.String separator,
                                                 boolean appendIndex)
        Deprecated.
      • fieldsStringList

        public java.lang.StringBuilder fieldsStringList​(java.util.List<ModelField> flds,
                                                        java.lang.StringBuilder sb,
                                                        java.lang.String eachString,
                                                        java.lang.String separator,
                                                        boolean appendIndex)
      • fieldsStringList

        @Deprecated
        public java.lang.String fieldsStringList​(java.lang.String eachString,
                                                 java.lang.String separator,
                                                 boolean appendIndex,
                                                 boolean onlyNonPK,
                                                 ModelField... flds)
        Deprecated.
      • fieldsStringList

        public java.lang.StringBuilder fieldsStringList​(java.lang.StringBuilder sb,
                                                        java.lang.String eachString,
                                                        java.lang.String separator,
                                                        boolean appendIndex,
                                                        boolean onlyNonPK,
                                                        ModelField... flds)
      • fieldsStringList

        @Deprecated
        public java.lang.String fieldsStringList​(java.util.List<ModelField> flds,
                                                 java.lang.String eachString,
                                                 java.lang.String separator,
                                                 boolean appendIndex,
                                                 boolean onlyNonPK)
        Deprecated.
      • fieldsStringList

        public java.lang.StringBuilder fieldsStringList​(java.util.List<ModelField> flds,
                                                        java.lang.StringBuilder sb,
                                                        java.lang.String eachString,
                                                        java.lang.String separator,
                                                        boolean appendIndex,
                                                        boolean onlyNonPK)
      • colNameString

        @Deprecated
        public java.lang.String colNameString​(ModelField... flds)
        Deprecated.
      • colNameString

        public java.lang.StringBuilder colNameString​(java.lang.StringBuilder sb,
                                                     java.lang.String prefix,
                                                     ModelField... flds)
      • colNameString

        @Deprecated
        public java.lang.String colNameString​(java.util.List<ModelField> flds)
        Deprecated.
      • colNameString

        public java.lang.StringBuilder colNameString​(java.util.List<ModelField> flds,
                                                     java.lang.StringBuilder sb,
                                                     java.lang.String prefix)
      • colNameString

        @Deprecated
        public java.lang.String colNameString​(java.lang.String separator,
                                              java.lang.String afterLast,
                                              boolean alias,
                                              ModelField... flds)
        Deprecated.
      • colNameString

        public java.lang.StringBuilder colNameString​(java.lang.StringBuilder sb,
                                                     java.lang.String prefix,
                                                     java.lang.String separator,
                                                     java.lang.String afterLast,
                                                     boolean alias,
                                                     ModelField... flds)
      • colNameString

        @Deprecated
        public java.lang.String colNameString​(java.util.List<ModelField> flds,
                                              java.lang.String separator,
                                              java.lang.String afterLast,
                                              boolean alias)
        Deprecated.
      • colNameString

        public java.lang.StringBuilder colNameString​(java.util.List<ModelField> flds,
                                                     java.lang.StringBuilder sb,
                                                     java.lang.String prefix,
                                                     java.lang.String separator,
                                                     java.lang.String afterLast,
                                                     boolean alias)
      • classNameString

        public java.lang.String classNameString​(ModelField... flds)
      • classNameString

        public java.lang.String classNameString​(java.util.List<ModelField> flds)
      • classNameString

        public java.lang.String classNameString​(java.lang.String separator,
                                                java.lang.String afterLast,
                                                ModelField... flds)
      • classNameString

        public java.lang.String classNameString​(java.util.List<ModelField> flds,
                                                java.lang.String separator,
                                                java.lang.String afterLast)
      • finderQueryString

        public java.lang.String finderQueryString​(ModelField... flds)
      • finderQueryString

        public java.lang.String finderQueryString​(java.util.List<ModelField> flds)
      • httpArgList

        public java.lang.String httpArgList​(ModelField... flds)
      • httpArgList

        public java.lang.String httpArgList​(java.util.List<ModelField> flds)
      • httpArgListFromClass

        public java.lang.String httpArgListFromClass​(ModelField... flds)
      • httpArgListFromClass

        public java.lang.String httpArgListFromClass​(java.util.List<ModelField> flds)
      • httpArgListFromClass

        public java.lang.String httpArgListFromClass​(java.lang.String entityNameSuffix,
                                                     ModelField... flds)
      • httpArgListFromClass

        public java.lang.String httpArgListFromClass​(java.util.List<ModelField> flds,
                                                     java.lang.String entityNameSuffix)
      • httpRelationArgList

        public java.lang.String httpRelationArgList​(ModelRelation relation,
                                                    ModelField... flds)
      • httpRelationArgList

        public java.lang.String httpRelationArgList​(java.util.List<ModelField> flds,
                                                    ModelRelation relation)
      • typeNameStringRelatedNoMapped

        public java.lang.String typeNameStringRelatedNoMapped​(ModelRelation relation,
                                                              ModelField... flds)
      • typeNameStringRelatedNoMapped

        public java.lang.String typeNameStringRelatedNoMapped​(java.util.List<ModelField> flds,
                                                              ModelRelation relation)
      • typeNameStringRelatedAndMain

        public java.lang.String typeNameStringRelatedAndMain​(ModelRelation relation,
                                                             ModelField... flds)
      • typeNameStringRelatedAndMain

        public java.lang.String typeNameStringRelatedAndMain​(java.util.List<ModelField> flds,
                                                             ModelRelation relation)
      • compareTo

        public int compareTo​(ModelEntity otherModelEntity)
        Specified by:
        compareTo in interface java.lang.Comparable<ModelEntity>
      • convertFieldMapInPlace

        public void convertFieldMapInPlace​(java.util.Map<java.lang.String,​java.lang.Object> inContext,
                                           Delegator delegator)
      • convertFieldMapInPlace

        public void convertFieldMapInPlace​(java.util.Map<java.lang.String,​java.lang.Object> inContext,
                                           ModelFieldTypeReader modelFieldTypeReader)
      • convertFieldValue

        public java.lang.Object convertFieldValue​(java.lang.String fieldName,
                                                  java.lang.Object value,
                                                  Delegator delegator)
      • convertFieldValue

        public java.lang.Object convertFieldValue​(ModelField modelField,
                                                  java.lang.Object value,
                                                  Delegator delegator)
      • convertFieldValue

        public java.lang.Object convertFieldValue​(ModelField modelField,
                                                  java.lang.Object value,
                                                  Delegator delegator,
                                                  java.util.Map<java.lang.String,​? extends java.lang.Object> context)
        Convert a field value from one Java data type to another. This is the preferred method - which takes into consideration the user's locale and time zone (for conversions that require them).
        Returns:
        the converted value
      • convertFieldValue

        public java.lang.Object convertFieldValue​(ModelField modelField,
                                                  java.lang.Object value,
                                                  ModelFieldTypeReader modelFieldTypeReader,
                                                  java.util.Map<java.lang.String,​? extends java.lang.Object> context)
        Convert a field value from one Java data type to another. This is the preferred method - which takes into consideration the user's locale and time zone (for conversions that require them).
        Returns:
        the converted value
      • getNoAutoStamp

        public boolean getNoAutoStamp()
        Returns:
        Returns the noAutoStamp.
      • setNoAutoStamp

        public void setNoAutoStamp​(boolean noAutoStamp)
        Parameters:
        noAutoStamp - The noAutoStamp to set.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toXmlElement

        public org.w3c.dom.Element toXmlElement​(org.w3c.dom.Document document,
                                                java.lang.String packageName)
      • toXmlElement

        public org.w3c.dom.Element toXmlElement​(org.w3c.dom.Document document)
      • toGroupXmlElement

        public org.w3c.dom.Element toGroupXmlElement​(org.w3c.dom.Document document)
      • toGroupXmlElement

        public org.w3c.dom.Element toGroupXmlElement​(org.w3c.dom.Document document,
                                                     java.lang.String packageName)
      • writeEoModelText

        public void writeEoModelText​(java.io.PrintWriter writer,
                                     java.lang.String entityPrefix,
                                     java.lang.String helperName,
                                     java.util.Set<java.lang.String> entityNameIncludeSet,
                                     ModelReader entityModelReader)
                              throws GenericEntityException
        Writes entity model information in the Apple EOModelBundle format. For document structure and definition see: http://developer.apple.com/documentation/InternetWeb/Reference/WO_BundleReference/Articles/EOModelBundle.html For examples see the JavaRealEstate.framework and JavaBusinessLogic.framework packages which are in the /Library/Frameworks directory after installing the WebObjects Examples package (get latest version of WebObjects download for this). This is based on examples and documentation from WebObjects 5.4, downloaded 20080221.
        Parameters:
        writer -
        entityPrefix -
        helperName -
        Throws:
        GenericEntityException
      • createEoModelMap

        public java.util.Map<java.lang.String,​java.lang.Object> createEoModelMap​(java.lang.String entityPrefix,
                                                                                       java.lang.String helperName,
                                                                                       java.util.Set<java.lang.String> entityNameIncludeSet,
                                                                                       ModelReader entityModelReader)
                                                                                throws GenericEntityException
        Throws:
        GenericEntityException
      • getAuthor

        public java.lang.String getAuthor()
      • getCopyright

        public java.lang.String getCopyright()
      • getDefaultResourceName

        public java.lang.String getDefaultResourceName()
      • getDescription

        public java.lang.String getDescription()
      • getTitle

        public java.lang.String getTitle()
      • getVersion

        public java.lang.String getVersion()