/**
   * Generates the field definition for the transient <code>rmRecordType</code> property
   *
   * @param form The Form instance to add the property to
   * @param nodeRef The node the form is being generated for
   */
  protected void generateRecordTypePropertyField(Form form, NodeRef nodeRef) {
    String dataKeyName = FormFieldConstants.PROP_DATA_PREFIX + TRANSIENT_RECORD_TYPE;
    PropertyFieldDefinition recordTypeField =
        new PropertyFieldDefinition(TRANSIENT_RECORD_TYPE, DataTypeDefinition.TEXT.getLocalName());
    recordTypeField.setLabel(TRANSIENT_RECORD_TYPE);
    recordTypeField.setDescription(TRANSIENT_RECORD_TYPE);
    recordTypeField.setProtectedField(true);
    recordTypeField.setDataKeyName(dataKeyName);
    form.addFieldDefinition(recordTypeField);

    // determine what record type value to return, use aspect/type title
    // from model
    String recordType = null;
    QName type = this.nodeService.getType(nodeRef);
    if (TYPE_NON_ELECTRONIC_DOCUMENT.equals(type)) {
      // get the non-electronic type title
      recordType = dictionaryService.getType(TYPE_NON_ELECTRONIC_DOCUMENT).getTitle();
    } else {
      // the aspect applied to record determines it's type
      if (nodeService.hasAspect(nodeRef, ASPECT_PDF_RECORD)) {
        recordType = dictionaryService.getAspect(ASPECT_PDF_RECORD).getTitle();
      } else if (nodeService.hasAspect(nodeRef, ASPECT_WEB_RECORD)) {
        recordType = dictionaryService.getAspect(ASPECT_WEB_RECORD).getTitle();
      } else if (nodeService.hasAspect(nodeRef, ASPECT_SCANNED_RECORD)) {
        recordType = dictionaryService.getAspect(ASPECT_SCANNED_RECORD).getTitle();
      } else if (nodeService.hasAspect(nodeRef, ASPECT_DIGITAL_PHOTOGRAPH_RECORD)) {
        recordType = dictionaryService.getAspect(ASPECT_DIGITAL_PHOTOGRAPH_RECORD).getTitle();
      } else {
        // no specific aspect applied so default to just "Record"
        recordType = dictionaryService.getAspect(ASPECT_RECORD).getTitle();
      }
    }

    form.addData(dataKeyName, recordType);
  }
 /**
  * Generates the field definition for the transient <code>rmDeclared</code> property.
  *
  * @param form The Form instance to add the property to
  * @param nodeRef The node the form is being generated for
  */
 protected void generateDeclaredPropertyField(Form form, NodeRef nodeRef) {
   // TODO should this be done using a new FieldProcessor?
   String dataKeyName = FormFieldConstants.PROP_DATA_PREFIX + TRANSIENT_DECLARED;
   PropertyFieldDefinition declaredField =
       new PropertyFieldDefinition(TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN.getLocalName());
   declaredField.setLabel(TRANSIENT_DECLARED);
   declaredField.setDescription(TRANSIENT_DECLARED);
   declaredField.setProtectedField(true);
   declaredField.setDataKeyName(dataKeyName);
   form.addFieldDefinition(declaredField);
   form.addData(dataKeyName, this.nodeService.hasAspect(nodeRef, ASPECT_DECLARED_RECORD));
 }
  /**
   * Generates the field definition for the transient <code>rmCategoryIdentifier</code> property
   *
   * @param form The Form instance to add the property to
   * @param nodeRef The node the form is being generated for
   */
  protected void generateCategoryIdentifierPropertyField(Form form, NodeRef nodeRef) {
    String dataKeyName = FormFieldConstants.PROP_DATA_PREFIX + TRANSIENT_CATEGORY_ID;
    PropertyFieldDefinition categoryIdField =
        new PropertyFieldDefinition(TRANSIENT_CATEGORY_ID, DataTypeDefinition.TEXT.getLocalName());
    categoryIdField.setLabel(TRANSIENT_CATEGORY_ID);
    categoryIdField.setDescription(TRANSIENT_CATEGORY_ID);
    categoryIdField.setProtectedField(true);
    categoryIdField.setDataKeyName(dataKeyName);
    form.addFieldDefinition(categoryIdField);

    // get the category id from the appropriate parent node
    NodeRef category = getRecordCategory(nodeRef);
    if (category != null) {
      String categoryId = (String) nodeService.getProperty(category, PROP_IDENTIFIER);
      if (categoryId != null) {
        form.addData(dataKeyName, categoryId);
      }
    }
  }
  /**
   * Generates the field definition for the transient <code>rmCategoryIdentifier</code> property
   *
   * @param form The Form instance to add the property to
   * @param nodeRef The node the form is being generated for
   */
  protected void generateDispositionInstructionsPropertyField(Form form, NodeRef nodeRef) {
    String dataKeyName = FormFieldConstants.PROP_DATA_PREFIX + TRANSIENT_DISPOSITION_INSTRUCTIONS;
    PropertyFieldDefinition dispInstructionsField =
        new PropertyFieldDefinition(
            TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT.getLocalName());
    dispInstructionsField.setLabel(TRANSIENT_DISPOSITION_INSTRUCTIONS);
    dispInstructionsField.setDescription(TRANSIENT_DISPOSITION_INSTRUCTIONS);
    dispInstructionsField.setProtectedField(true);
    dispInstructionsField.setDataKeyName(dataKeyName);
    form.addFieldDefinition(dispInstructionsField);

    // use RMService to get disposition instructions
    DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef);
    if (ds != null) {
      String instructions = ds.getDispositionInstructions();
      if (instructions != null) {
        form.addData(dataKeyName, instructions);
      }
    }
  }