本文整理汇总了Java中org.broadleafcommerce.common.presentation.client.VisibilityEnum类的典型用法代码示例。如果您正苦于以下问题:Java VisibilityEnum类的具体用法?Java VisibilityEnum怎么用?Java VisibilityEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisibilityEnum类属于org.broadleafcommerce.common.presentation.client包,在下文中一共展示了VisibilityEnum类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConsolidatedOptionField
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
/**
* Creates the metadata necessary for displaying all of the product option values in a single field. The display of this
* field is a single string with every product option value appended to it separated by a semicolon. This method should
* be invoked on an inspect for whatever is utilizing this so that the property will be ready to be populated on fetch.
*
* The metadata that is returned will also be set to prominent by default so that it will be ready to display on whatever
* grid is being inspected. If you do not want this behavior you will need to override this functionality in the metadata
* that is returned.
*
* @param inheritedFromType which type this should appear on. This would normally be SkuImpl.class, but if you want to
* display this field with a different entity then this should be that entity
* @return
*/
public static FieldMetadata createConsolidatedOptionField(Class<?> inheritedFromType) {
BasicFieldMetadata metadata = new BasicFieldMetadata();
metadata.setFieldType(SupportedFieldType.STRING);
metadata.setMutable(false);
metadata.setInheritedFromType(inheritedFromType.getName());
metadata.setAvailableToTypes(new String[] { SkuImpl.class.getName() });
metadata.setForeignKeyCollection(false);
metadata.setMergedPropertyType(MergedPropertyType.PRIMARY);
metadata.setName(CONSOLIDATED_PRODUCT_OPTIONS_FIELD_NAME);
metadata.setFriendlyName(CONSOLIDATED_PRODUCT_OPTIONS_FIELD_NAME);
metadata.setGroup("");
metadata.setExplicitFieldType(SupportedFieldType.UNKNOWN);
metadata.setProminent(true);
metadata.setVisibility(VisibilityEnum.FORM_HIDDEN);
metadata.setBroadleafEnumeration("");
metadata.setReadOnly(true);
metadata.setRequiredOverride(false);
metadata.setGridOrder(Integer.MAX_VALUE);
return metadata;
}
示例2: createConsolidatedOptionField
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
/**
* Creates the metadata necessary for displaying all of the product option values in a single field. The display of this
* field is a single string with every product option value appended to it separated by a semicolon. This method should
* be invoked on an inspect for whatever is utilizing this so that the property will be ready to be populated on fetch.
*
* The metadata that is returned will also be set to prominent by default so that it will be ready to display on whatever
* grid is being inspected. If you do not want this behavior you will need to override this functionality in the metadata
* that is returned.
*
* @param inheritedFromType which type this should appear on. This would normally be SkuImpl.class, but if you want to
* display this field with a different entity then this should be that entity
* @return
*/
public FieldMetadata createConsolidatedOptionField(Class<?> inheritedFromType) {
BasicFieldMetadata metadata = new BasicFieldMetadata();
metadata.setFieldType(SupportedFieldType.STRING);
metadata.setMutable(false);
metadata.setInheritedFromType(inheritedFromType.getName());
metadata.setAvailableToTypes(getPolymorphicClasses(SkuImpl.class));
metadata.setForeignKeyCollection(false);
metadata.setMergedPropertyType(MergedPropertyType.PRIMARY);
metadata.setName(CONSOLIDATED_PRODUCT_OPTIONS_FIELD_NAME);
metadata.setFriendlyName(CONSOLIDATED_PRODUCT_OPTIONS_FIELD_NAME);
metadata.setGroup("");
metadata.setExplicitFieldType(SupportedFieldType.UNKNOWN);
metadata.setProminent(true);
metadata.setVisibility(VisibilityEnum.FORM_HIDDEN);
metadata.setBroadleafEnumeration("");
metadata.setReadOnly(true);
metadata.setRequiredOverride(false);
metadata.setGridOrder(Integer.MAX_VALUE);
return metadata;
}
示例3: extractPropertiesFromMetadata
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
protected void extractPropertiesFromMetadata(Class<?>[] inheritanceLine, Map<String, FieldMetadata> mergedProperties, List<Property> properties, Boolean isHiddenOverride, MergedPropertyType type) {
for (Map.Entry<String, FieldMetadata> entry : mergedProperties.entrySet()) {
String property = entry.getKey();
Property prop = new Property();
FieldMetadata metadata = mergedProperties.get(property);
prop.setName(property);
Comparator<Property> comparator = new Comparator<Property>() {
@Override
public int compare(Property o1, Property o2) {
return o1.getName().compareTo(o2.getName());
}
};
Collections.sort(properties, comparator);
int pos = Collections.binarySearch(properties, prop, comparator);
if (pos >= 0 && MergedPropertyType.MAPSTRUCTUREKEY != type && MergedPropertyType.MAPSTRUCTUREVALUE != type) {
logWarn: {
if ((metadata instanceof BasicFieldMetadata) && SupportedFieldType.ID.equals(((BasicFieldMetadata) metadata).getFieldType())) {
//don't warn for id field collisions, but still ignore the colliding fields
break logWarn;
}
LOG.warn("Detected a field name collision (" + metadata.getTargetClass() + "." + property + ") during inspection for the inheritance line starting with (" + inheritanceLine[0].getName() + "). Ignoring the additional field. This can occur most commonly when using the @AdminPresentationAdornedTargetCollection and the collection type and target class have field names in common. This situation should be avoided, as the system will strip the repeated fields, which can cause unpredictable behavior.");
}
continue;
}
properties.add(prop);
prop.setMetadata(metadata);
if (isHiddenOverride && prop.getMetadata() instanceof BasicFieldMetadata) {
//this only makes sense for non collection types
((BasicFieldMetadata) prop.getMetadata()).setVisibility(VisibilityEnum.HIDDEN_ALL);
}
}
}
示例4: createIndividualOptionField
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
/**
* <p>Creates an individual property for the specified product option. This should set up an enum field whose values will
* be the option values for this option. This is useful when you would like to display each product option in as its
* own field in a grid so that you can further filter by product option values.</p>
* <p>In order for these fields to be utilized property on the fetch, in the GWT frontend you must use the
* for your datasource.</p>
*
* @param option
* @param order
* @return
*/
public static FieldMetadata createIndividualOptionField(ProductOption option, int order) {
BasicFieldMetadata metadata = new BasicFieldMetadata();
List<ProductOptionValue> allowedValues = option.getAllowedValues();
if (CollectionUtils.isNotEmpty(allowedValues)) {
metadata.setFieldType(SupportedFieldType.EXPLICIT_ENUMERATION);
metadata.setMutable(true);
metadata.setInheritedFromType(SkuImpl.class.getName());
metadata.setAvailableToTypes(new String[] { SkuImpl.class.getName() });
metadata.setForeignKeyCollection(false);
metadata.setMergedPropertyType(MergedPropertyType.PRIMARY);
//Set up the enumeration based on the product option values
String[][] optionValues = new String[allowedValues.size()][2];
for (int i = 0; i < allowedValues.size(); i++) {
ProductOptionValue value = option.getAllowedValues().get(i);
optionValues[i][0] = value.getId().toString();
optionValues[i][1] = value.getAttributeValue();
}
metadata.setEnumerationValues(optionValues);
metadata.setName(PRODUCT_OPTION_FIELD_PREFIX + option.getId());
metadata.setFriendlyName(option.getLabel());
metadata.setGroup("productOption_group");
metadata.setGroupOrder(-1);
metadata.setOrder(order);
metadata.setExplicitFieldType(SupportedFieldType.UNKNOWN);
metadata.setProminent(false);
metadata.setVisibility(VisibilityEnum.FORM_EXPLICITLY_SHOWN);
metadata.setBroadleafEnumeration("");
metadata.setReadOnly(false);
metadata.setRequiredOverride(BooleanUtils.isFalse(option.getRequired()));
return metadata;
}
return null;
}
示例5: extractPropertiesFromMetadata
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
protected void extractPropertiesFromMetadata(Class<?>[] inheritanceLine, Map<String, FieldMetadata> mergedProperties, List<Property> properties, Boolean isHiddenOverride, MergedPropertyType type) {
for (Map.Entry<String, FieldMetadata> entry : mergedProperties.entrySet()) {
String property = entry.getKey();
Property prop = new Property();
FieldMetadata metadata = mergedProperties.get(property);
prop.setName(property);
Comparator<Property> comparator = new Comparator<Property>() {
@Override
public int compare(Property o1, Property o2) {
return o1.getName().compareTo(o2.getName());
}
};
Collections.sort(properties, comparator);
int pos = Collections.binarySearch(properties, prop, comparator);
if (pos >= 0 && MergedPropertyType.MAPSTRUCTUREKEY != type && MergedPropertyType.MAPSTRUCTUREVALUE != type) {
logWarn: {
if ((metadata instanceof BasicFieldMetadata) && SupportedFieldType.ID.equals(((BasicFieldMetadata) metadata).getFieldType())) {
//don't warn for id field collisions, but still ignore the colliding fields
break logWarn;
}
//LOG.warn("Detected a field name collision (" + metadata.getTargetClass() + "." + property + ") during inspection for the inheritance line starting with (" + inheritanceLine[0].getName() + "). Ignoring the additional field. This can occur most commonly when using the @AdminPresentationAdornedTargetCollection and the collection type and target class have field names in common. This situation should be avoided, as the system will strip the repeated fields, which can cause unpredictable behavior.");
}
continue;
}
properties.add(prop);
prop.setMetadata(metadata);
if (isHiddenOverride && prop.getMetadata() instanceof BasicFieldMetadata) {
//this only makes sense for non collection types
((BasicFieldMetadata) prop.getMetadata()).setVisibility(VisibilityEnum.HIDDEN_ALL);
}
}
}
示例6: createIndividualOptionField
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
/**
* <p>Creates an individual property for the specified product option. This should set up an enum field whose values will
* be the option values for this option. This is useful when you would like to display each product option in as its
* own field in a grid so that you can further filter by product option values.</p>
* <p>In order for these fields to be utilized property on the fetch, in the GWT frontend you must use the
* for your datasource.</p>
*
* @param option
* @param order
* @return
*/
public FieldMetadata createIndividualOptionField(ProductOption option, int order) {
BasicFieldMetadata metadata = new BasicFieldMetadata();
List<ProductOptionValue> allowedValues = option.getAllowedValues();
if (CollectionUtils.isNotEmpty(allowedValues)) {
metadata.setFieldType(SupportedFieldType.EXPLICIT_ENUMERATION);
metadata.setMutable(true);
metadata.setInheritedFromType(SkuImpl.class.getName());
metadata.setAvailableToTypes(getPolymorphicClasses(SkuImpl.class));
metadata.setForeignKeyCollection(false);
metadata.setMergedPropertyType(MergedPropertyType.PRIMARY);
//Set up the enumeration based on the product option values
String[][] optionValues = new String[allowedValues.size()][2];
for (int i = 0; i < allowedValues.size(); i++) {
ProductOptionValue value = option.getAllowedValues().get(i);
optionValues[i][0] = value.getId().toString();
optionValues[i][1] = value.getAttributeValue();
}
metadata.setEnumerationValues(optionValues);
metadata.setName(PRODUCT_OPTION_FIELD_PREFIX + option.getId());
metadata.setFriendlyName(option.getLabel());
metadata.setGroup("productOption_group");
metadata.setGroupOrder(-1);
metadata.setOrder(order);
metadata.setExplicitFieldType(SupportedFieldType.UNKNOWN);
metadata.setProminent(false);
metadata.setVisibility(VisibilityEnum.FORM_EXPLICITLY_SHOWN);
metadata.setBroadleafEnumeration("");
metadata.setReadOnly(false);
metadata.setRequiredOverride(BooleanUtils.isFalse(option.getRequired()));
return metadata;
}
return null;
}
示例7: buildAdornedListForm
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
@Override
public EntityForm buildAdornedListForm(AdornedTargetCollectionMetadata adornedMd, AdornedTargetList adornedList,
String parentId, EntityForm ef)
throws ServiceException {
ef.setEntityType(adornedList.getAdornedTargetEntityClassname());
// Get the metadata for this adorned field
PersistencePackageRequest request = PersistencePackageRequest.adorned()
.withCeilingEntityClassname(adornedMd.getCollectionCeilingEntity())
.withAdornedList(adornedList);
ClassMetadata collectionMetadata = adminEntityService.getClassMetadata(request).getDynamicResultSet().getClassMetaData();
// We want our entity form to only render the maintained adorned target fields
List<Property> entityFormProperties = new ArrayList<Property>();
for (String targetFieldName : adornedMd.getMaintainedAdornedTargetFields()) {
Property p = collectionMetadata.getPMap().get(targetFieldName);
if (p.getMetadata() instanceof BasicFieldMetadata) {
((BasicFieldMetadata) p.getMetadata()).setVisibility(VisibilityEnum.VISIBLE_ALL);
entityFormProperties.add(p);
}
}
// Set the maintained fields on the form
setEntityFormFields(ef, entityFormProperties);
// Add these two additional hidden fields that are required for persistence
Field f = new Field()
.withName(adornedList.getLinkedObjectPath() + "." + adornedList.getLinkedIdProperty())
.withFieldType(SupportedFieldType.HIDDEN.toString())
.withValue(parentId);
ef.addHiddenField(f);
f = new Field()
.withName(adornedList.getTargetObjectPath() + "." + adornedList.getTargetIdProperty())
.withFieldType(SupportedFieldType.HIDDEN.toString())
.withIdOverride("adornedTargetIdProperty");
ef.addHiddenField(f);
if (StringUtils.isNotBlank(adornedList.getSortField())) {
f = new Field()
.withName(adornedList.getSortField())
.withFieldType(SupportedFieldType.HIDDEN.toString());
ef.addHiddenField(f);
}
ef.setParentId(parentId);
return ef;
}
示例8: getGridHiddenVisibilities
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
protected VisibilityEnum[] getGridHiddenVisibilities() {
return FormBuilderServiceImpl.GRID_HIDDEN_VISIBILITIES;
}
示例9: getFormHiddenVisibilities
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
protected VisibilityEnum[] getFormHiddenVisibilities() {
return FormBuilderServiceImpl.FORM_HIDDEN_VISIBILITIES;
}
示例10: getVisibility
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
public VisibilityEnum getVisibility() {
return visibility;
}
示例11: setVisibility
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
public void setVisibility(VisibilityEnum visibility) {
this.visibility = visibility;
}
示例12: getPropertiesForPrimitiveClass
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
@Override
public Map<String, FieldMetadata> getPropertiesForPrimitiveClass(
String propertyName,
String friendlyPropertyName,
Class<?> targetClass,
Class<?> parentClass,
MergedPropertyType mergedPropertyType
) {
Map<String, FieldMetadata> fields = new HashMap<String, FieldMetadata>();
BasicFieldMetadata presentationAttribute = new BasicFieldMetadata();
presentationAttribute.setFriendlyName(friendlyPropertyName);
if (String.class.isAssignableFrom(targetClass)) {
presentationAttribute.setExplicitFieldType(SupportedFieldType.STRING);
presentationAttribute.setVisibility(VisibilityEnum.VISIBLE_ALL);
fields.put(propertyName, metadata.getFieldMetadata("", propertyName, null, SupportedFieldType.STRING, null, parentClass, presentationAttribute, mergedPropertyType, this));
} else if (Boolean.class.isAssignableFrom(targetClass)) {
presentationAttribute.setExplicitFieldType(SupportedFieldType.BOOLEAN);
presentationAttribute.setVisibility(VisibilityEnum.VISIBLE_ALL);
fields.put(propertyName, metadata.getFieldMetadata("", propertyName, null, SupportedFieldType.BOOLEAN, null, parentClass, presentationAttribute, mergedPropertyType, this));
} else if (Date.class.isAssignableFrom(targetClass)) {
presentationAttribute.setExplicitFieldType(SupportedFieldType.DATE);
presentationAttribute.setVisibility(VisibilityEnum.VISIBLE_ALL);
fields.put(propertyName, metadata.getFieldMetadata("", propertyName, null, SupportedFieldType.DATE, null, parentClass, presentationAttribute, mergedPropertyType, this));
} else if (Money.class.isAssignableFrom(targetClass)) {
presentationAttribute.setExplicitFieldType(SupportedFieldType.MONEY);
presentationAttribute.setVisibility(VisibilityEnum.VISIBLE_ALL);
fields.put(propertyName, metadata.getFieldMetadata("", propertyName, null, SupportedFieldType.MONEY, null, parentClass, presentationAttribute, mergedPropertyType, this));
} else if (
Byte.class.isAssignableFrom(targetClass) ||
Integer.class.isAssignableFrom(targetClass) ||
Long.class.isAssignableFrom(targetClass) ||
Short.class.isAssignableFrom(targetClass)
) {
presentationAttribute.setExplicitFieldType(SupportedFieldType.INTEGER);
presentationAttribute.setVisibility(VisibilityEnum.VISIBLE_ALL);
fields.put(propertyName, metadata.getFieldMetadata("", propertyName, null, SupportedFieldType.INTEGER, null, parentClass, presentationAttribute, mergedPropertyType, this));
} else if (
Double.class.isAssignableFrom(targetClass) ||
BigDecimal.class.isAssignableFrom(targetClass)
) {
presentationAttribute.setExplicitFieldType(SupportedFieldType.DECIMAL);
presentationAttribute.setVisibility(VisibilityEnum.VISIBLE_ALL);
fields.put(propertyName, metadata.getFieldMetadata("", propertyName, null, SupportedFieldType.DECIMAL, null, parentClass, presentationAttribute, mergedPropertyType, this));
}
((BasicFieldMetadata) fields.get(propertyName)).setLength(255);
((BasicFieldMetadata) fields.get(propertyName)).setForeignKeyCollection(false);
((BasicFieldMetadata) fields.get(propertyName)).setRequired(true);
((BasicFieldMetadata) fields.get(propertyName)).setUnique(true);
((BasicFieldMetadata) fields.get(propertyName)).setScale(100);
((BasicFieldMetadata) fields.get(propertyName)).setPrecision(100);
return fields;
}
示例13: addMetadataFromFieldType
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
@Override
public FieldProviderResponse addMetadataFromFieldType(AddMetadataFromFieldTypeRequest addMetadataFromFieldTypeRequest, Map<String, FieldMetadata> metadata) {
if (!canHandleFieldForTypeMetadata(addMetadataFromFieldTypeRequest, metadata)) {
return FieldProviderResponse.NOT_HANDLED;
}
CollectionMetadata fieldMetadata = (CollectionMetadata) addMetadataFromFieldTypeRequest.getPresentationAttribute();
if (StringUtils.isEmpty(fieldMetadata.getCollectionCeilingEntity())) {
ParameterizedType listType = (ParameterizedType) addMetadataFromFieldTypeRequest.getRequestedField().getGenericType();
Class<?> listClass = (Class<?>) listType.getActualTypeArguments()[0];
fieldMetadata.setCollectionCeilingEntity(listClass.getName());
}
if (addMetadataFromFieldTypeRequest.getTargetClass() != null) {
if (StringUtils.isEmpty(fieldMetadata.getInheritedFromType())) {
fieldMetadata.setInheritedFromType(addMetadataFromFieldTypeRequest.getTargetClass().getName());
}
if (ArrayUtils.isEmpty(fieldMetadata.getAvailableToTypes())) {
fieldMetadata.setAvailableToTypes(new String[]{addMetadataFromFieldTypeRequest.getTargetClass().getName()});
}
}
// Handle scenarios where the collection metadata is also a foreign key. The {@link BasicFieldMetadata} that has all
// of the information about the foreign key will travel along with the built {@link BasicCollectionMetadata} under
// the {@link FieldMetadata#getAdditionalMetadata()} field. This is then pulled out within
// {@link BasicPersistenceModule#filterOutCollectionMetadata}
if (addMetadataFromFieldTypeRequest.getForeignField() != null && addMetadataFromFieldTypeRequest.isPropertyForeignKey()) {
FieldInfo info = buildFieldInfo(addMetadataFromFieldTypeRequest.getRequestedField());
BasicFieldMetadata basicMetadata = new BasicFieldMetadata();
basicMetadata.setName(info.getName());
basicMetadata.setExcluded(false);
// Don't show this anywhere on the form and ensure it's explicitly not required
basicMetadata.setVisibility(VisibilityEnum.HIDDEN_ALL);
basicMetadata.setRequired(false);
setClassOwnership(addMetadataFromFieldTypeRequest.getReturnedClass(), addMetadataFromFieldTypeRequest.getTargetClass(), metadata, info);
Map<String, FieldMetadata> fakedMd = new HashMap<String, FieldMetadata>();
fakedMd.put(addMetadataFromFieldTypeRequest.getRequestedField().getName(), basicMetadata);
// Fake out a request and some metadata to pass along as additional metadata within this metadata
AddMetadataFromFieldTypeRequest fakedRequest = new AddMetadataFromFieldTypeRequest(addMetadataFromFieldTypeRequest.getRequestedField(),
addMetadataFromFieldTypeRequest.getTargetClass(),
addMetadataFromFieldTypeRequest.getForeignField(),
addMetadataFromFieldTypeRequest.getAdditionalForeignFields(),
addMetadataFromFieldTypeRequest.getMergedPropertyType(),
addMetadataFromFieldTypeRequest.getComponentProperties(),
addMetadataFromFieldTypeRequest.getIdProperty(),
addMetadataFromFieldTypeRequest.getPrefix(),
addMetadataFromFieldTypeRequest.getRequestedPropertyName(),
addMetadataFromFieldTypeRequest.getType(),
addMetadataFromFieldTypeRequest.isPropertyForeignKey(),
addMetadataFromFieldTypeRequest.getAdditionalForeignKeyIndexPosition(),
fakedMd,
basicMetadata,
addMetadataFromFieldTypeRequest.getExplicitType(),
addMetadataFromFieldTypeRequest.getReturnedClass(),
addMetadataFromFieldTypeRequest.getDynamicEntityDao());
defaultMetadataProvider.addMetadataFromFieldType(fakedRequest, fakedMd);
fieldMetadata.getAdditionalMetadata().put(FOREIGN_KEY_ADDITIONAL_METADATA_KEY, basicMetadata);
}
metadata.put(addMetadataFromFieldTypeRequest.getRequestedPropertyName(), fieldMetadata);
return FieldProviderResponse.HANDLED;
}
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:62,代码来源:AdvancedCollectionFieldMetadataProvider.java
示例14: buildDynamicProperty
import org.broadleafcommerce.common.presentation.client.VisibilityEnum; //导入依赖的package包/类
public Property buildDynamicProperty(FieldDefinition definition, Class<?> inheritedType) {
Property property = new Property();
property.setName(definition.getName());
BasicFieldMetadata fieldMetadata = new BasicFieldMetadata();
property.setMetadata(fieldMetadata);
fieldMetadata.setFieldType(definition.getFieldType());
fieldMetadata.setMutable(true);
fieldMetadata.setInheritedFromType(inheritedType.getName());
fieldMetadata.setAvailableToTypes(new String[] {inheritedType.getName()});
fieldMetadata.setForeignKeyCollection(false);
fieldMetadata.setMergedPropertyType(MergedPropertyType.PRIMARY);
fieldMetadata.setLength(definition.getMaxLength());
if (definition.getDataDrivenEnumeration() != null && !CollectionUtils.isEmpty(definition.getDataDrivenEnumeration().getEnumValues())) {
int count = definition.getDataDrivenEnumeration().getEnumValues().size();
String[][] enumItems = new String[count][2];
for (int j = 0; j < count; j++) {
DataDrivenEnumerationValue item = definition.getDataDrivenEnumeration().getEnumValues().get(j);
enumItems[j][0] = item.getKey();
enumItems[j][1] = item.getDisplay();
}
fieldMetadata.setEnumerationValues(enumItems);
}
fieldMetadata.setName(definition.getName());
fieldMetadata.setFriendlyName(definition.getFriendlyName());
fieldMetadata.setSecurityLevel(definition.getSecurityLevel()==null?"":definition.getSecurityLevel());
fieldMetadata.setVisibility(definition.getHiddenFlag()?VisibilityEnum.HIDDEN_ALL:VisibilityEnum.VISIBLE_ALL);
fieldMetadata.setTab("General");
fieldMetadata.setTabOrder(100);
fieldMetadata.setExplicitFieldType(SupportedFieldType.UNKNOWN);
fieldMetadata.setLargeEntry(definition.getTextAreaFlag());
fieldMetadata.setProminent(false);
fieldMetadata.setColumnWidth(String.valueOf(definition.getColumnWidth()));
fieldMetadata.setBroadleafEnumeration("");
fieldMetadata.setReadOnly(false);
fieldMetadata.setRequiredOverride(definition.getRequiredFlag());
fieldMetadata.setHint(definition.getHint());
fieldMetadata.setHelpText(definition.getHelpText());
fieldMetadata.setTooltip(definition.getTooltip());
fieldMetadata.setTranslatable(true);
if (definition.getValidationRegEx() != null) {
Map<String, String> itemMap = new HashMap<String, String>();
itemMap.put("regularExpression", definition.getValidationRegEx());
itemMap.put(ConfigurationItem.ERROR_MESSAGE, definition.getValidationErrorMesageKey());
fieldMetadata.getValidationConfigurations().put("org.broadleafcommerce.openadmin.server.service.persistence.validation.RegexPropertyValidator", itemMap);
}
if (definition.getFieldType().equals(SupportedFieldType.ADDITIONAL_FOREIGN_KEY)) {
fieldMetadata.setForeignKeyClass(definition.getAdditionalForeignKeyClass());
fieldMetadata.setOwningClass(definition.getAdditionalForeignKeyClass());
fieldMetadata.setForeignKeyDisplayValueProperty("__adminMainEntity");
}
return property;
}