You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2011/11/02 09:49:46 UTC
svn commit: r1196504 [2/7] - in /chemistry/playground/moreq2010/moreq2010:
main/ main/java/ main/java/org/ main/java/org/apache/
main/java/org/apache/chemistry/ main/java/org/apache/chemistry/moreq2010/
main/java/org/apache/chemistry/moreq2010/util/ ma...
Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Dump.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Dump.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Dump.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/Dump.java Wed Nov 2 08:49:45 2011
@@ -0,0 +1,946 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.moreq2010.util;
+
+//import static java.lang.System.out;
+
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.apache.chemistry.moreq2010.jaxb.AceTYPE;
+import org.apache.chemistry.moreq2010.jaxb.AggregationTYPE;
+import org.apache.chemistry.moreq2010.jaxb.AggregationsTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ClassTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ClassesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ComplianceTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ComponentTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ComponentsTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ContextualdefinitionTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ContextualelementTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ContextualelementsTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ContextualmetadataTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DatatypeTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DisposalholdTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DisposalholdsTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DisposalscheduleTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DisposalschedulesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.DuplicatesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.EntityaclTYPE;
+import org.apache.chemistry.moreq2010.jaxb.EventTYPE;
+import org.apache.chemistry.moreq2010.jaxb.EventsTYPE;
+import org.apache.chemistry.moreq2010.jaxb.Export;
+import org.apache.chemistry.moreq2010.jaxb.FunctiondefinitionsTYPE;
+import org.apache.chemistry.moreq2010.jaxb.GroupTYPE;
+import org.apache.chemistry.moreq2010.jaxb.GroupmembershipTYPE;
+import org.apache.chemistry.moreq2010.jaxb.GroupsTYPE;
+import org.apache.chemistry.moreq2010.jaxb.HeldTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ImplementsmodulesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ImplementsservicesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.MceTYPE;
+import org.apache.chemistry.moreq2010.jaxb.McrscertificatesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.MetadatachangesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.RecordTYPE;
+import org.apache.chemistry.moreq2010.jaxb.RecordsTYPE;
+import org.apache.chemistry.moreq2010.jaxb.RoleTYPE;
+import org.apache.chemistry.moreq2010.jaxb.RolesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ServiceTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ServicepropertiesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ServicesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TemplateTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TemplateclassesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TemplatecontextualmetadataTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TemplateentitytypesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TemplatesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TemplateservicesTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TextualTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TitularTYPE;
+import org.apache.chemistry.moreq2010.jaxb.TransformationentryTYPE;
+import org.apache.chemistry.moreq2010.jaxb.UserTYPE;
+import org.apache.chemistry.moreq2010.jaxb.UsersTYPE;
+import org.apache.chemistry.moreq2010.jaxb.ValueTYPE;
+
+public class Dump {
+
+ PrintWriter out;
+ private static int INDENT_WIDTH = 2;
+
+ public Dump() {
+ out = new PrintWriter(System.out, true);
+ }
+
+ public Dump(Writer writer) {
+ out = new PrintWriter(writer, true);
+ }
+
+ /**
+ * Print information about the export object to System.out
+ * @param export
+ */
+ public void dumpInfo(Export export, String fileName) {
+
+ out.println();
+ out.println();
+ out.println("*********************************************************************** ");
+ out.println("Dumping information about XML file " + fileName);
+ out.println();
+
+ out.println("Export commencing: " + dump(export.getExportCommencing()));
+ out.println("Export id: " + export.getExportId());
+ out.println("Export comment: " + dump(export.getExportComment()));
+ out.println("Export completed: " + dump(export.getExportCompleted()));
+ out.println();
+ out.println("Export compliance: ");
+ dump(export.getCompliance(), INDENT_WIDTH);
+ out.println("Export services: ");
+ dump(export.getServices(), INDENT_WIDTH);
+ out.println("Export metadata definitions: ");
+ dump(export.getContextualMetadataDefinitions(), INDENT_WIDTH);
+ out.println("Export events: ");
+ dump(export.getEvents(), INDENT_WIDTH);
+ out.println();
+ out.println("*********************************************************************** ");
+ }
+
+ public void dump(ComplianceTYPE compliance, int indent) {
+
+ out.println(ind(indent) + "implemented modules: " + compliance.getImplementsModules().getImplementsModuleId().size());
+ for (String id: compliance.getImplementsModules().getImplementsModuleId()) {
+ ModuleDescription md = ModuleDescription.getModuleInfo(id);
+ if (md == null)
+ out.println(ind(indent) + "module name UNKNOWN, id: " + id);
+ else
+ out.println(ind(indent) + "module name: " + md.getName() + " (" + md.getId() + ")");
+
+ }
+ out.println(ind(indent) + "implemented services: " + compliance.getImplementsServices().getImplementsServiceId().size());
+ for (String id: compliance.getImplementsServices().getImplementsServiceId()) {
+ ServiceDescription sd = ServiceDescription.getServiceInfo(id);
+ if (sd == null)
+ out.println(ind(indent) + "service id: UNKNOWN");
+ else
+ out.println(ind(indent) + "service name: " + sd.getName() + " (" + sd.getId() + ")");
+ }
+ }
+
+ public void dump(ServicesTYPE services, int indent) {
+ out.println(ind(indent) + "Services: " + services.getService().size());
+ for (ServiceTYPE svc: services.getService())
+ dump(svc, indent);
+ }
+
+
+ private void dump(ServiceTYPE svc, int indent) {
+ String systemId = svc.getSystemId();
+ ServiceDescription svcInfo = ServiceDescription.getServiceInfo(systemId);
+ out.println(ind(indent) + "Service name " + (svcInfo==null ? "UNKNOWN (" + systemId + ")" :
+ svcInfo.getName() + "(" + svcInfo.getId() + ")") );
+
+ ServicepropertiesTYPE props = svc.getServiceProperties();
+ if (props != null) {
+ out.println(ind(indent) + "Properties:");
+ dump(props, indent+INDENT_WIDTH);
+ }
+ AggregationsTYPE aggregations = svc.getAggregations();
+ if (aggregations != null) {
+ out.println(ind(indent) + "Aggregations:");
+ dump(aggregations, indent+INDENT_WIDTH);
+ }
+ RecordsTYPE records = svc.getRecords();
+ if (records != null) {
+ out.println(ind(indent) + "Records:");
+ dump(records, indent+INDENT_WIDTH);
+ }
+ ClassesTYPE classes = svc.getClasses();
+ if (classes != null) {
+ out.println(ind(indent) + "Classes:");
+ dump(classes, indent+INDENT_WIDTH);
+ }
+ DisposalholdsTYPE disposalHolds = svc.getDisposalHolds();
+ if (disposalHolds != null) {
+ out.println(ind(indent) + "Disposal Holds:");
+ dump(disposalHolds, indent+INDENT_WIDTH);
+ }
+ DisposalschedulesTYPE disposalSchedules = svc.getDisposalSchedules();
+ if (disposalSchedules != null) {
+ out.println(ind(indent) + "Disposal Schedules");
+ dump(disposalSchedules, indent+INDENT_WIDTH);
+ }
+ RolesTYPE roles = svc.getRoles();
+ if (roles != null) {
+ out.println(ind(indent) + "Roles");
+ dump(roles, indent+INDENT_WIDTH);
+ }
+ TemplatesTYPE templates = svc.getTemplates();
+ if (templates != null) {
+ out.println(ind(indent) + "Templates");
+ dump(templates, indent+INDENT_WIDTH);
+ }
+ UsersTYPE users = svc.getUsers();
+ if (users != null) {
+ out.println(ind(indent) + "Users");
+ dump(users, indent+INDENT_WIDTH);
+ }
+ GroupsTYPE groups = svc.getGroups();
+ if (groups != null) {
+ out.println(ind(indent) + "Groups");
+ dump(groups, indent+INDENT_WIDTH);
+ }
+ List<Object> other = svc.getOther();
+ if (other != null) {
+ out.println(ind(indent) + "Other objects: " + other.size());
+ }
+ out.println();
+ }
+
+ private void dump(ServicepropertiesTYPE props, int indent) {
+ out.println(ind(indent) + "Title: " + dump(props.getTitle()));
+ out.println(ind(indent) + "Default Language: " + props.getDefaultLanguage());
+ out.println(ind(indent) + "Description: " + dump(props.getDescription()));
+ ContextualelementsTYPE ctx = props.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Contextual elements: ");
+ dump(props.getContextualElements(), indent+INDENT_WIDTH);
+ }
+ McrscertificatesTYPE certs = props.getMcrsCertificates();
+ if (certs != null) {
+ out.println(ind(indent) + "MRCS Certificates: ");
+ dump(certs, indent+INDENT_WIDTH);
+ }
+ ImplementsmodulesTYPE modules = props.getImplementsModules();
+ if (modules == null) {
+ out.println(ind(indent) + "Implemented Modules: ");
+ dump(modules, indent+INDENT_WIDTH);
+ }
+ ImplementsservicesTYPE svcs = props.getImplementsServices();
+ if (null != svcs) {
+ out.println(ind(indent) + "Implemented Services: ");
+ dump(svcs, indent+INDENT_WIDTH);
+ }
+ out.println(ind(indent) + "Owner Information: " + dump(props.getOwnerInformation()));
+ out.println(ind(indent) + "Supplier Information: " + dump(props.getSupplierInformation()));
+ out.println(ind(indent) + "Exported in full: " + props.isExportedInFull());
+ }
+
+ private void dump(ImplementsservicesTYPE implementsServices, int indent) {
+ for (String id: implementsServices.getImplementsServiceId()) {
+ ServiceDescription sd = ServiceDescription.getServiceInfo(id);
+ if (id == null)
+ out.println(ind(indent) + "UNKNOWN SERVICE: " + id);
+ else
+ out.println(ind(indent) + "service name: " + sd.getName() + " (" + sd.getId() + ")");
+ }
+ }
+
+ private void dump(ImplementsmodulesTYPE implementsModules, int indent) {
+ for (String id: implementsModules.getImplementsModuleId()) {
+ ModuleDescription md = ModuleDescription.getModuleInfo(id);
+ if (id == null)
+ out.println(ind(indent) + "UNKNOWN SERVICE: " + id);
+ else
+ out.println(ind(indent) + "service name: " + md.getName() + " (" + md.getId() + ")");
+ }
+ }
+
+ private void dump(McrscertificatesTYPE mcrsCertificates, int indent) {
+ List<String> ids = mcrsCertificates.getMcrsCertificateId();
+ if (null != ids)
+ for (String id: ids) {
+ out.println(ind(indent) + "MCRS Certificate: " + id);
+ }
+ }
+
+ private void dump(ContextualelementsTYPE contextualElements, int indent) {
+ List<ContextualelementTYPE> ctxList = contextualElements.getContextualElement();
+ if (ctxList != null)
+ for (ContextualelementTYPE ctx: ctxList) {
+ out.println(ind(indent) + "Contextual Element, Id: " + ctx.getDefId() + "; Value: "
+ + ctx.getValue() + "; Language: " + ctx.getLang());
+ }
+ }
+
+ private void dump(AggregationsTYPE aggregations, int indent) {
+ List<AggregationTYPE> aggList = aggregations.getAggregation();
+ if (aggList != null)
+ for (AggregationTYPE agg : aggList) {
+ out.println(ind(indent) + "Aggregation: ");
+ dump(agg, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(AggregationTYPE agg, int indent) {
+ out.println(ind(indent) + "Title: " + dump(agg.getTitle()));
+ out.println(ind(indent) + "System Id: " + agg.getSystemId());
+ out.println(ind(indent) + "Description: " + dump(agg.getDescription()));
+ out.println(ind(indent) + "Scope Notes: " + dump(agg.getScopeNotes()));
+ out.println(ind(indent) + "Parent Id: " + agg.getParentAggregationId());
+ out.println(ind(indent) + "Exported in full: " + agg.isExportedInFull());
+ out.println(ind(indent) + "Class: " + agg.getClass().getSimpleName());
+ out.println(ind(indent) + "Class Id: " + agg.getClassId());
+ out.println(ind(indent) + "Created: " + dump(agg.getCreated()));
+ out.println(ind(indent) + "Aggregated: " + dump(agg.getAggregated()));
+ out.println(ind(indent) + "Closed: " + dump(agg.getClosed()));
+ out.println(ind(indent) + "Destroyed: " + dump(agg.getDestroyed()));
+ out.println(ind(indent) + "First used: " + dump(agg.getFirstUsed()));
+ out.println(ind(indent) + "Last addition: " + dump(agg.getLastAddition()));
+ out.println(ind(indent) + "Originated: " + dump(agg.getOriginated()));
+ out.println(ind(indent) + "Class Id: " + agg.getClassId());
+ ContextualelementsTYPE ctx = agg.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Contextual Metadata: ");
+ dump(ctx, indent+INDENT_WIDTH);
+ }
+ EntityaclTYPE acl = agg.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Access Control List: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ out.println(ind(indent) + "Max Levels Of Aggregation: " + agg.getMaxLevelsOfAggregation());
+ }
+
+ private void dump(EntityaclTYPE acl, int indent) {
+ out.println(ind(indent) + "Included in inherited roles: " + acl.isIncludeInheritedRoles());
+ List<AceTYPE> aces = acl.getAccessControlEntry();
+ if (aces != null) {
+ out.println(ind(indent) + "Access Control Entries: ");
+ for (AceTYPE ace : aces) {
+ dump(ace, indent+INDENT_WIDTH);
+ }
+ }
+ }
+
+ private void dump(AceTYPE ace, int indent) {
+ out.println(ind(indent) + "User or Group Id: " + ace.getUserOrGroupId());
+ out.println(ind(indent) + "Class: " + ace.getClass().getSimpleName());
+ List<String> roles = ace.getRoleId();
+ if (roles != null) {
+ out.println(ind(indent) + "Roles: " + roles.toString());
+ }
+ }
+
+ private void dump(RecordsTYPE records, int indent) {
+ out.println(ind(indent) + "Records Class: " + records.getClass().getSimpleName());
+ List<RecordTYPE> recordsList = records.getRecord();
+ if (recordsList != null) {
+ out.println(ind(indent) + "Records: ");
+ for (RecordTYPE rec: recordsList) {
+ dump(rec, indent+INDENT_WIDTH);
+ }
+ }
+ }
+
+ public void dump(RecordTYPE rec, int indent) {
+ out.println(ind(indent) + "Record: ");
+ out.println(ind(indent) + "Title: " + dump(rec.getTitle()));
+ out.println(ind(indent) + "System Id: " + rec.getSystemId());
+ out.println(ind(indent) + "Description: " + dump(rec.getDescription()));
+ out.println(ind(indent) + "Records Class Id: " + rec.getClassId());
+ out.println(ind(indent) + "Parent Aggregation Id: " + rec.getParentAggregationId());
+ out.println(ind(indent) + "Created at: " + dump(rec.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(rec.getDestroyed()));
+ out.println(ind(indent) + "Aggregated at: " + dump(rec.getAggregated()));
+ EntityaclTYPE acl = rec.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Acl: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ ComponentsTYPE comps = rec.getComponents();
+ if (comps != null) {
+ out.println(ind(indent) + "Components: ");
+ dump(comps, indent+INDENT_WIDTH);
+ }
+ ContextualelementsTYPE ctx = rec.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Contextual Elements: ");
+ dump(ctx, indent+INDENT_WIDTH);
+ }
+ List<TransformationentryTYPE> te = rec.getTransformationEntry();
+ if (te != null) {
+ out.println(ind(indent) + "Transformation Entry: ");
+ dump(te, indent+INDENT_WIDTH);
+ }
+ List<String> tr = rec.getTransformedRecordId();
+ if (tr != null) {
+ out.println(ind(indent) + "Transformation Record Ids: " + tr);
+ }
+ DuplicatesTYPE dup = rec.getDuplicates();
+ if (dup != null) {
+ out.println(ind(indent) + "Duplicagtes: " + dup);
+ }
+
+ out.println(ind(indent) + "Disposal Schedule Id: " + rec.getDisposalScheduleId());
+ out.println(ind(indent) + "Disposal action due at: " + dump(rec.getDisposalActionDue()));
+ out.println(ind(indent) + "Disposal confirmation Due at: " + dump(rec.getDisposalConfirmationDue()));
+ out.println(ind(indent) + "Disposal overdue at: " + dump(rec.getDisposalOverdueAlert()));
+ out.println(ind(indent) + "Last review at: " + dump(rec.getLastReviewed()));
+ out.println(ind(indent) + "Review comment: " + dump(rec.getLastReviewedComment()));
+ out.println(ind(indent) + "Originated at: " + dump(rec.getOriginated()));
+ out.println(ind(indent) + "Retention start at: " + dump(rec.getRetentionStart()));
+ out.println(ind(indent) + "Transferred at: " + dump(rec.getTransferred()));
+ out.println(ind(indent) + "Disposal sction: " + rec.getDisposalAction());
+ out.println(ind(indent) + "Disposal schedule Id: " + rec.getDisposalScheduleId());
+ }
+
+ private void dump(List<TransformationentryTYPE> teList, int indent) {
+ if (teList != null) {
+ for (TransformationentryTYPE transEntry: teList) {
+ out.println(ind(indent) + "Original record id: " + transEntry.getOriginalRecordId());
+ out.println(ind(indent) + "Transformation detail: " + dump(transEntry.getTransformationDetail()));
+ out.println(ind(indent) + "Transformation type: " + transEntry.getTransformationType());
+ out.println(ind(indent) + "is extract: " + transEntry.isIsExtract());
+ }
+ }
+ }
+
+ private void dump(ComponentsTYPE comps, int indent) {
+ List<JAXBElement<? extends ComponentTYPE>> compList = comps.getComponent();
+ if (null != compList)
+ for (JAXBElement<? extends ComponentTYPE> comp: compList) {
+ out.println(ind(indent) + "Component: ");
+ dump(comp.getValue(), indent+INDENT_WIDTH);
+// out.println(ind(indent) + "Component name: " + comp.getName());
+// out.println(ind(indent) + "declared type: " + comp.getDeclaredType().getSimpleName());
+// out.println(ind(indent) + "Scope: " + comp.getScope().getSimpleName());
+// out.println(ind(indent) + "Global scope: " + comp.isGlobalScope());
+// out.println(ind(indent) + "IsNil: " + comp.isNil());
+// out.println(ind(indent) + "Is type substituted: " + comp.isTypeSubstituted());
+ }
+ }
+
+
+ private void dump(ComponentTYPE comp, int indent) {
+ out.println(ind(indent) + "Component name: " + comp.getSystemId());
+ out.println(ind(indent) + "System id: " + comp.getSystemId());
+ out.println(ind(indent) + "Title: " + dump(comp.getTitle()));
+ out.println(ind(indent) + "Class: " + comp.getClass().getSimpleName());
+ out.println(ind(indent) + "Description: " + dump(comp.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(comp.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(comp.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(comp.getOriginated()));
+ DuplicatesTYPE dupls = comp.getDuplicates();
+ if (dupls != null)
+ dump(dupls, indent+INDENT_WIDTH);
+ }
+
+ private void dump(DuplicatesTYPE dupls, int indent) {
+ out.println(ind(indent) + "Duplicate id: " + dupls.getDuplicateId());
+ out.println(ind(indent) + "Duplicate ids: " + dupls.getDuplicateId());
+ }
+
+ private void dump(ClassesTYPE classes, int indent) {
+ List<JAXBElement<? extends ClassTYPE>> cl = classes.getClazz();
+ if (null != cl)
+ for (JAXBElement<? extends ClassTYPE> clazz : cl) {
+ out.println(ind(indent) + "Class: ");
+ dump(clazz.getValue(), indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(ClassTYPE clazz, int indent) {
+ out.println(ind(indent) + "System id: " + clazz.getSystemId());
+ out.println(ind(indent) + "default disposal schedule id: " + clazz.getDefaultDisposalScheduleId());
+ out.println(ind(indent) + "Title: " + dump(clazz.getTitle()));
+ out.println(ind(indent) + "Description: " + dump(clazz.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(clazz.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(clazz.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(clazz.getOriginated()));
+ out.println(ind(indent) + "Acl: ");
+ dump(clazz.getAccessControlList(), indent+INDENT_WIDTH);
+ ContextualelementsTYPE ces = clazz.getContextualElements();
+ if (ces != null) {
+ out.println(ind(indent) + "Contextual Elements: ");
+ dump(ces, indent+INDENT_WIDTH);
+ }
+ out.println(ind(indent) + "First used: " + dump(clazz.getFirstUsed()));
+ out.println(ind(indent) + "Scope noted: " + dump(clazz.getScopeNotes()));
+ out.println(ind(indent) + "Exported in full: " + clazz.isExportedInFull());
+ }
+
+ private void dump(TemplatesTYPE templates, int indent) {
+ List<TemplateTYPE> templs = templates.getTemplate();
+ if (templs != null) {
+ out.println(ind(indent) + "Templates: ");
+ for (TemplateTYPE templ: templs) {
+ dump(templ, indent+INDENT_WIDTH);
+ }
+ }
+ }
+
+ private void dump(TemplateTYPE templ, int indent) {
+ out.println(ind(indent) + "Template: ");
+ out.println(ind(indent) + "System id: " + templ.getSystemId());
+ out.println(ind(indent) + "Title: " + dump(templ.getTitle()));
+ out.println(ind(indent) + "Description: " + dump(templ.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(templ.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(templ.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(templ.getOriginated()));
+ out.println(ind(indent) + "First used: " + dump(templ.getFirstUsed()));
+ out.println(ind(indent) + "Exported in full: " + templ.isExportedInFull());
+ EntityaclTYPE acl = templ.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Acl: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ ContextualelementsTYPE ctx = templ.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Template comntextual elements: ");
+ dump(ctx, indent+INDENT_WIDTH);
+ }
+ TemplateclassesTYPE tc = templ.getTemplateClasses();
+ if (tc != null) {
+ out.println(ind(indent) + "Template classes: ");
+ dump(tc, indent+INDENT_WIDTH);
+ }
+ TemplateentitytypesTYPE tet = templ.getTemplateEntityTypes();
+ if (tet != null) {
+ out.println(ind(indent) + "Template entity types: ");
+ dump(tet, indent+INDENT_WIDTH);
+ }
+ TemplatecontextualmetadataTYPE mdd = templ.getTemplateMetadataDefinitions();
+ if (mdd != null) {
+ out.println(ind(indent) + "Template metadata definitions: ");
+ dump(mdd, indent+INDENT_WIDTH);
+ }
+ TemplateservicesTYPE svc = templ.getTemplateServices();
+ if (svc != null) {
+ out.println(ind(indent) + "Template services: ");
+ dump(svc, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(TemplateservicesTYPE svc, int indent) {
+ List<String> ids = svc.getTemplateServiceId();
+ if (ids != null)
+ out.println(ind(indent) + "Template services: " + ids);
+ }
+
+ private void dump(TemplatecontextualmetadataTYPE mdd, int indent) {
+ List<String> ids = mdd.getContextualMetadataDefId();
+ if (ids != null)
+ out.println(ind(indent) + "Contextual metadata definition ids: " + ids);
+ }
+
+ private void dump(TemplateclassesTYPE tc, int indent) {
+ List<String> ids = tc.getTemplateClassId();
+ if (ids != null)
+ out.println(ind(indent) + "Template class ids: " + ids);
+ }
+
+ private void dump(TemplateentitytypesTYPE templateEntityTypes, int indent) {
+ List<String> ids = templateEntityTypes.getTemplateEntityTypeId();
+ if (ids != null)
+ out.println(ind(indent) + "Template entity types: " + ids);
+ }
+
+ private void dump(DisposalholdsTYPE disposalHolds, int indent) {
+ out.println(ind(indent) + "Disposal Holds: ");
+ List<DisposalholdTYPE> holds = disposalHolds.getDisposalHold();
+ if (holds!=null) {
+ for (DisposalholdTYPE hold : holds)
+ dump(hold, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(DisposalholdTYPE hold, int indent) {
+ out.println(ind(indent) + "Hold:");
+ out.println(ind(indent) + "System id: " + hold.getSystemId());
+ out.println(ind(indent) + "Title: " + dump(hold.getTitle()));
+ out.println(ind(indent) + "Description: " + dump(hold.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(hold.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(hold.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(hold.getOriginated()));
+ out.println(ind(indent) + "First used: " + dump(hold.getFirstUsed()));
+ out.println(ind(indent) + "Exported in full: " + hold.isExportedInFull());
+ out.println(ind(indent) + "Mandate: " + dump(hold.getMandate()));
+ out.println(ind(indent) + "Scope Notes: " + dump(hold.getScopeNotes()));
+ out.println(ind(indent) + "Originated: " + dump(hold.getOriginated()));
+ EntityaclTYPE acl = hold.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Access control list: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ ContextualelementsTYPE ctx = hold.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Contextual elements: ");
+ dump(ctx, indent+INDENT_WIDTH);
+ }
+ HeldTYPE held = hold.getHeld();
+ if (held != null) {
+ out.println(ind(indent) + "Held: ");
+ dump(held, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(HeldTYPE held, int indent) {
+ out.println(ind(indent) + "Aggregation ids: " + held.getHeldAggregationId());
+ out.println(ind(indent) + "Held class ids: " + held.getHeldClassId());
+ out.println(ind(indent) + "Record ids: " + held.getHeldRecordId());
+ }
+
+ private void dump(DisposalschedulesTYPE disposalSchedules, int indent) {
+ out.println(ind(indent) + "Disposal Schedules: ");
+ List<DisposalscheduleTYPE> schedules = disposalSchedules.getDisposalSchedule();
+ if (schedules!=null) {
+ for (DisposalscheduleTYPE schedule : schedules)
+ dump(schedule, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(DisposalscheduleTYPE schedule, int indent) {
+ out.println(ind(indent) + "Disposal Schedule: ");
+ out.println(ind(indent) + "System id: " + schedule.getSystemId());
+ out.println(ind(indent) + "Title: " + dump(schedule.getTitle()));
+ out.println(ind(indent) + "Description: " + dump(schedule.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(schedule.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(schedule.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(schedule.getOriginated()));
+ out.println(ind(indent) + "First used: " + dump(schedule.getFirstUsed()));
+ out.println(ind(indent) + "Exported in full: " + schedule.isExportedInFull());
+ out.println(ind(indent) + "Mandate: " + dump(schedule.getMandate()));
+ out.println(ind(indent) + "Scope notes: " + dump(schedule.getScopeNotes()));
+ out.println(ind(indent) + "Originated: " + dump(schedule.getOriginated()));
+ out.println(ind(indent) + "Confirmation interval: " + schedule.getConfirmationInterval());
+ out.println(ind(indent) + "Retention trigger element id: " + schedule.getRetentionTriggerElementId());
+ out.println(ind(indent) + "Retention Interval: " + schedule.getRetentionInterval());
+ out.println(ind(indent) + "Retention offset: " + schedule.getRetentionOffset());
+ out.println(ind(indent) + "Retention offset month: " + schedule.getRetentionOffsetMonth());
+ out.println(ind(indent) + "Confirmation interval duration: " + schedule.getConfirmationIntervalDuration());
+ out.println(ind(indent) + "Disposal Action: " + schedule.getDisposalAction());
+ out.println(ind(indent) + "Retention interval duration: " + schedule.getRetentionIntervalDuration());
+ out.println(ind(indent) + "Retention trigger: " + schedule.getRetentionTrigger());
+ out.println(ind(indent) + "Exported in full: " + schedule.isExportedInFull());
+ EntityaclTYPE acl = schedule.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Access control list: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ ContextualelementsTYPE ctx = schedule.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Contextual elements: ");
+ dump(ctx, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(RolesTYPE roles, int indent) {
+ out.println(ind(indent) + "Role: ");
+ List<RoleTYPE> roleList = roles.getRole();
+ if (roleList!=null) {
+ for (RoleTYPE role : roleList)
+ dump(role, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(RoleTYPE role, int indent) {
+ out.println(ind(indent) + "System id: " + role.getSystemId());
+ out.println(ind(indent) + "Title: " + dump(role.getTitle()));
+ out.println(ind(indent) + "Description: " + dump(role.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(role.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(role.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(role.getOriginated()));
+ out.println(ind(indent) + "First used: " + dump(role.getFirstUsed()));
+ out.println(ind(indent) + "Exported in full: " + role.isExportedInFull());
+ out.println(ind(indent) + "Administrative role: " + role.isIsAdministrativeRole());
+ EntityaclTYPE acl = role.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Access control list: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ ContextualelementsTYPE ctx = role.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Contextual elements: ");
+ dump(ctx, indent+INDENT_WIDTH);
+ }
+ FunctiondefinitionsTYPE fd = role.getFunctionDefinitions();
+ if (fd != null) {
+ out.println(ind(indent) + "Function definitions: ");
+ dump(fd, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(FunctiondefinitionsTYPE fdt, int indent) {
+ List<String> fIds = fdt.getFunctionId();
+ for (String id: fIds) {
+ FunctionDescription fd = FunctionDescription.getFunctionInfo(id);
+ if (fd == null)
+ out.println(ind(indent) + "UNKNOWN FUNCTION: " + id);
+ else
+ out.println(ind(indent) + "Function name: " + fd.getName() + " (" + fd.getId() + ")");
+ }
+ }
+
+ private void dump(UsersTYPE users, int indent) {
+ List<UserTYPE> usersList = users.getUser();
+ if (usersList != null) {
+ out.println(ind(indent) + "Groups: ");
+ for (UserTYPE user : usersList)
+ dump(user, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(UserTYPE user, int indent) {
+ out.println(ind(indent) + "User:");
+ out.println(ind(indent) + "System id: " + user.getSystemId());
+ out.println(ind(indent) + "Title: " + dump(user.getTitle()));
+ out.println(ind(indent) + "Description: " + dump(user.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(user.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(user.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(user.getOriginated()));
+ out.println(ind(indent) + "First used: " + dump(user.getFirstUsed()));
+ out.println(ind(indent) + "Exported in full: " + user.isExportedInFull());
+ GroupmembershipTYPE gm = user.getGroupMembership();
+ if (gm != null) {
+ out.println(ind(indent) + "Group Membership: " + gm.getGroupId());
+ }
+ EntityaclTYPE acl = user.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Access control list: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ ContextualelementsTYPE ctx = user.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Contextual elements: ");
+ dump(ctx, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(GroupsTYPE groups, int indent) {
+ List<GroupTYPE> groupList = groups.getGroup();
+ if (groupList != null) {
+ out.println(ind(indent) + "Groups: ");
+ for (GroupTYPE group : groupList)
+ dump(group, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(GroupTYPE group, int indent) {
+ out.println(ind(indent) + "Group:");
+ out.println(ind(indent) + "System id: " + group.getSystemId());
+ out.println(ind(indent) + "Title: " + dump(group.getTitle()));
+ out.println(ind(indent) + "Description: " + dump(group.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(group.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(group.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(group.getOriginated()));
+ out.println(ind(indent) + "First used: " + dump(group.getFirstUsed()));
+ out.println(ind(indent) + "Exported in full: " + group.isExportedInFull());
+ EntityaclTYPE acl = group.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Access control list: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ ContextualelementsTYPE ctx = group.getContextualElements();
+ if (ctx != null) {
+ out.println(ind(indent) + "Contextual elements: ");
+ dump(ctx, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(ContextualmetadataTYPE cmd, int indent) {
+ if (null == cmd)
+ return;
+
+ out.println(ind(indent) + "contextual definition count: " + cmd.getContextualDefinition().size());
+ for (ContextualdefinitionTYPE md: cmd.getContextualDefinition())
+ dump(md, INDENT_WIDTH);
+ }
+
+ private void dump(ContextualdefinitionTYPE ctx, int indent) {
+ out.println(ind(indent) + "Contextual definition: ");
+ out.println(ind(indent) + "System id: " + ctx.getSystemId());
+ out.println(ind(indent) + "Title: " + dump(ctx.getTitle()));
+ out.println(ind(indent) + "Description: " + dump(ctx.getDescription()));
+ out.println(ind(indent) + "Created at: " + dump(ctx.getCreated()));
+ out.println(ind(indent) + "Destroyed at: " + dump(ctx.getDestroyed()));
+ out.println(ind(indent) + "Originated at: " + dump(ctx.getOriginated()));
+ out.println(ind(indent) + "First used: " + dump(ctx.getFirstUsed()));
+ out.println(ind(indent) + "Exported in full: " + ctx.isExportedInFull());
+ out.println(ind(indent) + "Default Language: " + ctx.getDefaultLanguage());
+ out.println(ind(indent) + "Service Id: " + ctx.getServiceId());
+ out.println(ind(indent) + "Scope notes: " + dump(ctx.getScopeNotes()));
+ DatatypeTYPE dt = ctx.getDatatype();
+ out.println(ind(indent) + "Data Type: " + (dt==null ? "null" : dt.getValue()));
+ out.println(ind(indent) + "Min occurs: " + ctx.getMinOccurs());
+ out.println(ind(indent) + "Max occurs: " + ctx.getMaxOccurs());
+ out.println(ind(indent) + "Presentation Order: " + ctx.getPresentationOrder());
+ out.println(ind(indent) + "Entity Reference: " + ctx.isIsEntityReference());
+ out.println(ind(indent) + "Modifiable: " + ctx.isIsModifiable());
+ out.println(ind(indent) + "Textual: " + ctx.isIsTextual());
+ out.println(ind(indent) + "Retain on destruction: " + ctx.isRetainOnDestruction());
+ List<ValueTYPE> defVals = ctx.getDefaultValue();
+ if (dt != null) {
+ out.println(ind(indent) + "Default Values: ");
+ for (ValueTYPE defVal: defVals)
+ out.println(ind(indent) + "Default Value: " + defVal.getValue() + "(Lang: " + defVal.getLang() + ")");
+ }
+ EntityaclTYPE acl = ctx.getAccessControlList();
+ if (acl != null) {
+ out.println(ind(indent) + "Access control list: ");
+ dump(acl, indent+INDENT_WIDTH);
+ }
+ List<String> erids = ctx.getEntityReferenceTypeId();
+ if (erids != null) {
+ out.println(ind(indent) + "Entity Reference Ids: ");
+ dumpEntityRefId(erids, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dumpEntityRefId(List<String> erids, int indent) {
+ if (erids != null) {
+ for (String id: erids) {
+ EntityDescription fd = EntityDescription.getEntityInfo(id);
+ if (id == null)
+ out.println(ind(indent) + "UNKNOWN ENTITY: " + id);
+ else
+ out.println(ind(indent) + "Entity name: " + fd.getName() + " (" + fd.getId() + ")");
+ }
+ }
+ }
+
+ private void dump(EventsTYPE events, int indent) {
+ out.println(ind(indent) + "Events: ");
+ List<EventTYPE> eventList = events.getEvent();
+ for (EventTYPE event: eventList) {
+ out.println(ind(indent) + "Event: ");
+ dump(event, indent+INDENT_WIDTH);
+ }
+ }
+
+ private void dump(EventTYPE event, int indent) {
+ out.println(ind(indent) + "System id: " + event.getSystemId());
+ out.println(ind(indent) + "export id: " + event.getExportId());
+ out.println(ind(indent) + "Participating new parent: " + event.getPartNewParentId());
+ out.println(ind(indent) + "Participating previous parent id: " + event.getPartPreviousParentId());
+ out.println(ind(indent) + "Participating user or group id: " + event.getPartUserOrGroupId());
+ out.println(ind(indent) + "Performed by: " + event.getPerformedByUserId());
+ out.println(ind(indent) + "Search query: " + event.getSearchQuery());
+ out.println(ind(indent) + "Applied templates: " + event.getAppliedTemplateId());
+ out.println(ind(indent) + "Created at: " + event.getCreated());
+ out.println(ind(indent) + "Event deleted function definition id: " + event.getDeletedEventFunctionDefId());
+ out.println(ind(indent) + "Event deleted metadata definition id: " + event.getDeletedMetadataFunctionDefId());
+ out.println(ind(indent) + "Duplicates: ");
+ DuplicatesTYPE dupls = event.getDuplicates();
+ if (dupls != null)
+ dump(dupls, indent+INDENT_WIDTH);
+ out.println(ind(indent) + "Event comment: " + dump(event.getEventComment()));
+ out.println(ind(indent) + "Event occured at: " + dump(event.getEventOccurred()));
+ out.println(ind(indent) + "Export commencing at: " + dump(event.getExportCommencing()));
+ out.println(ind(indent) + "Export completed: " + dump(event.getExportCompleted()));
+ FunctionDescription fd = FunctionDescription.getFunctionInfo(event.getEventFunctionId());
+ if (fd == null)
+ out.println(ind(indent) + "Event funtion: unknown: " + event.getEventFunctionId());
+ else
+ out.println(ind(indent) + "Event function name: " + fd.getName() + " (" + fd.getId() + ")");
+ out.println(ind(indent) + "Export id: " + event.getExportId());
+ out.println(ind(indent) + "Granted role ids: " + event.getGrantedRoleId());
+ out.println(ind(indent) + "Historical: " + dump(event.getHistorical()));
+ out.println(ind(indent) + "Granted role id: " + event.getGrantedRoleId());
+ MetadatachangesTYPE mdc = event.getMetadataChanges();
+ if (mdc != null)
+ dump(mdc, indent+INDENT_WIDTH);
+ out.println(ind(indent) + "Participating compoenent ids: " + event.getPartComponentId());
+ out.println(ind(indent) + "Participating previous parent ids: " + event.getPartPreviousParentId());
+ out.println(ind(indent) + "Participating user or group ids: " + event.getPartUserOrGroupId());
+ out.println(ind(indent) + "Participating performed by user ids: " + event.getPerformedByUserId());
+ out.println(ind(indent) + "Participating aggregation ids: " + event.getPartAggregationId());
+ out.println(ind(indent) + "Participating class ids: " + event.getPartClassId());
+ out.println(ind(indent) + "Participating component ids: " + event.getPartComponentId());
+ out.println(ind(indent) + "Participating disposal hold ids: " + event.getPartDisposalHoldId());
+ out.println(ind(indent) + "Participating disposal schedule ids: " + event.getPartDisposalScheduleId());
+ out.println(ind(indent) + "Participating duplicated ids: " + event.getPartDuplicateId());
+ out.println(ind(indent) + "Participating entity type ids: " + event.getPartEntityTypeId() );
+ out.println(ind(indent) + "Participating event ids: " + event.getPartEventId() );
+ out.println(ind(indent) + "Participating function definition ids: " + event.getPartFunctionDefId() );
+ out.println(ind(indent) + "Participating group ids: " + event.getPartGroupId() );
+ out.println(ind(indent) + "Participating metadata element definition ids: " + event.getPartMetadataElementDefId() );
+ out.println(ind(indent) + "Participating record ids: " + event.getPartRecordId());
+ out.println(ind(indent) + "Participating role ids: " + event.getPartRoleId());
+ out.println(ind(indent) + "Participating service ids: " + event.getPartServiceId());
+ out.println(ind(indent) + "Participating parent template ids: " + event.getPartTemplateId());
+ out.println(ind(indent) + "Participating user ids: " + event.getPartUserId());
+ out.println(ind(indent) + "Participating record ids: " + event.getPartRecordId());
+ out.println(ind(indent) + "Rescinded role id: " + event.getRescindedRoleId());
+ out.println(ind(indent) + "Total entities: " + event.getTotalEntities());
+ }
+
+ private void dump(MetadatachangesTYPE mdc, int indent) {
+ out.println(ind(indent) + "Metadata changes: ");
+ for (MceTYPE mdce: mdc.getMetadataChangeEntry())
+ dump(mdce, indent+INDENT_WIDTH);
+ }
+
+ private void dump(MceTYPE mdce, int indent) {
+ out.println(ind(indent) + "Definition id: " + mdce.getDefId());
+ out.println(ind(indent) + "Content: ");
+ List<JAXBElement<ValueTYPE>> contList = mdce.getContent();
+ if (contList != null) {
+ for (JAXBElement<ValueTYPE> val : contList) {
+ out.println(ind(indent) + "Value: " + val.toString());
+ }
+ }
+ }
+
+ public static final String dump(XMLGregorianCalendar date) {
+ return date == null ? "" : date.toString();
+ }
+
+ public static final String dump(TextualTYPE text) {
+ return text == null ? "" : text.getValue() + " (Language: " + text.getLang() + ")";
+ }
+
+ private String dump(TitularTYPE title) {
+ return title == null ? "" : title.getValue() + " (Language: " + title.getLang() + ")";
+ }
+
+
+ private static String ind(int indent) {
+ return getIndent(indent);
+ }
+
+ private static String getIndent(int indent) {
+ switch (indent) {
+ case 2:
+ return " ";
+ case 4:
+ return " ";
+ case 6:
+ return " ";
+ case 8:
+ return " ";
+ case 10:
+ return " ";
+ case 12:
+ return " ";
+ case 14:
+ return " ";
+ case 16:
+ return " ";
+ case 18:
+ return " ";
+ case 20:
+ return " ";
+ default:
+ StringBuffer sb = new StringBuffer();
+ for (int i=0; i<indent; i++)
+ sb.append(" ");
+ return sb.toString();
+ }
+ }
+}
Added: chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/EntityDescription.java
URL: http://svn.apache.org/viewvc/chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/EntityDescription.java?rev=1196504&view=auto
==============================================================================
--- chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/EntityDescription.java (added)
+++ chemistry/playground/moreq2010/moreq2010/main/java/org/apache/chemistry/moreq2010/util/EntityDescription.java Wed Nov 2 08:49:45 2011
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.moreq2010.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public class EntityDescription {
+
+ private final String name;
+ private final UUID id;
+ public static enum EntityEnum {
+ AGGREGATION_ENTITY, CLASS_ENTITY, COMPONENT_ENTITY, CONTEXTUAL_METADATA_ELEMENT_DEFINITION_ENTITY,
+ DISPOSAL_HOLD__ENTITY, DISPOSAL_SCHEDULE_ENTITY, ENTITY_TYPE_ENTITY, EVENT_ENTITY, FUNCTION_DEFINITION_ENTITY,
+ GROUP_ENTITY, METADATA_ELEMENT_DEFINITION__ENTITY, RECORD_ENTITY, ROLE_ENTITY, SERVICE_ENTITY, TEMPLATE_ENTITY,
+ USER_ENTITY
+ };
+
+ private final EntityEnum key;
+
+ private static Map<String, EntityDescription> MAP = new HashMap<String, EntityDescription>() {{
+ put(Constants.AGGREGATION_ENTITY, new EntityDescription("Aggregation Entity", Constants.AGGREGATION_ENTITY,
+ EntityEnum.AGGREGATION_ENTITY));
+ put(Constants.CLASS_ENTITY, new EntityDescription("Class Entity", Constants.CLASS_ENTITY,
+ EntityEnum.CLASS_ENTITY));
+ put(Constants.COMPONENT_ENTITY, new EntityDescription("Component Entity",
+ Constants.COMPONENT_ENTITY, EntityEnum.COMPONENT_ENTITY));
+ put(Constants.CONTEXTUAL_METADATA_ELEMENT_DEFINITION_ENTITY, new EntityDescription("Contextual Metadata Element Definition Entity", Constants.CONTEXTUAL_METADATA_ELEMENT_DEFINITION_ENTITY,
+ EntityEnum.CONTEXTUAL_METADATA_ELEMENT_DEFINITION_ENTITY));
+ put(Constants.DISPOSAL_HOLD__ENTITY, new EntityDescription("Disposal Hold Entity",
+ Constants.DISPOSAL_HOLD__ENTITY, EntityEnum.DISPOSAL_HOLD__ENTITY));
+ put(Constants.DISPOSAL_SCHEDULE_ENTITY, new EntityDescription("Disposal Schedule Entity",
+ Constants.DISPOSAL_SCHEDULE_ENTITY, EntityEnum.DISPOSAL_SCHEDULE_ENTITY));
+ put(Constants.ENTITY_TYPE_ENTITY, new EntityDescription("Entity Type Entity",
+ Constants.ENTITY_TYPE_ENTITY, EntityEnum.ENTITY_TYPE_ENTITY));
+ put(Constants.EVENT_ENTITY, new EntityDescription("Event Entity",
+ Constants.EVENT_ENTITY, EntityEnum.EVENT_ENTITY));
+ put(Constants.FUNCTION_DEFINITION_ENTITY, new EntityDescription("Function Definition Entity",
+ Constants.FUNCTION_DEFINITION_ENTITY, EntityEnum.FUNCTION_DEFINITION_ENTITY));
+ put(Constants.GROUP_ENTITY, new EntityDescription("Group Entity",
+ Constants.GROUP_ENTITY, EntityEnum.GROUP_ENTITY));
+ put(Constants.METADATA_ELEMENT_DEFINITION__ENTITY, new EntityDescription("Metadata Element Definition Entity",
+ Constants.METADATA_ELEMENT_DEFINITION__ENTITY, EntityEnum.METADATA_ELEMENT_DEFINITION__ENTITY));
+ put(Constants.RECORD_ENTITY, new EntityDescription("Record Entity",
+ Constants.RECORD_ENTITY, EntityEnum.RECORD_ENTITY));
+ put(Constants.ROLE_ENTITY, new EntityDescription("Role Entity",
+ Constants.ROLE_ENTITY, EntityEnum.ROLE_ENTITY));
+ put(Constants.SERVICE_ENTITY, new EntityDescription("Service Entity",
+ Constants.SERVICE_ENTITY, EntityEnum.SERVICE_ENTITY));
+ put(Constants.TEMPLATE_ENTITY, new EntityDescription("Template Entity",
+ Constants.TEMPLATE_ENTITY, EntityEnum.TEMPLATE_ENTITY));
+ put(Constants.USER_ENTITY, new EntityDescription("User Entity",
+ Constants.USER_ENTITY, EntityEnum.USER_ENTITY));
+ }};
+
+ public static final EntityDescription getEntityInfo(String id) {
+ return MAP.get(id);
+ }
+
+ public EntityDescription (String name, String id, EntityEnum key) {
+ this.name = name;
+ this.id = UUID.fromString(id);
+ this.key = key;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getId() {
+ return id.toString();
+ }
+
+ EntityEnum getKey() {
+ return key;
+ }
+}