Interface AdminEntityService

All Known Implementing Classes:
AdminEntityServiceImpl

public interface AdminEntityService
Author:
Andre Azzolini (apazzolini)
  • Method Details

    • getClassMetadata

      PersistenceResponse getClassMetadata(PersistencePackageRequest request) throws org.broadleafcommerce.common.exception.ServiceException
      Returns class metadata for the given request object
      Parameters:
      request -
      Returns:
      ClassMetadata for the given request
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getRecords

      PersistenceResponse getRecords(PersistencePackageRequest request) throws org.broadleafcommerce.common.exception.ServiceException
      Returns the DynamicResultSet containing the total records for the query and the currently fetched Entity[]
      Parameters:
      request -
      Returns:
      DynamicResultSet
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getRecord

      PersistenceResponse getRecord(PersistencePackageRequest request, String id, ClassMetadata cmd, boolean isCollectionRequest) throws org.broadleafcommerce.common.exception.ServiceException
      Returns a specific record for the given request and primary key id/property
      Parameters:
      request -
      id -
      cmd -
      isCollectionRequest - whether or not this record request was initiated from a collection on a parent entity
      Returns:
      the Entity
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • addEntity

      PersistenceResponse addEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      Persists the given entity
      Parameters:
      entityForm -
      customCriteria -
      Returns:
      the persisted Entity
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • updateEntity

      PersistenceResponse updateEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      Updates the given entity
      Parameters:
      entityForm -
      customCriteria -
      Returns:
      the persisted Entity
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • removeEntity

      PersistenceResponse removeEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      Removes the given entity
      Parameters:
      entityForm -
      customCriteria -
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getRequestForEntityForm

      PersistencePackageRequest getRequestForEntityForm(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumbs)
      Gets the PersistencePackageRequest for the passed in EntityForm
      Parameters:
      entityForm -
      customCriteria -
      sectionCrumbs -
    • add

      PersistenceResponse add(PersistencePackageRequest request) throws org.broadleafcommerce.common.exception.ServiceException
      Thin layer on top of DynamicEntityService.add(org.broadleafcommerce.openadmin.dto.PersistencePackage) that swallows all ValidationExceptions that could be thrown and still just returns a PersistenceResponse with the Entity that failed validation.
      Parameters:
      request -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException - if there were exceptions other than a ValidationException that was thrown as a result of the attempted add
    • add

      PersistenceResponse add(PersistencePackageRequest request, boolean transactional) throws org.broadleafcommerce.common.exception.ServiceException
      Works the same as add(PersistencePackageRequest) but you can optionally invoke the transactional version of DynamicEntityRemoteService.add(org.broadleafcommerce.openadmin.dto.PersistencePackage) in situations where you want to manage the transactions in a parent component
      Parameters:
      request -
      transactional -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • update

      PersistenceResponse update(PersistencePackageRequest request) throws org.broadleafcommerce.common.exception.ServiceException
      Parameters:
      request -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException - if there were exceptions other than a ValidationException that was thrown as a result of the attempted update
    • update

      PersistenceResponse update(PersistencePackageRequest request, boolean transactional) throws org.broadleafcommerce.common.exception.ServiceException
      Works the same as update(PersistencePackageRequest) but you can optionally invoke the transactional version of DynamicEntityRemoteService.update(org.broadleafcommerce.openadmin.dto.PersistencePackage) in situations where you want to manage the transactions in a parent component
      Parameters:
      request -
      transactional -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • inspect

      PersistenceResponse inspect(PersistencePackageRequest request) throws org.broadleafcommerce.common.exception.ServiceException
      Parameters:
      request -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • remove

      PersistenceResponse remove(PersistencePackageRequest request) throws org.broadleafcommerce.common.exception.ServiceException
      Parameters:
      request -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • remove

      PersistenceResponse remove(PersistencePackageRequest request, boolean transactional) throws org.broadleafcommerce.common.exception.ServiceException
      Works the same as remove(PersistencePackageRequest) but you can optionally invoke the transactional version of DynamicEntityRemoteService.remove(org.broadleafcommerce.openadmin.dto.PersistencePackage) in situations where you want to manage the transactions in a parent component
      Parameters:
      request -
      transactional -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • fetch

      PersistenceResponse fetch(PersistencePackageRequest request) throws org.broadleafcommerce.common.exception.ServiceException
      Parameters:
      request -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getAdvancedCollectionRecord

      PersistenceResponse getAdvancedCollectionRecord(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId, List<SectionCrumb> sectionCrumbs, String alternateId) throws org.broadleafcommerce.common.exception.ServiceException
      Gets an Entity representing a specific collection item
      Parameters:
      containingClassMetadata -
      containingEntity -
      collectionProperty -
      collectionItemId -
      Returns:
      the Entity
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getAdvancedCollectionRecord

      PersistenceResponse getAdvancedCollectionRecord(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId, List<SectionCrumb> sectionCrumbs, String alternateId, String[] customCriteria) throws org.broadleafcommerce.common.exception.ServiceException
      Gets an Entity representing a specific collection item
      Parameters:
      containingClassMetadata -
      containingEntity -
      collectionProperty -
      collectionItemId -
      customCriteria -
      Returns:
      the Entity
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getRecordsForCollection

      PersistenceResponse getRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      Returns the DynamicResultSet representing the records that belong to the specified collectionProperty for the given containingClass and the primary key for the containingClass
      Parameters:
      containingClassMetadata -
      containingEntity -
      collectionProperty -
      fascs -
      startIndex -
      maxIndex -
      Returns:
      the DynamicResultSet
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getRecordsForCollection

      PersistenceResponse getRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex, String idValueOverride, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      The same as the other getRecordsForCollection method, except that this one expects allow the caller to explicitly set the id value that will be used in the fetch instead of delegating to #getContextSpecificRelationshipId()
      Parameters:
      containingClassMetadata -
      containingEntity -
      collectionProperty -
      fascs -
      startIndex -
      maxIndex -
      idValueOverride -
      Returns:
      the PersistenceResponse
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getPagedRecordsForCollection

      PersistenceResponse getPagedRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, FetchPageRequest fetchPageRequest, String idValueOverride, List<SectionCrumb> sectionCrumbs) throws org.broadleafcommerce.common.exception.ServiceException
      The same as the other getRecordsForCollection method, except that this one expects allow the caller to explicitly set the id value that will be used in the fetch instead of delegating to #getContextSpecificRelationshipId(). Also utilizes a FetchPageRequest to encapsulate result set paging configuration, which is needed for FetchType.LARGERESULTSET cases, if applicable.
      Parameters:
      containingClassMetadata -
      containingEntity -
      collectionProperty -
      fascs -
      fetchPageRequest -
      idValueOverride -
      sectionCrumbs -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getRecordsForAllSubCollections

      Map<String,DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, List<SectionCrumb> sectionCrum) throws org.broadleafcommerce.common.exception.ServiceException
      Returns all records for all subcollections of the specified request and its primary key
      Parameters:
      ppr -
      containingEntity -
      Returns:
      all Entity[] for all collections for the specified containingClass
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
      See Also:
      • #getRecordsForCollection(ClassMetadata, String, Property)
    • getRecordsForAllSubCollections

      Map<String,DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      overloading containing paging parameters
      Parameters:
      ppr -
      containingEntity -
      startIndex -
      maxIndex -
      sectionCrumb -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getAllRecordsForAllSubCollections

      Map<String,DynamicResultSet> getAllRecordsForAllSubCollections(ClassMetadata cmd, Entity containingEntity, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      overloading containing paging parameters
      Parameters:
      cmd -
      containingEntity -
      sectionCrumb -
      Returns:
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • addSubCollectionEntity

      PersistenceResponse addSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException, ClassNotFoundException
      Adds an item into the specified collection
      Parameters:
      entityForm -
      mainMetadata -
      field -
      parentEntity -
      Returns:
      the persisted Entity
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
      ClassNotFoundException
    • updateSubCollectionEntity

      PersistenceResponse updateSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException, ClassNotFoundException
      Updates the specified collection item
      Parameters:
      entityForm -
      mainMetadata -
      field -
      parentEntity -
      collectionItemId -
      Returns:
      the persisted Entity
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
      ClassNotFoundException
    • updateSubCollectionEntity

      PersistenceResponse updateSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId, String alternateId, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException, ClassNotFoundException
      Updates the specified collection item
      Parameters:
      entityForm -
      mainMetadata -
      field -
      parentEntity -
      collectionItemId -
      alternateId -
      Returns:
      the persisted Entity
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
      ClassNotFoundException
    • removeSubCollectionEntity

      PersistenceResponse removeSubCollectionEntity(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String priorKey, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      Removes the given item from the specified collection.
      Parameters:
      mainMetadata -
      field -
      parentEntity -
      itemId -
      priorKey - - only needed for Map type collections
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • removeSubCollectionEntity

      PersistenceResponse removeSubCollectionEntity(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String alternateId, String priorKey, List<SectionCrumb> sectionCrumb) throws org.broadleafcommerce.common.exception.ServiceException
      Removes the given item from the specified collection.
      Parameters:
      mainMetadata -
      field -
      parentEntity -
      itemId -
      alternateId -
      priorKey - - only needed for Map type collections
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getContextSpecificRelationshipId

      String getContextSpecificRelationshipId(ClassMetadata cmd, Entity entity, String propertyName)
      Returns the appropriate id to use for the given entity/metadata and prefix when dealing with collections. For example, on the Product screen, we display associated media. However, this media is actually owned by the Sku entity, which means its property name is "defaultSku.skuMedia". In this case, when wanting to look up media for this product, we cannot use the id of the product. Instead, we need to use the id of the sku.
      Parameters:
      cmd -
      entity -
      propertyName -
      Returns:
      the id to be used for this relationship
    • getIdProperty

      String getIdProperty(ClassMetadata cmd) throws org.broadleafcommerce.common.exception.ServiceException
      Returns the name of the property in this ClassMetadata that has field type set to SupportedFieldType.ID
      Parameters:
      cmd -
      Returns:
      the id property name
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • getForeignEntityName

      String getForeignEntityName(String owningClass, String id)
      For the given class (which could be an interface) and id, finds the AdminMainEntity value for the foreign entity
      Parameters:
      owningClass -
      id -
      Returns:
      the friendly name for the given foreign entity
    • getRecordsForSelectedTab

      Map<String,DynamicResultSet> getRecordsForSelectedTab(ClassMetadata cmd, Entity containingEntity, List<SectionCrumb> sectionCrumb, String currentTabName) throws org.broadleafcommerce.common.exception.ServiceException
      Returns all records for selected tab of the specified request and its primary key
      Parameters:
      cmd -
      containingEntity -
      Returns:
      all Entity[] for selected tab for the specified containingClass
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
      See Also:
      • #getRecordsForCollection(ClassMetadata, String, Property)
    • clearEntityManager

      void clearEntityManager()
    • populateParentRecordStructure

      void populateParentRecordStructure(PersistencePackage persistencePackage, Entity entity, ClassMetadata parentMetadata)
      Store parent record value, parent metadata to the PersistencePackage
      Parameters:
      persistencePackage -
      entity -
      parentMetadata -