Search in sources :

Example 6 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class PropertyFieldProcessor method makePropertyFieldDefinition.

private PropertyFieldDefinition makePropertyFieldDefinition(final PropertyDefinition propDef, FieldGroup group) {
    String name = getPrefixedName(propDef);
    QName dataType = propDef.getDataType().getName();
    PropertyFieldDefinition fieldDef = new PropertyFieldDefinition(name, dataType.getLocalName());
    populateFieldDefinition(propDef, fieldDef, group, PROP_DATA_PREFIX);
    fieldDef.setDefaultValue(propDef.getDefaultValue());
    fieldDef.setMandatory(propDef.isMandatory());
    fieldDef.setRepeating(propDef.isMultiValued());
    fieldDef.setIndexTokenisationMode(propDef.getIndexTokenisationMode());
    // currently enforce this so make sure they are not editable
    if (NamespaceService.SYSTEM_MODEL_1_0_URI.equals(propDef.getName().getNamespaceURI())) {
        fieldDef.setProtectedField(true);
    }
    // type parameters object to represent the options and rules
    if (dataType.equals(DataTypeDefinition.PERIOD)) {
        PeriodDataTypeParameters periodOptions = getPeriodOptions();
        fieldDef.setDataTypeParameters(periodOptions);
    }
    // setup constraints for the property
    List<FieldConstraint> fieldConstraints = makeFieldConstraints(propDef);
    fieldDef.setConstraints(fieldConstraints);
    return fieldDef;
}
Also used : QName(org.alfresco.service.namespace.QName) PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition) FieldConstraint(org.alfresco.repo.forms.PropertyFieldDefinition.FieldConstraint)

Example 7 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class SizeFieldProcessor method makeTransientFieldDefinition.

@Override
protected FieldDefinition makeTransientFieldDefinition() {
    String dataKeyName = PROP_DATA_PREFIX + KEY;
    PropertyFieldDefinition sizeField = new PropertyFieldDefinition(KEY, DataTypeDefinition.LONG.getLocalName());
    sizeField.setLabel(I18NUtil.getMessage(MSG_SIZE_LABEL));
    sizeField.setDescription(I18NUtil.getMessage(MSG_SIZE_DESC));
    sizeField.setDataKeyName(dataKeyName);
    sizeField.setProtectedField(true);
    return sizeField;
}
Also used : PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Example 8 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class EncodingFieldProcessor method makeTransientFieldDefinition.

@Override
protected FieldDefinition makeTransientFieldDefinition() {
    String dataKeyName = PROP_DATA_PREFIX + KEY;
    PropertyFieldDefinition encodingField = new PropertyFieldDefinition(KEY, DataTypeDefinition.TEXT.getLocalName());
    encodingField.setLabel(I18NUtil.getMessage(MSG_ENCODING_LABEL));
    encodingField.setDescription(I18NUtil.getMessage(MSG_ENCODING_DESC));
    encodingField.setDataKeyName(dataKeyName);
    return encodingField;
}
Also used : PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Example 9 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class MessageFieldProcessor method makeTransientFieldDefinition.

/* (non-Javadoc)
     * @see org.alfresco.repo.forms.processor.node.TransientFieldProcessor#makeTransientPropertyDefinition()
     */
@Override
protected FieldDefinition makeTransientFieldDefinition() {
    PropertyFieldDefinition fieldDef = new PropertyFieldDefinition(KEY, DATA_TYPE);
    fieldDef.setRepeating(false);
    fieldDef.setProtectedField(true);
    fieldDef.setLabel(I18NUtil.getMessage(MSG_LABEL));
    fieldDef.setDescription(I18NUtil.getMessage(MSG_DESCRIPTION));
    fieldDef.setDataKeyName(PROP_DATA_PREFIX + KEY);
    return fieldDef;
}
Also used : PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Example 10 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class ActionFormProcessorTest method validateExecuteAsynchronouslyField.

private void validateExecuteAsynchronouslyField(Map<String, FieldDefinition> fieldDefMap) {
    // executeAsynchronously
    PropertyFieldDefinition execAsync = (PropertyFieldDefinition) fieldDefMap.get("executeAsynchronously");
    assertNotNull("'executeAsynchronously' field defn was missing.", execAsync);
    assertEquals("'executeAsynchronously' name was wrong", "executeAsynchronously", execAsync.getName());
    assertEquals("'executeAsynchronously' label was wrong", "executeAsynchronously", execAsync.getLabel());
    assertNull("'executeAsynchronously' description was wrong", execAsync.getDescription());
    assertEquals("'executeAsynchronously' datatype was wrong", "boolean", execAsync.getDataType());
}
Also used : PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Aggregations

PropertyFieldDefinition (org.alfresco.repo.forms.PropertyFieldDefinition)10 Field (org.alfresco.repo.forms.Field)1 FieldConstraint (org.alfresco.repo.forms.PropertyFieldDefinition.FieldConstraint)1 QName (org.alfresco.service.namespace.QName)1