// Now create a metadata template hierarchy. // First get the root template UUID. The root template provides an optional root for the template hierarchy // for a specific organization. Other templates don't have to inherit from the root template, but it's // a good convention. Templates that don't inherit from the root template won't show up in the Administrator // application. String rootTemplateUuid = metadataManager.getRootMetadataTemplateUuid(joeSchmoeAuth, engineeringUuid); // Create a label in the root template called 'Author' of type STRINGLIST - it may take multiple free-form strings // as values. By adding the label in the root template, all other templates will inherit the label. String authorLabelUuid = metadataManager.createMetadataLabelInTemplate(joeSchmoeAuth, rootTemplateUuid, "Author", // the 'Key' true, // required DataType.STRINGLIST, null, // default value null); // max length // Create a new template String designDrawingsTemplateUuid = metadataManager.createTemplate(joeSchmoeAuth, "Design Drawings", engineeringUuid); // Make the new template a child of the root template. It now inherits the "Author" label from the root template. metadataManager.addChildTemplate(joeSchmoeAuth, rootTemplateUuid, designDrawingsTemplateUuid); // Add labels to the new template String statusLabelUuid = metadataManager.createMetadataLabelInTemplate(joeSchmoeAuth, designDrawingsTemplateUuid, "Design Status", // the 'Key' true, // required DataType.PICKONE, null, // default value null); // max length String inProgressSelectionUuid = metadataManager.createMetadataSelection(joeSchmoeAuth, statusLabelUuid, DataType.STRING, "In Progress", null ); String inRevisionSelectionUuid = metadataManager.createMetadataSelection(joeSchmoeAuth, statusLabelUuid, DataType.STRING, "In Revision", null ); String acceptedSelectionUuid = metadataManager.createMetadataSelection(joeSchmoeAuth, statusLabelUuid, DataType.STRING, "Accepted", null ); String rejectedSelectionUuid = metadataManager.createMetadataSelection(joeSchmoeAuth, statusLabelUuid, DataType.STRING, "Rejected", null ); // Create another template for the number of hours that have been spent on this drawing String hoursWorkedLabelUuid = metadataManager.createMetadataLabelInTemplate(joeSchmoeAuth, designDrawingsTemplateUuid, "Hours Worked", false, DataType.NUMBER, null, // default value null); // max length ); // Create a new template that belongs to Joe himself. Creating a template that's owned by a // user (as opposed to an organization or group) is not possible in the Admininstrator // application, but it is allowed by the server. String joesDrawingsTemplateUuid = metadataManager.createTemplate(joeSchmoeAuth, "Joe's Design Work", joeSchmoeUuid); // Make Joe's new template a child of the "Design Drawings" template. Inter-organization // relationships between metadata templates is another thing that isn't possible to create in // the Administrator application at present, but it is allowed in the server and can be very useful. metadataManager.addChildTemplate(joeSchmoeAuth, designDrawingsTemplateUuid, joesDrawingsTemplateUuid); // Add a label to the template String joesNotesLabelUuid = metadataManager.createMetadataLabelInTemplate(joeSchmoeAuth, joesDrawingsTemplateUuid, "Joe's Notes", true, DataType.NOTES, null, // default value null); // max length