@Component(value="cuba_DynamicAttributesManager") public class DynamicAttributesManager extends java.lang.Object implements DynamicAttributesManagerAPI
Modifier and Type | Field and Description |
---|---|
protected ClusterManagerAPI |
clusterManager |
protected DynamicAttributesCache |
dynamicAttributesCache |
protected java.util.concurrent.locks.ReentrantLock |
loadCacheLock |
static int |
MAX_ENTITIES_FOR_ATTRIBUTE_VALUES_BATCH |
protected Metadata |
metadata |
protected Persistence |
persistence |
protected PersistentAttributesLoadChecker |
persistentAttributesLoadChecker |
protected ReferenceToEntitySupport |
referenceToEntitySupport |
protected Security |
security |
protected TimeSource |
timeSource |
protected ViewRepository |
viewRepository |
NAME
Constructor and Description |
---|
DynamicAttributesManager() |
Modifier and Type | Method and Description |
---|---|
protected DynamicAttributesCache |
cache() |
protected void |
doFetchDynamicAttributes(MetaClass metaClass,
java.util.Collection<BaseGenericIdEntity> entities) |
protected void |
doLoadCache(boolean sendClusterMessage,
boolean stopIfNotNull) |
protected void |
doStoreDynamicAttributes(BaseGenericIdEntity entity) |
<E extends BaseGenericIdEntity> |
fetchDynamicAttributes(java.util.List<E> entities,
java.util.Set<java.lang.Class> dependentClasses)
Fetch dynamic attributes from database for each entity
|
CategoryAttribute |
getAttributeForMetaClass(MetaClass metaClass,
java.lang.String code)
Get certain category attribute for metaClass by attribute code
|
java.util.Collection<CategoryAttribute> |
getAttributesForMetaClass(MetaClass metaClass)
Get all categories attributes for metaClass from cache
|
DynamicAttributesCache |
getCacheIfNewer(java.util.Date clientCacheDate) |
java.util.Collection<Category> |
getCategoriesForMetaClass(MetaClass metaClass)
Get all categories linked with metaClass from cache
|
protected void |
handleAttributeValuesForIds(MetaClass metaClass,
java.util.List<java.lang.Object> currentIds,
com.google.common.collect.Multimap<java.lang.Object,CategoryAttributeValue> attributeValuesForEntity) |
protected java.util.List<CategoryAttributeValue> |
loadAttributeValues(MetaClass metaClass,
java.util.List<java.lang.Object> entityIds) |
void |
loadCache()
Reload dynamic attributes cache from database
|
protected void |
loadEntityValues(java.util.List<CategoryAttributeValue> cavsOfEntityType)
Method loads entity values for CategoryAttributeValues of entity type and sets entity values to the corresponding
property of the
CategoryAttributeValue entity. |
protected java.util.List<CategoryAttributeValue> |
reloadCategoryAttributeValuesWithChildren(java.util.List<CategoryAttributeValue> categoryAttributeValues) |
protected MetaClass |
resolveTargetMetaClass(MetaClass metaClass) |
void |
setClusterManager(ClusterManagerAPI clusterManager) |
protected void |
storeCategoryAttributeValueWithCollectionType(CategoryAttributeValue categoryAttributeValue)
Removes nested
CategoryAttributeValue entities for items that were removed from the collection value
and creates new child CategoryAttributeValue instances for just added collection value items. |
void |
storeDynamicAttributes(BaseGenericIdEntity entity)
Store dynamic attributes from the entity to database
|
public static final int MAX_ENTITIES_FOR_ATTRIBUTE_VALUES_BATCH
@Inject protected Metadata metadata
@Inject protected TimeSource timeSource
@Inject protected ViewRepository viewRepository
@Inject protected Persistence persistence
@Inject protected ReferenceToEntitySupport referenceToEntitySupport
@Inject protected PersistentAttributesLoadChecker persistentAttributesLoadChecker
@Inject protected Security security
protected ClusterManagerAPI clusterManager
protected java.util.concurrent.locks.ReentrantLock loadCacheLock
protected volatile DynamicAttributesCache dynamicAttributesCache
@Inject public void setClusterManager(ClusterManagerAPI clusterManager)
public void loadCache()
DynamicAttributesManagerAPI
loadCache
in interface DynamicAttributesManagerAPI
protected void doLoadCache(boolean sendClusterMessage, boolean stopIfNotNull)
public java.util.Collection<Category> getCategoriesForMetaClass(MetaClass metaClass)
DynamicAttributesManagerAPI
getCategoriesForMetaClass
in interface DynamicAttributesManagerAPI
public java.util.Collection<CategoryAttribute> getAttributesForMetaClass(MetaClass metaClass)
DynamicAttributesManagerAPI
getAttributesForMetaClass
in interface DynamicAttributesManagerAPI
@Nullable public CategoryAttribute getAttributeForMetaClass(MetaClass metaClass, java.lang.String code)
DynamicAttributesManagerAPI
getAttributeForMetaClass
in interface DynamicAttributesManagerAPI
public DynamicAttributesCache getCacheIfNewer(java.util.Date clientCacheDate)
getCacheIfNewer
in interface DynamicAttributesManagerAPI
protected DynamicAttributesCache cache()
public void storeDynamicAttributes(BaseGenericIdEntity entity)
DynamicAttributesManagerAPI
storeDynamicAttributes
in interface DynamicAttributesManagerAPI
public <E extends BaseGenericIdEntity> void fetchDynamicAttributes(java.util.List<E> entities, @Nonnull java.util.Set<java.lang.Class> dependentClasses)
DynamicAttributesManagerAPI
fetchDynamicAttributes
in interface DynamicAttributesManagerAPI
protected void doStoreDynamicAttributes(BaseGenericIdEntity entity)
protected void storeCategoryAttributeValueWithCollectionType(CategoryAttributeValue categoryAttributeValue)
CategoryAttributeValue
entities for items that were removed from the collection value
and creates new child CategoryAttributeValue
instances for just added collection value items.categoryAttributeValue
- protected void doFetchDynamicAttributes(MetaClass metaClass, java.util.Collection<BaseGenericIdEntity> entities)
protected void handleAttributeValuesForIds(MetaClass metaClass, java.util.List<java.lang.Object> currentIds, com.google.common.collect.Multimap<java.lang.Object,CategoryAttributeValue> attributeValuesForEntity)
protected java.util.List<CategoryAttributeValue> loadAttributeValues(MetaClass metaClass, java.util.List<java.lang.Object> entityIds)
protected void loadEntityValues(java.util.List<CategoryAttributeValue> cavsOfEntityType)
CategoryAttributeValue
entity.protected java.util.List<CategoryAttributeValue> reloadCategoryAttributeValuesWithChildren(java.util.List<CategoryAttributeValue> categoryAttributeValues)