Interface AdminEntityService
- All Known Implementing Classes:
AdminEntityServiceImpl
public interface AdminEntityService
- Author:
- Andre Azzolini (apazzolini)
-
Method Summary
Modifier and TypeMethodDescriptionadd
(PersistencePackageRequest request) Thin layer on top ofDynamicEntityService.add(org.broadleafcommerce.openadmin.dto.PersistencePackage)
that swallows allValidationException
s that could be thrown and still just returns aPersistenceResponse
with theEntity
that failed validation.add
(PersistencePackageRequest request, boolean transactional) Works the same asadd(PersistencePackageRequest)
but you can optionally invoke the transactional version ofDynamicEntityRemoteService.add(org.broadleafcommerce.openadmin.dto.PersistencePackage)
in situations where you want to manage the transactions in a parent componentaddEntity
(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) Persists the given entityaddSubCollectionEntity
(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, List<SectionCrumb> sectionCrumb) Adds an item into the specified collectionvoid
fetch
(PersistencePackageRequest request) getAdvancedCollectionRecord
(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId, List<SectionCrumb> sectionCrumbs, String alternateId) Gets an Entity representing a specific collection itemgetAdvancedCollectionRecord
(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId, List<SectionCrumb> sectionCrumbs, String alternateId, String[] customCriteria) Gets an Entity representing a specific collection itemgetAllRecordsForAllSubCollections
(ClassMetadata cmd, Entity containingEntity, List<SectionCrumb> sectionCrumb) overloading containing paging parametersReturns class metadata for the given request objectgetContextSpecificRelationshipId
(ClassMetadata cmd, Entity entity, String propertyName) Returns the appropriate id to use for the given entity/metadata and prefix when dealing with collections.getForeignEntityName
(String owningClass, String id) For the given class (which could be an interface) and id, finds theAdminMainEntity
value for the foreign entityReturns the name of the property in this ClassMetadata that has field type set toSupportedFieldType.ID
getPagedRecordsForCollection
(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, FetchPageRequest fetchPageRequest, String idValueOverride, List<SectionCrumb> sectionCrumbs) 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()
.getRecord
(PersistencePackageRequest request, String id, ClassMetadata cmd, boolean isCollectionRequest) Returns a specific record for the given request and primary key id/propertygetRecords
(PersistencePackageRequest request) Returns the DynamicResultSet containing the total records for the query and the currently fetched Entity[]getRecordsForAllSubCollections
(PersistencePackageRequest ppr, Entity containingEntity, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb) overloading containing paging parametersgetRecordsForAllSubCollections
(PersistencePackageRequest ppr, Entity containingEntity, List<SectionCrumb> sectionCrum) Returns all records for all subcollections of the specified request and its primary keygetRecordsForCollection
(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex, String idValueOverride, List<SectionCrumb> sectionCrumb) 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()
getRecordsForCollection
(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb) Returns the DynamicResultSet representing the records that belong to the specified collectionProperty for the given containingClass and the primary key for the containingClassgetRecordsForSelectedTab
(ClassMetadata cmd, Entity containingEntity, List<SectionCrumb> sectionCrumb, String currentTabName) Returns all records for selected tab of the specified request and its primary keygetRequestForEntityForm
(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumbs) Gets the PersistencePackageRequest for the passed in EntityForminspect
(PersistencePackageRequest request) Thin layer on top ofDynamicEntityService.inspect(org.broadleafcommerce.openadmin.dto.PersistencePackage)
void
populateParentRecordStructure
(PersistencePackage persistencePackage, Entity entity, ClassMetadata parentMetadata) Store parent record value, parent metadata to thePersistencePackage
remove
(PersistencePackageRequest request) Thin layer on top ofDynamicEntityService.remove(org.broadleafcommerce.openadmin.dto.PersistencePackage)
remove
(PersistencePackageRequest request, boolean transactional) Works the same asremove(PersistencePackageRequest)
but you can optionally invoke the transactional version ofDynamicEntityRemoteService.remove(org.broadleafcommerce.openadmin.dto.PersistencePackage)
in situations where you want to manage the transactions in a parent componentremoveEntity
(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) Removes the given entityremoveSubCollectionEntity
(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String alternateId, String priorKey, List<SectionCrumb> sectionCrumb) Removes the given item from the specified collection.removeSubCollectionEntity
(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String priorKey, List<SectionCrumb> sectionCrumb) Removes the given item from the specified collection.update
(PersistencePackageRequest request) Thin layer on top ofDynamicEntityService.update(org.broadleafcommerce.openadmin.dto.PersistencePackage)
update
(PersistencePackageRequest request, boolean transactional) Works the same asupdate(PersistencePackageRequest)
but you can optionally invoke the transactional version ofDynamicEntityRemoteService.update(org.broadleafcommerce.openadmin.dto.PersistencePackage)
in situations where you want to manage the transactions in a parent componentupdateEntity
(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) Updates the given entityupdateSubCollectionEntity
(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId, String alternateId, List<SectionCrumb> sectionCrumb) Updates the specified collection itemupdateSubCollectionEntity
(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId, List<SectionCrumb> sectionCrumb) Updates the specified collection item
-
Method Details
-
getClassMetadata
Returns class metadata for the given request object- Parameters:
request
-- Returns:
- ClassMetadata for the given request
- Throws:
ServiceException
-
getRecords
Returns the DynamicResultSet containing the total records for the query and the currently fetched Entity[]- Parameters:
request
-- Returns:
- DynamicResultSet
- Throws:
ServiceException
-
getRecord
PersistenceResponse getRecord(PersistencePackageRequest request, String id, ClassMetadata cmd, boolean isCollectionRequest) throws 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:
ServiceException
-
addEntity
PersistenceResponse addEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws ServiceException Persists the given entity- Parameters:
entityForm
-customCriteria
-- Returns:
- the persisted Entity
- Throws:
ServiceException
-
updateEntity
PersistenceResponse updateEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws ServiceException Updates the given entity- Parameters:
entityForm
-customCriteria
-- Returns:
- the persisted Entity
- Throws:
ServiceException
-
removeEntity
PersistenceResponse removeEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws ServiceException Removes the given entity- Parameters:
entityForm
-customCriteria
-- Throws:
ServiceException
-
getRequestForEntityForm
PersistencePackageRequest getRequestForEntityForm(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumbs) Gets the PersistencePackageRequest for the passed in EntityForm- Parameters:
entityForm
-customCriteria
-sectionCrumbs
-
-
add
Thin layer on top ofDynamicEntityService.add(org.broadleafcommerce.openadmin.dto.PersistencePackage)
that swallows allValidationException
s that could be thrown and still just returns aPersistenceResponse
with theEntity
that failed validation.- Parameters:
request
-- Returns:
- Throws:
ServiceException
- if there were exceptions other than aValidationException
that was thrown as a result of the attempted add
-
add
PersistenceResponse add(PersistencePackageRequest request, boolean transactional) throws ServiceException Works the same asadd(PersistencePackageRequest)
but you can optionally invoke the transactional version ofDynamicEntityRemoteService.add(org.broadleafcommerce.openadmin.dto.PersistencePackage)
in situations where you want to manage the transactions in a parent component- Parameters:
request
-transactional
-- Returns:
- Throws:
ServiceException
-
update
Thin layer on top ofDynamicEntityService.update(org.broadleafcommerce.openadmin.dto.PersistencePackage)
- Parameters:
request
-- Returns:
- Throws:
ServiceException
- if there were exceptions other than aValidationException
that was thrown as a result of the attempted update
-
update
PersistenceResponse update(PersistencePackageRequest request, boolean transactional) throws ServiceException Works the same asupdate(PersistencePackageRequest)
but you can optionally invoke the transactional version ofDynamicEntityRemoteService.update(org.broadleafcommerce.openadmin.dto.PersistencePackage)
in situations where you want to manage the transactions in a parent component- Parameters:
request
-transactional
-- Returns:
- Throws:
ServiceException
-
inspect
Thin layer on top ofDynamicEntityService.inspect(org.broadleafcommerce.openadmin.dto.PersistencePackage)
- Parameters:
request
-- Returns:
- Throws:
ServiceException
-
remove
Thin layer on top ofDynamicEntityService.remove(org.broadleafcommerce.openadmin.dto.PersistencePackage)
- Parameters:
request
-- Returns:
- Throws:
ServiceException
-
remove
PersistenceResponse remove(PersistencePackageRequest request, boolean transactional) throws ServiceException Works the same asremove(PersistencePackageRequest)
but you can optionally invoke the transactional version ofDynamicEntityRemoteService.remove(org.broadleafcommerce.openadmin.dto.PersistencePackage)
in situations where you want to manage the transactions in a parent component- Parameters:
request
-transactional
-- Returns:
- Throws:
ServiceException
-
fetch
Thin layer on top ofDynamicEntityService.fetch(org.broadleafcommerce.openadmin.dto.PersistencePackage, org.broadleafcommerce.openadmin.dto.CriteriaTransferObject)
. This will glean and create aCriteriaTransferObject
fromPersistencePackageRequest.getFilterAndSortCriteria()
to pass toDynamicEntityService
.- Parameters:
request
-- Returns:
- Throws:
ServiceException
-
getAdvancedCollectionRecord
PersistenceResponse getAdvancedCollectionRecord(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId, List<SectionCrumb> sectionCrumbs, String alternateId) throws ServiceException Gets an Entity representing a specific collection item- Parameters:
containingClassMetadata
-containingEntity
-collectionProperty
-collectionItemId
-- Returns:
- the Entity
- Throws:
ServiceException
-
getAdvancedCollectionRecord
PersistenceResponse getAdvancedCollectionRecord(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId, List<SectionCrumb> sectionCrumbs, String alternateId, String[] customCriteria) throws ServiceException Gets an Entity representing a specific collection item- Parameters:
containingClassMetadata
-containingEntity
-collectionProperty
-collectionItemId
-customCriteria
-- Returns:
- the Entity
- Throws:
ServiceException
-
getRecordsForCollection
PersistenceResponse getRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb) throws 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:
ServiceException
-
getRecordsForCollection
PersistenceResponse getRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex, String idValueOverride, List<SectionCrumb> sectionCrumb) throws 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:
ServiceException
-
getPagedRecordsForCollection
PersistenceResponse getPagedRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, FetchPageRequest fetchPageRequest, String idValueOverride, List<SectionCrumb> sectionCrumbs) throws 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 aFetchPageRequest
to encapsulate result set paging configuration, which is needed forFetchType.LARGERESULTSET
cases, if applicable.- Parameters:
containingClassMetadata
-containingEntity
-collectionProperty
-fascs
-fetchPageRequest
-idValueOverride
-sectionCrumbs
-- Returns:
- Throws:
ServiceException
-
getRecordsForAllSubCollections
Map<String,DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, List<SectionCrumb> sectionCrum) throws 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:
ServiceException
- See Also:
-
#getRecordsForCollection(ClassMetadata, String, Property)
-
getRecordsForAllSubCollections
Map<String,DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb) throws ServiceException overloading containing paging parameters- Parameters:
ppr
-containingEntity
-startIndex
-maxIndex
-sectionCrumb
-- Returns:
- Throws:
ServiceException
-
getAllRecordsForAllSubCollections
Map<String,DynamicResultSet> getAllRecordsForAllSubCollections(ClassMetadata cmd, Entity containingEntity, List<SectionCrumb> sectionCrumb) throws ServiceException overloading containing paging parameters- Parameters:
cmd
-containingEntity
-sectionCrumb
-- Returns:
- Throws:
ServiceException
-
addSubCollectionEntity
PersistenceResponse addSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, List<SectionCrumb> sectionCrumb) throws ServiceException, ClassNotFoundException Adds an item into the specified collection- Parameters:
entityForm
-mainMetadata
-field
-parentEntity
-- Returns:
- the persisted Entity
- Throws:
ServiceException
ClassNotFoundException
-
updateSubCollectionEntity
PersistenceResponse updateSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId, List<SectionCrumb> sectionCrumb) throws ServiceException, ClassNotFoundException Updates the specified collection item- Parameters:
entityForm
-mainMetadata
-field
-parentEntity
-collectionItemId
-- Returns:
- the persisted Entity
- Throws:
ServiceException
ClassNotFoundException
-
updateSubCollectionEntity
PersistenceResponse updateSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId, String alternateId, List<SectionCrumb> sectionCrumb) throws ServiceException, ClassNotFoundException Updates the specified collection item- Parameters:
entityForm
-mainMetadata
-field
-parentEntity
-collectionItemId
-alternateId
-- Returns:
- the persisted Entity
- Throws:
ServiceException
ClassNotFoundException
-
removeSubCollectionEntity
PersistenceResponse removeSubCollectionEntity(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String priorKey, List<SectionCrumb> sectionCrumb) throws ServiceException Removes the given item from the specified collection.- Parameters:
mainMetadata
-field
-parentEntity
-itemId
-priorKey
- - only needed for Map type collections- Throws:
ServiceException
-
removeSubCollectionEntity
PersistenceResponse removeSubCollectionEntity(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String alternateId, String priorKey, List<SectionCrumb> sectionCrumb) throws ServiceException Removes the given item from the specified collection.- Parameters:
mainMetadata
-field
-parentEntity
-itemId
-alternateId
-priorKey
- - only needed for Map type collections- Throws:
ServiceException
-
getContextSpecificRelationshipId
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
Returns the name of the property in this ClassMetadata that has field type set toSupportedFieldType.ID
- Parameters:
cmd
-- Returns:
- the id property name
- Throws:
ServiceException
-
getForeignEntityName
For the given class (which could be an interface) and id, finds theAdminMainEntity
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 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:
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 thePersistencePackage
- Parameters:
persistencePackage
-entity
-parentMetadata
-
-