Class DefaultTypeService

  • All Implemented Interfaces:
    TypeService, java.io.Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean

    public class DefaultTypeService
    extends AbstractBusinessService
    implements TypeService
    Default implementation of the type service interface
    Since:
    4.0
    See Also:
    Serialized Form
    • Constructor Detail

      • DefaultTypeService

        public DefaultTypeService()
    • Method Detail

      • getAtomicType

        @Deprecated
        public AtomicTypeModel getAtomicType​(java.lang.String typeCode)
        Deprecated.
        since ages
        Description copied from interface: TypeService
        Returns a specific atomic type.
        Specified by:
        getAtomicType in interface TypeService
        Parameters:
        typeCode - the unique code of this type
      • getAtomicTypeForCode

        public AtomicTypeModel getAtomicTypeForCode​(java.lang.String code)
        Description copied from interface: TypeService
        Gets the atomic type for code.
        Specified by:
        getAtomicTypeForCode in interface TypeService
        Parameters:
        code - the code
        Returns:
        the atomic type for code
      • getAtomicTypeForJavaClass

        public AtomicTypeModel getAtomicTypeForJavaClass​(java.lang.Class javaClass)
        Description copied from interface: TypeService
        Returns the atomic type for java class.
        Specified by:
        getAtomicTypeForJavaClass in interface TypeService
        Parameters:
        javaClass - the java class that we are looking atomic type for
        Returns:
        the atomic type for java class
      • getComposedType

        @Deprecated
        public ComposedTypeModel getComposedType​(java.lang.String typeCode)
        Deprecated.
        since ages
        Description copied from interface: TypeService
        Returns a specific composed type.
        Specified by:
        getComposedType in interface TypeService
        Parameters:
        typeCode - the unique code of this type
      • getComposedTypeForCode

        public ComposedTypeModel getComposedTypeForCode​(java.lang.String code)
        Description copied from interface: TypeService
        Returns the specific composed type for code.
        Specified by:
        getComposedTypeForCode in interface TypeService
        Parameters:
        code - the unique code of this type code
        Returns:
        the composed type for the specified code
      • getComposedType

        @Deprecated
        public ComposedTypeModel getComposedType​(java.lang.Class modelClass)
        Deprecated.
        since ages
        Description copied from interface: TypeService
        Returns the composed type for a specified model class.
        Specified by:
        getComposedType in interface TypeService
        Parameters:
        modelClass - the model class
      • getComposedTypeForClass

        public ComposedTypeModel getComposedTypeForClass​(java.lang.Class modelClass)
        Description copied from interface: TypeService
        Returns the specific composed type for the model class.
        Specified by:
        getComposedTypeForClass in interface TypeService
        Parameters:
        modelClass - the model class we are looking composed type for
        Returns:
        the composed type for class
      • getType

        @Deprecated
        public TypeModel getType​(java.lang.String typeCode)
        Deprecated.
        since ages
        Description copied from interface: TypeService
        Returns a specific type. This includes composed, atomic, collection and map types.
        Specified by:
        getType in interface TypeService
        Parameters:
        typeCode - the unique code of this type
      • getTypeForCode

        public TypeModel getTypeForCode​(java.lang.String code)
        Description copied from interface: TypeService
        Returns a specific type. This includes composed, atomic, collection and map types.
        Specified by:
        getTypeForCode in interface TypeService
        Parameters:
        code - the code for the required type
        Returns:
        the type for code
      • getAttributeDescriptor

        public AttributeDescriptorModel getAttributeDescriptor​(ComposedTypeModel composedType,
                                                               java.lang.String qualifier)
        Description copied from interface: TypeService
        Returns a specific attribute descriptor for a given composed type. This includes declared and inherited attributes.
        Specified by:
        getAttributeDescriptor in interface TypeService
        Parameters:
        composedType - the composed type to get attribute descriptor for
        qualifier - the attribute qualifier
      • getAttributeDescriptor

        public AttributeDescriptorModel getAttributeDescriptor​(java.lang.String composedType,
                                                               java.lang.String qualifier)
        Description copied from interface: TypeService
        Returns a specific attribute descriptor for a given composed type. This includes declared and inherited attributes.
        Specified by:
        getAttributeDescriptor in interface TypeService
        Parameters:
        composedType - the code of the composed type to get attribute descriptor for
        qualifier - the attribute qualifier
      • getAttributeDescriptors

        @Deprecated
        public java.util.Set<AttributeDescriptorModel> getAttributeDescriptors​(ComposedTypeModel composedType)
        Deprecated.
        since ages
        Description copied from interface: TypeService
        Returns all attribute descriptors of a single composed type. This includes declared and inherited ones.
        Specified by:
        getAttributeDescriptors in interface TypeService
        Parameters:
        composedType - the composed type to get attribute descriptors from
      • getAttributeDescriptors

        @Deprecated
        public java.util.Set<AttributeDescriptorModel> getAttributeDescriptors​(java.lang.String composedTypeCode)
        Deprecated.
        since ages
        Description copied from interface: TypeService
        Returns all attribute descriptors (as AttributeDescriptorModel) of a single composed type. This includes declared and inherited ones. This also includes attributes which are not generated in the model layer.
        Specified by:
        getAttributeDescriptors in interface TypeService
        Parameters:
        composedTypeCode - the code of the composed type to get attribute descriptors from
      • getInitialAttributeDescriptorsForType

        public java.util.Set<AttributeDescriptorModel> getInitialAttributeDescriptorsForType​(ComposedTypeModel composedTypeModel)
        Description copied from interface: TypeService
        Returns all attribute descriptors of this type which are marked as being initial.

        Initial attributes are normally non-writable attributes intended to be set during item creation only. Therefore having initial and writable attributed does not make much sense.

        Specified by:
        getInitialAttributeDescriptorsForType in interface TypeService
        Parameters:
        composedTypeModel - the composed type model we look initial attribute descriptors for
        Returns:
        the initial attribute descriptors for the given model
      • getEnumerationType

        @Deprecated
        public EnumerationMetaTypeModel getEnumerationType​(java.lang.String code)
        Deprecated.
        since ages
        Description copied from interface: TypeService
        Returns a specific enumeration type.
        Specified by:
        getEnumerationType in interface TypeService
        Parameters:
        code - the unique code of this type
      • getEnumerationValue

        public EnumerationValueModel getEnumerationValue​(java.lang.String type,
                                                         java.lang.String code)
        Description copied from interface: TypeService
        Returns a specific enumeration value.
        Specified by:
        getEnumerationValue in interface TypeService
        Parameters:
        type - the enumeration type code
        code - the value code
      • getMandatoryAttributes

        public java.util.Set<java.lang.String> getMandatoryAttributes​(java.lang.String type,
                                                                      boolean forCreation)
        Description copied from interface: TypeService
        Provides all mandatory attributes required to save models of the specified type. If the model is new (creation) this method will return initial attributes but omit attributes providing default values. Otherwise initial attributes are omitted but all other mandatory ones are returned no matter if they've got default values or not.
        Specified by:
        getMandatoryAttributes in interface TypeService
        Parameters:
        type - the type to get attributes for
        forCreation - creation or update
      • getUniqueAttributes

        public java.util.Set<java.lang.String> getUniqueAttributes​(java.lang.String type)
        Description copied from interface: TypeService
        Provides all attributes marked as unique within the given type.
        Specified by:
        getUniqueAttributes in interface TypeService
        Parameters:
        type - the type to get unique attributes for
        Returns:
        an empty set if type has no unique attributes
      • getUniqueModelRootType

        public java.lang.String getUniqueModelRootType​(java.lang.String composedTypeCode)
        Description copied from interface: TypeService
        This method finds for the given composedtypecode the root ComposedType which contains/declares the same unique attributes as the given ComposedType. This could be the same typecode or a typecode of any supertype of this ComposedType. The result is returned as typecode String.
        Specified by:
        getUniqueModelRootType in interface TypeService
        Parameters:
        composedTypeCode - any composed type code of the platform
        Returns:
        null if the given ComposedType contains no unique attributes.
      • getDefaultValues

        public java.util.Map<java.lang.String,​java.lang.Object> getDefaultValues​(java.lang.String type)
        Description copied from interface: TypeService
        Fetches all configured default values for a specified type.
        Specified by:
        getDefaultValues in interface TypeService
        Parameters:
        type - the type to get default values for
        Returns:
        a map containing all attributes and their default values which have got a configured value
      • getDefaultValues

        public java.util.Map<java.lang.String,​java.lang.Object> getDefaultValues​(java.lang.String type,
                                                                                       java.util.Collection<java.lang.String> attributes)
        Description copied from interface: TypeService
        Fetches a subset of all configured default values for a specified type.
        Specified by:
        getDefaultValues in interface TypeService
        Parameters:
        type - the type to get default values for
        attributes - the attributes to consider
        Returns:
        a map containing all attributes and their default values which have got a configured value
      • isAssignableFrom

        public boolean isAssignableFrom​(TypeModel target,
                                        TypeModel source)
        Description copied from interface: TypeService
        Returns true if the TypeModel, given by the parameter superModelType, is a super type of the TypeModel OR the same type as the TypeModel, given by the parameter subModelTypeCode.
        Specified by:
        isAssignableFrom in interface TypeService
        Returns:
        true if source type can be assigned to target type
      • isInstance

        public boolean isInstance​(TypeModel typemodel,
                                  java.lang.Object obj)
        Description copied from interface: TypeService
        Tests if the given object is an item instance of Type type.
        Specified by:
        isInstance in interface TypeService
        Returns:
        true if given object is an item instance of Type type
      • isAssignableFrom

        public boolean isAssignableFrom​(java.lang.String superModelTypeCode,
                                        java.lang.String subModelTypeCode)
        Description copied from interface: TypeService
        Returns true if the model type, given by the parameter superModelTypeCode, is a super type of the type of the model OR the same type as the type of the model, given by the parameter subModelTypeCode.
        Specified by:
        isAssignableFrom in interface TypeService
        Parameters:
        superModelTypeCode - - the type code (TypeModel) of the super type
        subModelTypeCode - - the type code (TypeModel) of the sub type
        Returns:
        false if the sub model type is not addignable from the super model type or if any parameter is null
      • getPartOfAttributes

        public java.util.Set<java.lang.String> getPartOfAttributes​(java.lang.String composedTypeCode)
        Description copied from interface: TypeService
        Provides all attribute qualifiers marked as part-of within the given type.
        Specified by:
        getPartOfAttributes in interface TypeService
        Parameters:
        composedTypeCode - the composedType code to get part-of attributes for
        Returns:
        an empty set if type has no part-of attributes
      • setConverterRegistry

        public void setConverterRegistry​(ConverterRegistry converterRegistry)
      • getTypeDao

        public TypeDao getTypeDao()
      • setTypeDao

        public void setTypeDao​(TypeDao typeDao)
      • getEnumerationManager

        @Deprecated
        public EnumerationManager getEnumerationManager()
        Deprecated.
        since ages
      • setEnumerationManager

        public void setEnumerationManager​(EnumerationManager enumerationManager)
      • hasAttribute

        public boolean hasAttribute​(ComposedTypeModel type,
                                    java.lang.String qualifier)
        Description copied from interface: TypeService
        Checks if type has attribute.
        Specified by:
        hasAttribute in interface TypeService
        Parameters:
        type - type
        qualifier - qualifier to check
        Returns:
        true if type has attribute
      • getModelClass

        public <T extends ItemModel> java.lang.Class<T> getModelClass​(ComposedTypeModel type)
        Description copied from interface: TypeService
        Returns model class for a type.
        Specified by:
        getModelClass in interface TypeService
        Parameters:
        type - type
        Returns:
        model class for a given type
      • getModelClass

        public <T extends ItemModel> java.lang.Class<T> getModelClass​(java.lang.String typeCode)
        Description copied from interface: TypeService
        Returns model class for a type code.
        Specified by:
        getModelClass in interface TypeService
        Parameters:
        typeCode - code of a type
        Returns:
        model class for a given type code
      • getAttributesForModifiers

        public java.util.Set<AttributeDescriptorModel> getAttributesForModifiers​(java.lang.String composedTypeCode,
                                                                                 AttributeModifierCriteria criteria)
        Description copied from interface: TypeService
        Gets the attributes for modifiers for given composed type and criteria container. To add proper criterias to the argument use constants in the class AttributeModifiers.
        Specified by:
        getAttributesForModifiers in interface TypeService
        Parameters:
        composedTypeCode - the composed type code
        criteria - the criteria
        Returns:
        the attributes for modifiers