org.broadleafcommerce.openadmin.web.service
Class FormBuilderServiceImpl

java.lang.Object
  extended by org.broadleafcommerce.openadmin.web.service.FormBuilderServiceImpl
All Implemented Interfaces:
FormBuilderService

@Service(value="blFormBuilderService")
public class FormBuilderServiceImpl
extends Object
implements FormBuilderService

Author:
Andre Azzolini (apazzolini)

Field Summary
protected  AdminEntityService adminEntityService
           
protected  AdminNavigationService navigationService
           
 
Constructor Summary
FormBuilderServiceImpl()
           
 
Method Summary
 EntityForm buildAdornedListForm(AdornedTargetCollectionMetadata adornedMd, AdornedTargetList adornedList, String parentId)
          Builds the EntityForm used in modal dialogs when adding items to adorned target collections.
 ListGrid buildCollectionListGrid(String containingEntityId, Entity[] entities, Property field, String sectionKey)
          Builds a list grid that is used to render a collection inline in an entity form.
 EntityForm buildEntityForm(ClassMetadata cmd)
          Builds an EntityForm that has all of the appropriate fields set up without any values.
 EntityForm buildEntityForm(ClassMetadata cmd, Entity entity)
          Builds an EntityForm that has all of the appropriate fields set up along with the values for those fields from the given Entity.
 EntityForm buildEntityForm(ClassMetadata cmd, Entity entity, Map<String,Entity[]> collectionRecords)
          Builds an EntityForm that has all of the appropriate fields set up along with the values for thsoe fields from the given Entity as well as all sub-collections of the given Entity that appear in the collectionRecords map.
 ListGrid buildMainListGrid(Entity[] entities, ClassMetadata cmd, String sectionKey)
          Builds a list grid that is typically used at the top entity level to select an entity for modification.
 EntityForm buildMapForm(MapMetadata mapMd, MapStructure mapStructure, ClassMetadata cmd, String parentId)
          Builds the EntityForm used in modal dialogs when adding items to map collections.
 void copyEntityFormValues(EntityForm destinationForm, EntityForm sourceForm)
          Copies all values for fields from the destinationForm into the sourceForm.
protected  ListGrid createListGrid(String className, List<Field> headerFields, ListGrid.Type type, Entity[] entities, String sectionKey, int order)
           
protected  EntityForm createStandardEntityForm()
           
 void populateAdornedEntityFormFields(EntityForm ef, Entity entity, AdornedTargetList adornedList)
          Sets values for the necessary adorned fields on the EntityForm from the specified entity.
 void populateEntityFormFields(EntityForm ef, Entity entity)
          Sets values for all fields found on the EntityForm from the specified entity.
 void populateMapEntityFormFields(EntityForm ef, Entity entity)
          Sets values for the necessary map fields on the EntityForm from the specified entity.
 void removeNonApplicableFields(ClassMetadata cmd, EntityForm entityForm, String entityType)
          Loops through all of the fields that are specified in given class metadata and removes fields that are not applicable for the given polymorphic entity type from the entity form.
protected  void setEntityFormFields(EntityForm ef, List<Property> properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adminEntityService

protected AdminEntityService adminEntityService

navigationService

protected AdminNavigationService navigationService
Constructor Detail

FormBuilderServiceImpl

public FormBuilderServiceImpl()
Method Detail

buildMainListGrid

public ListGrid buildMainListGrid(Entity[] entities,
                                  ClassMetadata cmd,
                                  String sectionKey)
                           throws ServiceException,
                                  com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: FormBuilderService
Builds a list grid that is typically used at the top entity level to select an entity for modification. Note that it can also be used in other places that require the same grid as the main entity search screen provided the type on the returned ListGrid is set appropriately.

Specified by:
buildMainListGrid in interface FormBuilderService
Returns:
the ListGrid
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

buildCollectionListGrid

public ListGrid buildCollectionListGrid(String containingEntityId,
                                        Entity[] entities,
                                        Property field,
                                        String sectionKey)
                                 throws ServiceException,
                                        com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: FormBuilderService
Builds a list grid that is used to render a collection inline in an entity form. Note that it can also be used in other places that require the same grid provided the type on the returned ListGrid is set appropriately.

Specified by:
buildCollectionListGrid in interface FormBuilderService
Returns:
the ListGrid
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

createListGrid

protected ListGrid createListGrid(String className,
                                  List<Field> headerFields,
                                  ListGrid.Type type,
                                  Entity[] entities,
                                  String sectionKey,
                                  int order)

setEntityFormFields

protected void setEntityFormFields(EntityForm ef,
                                   List<Property> properties)

removeNonApplicableFields

public void removeNonApplicableFields(ClassMetadata cmd,
                                      EntityForm entityForm,
                                      String entityType)
Description copied from interface: FormBuilderService
Loops through all of the fields that are specified in given class metadata and removes fields that are not applicable for the given polymorphic entity type from the entity form.

Specified by:
removeNonApplicableFields in interface FormBuilderService

buildEntityForm

public EntityForm buildEntityForm(ClassMetadata cmd)
Description copied from interface: FormBuilderService
Builds an EntityForm that has all of the appropriate fields set up without any values.

Specified by:
buildEntityForm in interface FormBuilderService
Returns:
the EntityForm

buildEntityForm

public EntityForm buildEntityForm(ClassMetadata cmd,
                                  Entity entity)
Description copied from interface: FormBuilderService
Builds an EntityForm that has all of the appropriate fields set up along with the values for those fields from the given Entity.

Specified by:
buildEntityForm in interface FormBuilderService
Returns:
the EntityForm

buildEntityForm

public EntityForm buildEntityForm(ClassMetadata cmd,
                                  Entity entity,
                                  Map<String,Entity[]> collectionRecords)
                           throws ServiceException,
                                  com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: FormBuilderService
Builds an EntityForm that has all of the appropriate fields set up along with the values for thsoe fields from the given Entity as well as all sub-collections of the given Entity that appear in the collectionRecords map.

Specified by:
buildEntityForm in interface FormBuilderService
Returns:
the EntityForm
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

populateEntityFormFields

public void populateEntityFormFields(EntityForm ef,
                                     Entity entity)
Description copied from interface: FormBuilderService
Sets values for all fields found on the EntityForm from the specified entity.

Specified by:
populateEntityFormFields in interface FormBuilderService

populateAdornedEntityFormFields

public void populateAdornedEntityFormFields(EntityForm ef,
                                            Entity entity,
                                            AdornedTargetList adornedList)
Description copied from interface: FormBuilderService
Sets values for the necessary adorned fields on the EntityForm from the specified entity.

Specified by:
populateAdornedEntityFormFields in interface FormBuilderService

populateMapEntityFormFields

public void populateMapEntityFormFields(EntityForm ef,
                                        Entity entity)
Description copied from interface: FormBuilderService
Sets values for the necessary map fields on the EntityForm from the specified entity.

Specified by:
populateMapEntityFormFields in interface FormBuilderService

copyEntityFormValues

public void copyEntityFormValues(EntityForm destinationForm,
                                 EntityForm sourceForm)
Description copied from interface: FormBuilderService
Copies all values for fields from the destinationForm into the sourceForm.

Specified by:
copyEntityFormValues in interface FormBuilderService

buildAdornedListForm

public EntityForm buildAdornedListForm(AdornedTargetCollectionMetadata adornedMd,
                                       AdornedTargetList adornedList,
                                       String parentId)
                                throws ServiceException,
                                       com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: FormBuilderService
Builds the EntityForm used in modal dialogs when adding items to adorned target collections.

Specified by:
buildAdornedListForm in interface FormBuilderService
Returns:
the EntityForm
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

buildMapForm

public EntityForm buildMapForm(MapMetadata mapMd,
                               MapStructure mapStructure,
                               ClassMetadata cmd,
                               String parentId)
                        throws ServiceException,
                               com.gwtincubator.security.exception.ApplicationSecurityException
Description copied from interface: FormBuilderService
Builds the EntityForm used in modal dialogs when adding items to map collections.

Specified by:
buildMapForm in interface FormBuilderService
Returns:
the EntityForm
Throws:
ServiceException
com.gwtincubator.security.exception.ApplicationSecurityException

createStandardEntityForm

protected EntityForm createStandardEntityForm()


Copyright © 2013. All Rights Reserved.