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 Details

    • jpaDao

      @Autowired protected JpaDao jpaDao
    • responseFactory

      @Autowired protected ResponseFactory responseFactory
  • Constructor Details

    • UniversalCrudmaService

      public UniversalCrudmaService()
  • Method Details

    • getDtoClass

      protected abstract Class<D> getDtoClass()
    • getEntityClass

      protected abstract Class<? extends E> getEntityClass(BusinessComponent bc)
    • entityToDto

      protected D entityToDto(E entity, Class<? extends D> dtoClass, Set<String> attributes)
    • 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 interface Crudma
      Overrides:
      update in class AbstractCrudmaService
      Parameters:
      bc - businessComponent
      data - information about entity
      Returns:
      ActionResultDTO class with DataResponseDTO and postactions
    • setAttributes

      protected void setAttributes(E entity, D dto, List<jakarta.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 interface Crudma
      Overrides:
      getMeta in class AbstractCrudmaService
      Parameters:
      bc - businessComponent
      Returns:
      MetaDTO class with meta DTO and postactions
    • getMeta

      protected EngineFieldsMeta getMeta(org.cxbox.api.data.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 interface Crudma
      Overrides:
      getMetaNew in class AbstractCrudmaService
      Parameters:
      bc - businessComponent
      data - 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 interface Crudma
      Overrides:
      getMetaEmpty in class AbstractCrudmaService
      Parameters:
      bc - businessComponent
      Returns:
      MetaDTO class with meta DTO and postactions
    • getActions

      public Actions<D> getActions()
    • 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 interface Crudma
      Overrides:
      invokeAction in class AbstractCrudmaService
      Parameters:
      bc - businessComponent
      actionName - name of action
      data - 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 interface Crudma
      Overrides:
      get in class AbstractCrudmaService
      Parameters:
      bc - businessComponent
      Returns:
      DataResponseDTO information 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: Crudma
      Returns all matched objects based on a business component
      Specified by:
      getAll in interface Crudma
      Overrides:
      getAll in class AbstractCrudmaService
      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<jakarta.persistence.metamodel.Attribute<?,?>> attributes)
    • getAttributes

      protected List<jakarta.persistence.metamodel.Attribute<?,?>> getAttributes(BusinessComponent bc)
    • getEntityAttributes

      protected List<jakarta.persistence.metamodel.Attribute<?,?>> getEntityAttributes(Class<? extends E> cls)
    • getIgnoredAttributes

      protected Set<String> getIgnoredAttributes()
    • getAttributes

      protected List<jakarta.persistence.metamodel.Attribute<?,?>> getAttributes(Class<? extends E> cls, Predicate<jakarta.persistence.metamodel.Attribute<?,?>> predicate)
    • getValues

      protected Map<String,Object> getValues(Object entity, Set<String> attributes)
    • setValues

      protected void setValues(Object entity, org.cxbox.api.data.dto.UniversalDTO dto, Set<String> attributes)
    • extractNames

      protected Set<String> extractNames(List<jakarta.persistence.metamodel.Attribute<?,?>> attributes)