@Override public Collection<CategoryAttribute> getAttributesForMetaClass(MetaClass metaClass) { return cache().getAttributesForMetaClass(metaClass); }
@Override public Collection<Category> getCategoriesForMetaClass(MetaClass metaClass) { return cache().getCategoriesForMetaClass(metaClass); }
@Override public void receive(ReloadCacheMsg message) { doLoadCache(false, false); } });
protected MetaPropertyPath resolveMetaPropertyPath(MetaClass metaClass, String property) { MetaPropertyPath mpp = metaClass.getPropertyPath(property); if (mpp == null && DynamicAttributesUtils.isDynamicAttribute(property)) { mpp = dynamicAttributesTools.getMetaPropertyPath(metaClass, property); } return mpp; }
/** * Get special meta property path object for dynamic attribute by code */ @Nullable public MetaPropertyPath getMetaPropertyPath(MetaClass metaClass, String attributeCode) { attributeCode = decodeAttributeCode(attributeCode); CategoryAttribute attribute = dynamicAttributes.getAttributeForMetaClass(metaClass, attributeCode); if (attribute != null) { return DynamicAttributesUtils.getMetaPropertyPath(metaClass, attribute); } else { return null; } }
@Override public DynamicAttributesCache getCacheIfNewer(Date clientCacheDate) { if (clientCacheDate == null || this.dynamicAttributesCache == null || this.dynamicAttributesCache.getCreationDate() == null || clientCacheDate.before(this.dynamicAttributesCache.getCreationDate())) { return cache(); } else { return null; } }
@Nullable @Override public CategoryAttribute getAttributeForMetaClass(MetaClass metaClass, String code) { return cache().getAttributeForMetaClass(metaClass, code); }
@Override public Object loadObject() { DynamicAttributesCache cacheFromServer = AppBeans.get(DynamicAttributesCacheService.NAME, DynamicAttributesCacheService.class) .getCacheIfNewer(dynamicAttributesCache != null ? dynamicAttributesCache.getCreationDate() : null); if (cacheFromServer != null) { dynamicAttributesCache = cacheFromServer; } needToValidateCache = false; return dynamicAttributesCache; }
public static CategoryAttribute getCategoryAttribute(MetaProperty metaProperty) { return ((DynamicAttributesMetaProperty) metaProperty).getAttribute(); }
@Override public void onBeforeInsert(CategoryAttribute entity, EntityManager entityManager) { setCategoryEntityType(entity); }
@Override public void loadCache(){ dynamicAttributesManagerAPI.loadCache(); }
@Override public String getId() { return name(); }
@Override public Collection<Category> getCategoriesForMetaClass(MetaClass metaClass) { return dynamicAttributesManagerAPI.getCategoriesForMetaClass(metaClass); }
@Override public Collection<CategoryAttribute> getAttributesForMetaClass(MetaClass metaClass){ return dynamicAttributesManagerAPI.getAttributesForMetaClass(metaClass); }
@Override public DynamicAttributesCache getCacheIfNewer(Date clientCacheDate) { return dynamicAttributesManagerAPI.getCacheIfNewer(clientCacheDate); } }
@Override @SuppressWarnings("unchecked") public Collection<DynamicAttributesMetaProperty> getPropertiesFilteredByCategory() { Collection propertiesFilteredByCategory = metaClass.getPropertiesFilteredByCategory(category); return (Collection<DynamicAttributesMetaProperty>) propertiesFilteredByCategory; }
protected DynamicAttributesCache cache() { if (this.dynamicAttributesCache == null) { doLoadCache(true, true); } return this.dynamicAttributesCache; }
@Override public void onBeforeUpdate(CategoryAttribute entity, EntityManager entityManager) { setCategoryEntityType(entity); }
@Override public void clearDynamicAttributesCache() { dynamicAttributesManagerAPI.loadCache(); }
@Override public void loadCache() { doLoadCache(true, false); }