Package io.tesler.core.crudma.impl.inner
Class UniversalCrudmaService<D extends UniversalDTO,E>
- java.lang.Object
-
- io.tesler.core.crudma.impl.AbstractCrudmaService
-
- io.tesler.core.crudma.impl.inner.UniversalCrudmaService<D,E>
-
- All Implemented Interfaces:
Crudma
- Direct Known Subclasses:
TranslationCrudmaService
public abstract class UniversalCrudmaService<D extends UniversalDTO,E> extends AbstractCrudmaService
-
-
Field Summary
Fields Modifier and Type Field Description protected JpaDao
jpaDao
protected ResponseFactory
responseFactory
-
Constructor Summary
Constructors Constructor Description UniversalCrudmaService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Class<? extends D>
createDTOClass(List<javax.persistence.metamodel.Attribute<?,?>> attributes)
protected D
entityToDto(E entity, Class<? extends D> dtoClass, Set<String> attributes)
protected Set<String>
extractNames(List<javax.persistence.metamodel.Attribute<?,?>> attributes)
D
get(BusinessComponent bc)
Returns object based on a business componentActions<D>
getActions()
ResultPage<D>
getAll(BusinessComponent bc)
Returns all matched objects based on a business componentprotected List<javax.persistence.metamodel.Attribute<?,?>>
getAttributes(BusinessComponent bc)
protected List<javax.persistence.metamodel.Attribute<?,?>>
getAttributes(Class<? extends E> cls, Predicate<javax.persistence.metamodel.Attribute<?,?>> predicate)
protected abstract Class<D>
getDtoClass()
protected abstract Collection<? extends E>
getEntities(BusinessComponent bc)
protected abstract E
getEntity(BusinessComponent bc)
protected List<javax.persistence.metamodel.Attribute<?,?>>
getEntityAttributes(Class<? extends E> cls)
protected abstract Class<? extends E>
getEntityClass(BusinessComponent bc)
protected Set<String>
getIgnoredAttributes()
protected EngineFieldsMeta
getMeta(BcIdentifier bc, RowMetaType type, D dataDto, boolean visibleOnly)
MetaDTO
getMeta(BusinessComponent bc)
Returns meta for entity based on a business componentMetaDTO
getMetaEmpty(BusinessComponent bc)
Returns empty meta for entity based on a business componentMetaDTO
getMetaNew(BusinessComponent bc, CreateResult data)
Returns new meta for entity based on a business componentprotected Map<String,Object>
getValues(Object entity, Set<String> attributes)
ActionResultDTO
invokeAction(BusinessComponent bc, String actionName, Map<String,Object> data)
Invokes action with given name, add preactions, loads or updates entity if necessaryprotected boolean
isCreateAvailable(BusinessComponent bc)
protected boolean
isDeleteAvailable(BusinessComponent bc)
protected boolean
isSaveAvailable(BusinessComponent bc)
protected void
setAttributes(E entity, D dto, List<javax.persistence.metamodel.Attribute<?,?>> attributes)
protected void
setValues(Object entity, UniversalDTO dto, Set<String> attributes)
ActionResultDTO
update(BusinessComponent bc, Map<String,Object> data)
Updates an entity based on a business component by map-
Methods inherited from class io.tesler.core.crudma.impl.AbstractCrudmaService
associate, buildMeta, buildMeta, count, create, delete, getOnFieldUpdateMeta, preview
-
-
-
-
Field Detail
-
jpaDao
@Autowired protected JpaDao jpaDao
-
responseFactory
@Autowired protected ResponseFactory responseFactory
-
-
Method Detail
-
getEntityClass
protected abstract Class<? extends E> getEntityClass(BusinessComponent bc)
-
update
public ActionResultDTO update(BusinessComponent bc, Map<String,Object> data)
Description copied from interface:Crudma
Updates an entity based on a business component by map- Specified by:
update
in interfaceCrudma
- Overrides:
update
in classAbstractCrudmaService
- Parameters:
bc
- businessComponentdata
- information about entity- Returns:
ActionResultDTO
class with DataResponseDTO and postactions
-
setAttributes
protected void setAttributes(E entity, D dto, List<javax.persistence.metamodel.Attribute<?,?>> attributes)
-
getMeta
public MetaDTO getMeta(BusinessComponent bc)
Description copied from interface:Crudma
Returns meta for entity based on a business component- Specified by:
getMeta
in interfaceCrudma
- Overrides:
getMeta
in classAbstractCrudmaService
- Parameters:
bc
- businessComponent- Returns:
MetaDTO
class with meta DTO and postactions
-
getMeta
protected EngineFieldsMeta getMeta(BcIdentifier bc, RowMetaType type, D dataDto, boolean visibleOnly)
-
getMetaNew
public MetaDTO getMetaNew(BusinessComponent bc, CreateResult data)
Description copied from interface:Crudma
Returns new meta for entity based on a business component- Specified by:
getMetaNew
in interfaceCrudma
- Overrides:
getMetaNew
in classAbstractCrudmaService
- Parameters:
bc
- businessComponentdata
- class with DataResponseDTO and postactions- Returns:
MetaDTO
class with meta DTO and postactions
-
getMetaEmpty
public MetaDTO getMetaEmpty(BusinessComponent bc)
Description copied from interface:Crudma
Returns empty meta for entity based on a business component- Specified by:
getMetaEmpty
in interfaceCrudma
- Overrides:
getMetaEmpty
in classAbstractCrudmaService
- Parameters:
bc
- businessComponent- Returns:
MetaDTO
class with meta DTO and postactions
-
invokeAction
public ActionResultDTO invokeAction(BusinessComponent bc, String actionName, Map<String,Object> data)
Description copied from interface:Crudma
Invokes action with given name, add preactions, loads or updates entity if necessary- Specified by:
invokeAction
in interfaceCrudma
- Overrides:
invokeAction
in classAbstractCrudmaService
- Parameters:
bc
- businessComponentactionName
- name of actiondata
- information about entity- Returns:
ActionResultDTO
class with DataResponseDTO and postactions
-
isSaveAvailable
protected boolean isSaveAvailable(BusinessComponent bc)
-
isCreateAvailable
protected boolean isCreateAvailable(BusinessComponent bc)
-
isDeleteAvailable
protected boolean isDeleteAvailable(BusinessComponent bc)
-
get
public D get(BusinessComponent bc)
Description copied from interface:Crudma
Returns object based on a business component- Specified by:
get
in interfaceCrudma
- Overrides:
get
in classAbstractCrudmaService
- Parameters:
bc
- businessComponent- Returns:
DataResponseDTO
information about entity, it's changed fields, errors
-
getEntity
protected abstract E getEntity(BusinessComponent bc)
-
getAll
public ResultPage<D> getAll(BusinessComponent bc)
Description copied from interface:Crudma
Returns all matched objects based on a business component- Specified by:
getAll
in interfaceCrudma
- Overrides:
getAll
in classAbstractCrudmaService
- Parameters:
bc
- businessComponent- Returns:
ResultPage
class with list of objects
-
getEntities
protected abstract Collection<? extends E> getEntities(BusinessComponent bc)
-
createDTOClass
protected Class<? extends D> createDTOClass(List<javax.persistence.metamodel.Attribute<?,?>> attributes)
-
getAttributes
protected List<javax.persistence.metamodel.Attribute<?,?>> getAttributes(BusinessComponent bc)
-
getEntityAttributes
protected List<javax.persistence.metamodel.Attribute<?,?>> getEntityAttributes(Class<? extends E> cls)
-
getAttributes
protected List<javax.persistence.metamodel.Attribute<?,?>> getAttributes(Class<? extends E> cls, Predicate<javax.persistence.metamodel.Attribute<?,?>> predicate)
-
setValues
protected void setValues(Object entity, UniversalDTO dto, Set<String> attributes)
-
-