@Service(value="blAdminEntityService") public class AdminEntityServiceImpl extends Object implements AdminEntityService
Modifier and Type | Field and Description |
---|---|
protected DynamicDaoHelper |
dynamicDaoHelper |
protected javax.persistence.EntityManager |
em |
protected EntityConfiguration |
entityConfiguration |
protected static org.apache.commons.logging.Log |
LOG |
protected PersistencePackageFactory |
persistencePackageFactory |
protected DynamicEntityService |
service |
Constructor and Description |
---|
AdminEntityServiceImpl() |
Modifier and Type | Method and Description |
---|---|
PersistenceResponse |
add(PersistencePackageRequest request)
Thin layer on top of
DynamicEntityService.add(org.broadleafcommerce.openadmin.dto.PersistencePackage) that
swallows all ValidationException s that could be thrown and still just returns a PersistenceResponse
with the Entity that failed validation. |
PersistenceResponse |
add(PersistencePackageRequest request,
boolean transactional)
Works the same as
AdminEntityService.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 |
PersistenceResponse |
addEntity(EntityForm entityForm,
String[] customCriteria,
List<SectionCrumb> sectionCrumb)
Persists the given entity
|
PersistenceResponse |
addSubCollectionEntity(EntityForm entityForm,
ClassMetadata mainMetadata,
Property field,
Entity parentEntity,
List<SectionCrumb> sectionCrumbs)
Adds an item into the specified collection
|
void |
clearEntityManager() |
protected void |
ensureEntityMarkedAsValidationFailure(ValidationException e,
PersistencePackageRequest originalRequest)
Should be invoked when a
ValidationException is thrown to verify that the Entity contained within the
given originalRequest has a validationFailure = true |
PersistenceResponse |
fetch(PersistencePackageRequest request)
|
PersistenceResponse |
getAdvancedCollectionRecord(ClassMetadata containingClassMetadata,
Entity containingEntity,
Property collectionProperty,
String collectionItemId,
List<SectionCrumb> sectionCrumbs,
String alternateId)
Gets an Entity representing a specific collection item
|
PersistenceResponse |
getAdvancedCollectionRecord(ClassMetadata containingClassMetadata,
Entity containingEntity,
Property collectionProperty,
String collectionItemId,
List<SectionCrumb> sectionCrumbs,
String alternateId,
String[] customCriteria)
Gets an Entity representing a specific collection item
|
Map<String,DynamicResultSet> |
getAllRecordsForAllSubCollections(ClassMetadata cmd,
Entity containingEntity,
List<SectionCrumb> sectionCrumb)
overloading containing paging parameters
|
PersistenceResponse |
getClassMetadata(PersistencePackageRequest request)
Returns class metadata for the given request object
|
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.
|
protected CriteriaTransferObject |
getDefaultCto() |
protected int |
getDefaultMaxResults() |
protected DynamicEntityDao |
getDynamicEntityDao(String owningClass) |
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 |
String |
getIdProperty(ClassMetadata cmd)
Returns the name of the property in this ClassMetadata that has field type set to
SupportedFieldType.ID |
PersistenceResponse |
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() . |
protected List<Property> |
getPropertiesFromEntityForm(EntityForm entityForm) |
PersistenceResponse |
getRecord(PersistencePackageRequest request,
String id,
ClassMetadata cmd,
boolean isCollectionRequest)
Returns a specific record for the given request and primary key id/property
|
PersistenceResponse |
getRecords(PersistencePackageRequest request)
Returns the DynamicResultSet containing the total records for the query and the currently fetched Entity[]
|
Map<String,DynamicResultSet> |
getRecordsForAllSubCollections(PersistencePackageRequest ppr,
Entity containingEntity,
Integer startIndex,
Integer maxIndex,
List<SectionCrumb> sectionCrumb)
overloading containing paging parameters
|
Map<String,DynamicResultSet> |
getRecordsForAllSubCollections(PersistencePackageRequest ppr,
Entity containingEntity,
List<SectionCrumb> sectionCrumb)
Returns all records for all subcollections of the specified request and its primary key
|
PersistenceResponse |
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 containingClass
|
PersistenceResponse |
getRecordsForCollection(ClassMetadata containingClassMetadata,
Entity containingEntity,
Property collectionProperty,
FilterAndSortCriteria[] fascs,
Integer startIndex,
Integer maxIndex,
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() |
Map<String,DynamicResultSet> |
getRecordsForSelectedTab(ClassMetadata cmd,
Entity containingEntity,
List<SectionCrumb> sectionCrumb,
String currentTabName)
Returns all records for selected tab of the specified request and its primary key
|
PersistencePackageRequest |
getRequestForEntityForm(EntityForm entityForm,
String[] customCriteria,
List<SectionCrumb> sectionCrumbs)
Gets the PersistencePackageRequest for the passed in EntityForm
|
PersistenceResponse |
inspect(PersistencePackageRequest request)
Thin layer on top of
DynamicEntityService.inspect(org.broadleafcommerce.openadmin.dto.PersistencePackage) |
PersistenceResponse |
remove(PersistencePackageRequest request)
Thin layer on top of
DynamicEntityService.remove(org.broadleafcommerce.openadmin.dto.PersistencePackage) |
PersistenceResponse |
remove(PersistencePackageRequest request,
boolean transactional)
Works the same as
AdminEntityService.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 |
PersistenceResponse |
removeEntity(EntityForm entityForm,
String[] customCriteria,
List<SectionCrumb> sectionCrumb)
Removes the given entity
|
PersistenceResponse |
removeSubCollectionEntity(ClassMetadata mainMetadata,
Property field,
Entity parentEntity,
String itemId,
String priorKey,
List<SectionCrumb> sectionCrumbs)
Removes the given item from the specified collection.
|
PersistenceResponse |
removeSubCollectionEntity(ClassMetadata mainMetadata,
Property field,
Entity parentEntity,
String itemId,
String alternateId,
String priorKey,
List<SectionCrumb> sectionCrumbs)
Removes the given item from the specified collection.
|
protected Object |
toIdFieldType(String id,
Class<?> entityClass) |
PersistenceResponse |
update(PersistencePackageRequest request)
Thin layer on top of
DynamicEntityService.update(org.broadleafcommerce.openadmin.dto.PersistencePackage) |
PersistenceResponse |
update(PersistencePackageRequest request,
boolean transactional)
Works the same as
AdminEntityService.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 |
PersistenceResponse |
updateEntity(EntityForm entityForm,
String[] customCriteria,
List<SectionCrumb> sectionCrumb)
Updates the given entity
|
PersistenceResponse |
updateSubCollectionEntity(EntityForm entityForm,
ClassMetadata mainMetadata,
Property field,
Entity parentEntity,
String collectionItemId,
List<SectionCrumb> sectionCrumb)
Updates the specified collection item
|
PersistenceResponse |
updateSubCollectionEntity(EntityForm entityForm,
ClassMetadata mainMetadata,
Property field,
Entity parentEntity,
String collectionItemId,
String alternateId,
List<SectionCrumb> sectionCrumbs)
Updates the specified collection item
|
protected void |
updateTabInfo(CollectionMetadata fmd,
ClassMetadata cmd,
String tabName,
int tabOrder) |
protected static final org.apache.commons.logging.Log LOG
protected DynamicEntityService service
protected PersistencePackageFactory persistencePackageFactory
protected javax.persistence.EntityManager em
protected EntityConfiguration entityConfiguration
protected DynamicDaoHelper dynamicDaoHelper
public PersistenceResponse getClassMetadata(PersistencePackageRequest request) throws ServiceException
AdminEntityService
getClassMetadata
in interface AdminEntityService
ServiceException
public PersistenceResponse getRecords(PersistencePackageRequest request) throws ServiceException
AdminEntityService
getRecords
in interface AdminEntityService
ServiceException
public PersistenceResponse getRecord(PersistencePackageRequest request, String id, ClassMetadata cmd, boolean isCollectionRequest) throws ServiceException
AdminEntityService
getRecord
in interface AdminEntityService
isCollectionRequest
- whether or not this record request was initiated from a collection on a parent entityServiceException
public PersistenceResponse addEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws ServiceException
AdminEntityService
addEntity
in interface AdminEntityService
ServiceException
public PersistenceResponse updateEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws ServiceException
AdminEntityService
updateEntity
in interface AdminEntityService
ServiceException
public PersistenceResponse removeEntity(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumb) throws ServiceException
AdminEntityService
removeEntity
in interface AdminEntityService
ServiceException
protected List<Property> getPropertiesFromEntityForm(EntityForm entityForm)
public PersistencePackageRequest getRequestForEntityForm(EntityForm entityForm, String[] customCriteria, List<SectionCrumb> sectionCrumbs)
AdminEntityService
getRequestForEntityForm
in interface AdminEntityService
public PersistenceResponse getAdvancedCollectionRecord(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId, List<SectionCrumb> sectionCrumbs, String alternateId) throws ServiceException
AdminEntityService
getAdvancedCollectionRecord
in interface AdminEntityService
ServiceException
public PersistenceResponse getAdvancedCollectionRecord(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId, List<SectionCrumb> sectionCrumbs, String alternateId, String[] customCriteria) throws ServiceException
AdminEntityService
getAdvancedCollectionRecord
in interface AdminEntityService
ServiceException
public PersistenceResponse getRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb) throws ServiceException
AdminEntityService
getRecordsForCollection
in interface AdminEntityService
ServiceException
public PersistenceResponse getPagedRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, FetchPageRequest fetchPageRequest, String idValueOverride, List<SectionCrumb> sectionCrumbs) throws ServiceException
AdminEntityService
#getContextSpecificRelationshipId()
.
Also utilizes a FetchPageRequest
to encapsulate result set paging configuration, which is needed for
FetchType.LARGERESULTSET
cases, if applicable.getPagedRecordsForCollection
in interface AdminEntityService
ServiceException
public PersistenceResponse getRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex, String idValueOverride, List<SectionCrumb> sectionCrumbs) throws ServiceException
AdminEntityService
#getContextSpecificRelationshipId()
getRecordsForCollection
in interface AdminEntityService
ServiceException
public Map<String,DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb) throws ServiceException
AdminEntityService
getRecordsForAllSubCollections
in interface AdminEntityService
ServiceException
public Map<String,DynamicResultSet> getAllRecordsForAllSubCollections(ClassMetadata cmd, Entity containingEntity, List<SectionCrumb> sectionCrumb) throws ServiceException
AdminEntityService
getAllRecordsForAllSubCollections
in interface AdminEntityService
ServiceException
public Map<String,DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, List<SectionCrumb> sectionCrumb) throws ServiceException
AdminEntityService
getRecordsForAllSubCollections
in interface AdminEntityService
ServiceException
#getRecordsForCollection(ClassMetadata, String, Property)
public Map<String,DynamicResultSet> getRecordsForSelectedTab(ClassMetadata cmd, Entity containingEntity, List<SectionCrumb> sectionCrumb, String currentTabName) throws ServiceException
AdminEntityService
getRecordsForSelectedTab
in interface AdminEntityService
ServiceException
#getRecordsForCollection(ClassMetadata, String, Property)
protected void updateTabInfo(CollectionMetadata fmd, ClassMetadata cmd, String tabName, int tabOrder)
public PersistenceResponse addSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, List<SectionCrumb> sectionCrumbs) throws ServiceException, ClassNotFoundException
AdminEntityService
addSubCollectionEntity
in interface AdminEntityService
ServiceException
ClassNotFoundException
public PersistenceResponse updateSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId, List<SectionCrumb> sectionCrumb) throws ServiceException, ClassNotFoundException
AdminEntityService
updateSubCollectionEntity
in interface AdminEntityService
ServiceException
ClassNotFoundException
public PersistenceResponse updateSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId, String alternateId, List<SectionCrumb> sectionCrumbs) throws ServiceException, ClassNotFoundException
AdminEntityService
updateSubCollectionEntity
in interface AdminEntityService
ServiceException
ClassNotFoundException
public PersistenceResponse removeSubCollectionEntity(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String priorKey, List<SectionCrumb> sectionCrumbs) throws ServiceException
AdminEntityService
removeSubCollectionEntity
in interface AdminEntityService
priorKey
- - only needed for Map type collectionsServiceException
public PersistenceResponse removeSubCollectionEntity(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String alternateId, String priorKey, List<SectionCrumb> sectionCrumbs) throws ServiceException
AdminEntityService
removeSubCollectionEntity
in interface AdminEntityService
priorKey
- - only needed for Map type collectionsServiceException
public String getContextSpecificRelationshipId(ClassMetadata cmd, Entity entity, String propertyName)
AdminEntityService
getContextSpecificRelationshipId
in interface AdminEntityService
public String getIdProperty(ClassMetadata cmd) throws ServiceException
AdminEntityService
SupportedFieldType.ID
getIdProperty
in interface AdminEntityService
ServiceException
public PersistenceResponse add(PersistencePackageRequest request) throws ServiceException
AdminEntityService
DynamicEntityService.add(org.broadleafcommerce.openadmin.dto.PersistencePackage)
that
swallows all ValidationException
s that could be thrown and still just returns a PersistenceResponse
with the Entity
that failed validation.add
in interface AdminEntityService
ServiceException
- if there were exceptions other than a ValidationException
that was thrown as a
result of the attempted addpublic PersistenceResponse add(PersistencePackageRequest request, boolean transactional) throws ServiceException
AdminEntityService
AdminEntityService.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 componentadd
in interface AdminEntityService
ServiceException
public PersistenceResponse update(PersistencePackageRequest request) throws ServiceException
AdminEntityService
DynamicEntityService.update(org.broadleafcommerce.openadmin.dto.PersistencePackage)
update
in interface AdminEntityService
ServiceException
- if there were exceptions other than a ValidationException
that was thrown as a
result of the attempted updatepublic PersistenceResponse update(PersistencePackageRequest request, boolean transactional) throws ServiceException
AdminEntityService
AdminEntityService.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 componentupdate
in interface AdminEntityService
ServiceException
public PersistenceResponse inspect(PersistencePackageRequest request) throws ServiceException
AdminEntityService
DynamicEntityService.inspect(org.broadleafcommerce.openadmin.dto.PersistencePackage)
inspect
in interface AdminEntityService
ServiceException
public PersistenceResponse remove(PersistencePackageRequest request) throws ServiceException
AdminEntityService
DynamicEntityService.remove(org.broadleafcommerce.openadmin.dto.PersistencePackage)
remove
in interface AdminEntityService
ServiceException
public PersistenceResponse remove(PersistencePackageRequest request, boolean transactional) throws ServiceException
AdminEntityService
AdminEntityService.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 componentremove
in interface AdminEntityService
ServiceException
protected void ensureEntityMarkedAsValidationFailure(ValidationException e, PersistencePackageRequest originalRequest)
Should be invoked when a ValidationException
is thrown to verify that the Entity
contained within the
given originalRequest has a validationFailure = true
This will also check for a cause of ConstraintViolationException
and add a gloal error to that.
public PersistenceResponse fetch(PersistencePackageRequest request) throws ServiceException
AdminEntityService
DynamicEntityService.fetch(org.broadleafcommerce.openadmin.dto.PersistencePackage, org.broadleafcommerce.openadmin.dto.CriteriaTransferObject)
.
This will glean and create a CriteriaTransferObject
from PersistencePackageRequest.getFilterAndSortCriteria()
to pass to DynamicEntityService
.fetch
in interface AdminEntityService
ServiceException
protected CriteriaTransferObject getDefaultCto()
public String getForeignEntityName(String owningClass, String id)
AdminEntityService
AdminMainEntity
value for the
foreign entitygetForeignEntityName
in interface AdminEntityService
protected DynamicEntityDao getDynamicEntityDao(String owningClass)
protected int getDefaultMaxResults()
public void clearEntityManager()
clearEntityManager
in interface AdminEntityService
Copyright © 2019. All rights reserved.