Class DefaultTypeService

  • All Implemented Interfaces:
    TypeService

    public class DefaultTypeService
    extends java.lang.Object
    implements TypeService
    • Constructor Detail

      • DefaultTypeService

        public DefaultTypeService()
    • Method Detail

      • checkItemAlive

        public boolean checkItemAlive​(TypedObject typedItem)
        Description copied from interface: TypeService
        Check item alive.
        Specified by:
        checkItemAlive in interface TypeService
        Parameters:
        typedItem - the typed item
        Returns:
        true, if successful
      • countAllInstancesOf

        public int countAllInstancesOf​(ObjectType type)
        Description copied from interface: TypeService
        Count all instances of the given type
        Specified by:
        countAllInstancesOf in interface TypeService
        Parameters:
        type - the type
        Returns:
        the number of instances or -1 if there was an error
      • getAllInstancesOf

        public java.util.Collection<TypedObject> getAllInstancesOf​(ObjectType type,
                                                                   java.lang.String sortBy,
                                                                   java.lang.String sortOrder)
        Description copied from interface: TypeService
        Gets all instances of the given type according to given sort criteria. Keep in mind that this can be very expensive, so use TypeService.countAllInstancesOf(ObjectType) before calling this method
        Specified by:
        getAllInstancesOf in interface TypeService
        Parameters:
        type - the type
        sortBy - given sort property
        sortOrder - given sort order
        Returns:
        the instances of the given type
      • clear

        public void clear()
      • getAttributeCodeFromPropertyQualifier

        public java.lang.String getAttributeCodeFromPropertyQualifier​(java.lang.String propertyQualifier)
        Description copied from interface: TypeService
        Gets the attribute code from property qualifier.
        Specified by:
        getAttributeCodeFromPropertyQualifier in interface TypeService
        Parameters:
        propertyQualifier - the property qualifier
        Returns:
        the attribute code from property qualifier
      • getAvailableValues

        public java.util.List<java.lang.Object> getAvailableValues​(PropertyDescriptor propertyDescriptor)
        Description copied from interface: TypeService
        Gets the available values.
        Specified by:
        getAvailableValues in interface TypeService
        Parameters:
        propertyDescriptor - the property descriptor
        Returns:
        the available values
      • getAvailableValues

        public java.util.List<java.lang.Object> getAvailableValues​(PropertyDescriptor propertyDescriptor,
                                                                   TypedObject object)
        Description copied from interface: TypeService
        Gets the available values.
        Specified by:
        getAvailableValues in interface TypeService
        Parameters:
        propertyDescriptor - the property descriptor
        Returns:
        the available values
      • getBaseType

        public BaseType getBaseType​(java.lang.String code)
        Description copied from interface: TypeService
        Gets the base type.
        Specified by:
        getBaseType in interface TypeService
        Parameters:
        code - the code
        Returns:
        the base type
      • getExtendedType

        public ExtendedType getExtendedType​(java.lang.String code)
        Description copied from interface: TypeService
        Gets the extended type.
        Specified by:
        getExtendedType in interface TypeService
        Parameters:
        code - the code
        Returns:
        the extended type
      • getObjectTemplate

        public ObjectTemplate getObjectTemplate​(java.lang.String code)
        Description copied from interface: TypeService
        Gets the object template.
        Specified by:
        getObjectTemplate in interface TypeService
        Parameters:
        code - the code
        Returns:
        the object template
      • getObjectType

        public ObjectType getObjectType​(java.lang.String code)
        Description copied from interface: TypeService
        Gets the object type.
        Specified by:
        getObjectType in interface TypeService
        Parameters:
        code - the code
        Returns:
        the object type
      • getObjectTypeFromPropertyQualifier

        public ObjectType getObjectTypeFromPropertyQualifier​(java.lang.String propertyQualifier)
        Description copied from interface: TypeService
        Gets the object type from property qualifier.
        Specified by:
        getObjectTypeFromPropertyQualifier in interface TypeService
        Parameters:
        propertyQualifier - the property qualifier
        Returns:
        the object type from property qualifier
      • getPropertyDescriptor

        public PropertyDescriptor getPropertyDescriptor​(java.lang.String propertyQualifier)
        Description copied from interface: TypeService
        Gets the property descriptor.
        Specified by:
        getPropertyDescriptor in interface TypeService
        Parameters:
        propertyQualifier - the property qualifier
        Returns:
        the property descriptor
      • getTypeCodeFromPropertyQualifier

        public java.lang.String getTypeCodeFromPropertyQualifier​(java.lang.String propertyQualifier)
        Description copied from interface: TypeService
        The type (base or extended) part of the property qualifier. (E.g. having qualifier "Product.code" this returns "Product".)
        Specified by:
        getTypeCodeFromPropertyQualifier in interface TypeService
        Parameters:
        propertyQualifier - the property qualifier
        Returns:
        the type code from property qualifier
      • getValueTypeCode

        public java.lang.String getValueTypeCode​(PropertyDescriptor propertyDescriptor)
        Description copied from interface: TypeService
        Gets the value type code.
        Specified by:
        getValueTypeCode in interface TypeService
        Parameters:
        propertyDescriptor - the property descriptor
        Returns:
        the value type code
      • init

        public void init()
      • setBaseTypeCache

        public void setBaseTypeCache​(TypeCache typeCache)
      • setBaseTypePropertyCache

        public void setBaseTypePropertyCache​(PropertyCache propCache)
      • setExtendedTypeCache

        public void setExtendedTypeCache​(TypeCache typeCache)
      • setModelService

        public void setModelService​(ModelService modelService)
      • setObjectTemplateCache

        public void setObjectTemplateCache​(TypeCache typeCache)
      • setTypeService

        public void setTypeService​(TypeService typeService)
      • wrapItem

        public TypedObject wrapItem​(java.lang.Object itemObject)
        Description copied from interface: TypeService
        Wrap item.
        Specified by:
        wrapItem in interface TypeService
        Parameters:
        itemObject - the item
        Returns:
        the typed object
      • wrapItems

        public java.util.List<TypedObject> wrapItems​(java.util.Collection<? extends java.lang.Object> itemObjects)
        Description copied from interface: TypeService
        Wrap items.
        Specified by:
        wrapItems in interface TypeService
        Parameters:
        itemObjects - the items
        Returns:
        the list< typed object>
      • unwrapItems

        public java.util.List<ItemModel> unwrapItems​(java.util.Collection<TypedObject> typedObjects)
        Description copied from interface: TypeService
        Unwrap items to models
        Specified by:
        unwrapItems in interface TypeService
        Returns:
        the list of ItemModel items
      • addToCache

        protected void addToCache​(ObjectType type)
      • getBaseTypeCache

        protected TypeCache getBaseTypeCache()
      • getBaseTypeCached

        protected BaseType getBaseTypeCached​(java.lang.String code)
      • addBaseTypePropertyToCache

        protected void addBaseTypePropertyToCache​(java.lang.String qualifier,
                                                  PropertyDescriptor propDesc)
      • getBaseTypePropertyCache

        protected PropertyCache getBaseTypePropertyCache()
      • getBaseTypePropertyCached

        protected PropertyDescriptor getBaseTypePropertyCached​(java.lang.String qualifier)
      • getDefaultEditorType

        protected java.lang.String getDefaultEditorType​(AttributeDescriptorModel attributeDescriptorModel)
      • getDefaultEditorType

        protected java.lang.String getDefaultEditorType​(TypeModel type,
                                                        boolean localized)
      • getExtendedTypeCache

        protected TypeCache getExtendedTypeCache()
      • getExtendedTypeCached

        protected ExtendedType getExtendedTypeCached​(java.lang.String code)
      • getModelService

        protected ModelService getModelService()
      • getObjectTemplateCache

        protected TypeCache getObjectTemplateCache()
      • getObjectTemplateCached

        protected ObjectTemplate getObjectTemplateCached​(java.lang.String code)
      • getTypeService

        protected TypeService getTypeService()
      • loadClassificationType

        protected ClassificationType loadClassificationType​(java.lang.String code)
      • resolveClassificationPropertyPath

        protected java.lang.String resolveClassificationPropertyPath​(java.lang.String code,
                                                                     java.lang.String classificationAttributeCode)
      • loadWidgetType

        protected WidgetType loadWidgetType​(java.lang.String code)
      • loadItemTemplate

        protected ObjectTemplate loadItemTemplate​(java.lang.String code)
      • loadItemType

        protected ItemType loadItemType​(java.lang.String code)
      • getSelectionOf

        public PropertyDescriptor getSelectionOf​(PropertyDescriptor descriptor)
        Description copied from interface: TypeService
        returns the "selectionOf" property of the given property descriptor
        Specified by:
        getSelectionOf in interface TypeService
        Parameters:
        descriptor - the source property descriptor
        Returns:
        the "selectionOf" property of the given property descriptor
      • getReverseSelectionOf

        public java.util.Collection<PropertyDescriptor> getReverseSelectionOf​(PropertyDescriptor descriptor)
        Description copied from interface: TypeService
        returns the list of all property descriptors that the give property descriptor is "selectionOf"
        Specified by:
        getReverseSelectionOf in interface TypeService
        Parameters:
        descriptor - the source property descriptor
        Returns:
        the list of all property descriptors that the give property descriptor is "selectionOf"