コード例 #1
0
 /**
  * Finds the MaintainableCollectionDefinition corresponding to the given collection name. For
  * example, if the collection name is "A.B.C", it will attempt to find the
  * MaintainableCollectionDefinition for C that is nested in B that is nested under A. This may not
  * work correctly if there are duplicate collection definitions within the sections
  *
  * @param sections the sections of a maint doc
  * @param collectionName the name of a collection, relative to the root of the BO being
  *     maintained. This value may have index values (e.g. [1]), but these are ignored.
  * @return
  */
 public static MaintainableCollectionDefinition findMaintainableCollectionDefinition(
     List<MaintainableSectionDefinition> sections, String collectionName) {
   String[] collectionNameParts = StringUtils.split(collectionName, ".");
   for (MaintainableSectionDefinition section : sections) {
     MaintainableCollectionDefinition collDefinition =
         findMaintainableCollectionDefinitionHelper(
             section.getMaintainableItems(), collectionNameParts, 0);
     if (collDefinition != null) {
       return collDefinition;
     }
   }
   return null;
 }
コード例 #2
0
  public static Map<String, AttributeSecurity> retrievePropertyPathToAttributeSecurityMappings(
      String docTypeName) {
    Map<String, AttributeSecurity> results = new HashMap<String, AttributeSecurity>();
    MaintenanceDocumentEntry entry =
        getMaintenanceDocumentDictionaryService().getMaintenanceDocumentEntry(docTypeName);
    String className = entry.getDataObjectClass().getName();

    for (MaintainableSectionDefinition section : entry.getMaintainableSections()) {
      for (MaintainableItemDefinition item : section.getMaintainableItems()) {
        if (item instanceof MaintainableFieldDefinition) {
          MaintainableFieldDefinition field = (MaintainableFieldDefinition) item;
          AttributeSecurity attributeSecurity =
              getDataDictionaryService().getAttributeSecurity(className, field.getName());
          if (attributeSecurity != null) {
            results.put(field.getName(), attributeSecurity);
          }
        } else if (item instanceof MaintainableCollectionDefinition) {
          addMaintenanceDocumentCollectionPathToSecurityMappings(
              results, "", (MaintainableCollectionDefinition) item);
        }
      }
    }
    return results;
  }