|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.broadleafcommerce.openadmin.web.service.FormBuilderServiceImpl
@Service(value="blFormBuilderService") public class FormBuilderServiceImpl
| Field Summary | |
|---|---|
protected AdminEntityService |
adminEntityService
|
protected FormBuilderExtensionManager |
extensionManager
|
protected static VisibilityEnum[] |
FORM_HIDDEN_VISIBILITIES
|
protected static VisibilityEnum[] |
GRID_HIDDEN_VISIBILITIES
|
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. |
EntityForm |
buildAdornedListForm(AdornedTargetCollectionMetadata adornedMd,
AdornedTargetList adornedList,
String parentId,
EntityForm ef)
Equivalent to FormBuilderService.buildAdornedListForm(AdornedTargetCollectionMetadata, AdornedTargetList, String) except rather than creating a
new EntityForm this simply uses the EntityForm that was passed in as ef. |
ListGrid |
buildCollectionListGrid(String containingEntityId,
DynamicResultSet drs,
Property field,
String sectionKey)
Builds a list grid that is used to render a collection inline in an entity form. |
ListGrid |
buildMainListGrid(DynamicResultSet drs,
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. |
EntityForm |
buildMapForm(MapMetadata mapMd,
MapStructure mapStructure,
ClassMetadata cmd,
String parentId,
EntityForm ef)
Equivalent to FormBuilderService.buildMapForm(MapMetadata, MapStructure, ClassMetadata, String) except rather than creating a
new EntityForm this simply uses the EntityForm that was passed in as ef. |
protected DataWrapper |
convertJsonToDataWrapper(String json)
When using Thymeleaf, we need to convert the JSON string back to a DataWrapper object because Thymeleaf escapes JSON strings. |
protected Media |
convertJsonToMedia(String json)
|
EntityForm |
createEntityForm(ClassMetadata cmd)
Creates a new EntityForm with the a default 'Save' action. |
EntityForm |
createEntityForm(ClassMetadata cmd,
Entity entity)
Creates a new EntityForm that has all of the appropriate fields set up along with the values for those fields from the given Entity. |
EntityForm |
createEntityForm(ClassMetadata cmd,
Entity entity,
Map<String,DynamicResultSet> collectionRecords)
Builds an EntityForm that has all of the appropriate fields set up along with the values for those fields from the given Entity as well as all sub-collections of the given Entity that appear in the collectionRecords map. |
protected Field |
createHeaderField(Property p,
BasicFieldMetadata fmd)
|
protected ListGrid |
createListGrid(String className,
List<Field> headerFields,
ListGrid.Type type,
DynamicResultSet drs,
String sectionKey,
int order,
String idProperty)
|
protected EntityForm |
createStandardEntityForm()
|
protected VisibilityEnum[] |
getFormHiddenVisibilities()
|
protected VisibilityEnum[] |
getGridHiddenVisibilities()
|
protected Boolean |
isDerivedField(Field headerField,
Field recordField,
Property p)
Determines whether or not a particular field in a record is derived. |
void |
populateAdornedEntityFormFields(EntityForm ef,
Entity entity,
AdornedTargetList adornedList)
Sets values for the necessary adorned fields on the EntityForm from the specified entity. |
protected void |
populateDropdownToOneFields(EntityForm ef,
ClassMetadata cmd)
|
void |
populateEntityForm(ClassMetadata cmd,
Entity entity,
EntityForm ef)
Populates a given ef based on the given cmd to initially create fields with the necessary metadata and then fills those fields out based on the property values from entity. |
void |
populateEntityForm(ClassMetadata cmd,
EntityForm ef)
Populates the given ef with all of the fields based on the properties from cmd. |
void |
populateEntityForm(ClassMetadata cmd,
Entity entity,
Map<String,DynamicResultSet> collectionRecords,
EntityForm ef)
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. |
void |
populateEntityFormFields(EntityForm ef,
Entity entity)
Delegates to FormBuilderService.populateEntityFormFields(EntityForm, Entity, boolean, boolean) with true for populating both
the id and type. |
void |
populateEntityFormFields(EntityForm ef,
Entity entity,
boolean populateType,
boolean populateId)
Sets values for all fields found on the EntityForm from the specified entity. |
void |
populateEntityFormFieldValues(ClassMetadata cmd,
Entity entity,
EntityForm ef)
Populates the given EntityForm with values based on the Entity that has been passed in. |
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 |
|---|
protected AdminEntityService adminEntityService
protected AdminNavigationService navigationService
protected FormBuilderExtensionManager extensionManager
protected static final VisibilityEnum[] FORM_HIDDEN_VISIBILITIES
protected static final VisibilityEnum[] GRID_HIDDEN_VISIBILITIES
| Constructor Detail |
|---|
public FormBuilderServiceImpl()
| Method Detail |
|---|
public ListGrid buildMainListGrid(DynamicResultSet drs,
ClassMetadata cmd,
String sectionKey)
throws ServiceException
FormBuilderService
buildMainListGrid in interface FormBuilderServiceServiceException
protected Field createHeaderField(Property p,
BasicFieldMetadata fmd)
public ListGrid buildCollectionListGrid(String containingEntityId,
DynamicResultSet drs,
Property field,
String sectionKey)
throws ServiceException
FormBuilderService
buildCollectionListGrid in interface FormBuilderServiceServiceException
protected ListGrid createListGrid(String className,
List<Field> headerFields,
ListGrid.Type type,
DynamicResultSet drs,
String sectionKey,
int order,
String idProperty)
protected Boolean isDerivedField(Field headerField,
Field recordField,
Property p)
BasicFieldMetadata
for the given Property to see if something on the backend has marked it as derived
headerField - the header for this recordFieldrecordField - the recordField being populatedp - the property that relates to this recordField
#createListGrid(String, List, org.broadleafcommerce.openadmin.web.form.component.ListGrid.Type, DynamicResultSet, String, int, String)}
protected void setEntityFormFields(EntityForm ef,
List<Property> properties)
public void removeNonApplicableFields(ClassMetadata cmd,
EntityForm entityForm,
String entityType)
FormBuilderService
removeNonApplicableFields in interface FormBuilderService
public EntityForm createEntityForm(ClassMetadata cmd)
throws ServiceException
FormBuilderServiceFormBuilderService.populateEntityForm(ClassMetadata, EntityForm) to ensure that the newly created EntityForm
has all of the appropriate fields set up without any values based on cmd
createEntityForm in interface FormBuilderServiceServiceException#populateEntityForm(ClassMetadata, EntityForm)}
public void populateEntityForm(ClassMetadata cmd,
EntityForm ef)
throws ServiceException
FormBuilderService#populateEntityForm(ClassMetadata, Entity, EntityForm, boolean)
populateEntityForm in interface FormBuilderServiceServiceException
public EntityForm createEntityForm(ClassMetadata cmd,
Entity entity)
throws ServiceException
FormBuilderServiceFormBuilderService.createEntityForm(ClassMetadata) for further population
createEntityForm in interface FormBuilderServicecmd - metadata that the created EntityForm should use to initialize its fields
ServiceException#createEntityForm(ClassMetadata)}
public void populateEntityForm(ClassMetadata cmd,
Entity entity,
EntityForm ef)
throws ServiceException
FormBuilderService
populateEntityForm in interface FormBuilderServiceServiceException#populateEntityForm(ClassMetadata, EntityForm)}
public void populateEntityFormFieldValues(ClassMetadata cmd,
Entity entity,
EntityForm ef)
FormBuilderServiceEntityForm with values based on the Entity that has been passed in. The
ClassMetadata is used to determine which properties should be attempted to be populated
populateEntityFormFieldValues in interface FormBuilderServicecmd - 'inspect' metadata for the class being populatedentity - the Entity that should be used to fill out the field values in the given EntityFormef - the EntityForm to populate field values from the given Entityprotected Media convertJsonToMedia(String json)
protected DataWrapper convertJsonToDataWrapper(String json)
json -
IOException
protected void populateDropdownToOneFields(EntityForm ef,
ClassMetadata cmd)
throws ServiceException
ServiceException
public EntityForm createEntityForm(ClassMetadata cmd,
Entity entity,
Map<String,DynamicResultSet> collectionRecords)
throws ServiceException
FormBuilderServiceEntityForm (that has a save action) and then populates
that EntityForm using FormBuilderService.populateEntityForm(ClassMetadata, Entity, Map, EntityForm).
NOTE: if you are submitting a validation result, you must not call this method and instead invoke the one that has
an EntityForm as a parameter. You cannot re-assign the entityForm to the model after it has already been
bound to a BindingResult, else the binding result will be removed.
createEntityForm in interface FormBuilderServiceServiceException#populateEntityForm(ClassMetadata, Entity, Map, EntityForm)}
public void populateEntityForm(ClassMetadata cmd,
Entity entity,
Map<String,DynamicResultSet> collectionRecords,
EntityForm ef)
throws ServiceException
FormBuilderServiceEntityForm to the model or else you lose the whole BindingResult and errors will not properly be
displayed. In that scenario, you must use this method rather than the one that does not take in an entityForm as it
will attempt to instantiate a new object.
populateEntityForm in interface FormBuilderServiceef - rather than instantiate a new EntityForm, this will use this parameter to fill out
ServiceException
public void populateEntityFormFields(EntityForm ef,
Entity entity)
FormBuilderServiceFormBuilderService.populateEntityFormFields(EntityForm, Entity, boolean, boolean) with true for populating both
the id and type.
populateEntityFormFields in interface FormBuilderService#populateEntityFormFields(EntityForm, Entity, boolean, boolean)}
public void populateEntityFormFields(EntityForm ef,
Entity entity,
boolean populateType,
boolean populateId)
FormBuilderService
populateEntityFormFields in interface FormBuilderServicepopulateType - whether or not to use the type from the given Entity or keep the current value on
the EntityFormpopulateId - whether or not to use the id from the given Entity or keep the current value on
the EntityForm
public void populateAdornedEntityFormFields(EntityForm ef,
Entity entity,
AdornedTargetList adornedList)
FormBuilderService
populateAdornedEntityFormFields in interface FormBuilderService
public void populateMapEntityFormFields(EntityForm ef,
Entity entity)
FormBuilderService
populateMapEntityFormFields in interface FormBuilderService
public EntityForm buildAdornedListForm(AdornedTargetCollectionMetadata adornedMd,
AdornedTargetList adornedList,
String parentId)
throws ServiceException
FormBuilderService
buildAdornedListForm in interface FormBuilderServiceServiceException
public EntityForm buildAdornedListForm(AdornedTargetCollectionMetadata adornedMd,
AdornedTargetList adornedList,
String parentId,
EntityForm ef)
throws ServiceException
FormBuilderServiceFormBuilderService.buildAdornedListForm(AdornedTargetCollectionMetadata, AdornedTargetList, String) except rather than creating a
new EntityForm this simply uses the EntityForm that was passed in as ef. Used mainly when
rebuilding an EntityForm after it has already been bound by Spring.
Before invoking this method, you should invoke EntityForm.clearFieldsMap() to ensure that you have a clean
set of field groups and tabs for this method to work with
buildAdornedListForm in interface FormBuilderServiceef - the form DTO to populate
EntityForm passed in but fully populated
ServiceException
public EntityForm buildMapForm(MapMetadata mapMd,
MapStructure mapStructure,
ClassMetadata cmd,
String parentId)
throws ServiceException
FormBuilderService
buildMapForm in interface FormBuilderServiceServiceException
public EntityForm buildMapForm(MapMetadata mapMd,
MapStructure mapStructure,
ClassMetadata cmd,
String parentId,
EntityForm ef)
throws ServiceException
FormBuilderServiceFormBuilderService.buildMapForm(MapMetadata, MapStructure, ClassMetadata, String) except rather than creating a
new EntityForm this simply uses the EntityForm that was passed in as ef. Used mainly when
rebuilding an EntityForm after it has already been bound by Spring.
Before invoking this method, you should invoke EntityForm.clearFieldsMap() to ensure that you have a clean
set of field groups and tabs for this method to work with
buildMapForm in interface FormBuilderServiceef - the form DTO to populate
EntityForm passed in but fully populated
ServiceExceptionprotected EntityForm createStandardEntityForm()
protected VisibilityEnum[] getGridHiddenVisibilities()
protected VisibilityEnum[] getFormHiddenVisibilities()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||