Package org.cxbox.core.crudma.impl.inner
Class UniversalCrudmaService<D extends org.cxbox.api.data.dto.UniversalDTO,E>
- java.lang.Object
-
- org.cxbox.core.crudma.impl.AbstractCrudmaService
-
- org.cxbox.core.crudma.impl.inner.UniversalCrudmaService<D,E>
-
- All Implemented Interfaces:
Crudma
- Direct Known Subclasses:
TranslationCrudmaService
public abstract class UniversalCrudmaService<D extends org.cxbox.api.data.dto.UniversalDTO,E> extends AbstractCrudmaService
-
-
Field Summary
Fields Modifier and Type Field Description protected JpaDaojpaDaoprotected ResponseFactoryresponseFactory
-
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 DentityToDto(E entity, Class<? extends D> dtoClass, Set<String> attributes)protected Set<String>extractNames(List<javax.persistence.metamodel.Attribute<?,?>> attributes)Dget(BusinessComponent bc)Returns object based on a business componentActions<D>getActions()org.cxbox.api.data.ResultPage<D>getAll(BusinessComponent bc)Returns all matched objects based on a business componentprotected List<javax.persistence.metamodel.Attribute<?,?>>getAttributes(Class<? extends E> cls, Predicate<javax.persistence.metamodel.Attribute<?,?>> predicate)protected List<javax.persistence.metamodel.Attribute<?,?>>getAttributes(BusinessComponent bc)protected abstract Class<D>getDtoClass()protected abstract Collection<? extends E>getEntities(BusinessComponent bc)protected abstract EgetEntity(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 EngineFieldsMetagetMeta(BcIdentifier bc, RowMetaType type, D dataDto, boolean visibleOnly)MetaDTOgetMeta(BusinessComponent bc)Returns meta for entity based on a business componentMetaDTOgetMetaEmpty(BusinessComponent bc)Returns empty meta for entity based on a business componentMetaDTOgetMetaNew(BusinessComponent bc, CreateResult data)Returns new meta for entity based on a business componentprotected Map<String,Object>getValues(Object entity, Set<String> attributes)ActionResultDTOinvokeAction(BusinessComponent bc, String actionName, Map<String,Object> data)Invokes action with given name, add preactions, loads or updates entity if necessaryprotected booleanisCreateAvailable(BusinessComponent bc)protected booleanisDeleteAvailable(BusinessComponent bc)protected booleanisSaveAvailable(BusinessComponent bc)protected voidsetAttributes(E entity, D dto, List<javax.persistence.metamodel.Attribute<?,?>> attributes)protected voidsetValues(Object entity, org.cxbox.api.data.dto.UniversalDTO dto, Set<String> attributes)ActionResultDTOupdate(BusinessComponent bc, Map<String,Object> data)Updates an entity based on a business component by map-
Methods inherited from class org.cxbox.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:CrudmaUpdates an entity based on a business component by map- Specified by:
updatein interfaceCrudma- Overrides:
updatein classAbstractCrudmaService- Parameters:
bc- businessComponentdata- information about entity- Returns:
ActionResultDTOclass 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:CrudmaReturns meta for entity based on a business component- Specified by:
getMetain interfaceCrudma- Overrides:
getMetain classAbstractCrudmaService- Parameters:
bc- businessComponent- Returns:
MetaDTOclass 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:CrudmaReturns new meta for entity based on a business component- Specified by:
getMetaNewin interfaceCrudma- Overrides:
getMetaNewin classAbstractCrudmaService- Parameters:
bc- businessComponentdata- class with DataResponseDTO and postactions- Returns:
MetaDTOclass with meta DTO and postactions
-
getMetaEmpty
public MetaDTO getMetaEmpty(BusinessComponent bc)
Description copied from interface:CrudmaReturns empty meta for entity based on a business component- Specified by:
getMetaEmptyin interfaceCrudma- Overrides:
getMetaEmptyin classAbstractCrudmaService- Parameters:
bc- businessComponent- Returns:
MetaDTOclass with meta DTO and postactions
-
invokeAction
public ActionResultDTO invokeAction(BusinessComponent bc, String actionName, Map<String,Object> data)
Description copied from interface:CrudmaInvokes action with given name, add preactions, loads or updates entity if necessary- Specified by:
invokeActionin interfaceCrudma- Overrides:
invokeActionin classAbstractCrudmaService- Parameters:
bc- businessComponentactionName- name of actiondata- information about entity- Returns:
ActionResultDTOclass 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:CrudmaReturns object based on a business component- Specified by:
getin interfaceCrudma- Overrides:
getin classAbstractCrudmaService- Parameters:
bc- businessComponent- Returns:
DataResponseDTOinformation about entity, it's changed fields, errors
-
getEntity
protected abstract E getEntity(BusinessComponent bc)
-
getAll
public org.cxbox.api.data.ResultPage<D> getAll(BusinessComponent bc)
Description copied from interface:CrudmaReturns all matched objects based on a business component- Specified by:
getAllin interfaceCrudma- Overrides:
getAllin classAbstractCrudmaService- Parameters:
bc- businessComponent- Returns:
ResultPageclass 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, org.cxbox.api.data.dto.UniversalDTO dto, Set<String> attributes)
-
-