org.broadleafcommerce.openadmin.server.service
Class AdminEntityServiceImpl

java.lang.Object
  extended by org.broadleafcommerce.openadmin.server.service.AdminEntityServiceImpl
All Implemented Interfaces:
AdminEntityService

@Service(value="blAdminEntityService")
public class AdminEntityServiceImpl
extends Object
implements AdminEntityService

Author:
Andre Azzolini (apazzolini)

Field Summary
protected  PersistencePackageFactory persistencePackageFactory
           
protected  DynamicEntityService service
           
 
Constructor Summary
AdminEntityServiceImpl()
           
 
Method Summary
protected  Entity add(PersistencePackageRequest request)
           
 Entity addEntity(EntityForm entityForm, String[] customCriteria)
          Persists the given entity
 Entity addSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity)
          Adds an item into the specified collection
protected  DynamicResultSet fetch(PersistencePackageRequest request)
           
 Entity getAdvancedCollectionRecord(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, String collectionItemId)
          Gets an Entity representing a specific collection item
 ClassMetadata 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()
           
 Entity getRecord(PersistencePackageRequest request, String id)
          Returns a specific record for the given request and primary key id
 Entity[] getRecords(PersistencePackageRequest request)
          Returns an Entity[] representing the records that were found for the given request.
 Map<String,Entity[]> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity)
          Returns all records for all subcollections of the specified request and its primary key
 Entity[] getRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] criteria)
          Returns the Entity[] representing the records that belong to the specified collectionProperty for the given containingClass and the primary key for the containingClass
protected  PersistencePackageRequest getRequestForEntityForm(EntityForm entityForm, String[] customCriteria)
           
protected  DynamicResultSet inspect(PersistencePackageRequest request)
           
protected  void remove(PersistencePackageRequest request)
           
 void removeEntity(EntityForm entityForm, String[] customCriteria)
          Removes the given entity
 void removeSubCollectionEntity(ClassMetadata mainMetadata, Property field, Entity parentEntity, String itemId, String priorKey)
          Removes the given item from the specified collection.
protected  Entity update(PersistencePackageRequest request)
           
 Entity updateEntity(EntityForm entityForm, String[] customCriteria)
          Updates the given entity
 Entity updateSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field, Entity parentEntity, String collectionItemId)
          Updates the specified collection item
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

service

protected DynamicEntityService service

persistencePackageFactory

protected PersistencePackageFactory persistencePackageFactory
Constructor Detail

AdminEntityServiceImpl

public AdminEntityServiceImpl()
Method Detail

getClassMetadata

public ClassMetadata getClassMetadata(PersistencePackageRequest request)
                               throws ServiceException,
                                      com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Returns class metadata for the given request object

Specified by:
getClassMetadata in interface AdminEntityService
Returns:
ClassMetadata for the given request
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRecords

public Entity[] getRecords(PersistencePackageRequest request)
                    throws ServiceException,
                           com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Returns an Entity[] representing the records that were found for the given request.

Specified by:
getRecords in interface AdminEntityService
Returns:
the Entity[]
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRecord

public Entity getRecord(PersistencePackageRequest request,
                        String id)
                 throws ServiceException,
                        com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Returns a specific record for the given request and primary key id

Specified by:
getRecord in interface AdminEntityService
Returns:
the Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

addEntity

public Entity addEntity(EntityForm entityForm,
                        String[] customCriteria)
                 throws ServiceException,
                        com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Persists the given entity

Specified by:
addEntity in interface AdminEntityService
Returns:
the persisted Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

updateEntity

@Transactional(value="blTransactionManager")
public Entity updateEntity(EntityForm entityForm,
                                         String[] customCriteria)
                    throws ServiceException,
                           com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Updates the given entity

Specified by:
updateEntity in interface AdminEntityService
Returns:
the persisted Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

removeEntity

public void removeEntity(EntityForm entityForm,
                         String[] customCriteria)
                  throws ServiceException,
                         com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Removes the given entity

Specified by:
removeEntity in interface AdminEntityService
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRequestForEntityForm

protected PersistencePackageRequest getRequestForEntityForm(EntityForm entityForm,
                                                            String[] customCriteria)

getAdvancedCollectionRecord

public Entity getAdvancedCollectionRecord(ClassMetadata containingClassMetadata,
                                          Entity containingEntity,
                                          Property collectionProperty,
                                          String collectionItemId)
                                   throws ServiceException,
                                          com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Gets an Entity representing a specific collection item

Specified by:
getAdvancedCollectionRecord in interface AdminEntityService
Returns:
the Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRecordsForCollection

public Entity[] getRecordsForCollection(ClassMetadata containingClassMetadata,
                                        Entity containingEntity,
                                        Property collectionProperty,
                                        FilterAndSortCriteria[] criteria)
                                 throws ServiceException,
                                        com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Returns the Entity[] representing the records that belong to the specified collectionProperty for the given containingClass and the primary key for the containingClass

Specified by:
getRecordsForCollection in interface AdminEntityService
Returns:
the Entity[]
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRecordsForAllSubCollections

public Map<String,Entity[]> getRecordsForAllSubCollections(PersistencePackageRequest ppr,
                                                           Entity containingEntity)
                                                    throws ServiceException,
                                                           com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Returns all records for all subcollections of the specified request and its primary key

Specified by:
getRecordsForAllSubCollections in interface AdminEntityService
Returns:
all Entity[] for all collections for the specified containingClass
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException
See Also:
#getRecordsForCollection(ClassMetadata, String, Property)

addSubCollectionEntity

public Entity addSubCollectionEntity(EntityForm entityForm,
                                     ClassMetadata mainMetadata,
                                     Property field,
                                     Entity parentEntity)
                              throws ServiceException,
                                     com.gwtincubator.security.exception.ApplicationSecurityException,
                                     ClassNotFoundException
Description copied from interface: AdminEntityService
Adds an item into the specified collection

Specified by:
addSubCollectionEntity in interface AdminEntityService
Returns:
the persisted Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException
ClassNotFoundException

updateSubCollectionEntity

public Entity updateSubCollectionEntity(EntityForm entityForm,
                                        ClassMetadata mainMetadata,
                                        Property field,
                                        Entity parentEntity,
                                        String collectionItemId)
                                 throws ServiceException,
                                        com.gwtincubator.security.exception.ApplicationSecurityException,
                                        ClassNotFoundException
Description copied from interface: AdminEntityService
Updates the specified collection item

Specified by:
updateSubCollectionEntity in interface AdminEntityService
Returns:
the persisted Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException
ClassNotFoundException

removeSubCollectionEntity

public void removeSubCollectionEntity(ClassMetadata mainMetadata,
                                      Property field,
                                      Entity parentEntity,
                                      String itemId,
                                      String priorKey)
                               throws ServiceException,
                                      com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: AdminEntityService
Removes the given item from the specified collection.

Specified by:
removeSubCollectionEntity in interface AdminEntityService
priorKey - - only needed for Map type collections
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getContextSpecificRelationshipId

public String getContextSpecificRelationshipId(ClassMetadata cmd,
                                               Entity entity,
                                               String propertyName)
Description copied from interface: AdminEntityService
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.

Specified by:
getContextSpecificRelationshipId in interface AdminEntityService
Returns:
the id to be used for this relationship

add

protected Entity add(PersistencePackageRequest request)
              throws ServiceException,
                     com.gwtincubator.security.exception.ApplicationSecurityException
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

update

protected Entity update(PersistencePackageRequest request)
                 throws ServiceException,
                        com.gwtincubator.security.exception.ApplicationSecurityException
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

inspect

protected DynamicResultSet inspect(PersistencePackageRequest request)
                            throws ServiceException,
                                   com.gwtincubator.security.exception.ApplicationSecurityException
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

remove

protected void remove(PersistencePackageRequest request)
               throws ServiceException,
                      com.gwtincubator.security.exception.ApplicationSecurityException
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

fetch

protected DynamicResultSet fetch(PersistencePackageRequest request)
                          throws ServiceException,
                                 com.gwtincubator.security.exception.ApplicationSecurityException
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getDefaultCto

protected CriteriaTransferObject getDefaultCto()


Copyright © 2013. All Rights Reserved.