Class BaseDao

  • All Implemented Interfaces:
    Dao

    @Deprecated(since="4.4",
                forRemoval=true)
    public class BaseDao
    extends java.lang.Object
    implements Dao
    Deprecated, for removal: This API element is subject to removal in a future version.
    Since 4.4. Perfer use of DefaultGenericDao
    This dao provides convinience methods to look up models without having to implement your own Dao.
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseDao()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      <M extends ItemModel>
      M
      copyDirtyAttributes​(M source, M target)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Copies dirty attributes from source model to the target.
      <M extends ItemModel>
      java.lang.Integer
      countAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs, boolean excludeSubtypes, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Counts models matching the given attribute map.
      <M extends ItemModel>
      M
      deepClone​(M model, java.lang.String... excludeAttributesFromCopy)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Copies all attributes that are marked as loaded from model into a new copy of the same ItemModel type.
      <M extends ItemModel>
      java.util.List<M>
      findAll​(int count, int start, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds all models.
      <M extends ItemModel>
      java.util.List<M>
      findAllByAttribute​(java.lang.String attributeName, java.lang.Object attributeValue, int count, int start, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds models matching the given attribute.
      <M extends ItemModel>
      java.util.List<M>
      findAllByAttribute​(java.lang.String attributeName, java.lang.Object attributeValue, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds models matching the given attribute.
      <M extends ItemModel>
      java.util.List<M>
      findAllByAttribute​(java.lang.String attributeName, java.lang.Object attributeValue, java.util.Map<java.lang.String,​java.lang.Boolean> orderBy, int count, int start, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds models matching the given attribute.
      <M extends ItemModel>
      java.util.List<M>
      findAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs, int count, int start, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds models matching the given attribute map.
      <M extends ItemModel>
      java.util.List<M>
      findAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds models matching the given attribute map.
      <M extends ItemModel>
      java.util.List<M>
      findAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs, java.util.Map<java.lang.String,​java.lang.Boolean> orderByMap, int count, int start, boolean excludeSubtypes, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds models matching the given attribute map.
      <M extends ItemModel>
      java.util.List<M>
      findAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs, java.util.Map<java.lang.String,​java.lang.Boolean> orderByMap, int count, int start, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds models matching the given attribute map.
      <M> M findByBeanProperty​(java.util.Collection<M> collection, java.lang.String propertyName, java.lang.String propertyValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      <M extends ItemModel>
      M
      findFirstByAttribute​(java.lang.String attributeName, java.lang.Object attributeValue, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds a model matching the given attribute.
      <M extends ItemModel>
      M
      findFirstByAttribute​(java.lang.String attributeName, java.lang.Object attributeValue, java.util.Map<java.lang.String,​java.lang.Boolean> orderBy, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds a model matching the given attribute.
      <M extends ItemModel>
      M
      findFirstByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs, java.util.Map<java.lang.String,​java.lang.Boolean> orderBy, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds a model matching the given attributes.
      <M extends ItemModel>
      M
      findLastInsertedItem​(java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      <M extends ItemModel>
      M
      findUniqueByAttribute​(java.lang.String attributeName, java.lang.Object attributeValue, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds a model matching the given attribute.
      <M extends ItemModel>
      M
      findUniqueByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs, java.lang.Class<M> modelClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finds a model matching the given attributes.
      protected java.util.Set<java.lang.String> getAllAttributes​(ItemModel model)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get all the attributes an ItemModel instance including all the attributes of its super classes.
      FlexibleSearchService getFlexibleSearchService()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the search service.
      ModelService getModelService()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the model service.
      <M extends ItemModel>
      void
      save​(M model)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Persists the model.
      <M extends ItemModel>
      void
      saveAll​(java.util.Collection<M> models)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Save all.
      void setFlexibleSearchService​(FlexibleSearchService flexibleSearchService)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the search service.
      void setModelService​(ModelService modelService)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the model service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseDao

        public BaseDao()
        Deprecated, for removal: This API element is subject to removal in a future version.
    • Method Detail

      • findAll

        public <M extends ItemModel> java.util.List<M> findAll​(int count,
                                                               int start,
                                                               java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Finds all models.
        Parameters:
        count - The max. number of models returned.
        start - The number of the first record.
        Returns:
        A list of models.
      • findUniqueByAttribute

        public <M extends ItemModel> M findUniqueByAttribute​(java.lang.String attributeName,
                                                             java.lang.Object attributeValue,
                                                             java.lang.Class<M> modelClass)
                                                      throws AmbiguousIdentifierException
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds a model matching the given attribute. If the query returns more than one model a AmbiguousIdentifierException is thrown. If no model was found null is returned.

        Parameters:
        attributeName - The name of the attribute.
        attributeValue - The value of the attribute
        Returns:
        A list of models.
        Throws:
        AmbiguousIdentifierException - If more than one model was found.
      • findUniqueByAttributes

        public <M extends ItemModel> M findUniqueByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs,
                                                              java.lang.Class<M> modelClass)
                                                       throws AmbiguousIdentifierException
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds a model matching the given attributes. If the query returns more than one model a AmbiguousIdentifierException is thrown. If no model was found null is returned.

        Parameters:
        attribs - A map of attribute names and values
        Returns:
        A list of models.
        Throws:
        AmbiguousIdentifierException - If more than one model was found.
      • findFirstByAttribute

        public <M extends ItemModel> M findFirstByAttribute​(java.lang.String attributeName,
                                                            java.lang.Object attributeValue,
                                                            java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds a model matching the given attribute. If the query returns more than one model the first model is returned. If no model was found null is returned.

        Parameters:
        attributeName - The name of the attribute.
        attributeValue - The value of the attribute
        Returns:
        A list of models.
      • findFirstByAttribute

        public <M extends ItemModel> M findFirstByAttribute​(java.lang.String attributeName,
                                                            java.lang.Object attributeValue,
                                                            java.util.Map<java.lang.String,​java.lang.Boolean> orderBy,
                                                            java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds a model matching the given attribute. If the query returns more than one model the first model is returned. If no model was found null is returned.

        Parameters:
        attributeName - The name of the attribute.
        attributeValue - The value of the attribute
        orderBy - Map providing attribute names that will be included in the order by clause . The boolean value determines whether the sort order should be ascending (true) or descending ( false).
        Returns:
        A list of models.
      • findLastInsertedItem

        public <M extends ItemModel> M findLastInsertedItem​(java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • findFirstByAttributes

        public <M extends ItemModel> M findFirstByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs,
                                                             java.util.Map<java.lang.String,​java.lang.Boolean> orderBy,
                                                             java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds a model matching the given attributes. If the query returns more than one model the first model is returned. If no model was found null is returned.

        Parameters:
        attribs - A map of attribute names and values
        orderBy - Map providing attribute names that will be included in the order by clause. The boolean value determines whether the sort order should be ascending (true) or descending ( false).
        Returns:
        A list of models.
      • findAllByAttribute

        public <M extends ItemModel> java.util.List<M> findAllByAttribute​(java.lang.String attributeName,
                                                                          java.lang.Object attributeValue,
                                                                          java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds models matching the given attribute.

        Parameters:
        attributeName - The name of the attribute.
        attributeValue - The value of the attribute
        Returns:
        A list of models.
      • findAllByAttribute

        public <M extends ItemModel> java.util.List<M> findAllByAttribute​(java.lang.String attributeName,
                                                                          java.lang.Object attributeValue,
                                                                          int count,
                                                                          int start,
                                                                          java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds models matching the given attribute.

        Parameters:
        attributeName - The name of the attribute.
        attributeValue - The value of the attribute
        count - The max. number of models returned.
        start - The number of the first record.
        Returns:
        A list of models.
      • findAllByAttribute

        public <M extends ItemModel> java.util.List<M> findAllByAttribute​(java.lang.String attributeName,
                                                                          java.lang.Object attributeValue,
                                                                          java.util.Map<java.lang.String,​java.lang.Boolean> orderBy,
                                                                          int count,
                                                                          int start,
                                                                          java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds models matching the given attribute.

        Parameters:
        attributeName - The name of the attribute.
        attributeValue - The value of the attribute
        orderBy - Map providing attribute names that will be included in the order by clause . The boolean value determines whether the sort order should be ascending (true) or descending ( false).
        count - The max. number of models returned.
        start - The number of the first record.
        Returns:
        A list of models.
      • findAllByAttributes

        public <M extends ItemModel> java.util.List<M> findAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs,
                                                                           java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds models matching the given attribute map.

        Parameters:
        attribs - Map providing attribute names and values that will be included in the where clause or null. The value can be an ItemModel.
        Returns:
        the list< m>
      • findAllByAttributes

        public <M extends ItemModel> java.util.List<M> findAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs,
                                                                           int count,
                                                                           int start,
                                                                           java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds models matching the given attribute map.

        Parameters:
        attribs - Map providing attribute names and values that will be included in the where clause or null. The value can be an ItemModel .
        count - The max. number of models returned.
        start - The number of the first record.
        Returns:
        A list of models.
      • findAllByAttributes

        public <M extends ItemModel> java.util.List<M> findAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs,
                                                                           java.util.Map<java.lang.String,​java.lang.Boolean> orderByMap,
                                                                           int count,
                                                                           int start,
                                                                           java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds models matching the given attribute map.

        Parameters:
        attribs - Map providing attribute names and values that will be included in the where clause or null. The value can be an ItemModel .
        orderByMap - Map providing attribute names that will be included in the order by clause. The boolean value determines whether the sort order should be ascending (true) or descending ( false).
        count - The max. number of models returned.
        start - The number of the first record.
        Returns:
        A list of models.
      • findAllByAttributes

        public <M extends ItemModel> java.util.List<M> findAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs,
                                                                           java.util.Map<java.lang.String,​java.lang.Boolean> orderByMap,
                                                                           int count,
                                                                           int start,
                                                                           boolean excludeSubtypes,
                                                                           java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Finds models matching the given attribute map.

        Parameters:
        attribs - Map providing attribute names and values that will be included in the where clause or null. The value can be an ItemModel .
        orderByMap - Map providing attribute names that will be included in the order by clause. The boolean value determines whether the sort order should be ascending (true) or descending ( false).
        count - The max. number of models returned.
        start - The number of the first record.
        excludeSubtypes - Use if you want to exclude the subtyps so in the case of a Product no Color- or SizeVariants will be given back.
        modelClass - Service Layer model class
        Returns:
        A list of models.
      • countAllByAttributes

        public <M extends ItemModel> java.lang.Integer countAllByAttributes​(java.util.Map<java.lang.String,​java.lang.Object> attribs,
                                                                            boolean excludeSubtypes,
                                                                            java.lang.Class<M> modelClass)
        Deprecated, for removal: This API element is subject to removal in a future version.

        Counts models matching the given attribute map.

        Parameters:
        attribs - Map providing attribute names and values that will be included in the where clause or null. The value can be an ItemModel.
        excludeSubtypes - Use if you want to exclude the subtyps so in the case of a Product no Color- or SizeVariants will be given back.
        Returns:
        A list of models.
      • saveAll

        public <M extends ItemModel> void saveAll​(java.util.Collection<M> models)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Save all.
        Parameters:
        models - the models
      • getFlexibleSearchService

        public FlexibleSearchService getFlexibleSearchService()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Gets the search service.
        Returns:
        the flexibleSearchService
      • setFlexibleSearchService

        public void setFlexibleSearchService​(FlexibleSearchService flexibleSearchService)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Sets the search service.
        Parameters:
        flexibleSearchService - the flexibleSearchService to set
      • getModelService

        public ModelService getModelService()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Gets the model service.
        Returns:
        the modelService
      • setModelService

        public void setModelService​(ModelService modelService)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Sets the model service.
        Parameters:
        modelService - the modelService to set
      • copyDirtyAttributes

        public <M extends ItemModel> M copyDirtyAttributes​(M source,
                                                           M target)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Copies dirty attributes from source model to the target.
        Parameters:
        source - A model to read dirty attributes from.
        target - A model to updated with dirty values of the source.
        Returns:
        An updated target model.
      • deepClone

        public <M extends ItemModel> M deepClone​(M model,
                                                 java.lang.String... excludeAttributesFromCopy)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Copies all attributes that are marked as loaded from model into a new copy of the same ItemModel type. Note that both models are detached from the ModelContext when using this method you should explicitly call ModelService.attach(Object)

         The following attributes will not be copied.
         Item.CREATION_TIME
         Item.MODIFIED_TIME
         Item.PK
         Item.OWNER
         assignedCockpitItemTemplates
         allDocuments
         synchronizationSources
         synchronizedCopies
         savedValues
         valueHistory
        
         
        Parameters:
        model - A model to copy
        excludeAttributesFromCopy - the exclude attributes from copy
        Returns:
        A copy of a model.
      • getAllAttributes

        protected java.util.Set<java.lang.String> getAllAttributes​(ItemModel model)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Get all the attributes an ItemModel instance including all the attributes of its super classes.
        Parameters:
        model - An ItemModel instance.
        Returns:
        A unmodifiable set of all modifiable attributes of an ItemModel and its super classes
      • findByBeanProperty

        public <M> M findByBeanProperty​(java.util.Collection<M> collection,
                                        java.lang.String propertyName,
                                        java.lang.String propertyValue)
        Deprecated, for removal: This API element is subject to removal in a future version.