use of org.alfresco.repo.forms.Field in project records-management by Alfresco.
the class RecordsManagementNodeFormFilter method forceSupplementalMarkingListProperty.
/**
* Forces the "rmc:supplementalMarkingList" property to be present, if it is
* already on the given node this method does nothing, otherwise a property
* field definition is generated for the property.
*
* @param form The Form instance to add the property to
* @param nodeRef The node the form is being generated for
*/
protected void forceSupplementalMarkingListProperty(Form form, NodeRef nodeRef) {
if (!this.nodeService.hasAspect(nodeRef, RecordsManagementCustomModel.ASPECT_SUPPLEMENTAL_MARKING_LIST)) {
PropertyDefinition propDef = this.dictionaryService.getProperty(RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST);
if (propDef != null) {
Field field = FieldUtils.makePropertyField(propDef, null, null, namespaceService, dictionaryService);
form.addField(field);
} else if (logger.isWarnEnabled()) {
logger.warn("Could not add " + RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST.getLocalName() + " property as it's definition could not be found");
}
}
}
use of org.alfresco.repo.forms.Field in project records-management by Alfresco.
the class RecordsManagementFormFilter method addPropertyFieldsToGroup.
/**
* Add property fields to group
*
* @param form
* @param props
* @param setId
*/
protected void addPropertyFieldsToGroup(Form form, Map<QName, PropertyDefinition> props, String setId, String setLabel) {
if (props != null) {
for (Map.Entry<QName, PropertyDefinition> entry : props.entrySet()) {
PropertyDefinition prop = entry.getValue();
String id = form.getItem().getId();
id = id.replaceFirst("/", "://");
NodeRef nodeRef = new NodeRef(id);
Serializable value = nodeService.getProperty(nodeRef, entry.getKey());
FieldGroup group = new FieldGroup(setId, setLabel, false, false, null);
Field field = FieldUtils.makePropertyField(prop, value, group, namespaceService, dictionaryService);
form.addField(field);
if (logger.isDebugEnabled()) {
logger.debug("Adding custom property .. " + prop.getName().toString() + " .. with value " + value + ".. to group .. " + setId);
}
}
}
}
use of org.alfresco.repo.forms.Field in project records-management by Alfresco.
the class RecordsManagementTypeFormFilter method addCustomRMProperties.
/**
* Adds a property definition for each of the custom properties for the
* given RM type to the given form.
*
* @param rmTypeCustomAspect Enum representing the RM type to add custom
* properties for
* @param form The form to add the properties to
*/
protected void addCustomRMProperties(QName customisableType, Form form) {
ParameterCheck.mandatory("customisableType", customisableType);
ParameterCheck.mandatory("form", form);
Map<QName, PropertyDefinition> customProps = rmAdminService.getCustomPropertyDefinitions(customisableType);
if (customProps != null && !customProps.isEmpty()) {
if (logger.isDebugEnabled()) {
logger.debug("Found " + customProps.size() + " custom properties for customisable type " + customisableType);
}
// setup field definition for each custom property
Collection<PropertyDefinition> properties = customProps.values();
FieldGroup group = new FieldGroup(CUSTOM_RM_FIELD_GROUP_ID, null, false, false, null);
List<Field> fields = FieldUtils.makePropertyFields(properties, group, namespaceService, dictionaryService);
form.addFields(fields);
}
}
Aggregations