org.broadleafcommerce.openadmin.server.service
Interface AdminEntityService

All Known Implementing Classes:
AdminEntityServiceImpl

public interface AdminEntityService

Author:
Andre Azzolini (apazzolini)

Method Summary
 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
 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.
 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
 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.
 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
 

Method Detail

getClassMetadata

ClassMetadata getClassMetadata(PersistencePackageRequest request)
                               throws ServiceException,
                                      com.gwtincubator.security.exception.ApplicationSecurityException
Returns class metadata for the given request object

Parameters:
request -
Returns:
ClassMetadata for the given request
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRecords

Entity[] getRecords(PersistencePackageRequest request)
                    throws ServiceException,
                           com.gwtincubator.security.exception.ApplicationSecurityException
Returns an Entity[] representing the records that were found for the given request.

Parameters:
request -
Returns:
the Entity[]
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRecord

Entity getRecord(PersistencePackageRequest request,
                 String id)
                 throws ServiceException,
                        com.gwtincubator.security.exception.ApplicationSecurityException
Returns a specific record for the given request and primary key id

Parameters:
request -
id -
Returns:
the Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

addEntity

Entity addEntity(EntityForm entityForm,
                 String[] customCriteria)
                 throws ServiceException,
                        com.gwtincubator.security.exception.ApplicationSecurityException
Persists the given entity

Parameters:
entityForm -
customCriteria -
Returns:
the persisted Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

updateEntity

Entity updateEntity(EntityForm entityForm,
                    String[] customCriteria)
                    throws ServiceException,
                           com.gwtincubator.security.exception.ApplicationSecurityException
Updates the given entity

Parameters:
entityForm -
customCriteria -
Returns:
the persisted Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

removeEntity

void removeEntity(EntityForm entityForm,
                  String[] customCriteria)
                  throws ServiceException,
                         com.gwtincubator.security.exception.ApplicationSecurityException
Removes the given entity

Parameters:
entityForm -
customCriteria -
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getAdvancedCollectionRecord

Entity getAdvancedCollectionRecord(ClassMetadata containingClassMetadata,
                                   Entity containingEntity,
                                   Property collectionProperty,
                                   String collectionItemId)
                                   throws ServiceException,
                                          com.gwtincubator.security.exception.ApplicationSecurityException
Gets an Entity representing a specific collection item

Parameters:
containingClassMetadata -
containingEntity -
collectionProperty -
collectionItemId -
Returns:
the Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRecordsForCollection

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

Parameters:
containingClassMetadata -
containingEntity -
collectionProperty -
Returns:
the Entity[]
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

getRecordsForAllSubCollections

Map<String,Entity[]> getRecordsForAllSubCollections(PersistencePackageRequest ppr,
                                                    Entity containingEntity)
                                                    throws ServiceException,
                                                           com.gwtincubator.security.exception.ApplicationSecurityException
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
com.gwtincubator.security.exception.ApplicationSecurityException
See Also:
#getRecordsForCollection(ClassMetadata, String, Property)

addSubCollectionEntity

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

Parameters:
entityForm -
mainMetadata -
field -
parentEntity -
Returns:
the persisted Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException
ClassNotFoundException

updateSubCollectionEntity

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

Parameters:
entityForm -
mainMetadata -
field -
parentEntity -
collectionItemId -
Returns:
the persisted Entity
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException
ClassNotFoundException

removeSubCollectionEntity

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

Parameters:
mainMetadata -
field -
parentId -
itemId -
priorKey - - only needed for Map type collections
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

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


Copyright © 2013. All Rights Reserved.