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.
 String getIdProperty(ClassMetadata cmd)
          Returns the name of the property in this ClassMetadata that has field type set to SupportedFieldType.ID
 Entity getRecord(PersistencePackageRequest request, String id, ClassMetadata cmd)
          Returns a specific record for the given request and primary key id/property
 DynamicResultSet 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)
          Returns all records for all subcollections of the specified request and its primary key
 DynamicResultSet getRecordsForCollection(ClassMetadata containingClassMetadata, Entity containingEntity, Property collectionProperty, FilterAndSortCriteria[] fascs, Integer startIndex, Integer maxIndex)
          Returns the DynamicResultSet 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
Returns class metadata for the given request object

Parameters:
request -
Returns:
ClassMetadata for the given request
Throws:
ServiceException

getRecords

DynamicResultSet getRecords(PersistencePackageRequest request)
                            throws ServiceException
Returns the DynamicResultSet containing the total records for the query and the currently fetched Entity[]

Parameters:
request -
Returns:
DynamicResultSet
Throws:
ServiceException

getRecord

Entity getRecord(PersistencePackageRequest request,
                 String id,
                 ClassMetadata cmd)
                 throws ServiceException
Returns a specific record for the given request and primary key id/property

Parameters:
request -
id -
cmd -
Returns:
the Entity
Throws:
ServiceException

addEntity

Entity addEntity(EntityForm entityForm,
                 String[] customCriteria)
                 throws ServiceException
Persists the given entity

Parameters:
entityForm -
customCriteria -
Returns:
the persisted Entity
Throws:
ServiceException

updateEntity

Entity updateEntity(EntityForm entityForm,
                    String[] customCriteria)
                    throws ServiceException
Updates the given entity

Parameters:
entityForm -
customCriteria -
Returns:
the persisted Entity
Throws:
ServiceException

removeEntity

void removeEntity(EntityForm entityForm,
                  String[] customCriteria)
                  throws ServiceException
Removes the given entity

Parameters:
entityForm -
customCriteria -
Throws:
ServiceException

getAdvancedCollectionRecord

Entity getAdvancedCollectionRecord(ClassMetadata containingClassMetadata,
                                   Entity containingEntity,
                                   Property collectionProperty,
                                   String collectionItemId)
                                   throws ServiceException
Gets an Entity representing a specific collection item

Parameters:
containingClassMetadata -
containingEntity -
collectionProperty -
collectionItemId -
Returns:
the Entity
Throws:
ServiceException

getRecordsForCollection

DynamicResultSet getRecordsForCollection(ClassMetadata containingClassMetadata,
                                         Entity containingEntity,
                                         Property collectionProperty,
                                         FilterAndSortCriteria[] fascs,
                                         Integer startIndex,
                                         Integer maxIndex)
                                         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

getRecordsForAllSubCollections

Map<String,DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr,
                                                            Entity containingEntity)
                                                            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)

addSubCollectionEntity

Entity addSubCollectionEntity(EntityForm entityForm,
                              ClassMetadata mainMetadata,
                              Property field,
                              Entity parentEntity)
                              throws ServiceException,
                                     ClassNotFoundException
Adds an item into the specified collection

Parameters:
entityForm -
mainMetadata -
field -
parentEntity -
Returns:
the persisted Entity
Throws:
ServiceException
ClassNotFoundException

updateSubCollectionEntity

Entity updateSubCollectionEntity(EntityForm entityForm,
                                 ClassMetadata mainMetadata,
                                 Property field,
                                 Entity parentEntity,
                                 String collectionItemId)
                                 throws ServiceException,
                                        ClassNotFoundException
Updates the specified collection item

Parameters:
entityForm -
mainMetadata -
field -
parentEntity -
collectionItemId -
Returns:
the persisted Entity
Throws:
ServiceException
ClassNotFoundException

removeSubCollectionEntity

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

Parameters:
mainMetadata -
field -
parentId -
itemId -
priorKey - - only needed for Map type collections
Throws:
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 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:
ServiceException


Copyright © 2013. All Rights Reserved.