public abstract class EntityPrefService<ENTITY extends umun.iam.model.Meta,PREF extends EntityPref,ID extends EntityPrefId> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected EntityPrefCategoryService |
categoryService |
EntityPrefCategory |
rootCategory |
protected umun.core.service.SystemPrefService |
systemPrefService |
| Constructor and Description |
|---|
EntityPrefService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addRootKeys(String rootKey,
String defaultValue,
String remoteHideKey,
PrefDataType dataType,
EntityPrefOptionsInterface optionsInterface,
String displayName,
EntityPrefValidationInterface<ENTITY,PREF> entityPrefValidationInterface,
String group,
boolean defaultRemoteHide,
EntityPrefProp<ENTITY,PREF> properties) |
void |
addServiceReference(String categoryName,
EntityPrefCategoryInterface<ENTITY,PREF,ID,?> instance) |
protected abstract PREF |
createCategoryAsPref(ENTITY entity,
EntityPrefCategory category) |
protected abstract ID |
createEntityPrefId(ENTITY entity,
EntityPrefCategory category,
String key) |
protected abstract PREF |
createMissingRootPref(ENTITY entity,
EntityPrefCategory rootCategory,
String key,
EntityPrefValue<ENTITY,PREF> value,
Map<String,String> options,
String group) |
PREF |
createOrUpdate(ENTITY entity,
EntityPrefCategory category,
String key,
String value,
umun.iam.model.User requestedBy) |
protected abstract PREF |
createPref(ENTITY entity,
EntityPrefCategory category,
String key,
String value,
String remoteHideKey) |
protected PREF |
doPostCreationOperations(ENTITY entity,
EntityPrefCategory category,
PREF pref,
String key,
String value,
umun.iam.model.User requestedBy) |
protected PREF |
doPostFoundOperations(PREF pref,
EntityPrefValue<ENTITY,PREF> value,
ENTITY entity) |
protected abstract List<PREF> |
findByEntityAndCategoryOrderByKey(ENTITY entity,
EntityPrefCategory rootCategory) |
protected abstract ENTITY |
findEntityOrFail(long entityId,
umun.iam.model.User requestedBy) |
ENTITY |
findOne(long entityId,
umun.iam.model.User requestedBy) |
protected abstract Map<String,EntityPrefCategoryInterface<ENTITY,PREF,ID,?>> |
getCategoryServicesMap() |
List<TemplatePref> |
getCreationTemplate(Map<String,String> allRequestParams) |
protected abstract EntityCRUDService<ENTITY> |
getCrudService() |
protected PrefDataType |
getDataType(EntityPrefCategory category,
String key) |
protected String |
getDisplayname(String key) |
protected abstract String |
getEntityName() |
protected String |
getGroup(EntityPrefCategory category,
String key) |
protected Map<String,String> |
getOptions(EntityPrefCategory category,
String key,
ENTITY entity) |
protected String |
getRemoteHideKey(EntityPrefCategory category,
String key) |
protected abstract EntityPrefRepository<PREF,ID> |
getRepository() |
protected abstract Map<String,EntityPrefValue<ENTITY,PREF>> |
getRootKeys() |
protected boolean |
isDoNotAddIfMissing(String key,
ENTITY entity) |
List<PREF> |
read(ENTITY entity) |
List<PREF> |
read(ENTITY entity,
EntityPrefCategory category) |
protected PREF |
read(ID entityPrefId) |
List<PREF> |
read(long entityId,
umun.iam.model.User requestedBy) |
List<PREF> |
read(umun.iam.model.User requestedBy,
long categoryId,
long entityId) |
Map<String,List<PREF>> |
readAllPrefs(umun.iam.model.User requestedBy,
long entityId) |
PREF |
readOrFail(ENTITY entity,
EntityPrefCategory category,
String key) |
PREF |
readWithoutFail(ENTITY entity,
EntityPrefCategory category,
String key,
String value) |
protected List<PREF> |
removeHidden(List<PREF> prefs) |
protected PREF |
saveAndFlush(ENTITY entity,
EntityPrefCategory category,
PREF pref,
String key,
String value,
umun.iam.model.User requestedBy,
String oldValue) |
void |
startUp(org.springframework.context.event.ContextRefreshedEvent event) |
PREF |
update(long entityId,
long categoryId,
String key,
String value,
umun.iam.model.User requestedBy) |
String |
validate(String key,
EntityPref value) |
protected void |
validateCreateOrUpdate(ENTITY entity,
EntityPrefCategory category,
String key,
String value,
umun.iam.model.User requestedBy,
PREF pref) |
public EntityPrefCategory rootCategory
@Autowired protected EntityPrefCategoryService categoryService
@Autowired protected umun.core.service.SystemPrefService systemPrefService
protected abstract EntityPrefRepository<PREF,ID> getRepository()
protected abstract Map<String,EntityPrefCategoryInterface<ENTITY,PREF,ID,?>> getCategoryServicesMap()
protected abstract Map<String,EntityPrefValue<ENTITY,PREF>> getRootKeys()
protected abstract List<PREF> findByEntityAndCategoryOrderByKey(ENTITY entity, EntityPrefCategory rootCategory)
protected abstract PREF createMissingRootPref(ENTITY entity, EntityPrefCategory rootCategory, String key, EntityPrefValue<ENTITY,PREF> value, Map<String,String> options, String group)
protected abstract PREF createCategoryAsPref(ENTITY entity, EntityPrefCategory category) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected abstract ID createEntityPrefId(ENTITY entity, EntityPrefCategory category, String key)
protected abstract PREF createPref(ENTITY entity, EntityPrefCategory category, String key, String value, String remoteHideKey) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected abstract ENTITY findEntityOrFail(long entityId, umun.iam.model.User requestedBy) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected abstract String getEntityName()
protected abstract EntityCRUDService<ENTITY> getCrudService()
@EventListener public void startUp(org.springframework.context.event.ContextRefreshedEvent event)
public void addRootKeys(String rootKey, String defaultValue, String remoteHideKey, PrefDataType dataType, EntityPrefOptionsInterface optionsInterface, String displayName, EntityPrefValidationInterface<ENTITY,PREF> entityPrefValidationInterface, String group, boolean defaultRemoteHide, EntityPrefProp<ENTITY,PREF> properties)
public void addServiceReference(String categoryName, EntityPrefCategoryInterface<ENTITY,PREF,ID,?> instance)
public PREF createOrUpdate(ENTITY entity, EntityPrefCategory category, String key, String value, umun.iam.model.User requestedBy) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected PREF saveAndFlush(ENTITY entity, EntityPrefCategory category, PREF pref, String key, String value, umun.iam.model.User requestedBy, String oldValue)
protected void validateCreateOrUpdate(ENTITY entity, EntityPrefCategory category, String key, String value, umun.iam.model.User requestedBy, PREF pref) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected PREF doPostCreationOperations(ENTITY entity, EntityPrefCategory category, PREF pref, String key, String value, umun.iam.model.User requestedBy) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionpublic List<PREF> read(long entityId, umun.iam.model.User requestedBy) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionpublic List<PREF> read(umun.iam.model.User requestedBy, long categoryId, long entityId) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionpublic List<PREF> read(ENTITY entity, EntityPrefCategory category)
public Map<String,List<PREF>> readAllPrefs(umun.iam.model.User requestedBy, long entityId) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionpublic PREF readWithoutFail(ENTITY entity, EntityPrefCategory category, String key, String value) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionpublic PREF readOrFail(ENTITY entity, EntityPrefCategory category, String key) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionpublic List<TemplatePref> getCreationTemplate(Map<String,String> allRequestParams)
public String validate(String key, EntityPref value) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionpublic ENTITY findOne(long entityId, umun.iam.model.User requestedBy) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionpublic PREF update(long entityId, long categoryId, String key, String value, umun.iam.model.User requestedBy) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected String getRemoteHideKey(EntityPrefCategory category, String key) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected PrefDataType getDataType(EntityPrefCategory category, String key) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected Map<String,String> getOptions(EntityPrefCategory category, String key, ENTITY entity) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected String getGroup(EntityPrefCategory category, String key) throws umun.core.constants.ValidationException
umun.core.constants.ValidationExceptionprotected PREF doPostFoundOperations(PREF pref, EntityPrefValue<ENTITY,PREF> value, ENTITY entity)
Copyright © 2022 Pivotal Software, Inc.. All rights reserved.