You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by da...@apache.org on 2018/01/27 00:41:40 UTC
[5/7] atlas git commit: ATLAS-1095:final code drop for OCF
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetSummary.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetSummary.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetSummary.java
new file mode 100644
index 0000000..ef40770
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetSummary.java
@@ -0,0 +1,253 @@
+/**
+ * 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.atlas.ocf.properties;
+
+
+/**
+ * AssetSummary holds asset properties that are used for displaying details of
+ * an asset in summary lists or hover text. It includes the following properties:
+ * <ul>
+ * <li>type - metadata type information for the asset properties</li>
+ * <li>guid - globally unique identifier for the asset</li>
+ * <li>url - external link for the asset</li>
+ * <li>qualifiedName - The official (unique) name for the asset. This is often defined by the IT systems
+ * management organization and should be used (when available) on audit logs and error messages.
+ * (qualifiedName from Referenceable - model 0010)</li>
+ * <li>displayName - A consumable name for the endpoint. Often a shortened form of the assetQualifiedName
+ * for use on user interfaces and messages. The assetDisplayName should be only be used for audit logs and error
+ * messages if the assetQualifiedName is not set. (Sourced from attribute name within Asset - model 0010)</li>
+ * <li>shortDescription - short description about the asset.
+ * (Sourced from assetSummary within ConnectionsToAsset - model 0205)</li>
+ * <li>description - full description of the asset.
+ * (Sourced from attribute description within Asset - model 0010)</li>
+ * <li>owner - name of the person or organization that owns the asset.
+ * (Sourced from attribute owner within Asset - model 0010)</li>
+ * <li>classifications - list of classifications assigned to the asset</li>
+ * </ul>
+ */
+public class AssetSummary extends AssetDescriptor
+{
+ private ElementType type = null;
+ private String qualifiedName = null;
+ private String displayName = null;
+ private String shortDescription = null;
+ private String description = null;
+ private String owner = null;
+ private Classifications classifications = null;
+
+
+ /**
+ * Typical constructor with parameters to fill properties.
+ *
+ * @param type - details of the metadata type for this asset
+ * @param guid - guid property
+ * @param url - element URL used to access its properties in the metadata repository.
+ * @param qualifiedName - unique name
+ * @param displayName - consumable name
+ * @param description - description of the asset
+ * @param shortDescription - short description from relationship with Connection
+ * @param owner - owner name
+ * @param classifications - enumeration of classifications
+ */
+ public AssetSummary(ElementType type,
+ String guid,
+ String url,
+ String qualifiedName,
+ String displayName,
+ String shortDescription,
+ String description,
+ String owner,
+ Classifications classifications)
+ {
+ super(guid, url);
+
+ this.type = type;
+ if (type != null)
+ {
+ super.setAssetTypeName(type.getElementTypeName());
+ }
+
+ this.qualifiedName = qualifiedName;
+ this.displayName = displayName;
+
+ /*
+ * Use the qualified name as the asset name if it is not null or the empty string.
+ * Otherwise use display name (unless it is null or the empty string).
+ */
+ if ((qualifiedName == null) || (qualifiedName.equals("")))
+ {
+ if ((displayName != null) && (!displayName.equals("")))
+ {
+ /*
+ * Good display name
+ */
+ super.setAssetName(displayName);
+ }
+ }
+ else /* good qualified name */
+ {
+ super.setAssetName(qualifiedName);
+ }
+
+ this.shortDescription = shortDescription;
+ this.description = description;
+ this.owner = owner;
+ this.classifications = classifications;
+ }
+
+
+ /**
+ * Copy/clone constructor. Note, this is a deep copy
+ *
+ * @param templateAssetSummary - template values for asset summary
+ */
+ public AssetSummary(AssetSummary templateAssetSummary)
+ {
+ /*
+ * Initialize super class
+ */
+ super(templateAssetSummary);
+
+ /*
+ * Copy relevant values from the template
+ */
+ if (templateAssetSummary != null)
+ {
+ type = templateAssetSummary.getType();
+ qualifiedName = templateAssetSummary.getQualifiedName();
+ displayName = templateAssetSummary.getDisplayName();
+ shortDescription = templateAssetSummary.getShortDescription();
+ description = templateAssetSummary.getDescription();
+ owner = templateAssetSummary.getOwner();
+
+ Classifications templateClassifications = templateAssetSummary.getClassifications();
+ if (templateClassifications != null)
+ {
+ classifications = templateClassifications.cloneIterator(this);
+ }
+ }
+ }
+
+
+ /**
+ * Return the element type properties for this asset. These values are set up by the metadata repository
+ * and define details to the metadata entity used to represent this element.
+ *
+ * @return ElementType - type information.
+ */
+ public ElementType getType()
+ {
+ return type;
+ }
+
+
+ /**
+ * Returns the stored qualified name property for the asset.
+ * If no qualified name is provided then null is returned.
+ *
+ * @return qualifiedName
+ */
+ public String getQualifiedName() {
+ return qualifiedName;
+ }
+
+
+ /**
+ * Returns the stored display name property for the asset.
+ * If no display name is available then null is returned.
+ *
+ * @return displayName
+ */
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+
+ /**
+ * Returns the short description of the asset from relationship with Connection.
+ *
+ * @return shortDescription String
+ */
+ public String getShortDescription()
+ {
+ return shortDescription;
+ }
+
+
+ /**
+ * Returns the stored description property for the asset.
+ * If no description is provided then null is returned.
+ *
+ * @return description String
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+
+ /**
+ * Returns the name of the owner for this asset.
+ *
+ * @return owner String
+ */
+ public String getOwner() {
+ return owner;
+ }
+
+
+ /**
+ * Return the list of classifications associated with the asset. This is an enumeration and the
+ * pointers are set to the start of the list of classifications
+ *
+ * @return Classifications - enumeration of classifications
+ */
+ public Classifications getClassifications()
+ {
+ if (classifications == null)
+ {
+ return classifications;
+ }
+ else
+ {
+ return classifications.cloneIterator(this);
+ }
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "AssetSummary{" +
+ "type=" + type +
+ ", qualifiedName='" + qualifiedName + '\'' +
+ ", displayName='" + displayName + '\'' +
+ ", shortDescription='" + shortDescription + '\'' +
+ ", description='" + description + '\'' +
+ ", owner='" + owner + '\'' +
+ ", classifications=" + classifications +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetUniverse.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetUniverse.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetUniverse.java
new file mode 100644
index 0000000..6d352b9
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetUniverse.java
@@ -0,0 +1,338 @@
+/**
+ * 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.atlas.ocf.properties;
+
+/**
+ * AssetUniverse extends AssetDetail which extend AssetSummary. AssetUniverse adds information about the
+ * common open metadata entities related to this asset.
+ * <ul>
+ * <li>Meanings - glossary term(s) assigned to this asset.</li>
+ * <li>Schema - details of the schema associated with the asset.</li>
+ * <li>Analysis - details of the annotations added by the discovery services.</li>
+ * <li>Feedback - details of the people, products and feedback that are connected to the asset.</li>
+ * <li>Locations - details of the known locations of the asset.</li>
+ * <li>Lineage - details of the lineage for the asset.</li>
+ * <li>Related Assets - details of the assets lined to this asset.</li>
+ * </ul>
+ *
+ */
+public class AssetUniverse extends AssetDetail
+{
+ private Meanings meanings = null;
+ private SchemaElement schema = null;
+ private Annotations analysis = null;
+ private Feedback feedback = null;
+ private Locations knownLocations = null;
+ private Lineage lineage = null;
+ private RelatedAssets relatedAssets = null;
+
+
+ /**
+ * Typical Constructor
+ *
+ * @param type - details of the metadata type for this asset
+ * @param guid - guid property
+ * @param url - element URL used to access its properties in the metadata repository.
+ * @param qualifiedName - unique name
+ * @param displayName - consumable name
+ * @param description - description of the asset
+ * @param shortDescription - short description from relationship with Connection
+ * @param owner - owner name
+ * @param classifications - enumeration of classifications
+ * @param assetProperties - AdditionalProperties object
+ * @param externalIdentifiers - ExternalIdentifiers enumeration
+ * @param relatedMediaReferences - RelatedMediaReferences enumeration
+ * @param noteLogs - NoteLogs iterator
+ * @param externalReferences - ExternalReferences iterator
+ * @param connections - List of connections attached to the asset
+ * @param licenses - List of licenses
+ * @param certifications - Certifications - list of certifications
+ * @param meanings - Meanings - list of glossary definitions.
+ * @param schema - Schema object to query schema and related glossary definitions.
+ * @param analysis - Annotations from metadata discovery.
+ * @param feedback - Feedback object to query the feedback.
+ * @param knownLocations - Locations list
+ * @param lineage - lineage object to query the origin of the asset.
+ * @param relatedAssets - RelatedAssets list
+ */
+ public AssetUniverse(ElementType type,
+ String guid,
+ String url,
+ String qualifiedName,
+ String displayName,
+ String shortDescription,
+ String description,
+ String owner,
+ Classifications classifications,
+ AdditionalProperties assetProperties,
+ ExternalIdentifiers externalIdentifiers,
+ RelatedMediaReferences relatedMediaReferences,
+ NoteLogs noteLogs,
+ ExternalReferences externalReferences,
+ Connections connections,
+ Licenses licenses,
+ Certifications certifications,
+ Meanings meanings,
+ SchemaElement schema,
+ Annotations analysis,
+ Feedback feedback,
+ Locations knownLocations,
+ Lineage lineage,
+ RelatedAssets relatedAssets)
+ {
+ super(type,
+ guid,
+ url,
+ qualifiedName,
+ displayName,
+ shortDescription,
+ description,
+ owner,
+ classifications,
+ assetProperties,
+ externalIdentifiers,
+ relatedMediaReferences,
+ noteLogs,
+ externalReferences,
+ connections,
+ licenses,
+ certifications);
+
+ this.meanings = meanings;
+ this.schema = schema;
+ this.analysis = analysis;
+ this.feedback = feedback;
+ this.knownLocations = knownLocations;
+ this.lineage = lineage;
+ this.relatedAssets = relatedAssets;
+ }
+
+ /**
+ * Copy/clone Constructor - note this is a deep copy
+ *
+ * @param templateAssetUniverse - template to copy
+ */
+ public AssetUniverse(AssetUniverse templateAssetUniverse)
+ {
+ /*
+ * Initialize the super classes
+ */
+ super(templateAssetUniverse);
+
+ /*
+ * Set up the universe private variables.
+ */
+ if (templateAssetUniverse != null)
+ {
+ /*
+ * Create the top-level property objects for this new asset using the values from the template.
+ * The get methods create clones of the returned objects so no need to duplicate objects here.
+ */
+ Meanings templateMeanings = templateAssetUniverse.getMeanings();
+ SchemaElement templateSchema = templateAssetUniverse.getSchema();
+ Annotations templateAnalysis = templateAssetUniverse.getAnalysis();
+ Feedback templateFeedback = templateAssetUniverse.getFeedback();
+ Locations templateLocations = templateAssetUniverse.getKnownLocations();
+ Lineage templateLineage = templateAssetUniverse.getLineage();
+ RelatedAssets templateRelatedAssets = templateAssetUniverse.getRelatedAssets();
+
+ if (templateMeanings != null)
+ {
+ meanings = templateMeanings.cloneIterator(this);
+ }
+ if (templateSchema != null)
+ {
+ if (templateSchema.getType().equals("Schema"))
+ {
+ schema = new Schema(this, (Schema) templateSchema);
+ }
+ else
+ {
+ schema = new PrimitiveSchemaElement(this, (PrimitiveSchemaElement) templateSchema);
+ }
+ }
+ if (templateAnalysis != null)
+ {
+ analysis = templateAnalysis.cloneIterator(this);
+ }
+ if (templateFeedback != null)
+ {
+ feedback = new Feedback(this, templateFeedback);
+ }
+ if (templateLocations != null)
+ {
+ knownLocations = templateLocations.cloneIterator(this);
+ }
+ if (templateLineage != null)
+ {
+ lineage = new Lineage(this, templateLineage);
+ }
+ if (templateRelatedAssets != null)
+ {
+ relatedAssets = templateRelatedAssets.cloneIterator(this);
+ }
+ }
+ }
+
+
+ /**
+ * Return the list of glossary definitions assigned directly to this asset.
+ *
+ * @return Meanings - list of glossary definitions.
+ */
+ public Meanings getMeanings()
+ {
+ if (meanings == null)
+ {
+ return meanings;
+ }
+ else
+ {
+ return meanings.cloneIterator(this);
+ }
+ }
+
+
+ /**
+ * Return details of the schema associated with the asset.
+ *
+ * @return SchemaElement - schema object to query the schema associated with the connected asset.
+ */
+ public SchemaElement getSchema()
+ {
+ if (schema == null)
+ {
+ return schema;
+ }
+ else
+ {
+ return schema.cloneSchemaElement(this);
+ }
+ }
+
+
+ /**
+ * Return details of the metadata discovery analysis for the asset.
+ *
+ * @return Annotations - List of annotations from metadata discovery
+ */
+ public Annotations getAnalysis()
+ {
+ if (analysis == null)
+ {
+ return analysis;
+ }
+ else
+ {
+ return analysis.cloneIterator(this);
+ }
+ }
+
+
+ /**
+ * Return details of the people, products and feedback that are connected to the asset.
+ *
+ * @return Feedback - feedback object to query the feedback on the asset.
+ */
+ public Feedback getFeedback()
+ {
+ if (feedback == null)
+ {
+ return feedback;
+ }
+ else
+ {
+ return new Feedback(this, feedback);
+ }
+ }
+
+
+ /**
+ * Return the list of locations for the asset.
+ *
+ * @return Locations - list of locations.
+ */
+ public Locations getKnownLocations()
+ {
+ if (knownLocations == null)
+ {
+ return knownLocations;
+ }
+ else
+ {
+ return knownLocations.cloneIterator(this);
+ }
+ }
+
+
+ /**
+ * Return details of the lineage for the asset.
+ *
+ * @return Lineage - lineage object that allows queries about the lineage of the asset.
+ */
+ public Lineage getLineage()
+ {
+ if (lineage == null)
+ {
+ return lineage;
+ }
+ else
+ {
+ return new Lineage(this, lineage);
+ }
+ }
+
+
+ /**
+ * Return the list of assets related to this asset.
+ *
+ * @return RelatedAssets list
+ */
+ public RelatedAssets getRelatedAssets()
+ {
+ if (relatedAssets == null)
+ {
+ return relatedAssets;
+ }
+ else
+ {
+ return relatedAssets.cloneIterator(this);
+ }
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "AssetUniverse{" +
+ "meanings=" + meanings +
+ ", schema=" + schema +
+ ", analysis=" + analysis +
+ ", feedback=" + feedback +
+ ", knownLocations=" + knownLocations +
+ ", lineage=" + lineage +
+ ", relatedAssets=" + relatedAssets +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certification.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certification.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certification.java
new file mode 100644
index 0000000..c0ffeeb
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certification.java
@@ -0,0 +1,303 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * Certification stores the certifications awarded to the asset.
+ * </p>
+ * <p>
+ * Many regulations and industry bodies define certifications that can confirm a level of support,
+ * capability or competence in an aspect of a digital organization’s operation.
+ * Having certifications may be necessary to operating legally or may be a business advantage.
+ * </p>
+ * <p>
+ * The certifications awarded to an asset can be captured in the metadata repository to enable both
+ * effective use and management of the certification process.
+ * </p>
+ */
+public class Certification extends Referenceable
+{
+ /*
+ * Properties of a certification
+ */
+ private String certificationTypeGUID = null;
+ private String certificationTypeName = null;
+ private String examiner = null;
+ private String summary = null;
+ private ExternalReference link = null;
+ private Date startDate = null;
+ private Date endDate = null;
+ private String certificationConditions = null;
+ private String createdBy = null;
+ private String custodian = null;
+ private String notes = null;
+
+
+ /**
+ * Typical constructor.
+ *
+ * @param parentAsset - descriptor for parent asset
+ * @param type - details of the metadata type for this properties object
+ * @param guid - unique id
+ * @param url - URL of the certification in the metadata repository
+ * @param classifications - enumeration of classifications
+ * @param qualifiedName - unique name
+ * @param additionalProperties - additional properties for the referenceable object
+ * @param meanings - list of glossary terms (summary)
+ * @param certificationTypeGUID - certification type GUID
+ * @param certificationTypeName - certification type name
+ * @param examiner - name of the organization or person that issued the certification
+ * @param summary - brief summary of the certification
+ * @param link - external reference for full text of the certification.
+ * @param startDate - start date for the certification. Null means unknown or not relevant.
+ * @param endDate - end date for the certification. Null means it does not expire.
+ * @param certificationConditions - any special conditions that apply to the certification - such as endorsements
+ * @param createdBy - name of the person or organization that set up the certification for this asset
+ * @param custodian - String name of the person or organization that is responsible for the correct management
+ * of the asset according to the certification
+ * @param notes - String notes from the custodian
+ */
+ public Certification(AssetDescriptor parentAsset,
+ ElementType type,
+ String guid,
+ String url,
+ Classifications classifications,
+ String qualifiedName,
+ AdditionalProperties additionalProperties,
+ Meanings meanings,
+ String certificationTypeGUID,
+ String certificationTypeName,
+ String examiner,
+ String summary,
+ ExternalReference link,
+ Date startDate,
+ Date endDate,
+ String certificationConditions,
+ String createdBy,
+ String custodian,
+ String notes)
+ {
+ super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
+
+ this.certificationTypeGUID = certificationTypeGUID;
+ this.certificationTypeName = certificationTypeName;
+ this.examiner = examiner;
+ this.summary = summary;
+ this.link = link;
+ this.startDate = startDate;
+ this.endDate = endDate;
+ this.certificationConditions = certificationConditions;
+ this.createdBy = createdBy;
+ this.custodian = custodian;
+ this.notes = notes;
+ }
+
+ /**
+ * Copy/clone constructor.
+ *
+ * @param parentAsset - descriptor for parent asset
+ * @param templateCertification - element to copy
+ */
+ public Certification(AssetDescriptor parentAsset, Certification templateCertification)
+ {
+ super(parentAsset, templateCertification);
+
+ if (templateCertification != null)
+ {
+ certificationTypeGUID = templateCertification.getCertificationTypeGUID();
+ certificationTypeName = templateCertification.getCertificationTypeName();
+ examiner = templateCertification.getExaminer();
+ summary = templateCertification.getSummary();
+
+ ExternalReference templateLink = templateCertification.getLink();
+ if (templateLink != null)
+ {
+ link = new ExternalReference(parentAsset, templateLink);
+ }
+
+ Date templateStartDate = templateCertification.getStartDate();
+ if (templateStartDate != null)
+ {
+ startDate = new Date(templateStartDate.getTime());
+ }
+
+ Date templateEndDate = templateCertification.getEndDate();
+ if (templateEndDate != null)
+ {
+ endDate = new Date(templateStartDate.getTime());
+ }
+
+ certificationConditions = templateCertification.getCertificationConditions();
+ createdBy = templateCertification.getCreatedBy();
+ custodian = templateCertification.getCustodian();
+ notes = templateCertification.getNotes();
+ }
+ }
+
+
+ /**
+ * Return the unique id for the type of certification.
+ *
+ * @return String certification type GUID
+ */
+ public String getCertificationTypeGUID() { return certificationTypeGUID; }
+
+
+ /**
+ * Return the type of the certification.
+ *
+ * @return String certification type
+ */
+ public String getCertificationTypeName() { return certificationTypeName; }
+
+
+ /**
+ * Return the name of the organization or person that issued the certification.
+ *
+ * @return String name
+ */
+ public String getExaminer() { return examiner; }
+
+
+ /**
+ * Return a brief summary of the certification.
+ *
+ * @return String summary
+ */
+ public String getSummary() { return summary; }
+
+
+ /**
+ * Return the link to the full text of the certification.
+ *
+ * @return ExternalReference for full text
+ */
+ public ExternalReference getLink()
+ {
+ if (link == null)
+ {
+ return link;
+ }
+ else
+ {
+ return new ExternalReference(super.getParentAsset(), link);
+ }
+ }
+
+
+ /**
+ * Return the start date for the certification. Null means unknown or not relevant.
+ *
+ * @return Date - start date for the certification
+ */
+ public Date getStartDate()
+ {
+ if (startDate == null)
+ {
+ return startDate;
+ }
+ else
+ {
+ return new Date(startDate.getTime());
+ }
+ }
+
+
+ /**
+ * Return the end date for the certification. Null means it does not expire.
+ *
+ * @return Date - end date for the certification
+ */
+ public Date getEndDate()
+ {
+ if (endDate == null)
+ {
+ return endDate;
+ }
+ else
+ {
+ return new Date(endDate.getTime());
+ }
+ }
+
+
+ /**
+ * Return any special conditions that apply to the certification - such as endorsements.
+ *
+ * @return String certification conditions
+ */
+ public String getCertificationConditions() { return certificationConditions; }
+
+
+ /**
+ * Return the name of the person or organization that set up the certification for this asset.
+ *
+ * @return String name
+ */
+ public String getCreatedBy() { return createdBy; }
+
+
+ /**
+ * Return the name of the person or organization that is responsible for the correct management of the asset
+ * according to the certification.
+ *
+ * @return String name
+ */
+ public String getCustodian() { return custodian; }
+
+
+ /**
+ * Return the notes from the custodian.
+ *
+ * @return String notes
+ */
+ public String getNotes() { return notes; }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "Certification{" +
+ "certificationTypeGUID='" + certificationTypeGUID + '\'' +
+ ", certificationTypeName='" + certificationTypeName + '\'' +
+ ", examiner='" + examiner + '\'' +
+ ", summary='" + summary + '\'' +
+ ", link=" + link +
+ ", startDate=" + startDate +
+ ", endDate=" + endDate +
+ ", certificationConditions='" + certificationConditions + '\'' +
+ ", createdBy='" + createdBy + '\'' +
+ ", custodian='" + custodian + '\'' +
+ ", notes='" + notes + '\'' +
+ ", qualifiedName='" + qualifiedName + '\'' +
+ ", additionalProperties=" + additionalProperties +
+ ", meanings=" + meanings +
+ ", type=" + type +
+ ", guid='" + guid + '\'' +
+ ", url='" + url + '\'' +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certifications.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certifications.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certifications.java
new file mode 100644
index 0000000..0db0edd
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certifications.java
@@ -0,0 +1,128 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+import java.util.Iterator;
+
+/**
+ * Certifications supports an iterator over a list of certifications awarded to the asset.
+ * Callers can use it to step through the list
+ * just once. If they want to parse the list again, they could use the copy/clone constructor to create
+ * a new iterator.
+ */
+public abstract class Certifications extends AssetPropertyIteratorBase implements Iterator<Certification>
+{
+ /**
+ * Typical Constructor creates an iterator with the supplied list of elements.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
+ * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
+ * cached in the element list at any one time. If a number less than one is supplied, 1 is used.
+ */
+ public Certifications(AssetDescriptor parentAsset,
+ int totalElementCount,
+ int maxCacheSize)
+ {
+ super(parentAsset, totalElementCount, maxCacheSize);
+ }
+
+
+ /**
+ * Copy/clone constructor. Used to reset iterator element pointer to 0;
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param template - type-specific iterator to copy; null to create an empty iterator
+ */
+ public Certifications(AssetDescriptor parentAsset, Certifications template)
+ {
+ super(parentAsset, template);
+ }
+
+
+ /**
+ * Provides a concrete implementation of cloneElement for the specific iterator type.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param template - object to clone
+ * @return new cloned object.
+ */
+ protected Certification cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
+ {
+ return new Certification(parentAsset, (Certification)template);
+ }
+
+
+ /**
+ * Clones this iterator.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @return new cloned object.
+ */
+ protected abstract Certifications cloneIterator(AssetDescriptor parentAsset);
+
+
+ /**
+ * The iterator can only be used once to step through the elements. This method returns
+ * a boolean to indicate if it has got to the end of the list yet.
+ *
+ * @return boolean indicating whether there are more elements.
+ */
+ @Override
+ public boolean hasNext()
+ {
+ return super.pagingIterator.hasNext();
+ }
+
+
+ /**
+ * Return the next element in the iteration.
+ *
+ * @return Certification - next element object that has been cloned.
+ */
+ @Override
+ public Certification next()
+ {
+ return (Certification)super.pagingIterator.next();
+ }
+
+
+ /**
+ * Remove the current element in the iterator. (Null implementation since this iterator works off of cached
+ * elements from the property (metadata) server.)
+ */
+ @Override
+ public void remove()
+ {
+ super.pagingIterator.remove();
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "Certifications{" +
+ "pagingIterator=" + pagingIterator +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classification.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classification.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classification.java
new file mode 100644
index 0000000..5fee198
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classification.java
@@ -0,0 +1,175 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+import org.apache.atlas.ocf.ffdc.OCFErrorCode;
+import org.apache.atlas.ocf.ffdc.OCFRuntimeException;
+
+/**
+ * The Classification class stores information about a classification assigned to an asset. The Classification
+ * has a name and some properties. It also stores the typename of the asset it is connected to for debug purposes.
+ *
+ * Note: it is not valid to have a classification with a null or blank name.
+ */
+public class Classification extends AssetPropertyBase
+{
+ private String classificationName = null;
+ private AdditionalProperties classificationProperties = null;
+
+ /**
+ * A private validation method used by the constructors.
+ *
+ * @param name - name to check
+ * @return validated name
+ */
+ private String validateName(String name)
+ {
+ /*
+ * Throw an exception if the classification's name is null because that does not make sense.
+ * The constructors do not catch this exception so it is received by the creator of the classification
+ * object.
+ */
+ if (name == null || name.equals(""))
+ {
+ /*
+ * Build and throw exception. This should not happen - likely to be a problem in the
+ * repository connector.
+ */
+ OCFErrorCode errorCode = OCFErrorCode.NULL_CLASSIFICATION_NAME;
+ String errorMessage = errorCode.getErrorMessageId()
+ + errorCode.getFormattedErrorMessage(super.getParentAssetName(),
+ super.getParentAssetTypeName());
+
+ throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
+ this.getClass().getName(),
+ "validateName",
+ errorMessage,
+ errorCode.getSystemAction(),
+ errorCode.getUserAction());
+ }
+ else
+ {
+ return name;
+ }
+ }
+
+
+ /**
+ * Typical constructor - verifies and saves parameters.
+ *
+ * @param parentAsset - name and type of related asset
+ * @param name - name of the classification
+ * @param properties - additional properties for the classification
+ */
+ public Classification(AssetDescriptor parentAsset,
+ String name,
+ AdditionalProperties properties)
+ {
+ super(parentAsset);
+
+ this.classificationName = validateName(name);
+ this.classificationProperties = properties;
+ }
+
+
+ /**
+ * Copy/clone Constructor - sets up new classification using values from the template
+ *
+ * @param parentAsset - details of the asset that this classification is linked to.
+ * @param templateClassification - object to copy
+ */
+ public Classification(AssetDescriptor parentAsset, Classification templateClassification)
+ {
+ super(parentAsset, templateClassification);
+
+ /*
+ * An empty classification object is passed in the variable declaration so throw exception
+ * because we need the classification name.
+ */
+ if (templateClassification == null)
+ {
+ /*
+ * Build and throw exception. This should not happen - likely to be a problem in the
+ * repository connector.
+ */
+ OCFErrorCode errorCode = OCFErrorCode.NULL_CLASSIFICATION_NAME;
+ String errorMessage = errorCode.getErrorMessageId()
+ + errorCode.getFormattedErrorMessage("<Unknown>");
+
+ throw new OCFRuntimeException(errorCode.getHTTPErrorCode(),
+ this.getClass().getName(),
+ "Copy Constructor",
+ errorMessage,
+ errorCode.getSystemAction(),
+ errorCode.getUserAction());
+ }
+ else
+ {
+ /*
+ * Save the name and properties.
+ */
+ this.classificationName = validateName(templateClassification.getName());
+ this.classificationProperties = templateClassification.getProperties();
+ }
+ }
+
+
+ /**
+ * Return the name of the classification
+ *
+ * @return name of classification
+ */
+ public String getName()
+ {
+ return classificationName;
+ }
+
+
+ /**
+ * Returns a collection of the additional stored properties for the classification.
+ * If no stored properties are present then null is returned.
+ *
+ * @return properties for the classification
+ */
+ public AdditionalProperties getProperties()
+ {
+ if (classificationProperties == null)
+ {
+ return classificationProperties;
+ }
+ else
+ {
+ return new AdditionalProperties(super.getParentAsset(), classificationProperties);
+ }
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "Classification{" +
+ "classificationName='" + classificationName + '\'' +
+ ", classificationProperties=" + classificationProperties +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classifications.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classifications.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classifications.java
new file mode 100644
index 0000000..9ff493c
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classifications.java
@@ -0,0 +1,128 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+import java.util.Iterator;
+
+/**
+ * Classifications supports an iterator over a list of classifications. Callers can use it to step through the list
+ * just once. If they want to parse the list again, they could use the copy/clone constructor to create
+ * a new iterator.
+ */
+public abstract class Classifications extends AssetPropertyIteratorBase implements Iterator<Classification>
+{
+ /**
+ * Typical Constructor creates an iterator with the supplied list of elements.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
+ * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
+ * cached in the element list at any one time. If a number less than one is supplied, 1 is used.
+ */
+ public Classifications(AssetDescriptor parentAsset,
+ int totalElementCount,
+ int maxCacheSize)
+ {
+ super(parentAsset, totalElementCount, maxCacheSize);
+ }
+
+
+ /**
+ * Copy/clone constructor. Used to reset iterator element pointer to 0;
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param template - type-specific iterator to copy; null to create an empty iterator
+ */
+ public Classifications(AssetDescriptor parentAsset, Classifications template)
+ {
+ super(parentAsset, template);
+ }
+
+
+ /**
+ * Provides a concrete implementation of cloneElement for the specific iterator type.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param template - object to clone
+ * @return new cloned object.
+ */
+ protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
+ {
+ return new Classification(parentAsset, (Classification)template);
+ }
+
+
+ /**
+ * Clones this iterator.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @return new cloned object.
+ */
+ protected abstract Classifications cloneIterator(AssetDescriptor parentAsset);
+
+
+
+ /**
+ * The iterator can only be used once to step through the elements. This method returns
+ * a boolean to indicate if it has got to the end of the list yet.
+ *
+ * @return boolean indicating whether there are more elements.
+ */
+ @Override
+ public boolean hasNext()
+ {
+ return super.pagingIterator.hasNext();
+ }
+
+
+ /**
+ * Return the next element in the iteration.
+ *
+ * @return Classification - next element object that has been cloned.
+ */
+ @Override
+ public Classification next()
+ {
+ return (Classification)super.pagingIterator.next();
+ }
+
+
+ /**
+ * Remove the current element in the iterator. (Null implementation since this iterator works off of cached
+ * elements from the property (metadata) server.)
+ */
+ @Override
+ public void remove()
+ {
+ super.pagingIterator.remove();
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "Classifications{" +
+ "pagingIterator=" + pagingIterator +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comment.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comment.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comment.java
new file mode 100644
index 0000000..d80db87
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comment.java
@@ -0,0 +1,177 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+
+/**
+ * Stores information about a comment connected to an asset. Comments provide informal feedback to assets
+ * and can be added at any time.
+ *
+ * Comments have the userId of the person who added the feedback, along with their comment text.
+ *
+ * Comments can have other comments attached.
+ *
+ * The content of the comment is a personal statement (which is why the user's id is in the comment)
+ * and there is no formal review of the content.
+ */
+public class Comment extends ElementHeader
+{
+ /*
+ * Attributes of a Comment
+ */
+ private CommentType commentType = null;
+ private String commentText = null;
+ private String user = null;
+ private Comments commentReplies = null;
+
+
+ /**
+ * Typical Constructor
+ *
+ * @param parentAsset - descriptor for parent asset
+ * @param type - details of the metadata type for this properties object
+ * @param guid - String - unique id
+ * @param url - String - URL
+ * @param classifications - list of classifications
+ * @param commentType - enum describing the type of the comment
+ * @param commentText - comment text String
+ * @param user - String - user id of the person who created the comment. Null means the user id is not known.
+ * @param commentReplies - Nested list of comments replies
+ */
+ public Comment(AssetDescriptor parentAsset,
+ ElementType type,
+ String guid,
+ String url,
+ Classifications classifications,
+ CommentType commentType,
+ String commentText,
+ String user,
+ Comments commentReplies)
+ {
+ super(parentAsset, type, guid, url, classifications);
+
+ this.commentType = commentType;
+ this.commentText = commentText;
+ this.user = user;
+ this.commentReplies = commentReplies;
+ }
+
+ /**
+ * Copy/clone constructor.
+ *
+ * @param parentAsset - descriptor for parent asset
+ * @param templateComment - element to copy
+ */
+ public Comment(AssetDescriptor parentAsset, Comment templateComment)
+ {
+ /*
+ * Save the parent asset description.
+ */
+ super(parentAsset, templateComment);
+
+ if (templateComment != null)
+ {
+ /*
+ * Copy the values from the supplied comment.
+ */
+ commentType = templateComment.getCommentType();
+ user = templateComment.getUser();
+ commentText = templateComment.getCommentText();
+
+ Comments templateCommentReplies = templateComment.getCommentReplies();
+ if (templateCommentReplies != null)
+ {
+ /*
+ * Ensure comment replies has this object's parent asset, not the template's.
+ */
+ commentReplies = templateCommentReplies.cloneIterator(parentAsset);
+ }
+ }
+ }
+
+
+ /**
+ * Return an enum that describes the type of comment.
+ *
+ * @return CommentType enum
+ */
+ public CommentType getCommentType()
+ {
+ return commentType;
+ }
+
+
+ /**
+ * Return the user id of the person who created the comment. Null means the user id is not known.
+ *
+ * @return String - commenting user
+ */
+ public String getUser()
+ {
+ return user;
+ }
+
+
+ /**
+ * Return the comment text.
+ *
+ * @return String - commentText
+ */
+ public String getCommentText()
+ {
+ return commentText;
+ }
+
+
+ /**
+ * Return an iterator of the replies to this comment - null means no replies are available.
+ *
+ * @return Comments - comment replies iterator
+ */
+ public Comments getCommentReplies()
+ {
+ if (commentReplies == null)
+ {
+ return commentReplies;
+ }
+ else
+ {
+ return commentReplies.cloneIterator(super.getParentAsset());
+ }
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "Comment{" +
+ "commentText='" + commentText + '\'' +
+ ", user='" + user + '\'' +
+ ", commentReplies=" + commentReplies +
+ ", type=" + type +
+ ", guid='" + guid + '\'' +
+ ", url='" + url + '\'' +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/CommentType.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/CommentType.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/CommentType.java
new file mode 100644
index 0000000..6c07145
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/CommentType.java
@@ -0,0 +1,102 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+import java.io.Serializable;
+
+/**
+ * The CommentType allows comments to be used to ask and answer questions as well as make suggestions and
+ * provide useful information to other users.
+ */
+public enum CommentType implements Serializable
+{
+ STANDARD_COMMENT (0, "Comment", "General comment about the asset."),
+ QUESTION (1, "Question", "Asks a question to the people owning, managing or using the asset."),
+ ANSWER (2, "Answer", "Answers a question (posted as a reply to the question)."),
+ SUGGESTION (3, "Suggestion", "Provides a suggestion on how to improve the asset or its properties and description."),
+ USAGE_EXPERIENCE (4, "Experience", "Describes situations where this asset has been used and related hints and tips.");
+
+ private static final long serialVersionUID = 1L;
+
+ private int commentTypeCode;
+ private String commentType;
+ private String commentTypeDescription;
+
+
+ /**
+ * Typical Constructor
+ */
+ CommentType(int commentTypeCode, String commentType, String commentTypeDescription)
+ {
+ /*
+ * Save the values supplied
+ */
+ this.commentTypeCode = commentTypeCode;
+ this.commentType = commentType;
+ this.commentTypeDescription = commentTypeDescription;
+ }
+
+
+ /**
+ * Return the code for this enum instance
+ *
+ * @return int - comment type code
+ */
+ public int getCommentTypeCode()
+ {
+ return commentTypeCode;
+ }
+
+
+ /**
+ * Return the default type name for this enum instance.
+ *
+ * @return String - default type name
+ */
+ public String getCommentType()
+ {
+ return commentType;
+ }
+
+
+ /**
+ * Return the default description for the star rating for this enum instance.
+ *
+ * @return String - default description
+ */
+ public String getCommentTypeDescription()
+ {
+ return commentTypeDescription;
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "CommentType{" +
+ "commentTypeCode=" + commentTypeCode +
+ ", commentType='" + commentType + '\'' +
+ ", commentTypeDescription='" + commentTypeDescription + '\'' +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comments.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comments.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comments.java
new file mode 100644
index 0000000..baecec7
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comments.java
@@ -0,0 +1,127 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+import java.util.Iterator;
+
+/**
+ * Comments supports an iterator over a list of Comment objects. Callers can use it to step through the list
+ * just once. If they want to parse the list again, they could use the copy/clone constructor to create
+ * a new iterator.
+ */
+public abstract class Comments extends AssetPropertyIteratorBase implements Iterator<Comment>
+{
+ /**
+ * Typical Constructor creates an iterator with the supplied list of elements.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param totalElementCount - the total number of elements to process. A negative value is converted to 0.
+ * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and
+ * cached in the element list at any one time. If a number less than one is supplied, 1 is used.
+ */
+ public Comments(AssetDescriptor parentAsset,
+ int totalElementCount,
+ int maxCacheSize)
+ {
+ super(parentAsset, totalElementCount, maxCacheSize);
+ }
+
+
+ /**
+ * Copy/clone constructor. Used to reset iterator element pointer to 0;
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param template - type-specific iterator to copy; null to create an empty iterator
+ */
+ public Comments(AssetDescriptor parentAsset, Comments template)
+ {
+ super(parentAsset, template);
+ }
+
+
+ /**
+ * Provides a concrete implementation of cloneElement for the specific iterator type.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @param template - object to clone
+ * @return new cloned object.
+ */
+ protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template)
+ {
+ return new Comment(parentAsset, (Comment)template);
+ }
+
+
+ /**
+ * Clones this iterator.
+ *
+ * @param parentAsset - descriptor of parent asset
+ * @return new cloned object.
+ */
+ protected abstract Comments cloneIterator(AssetDescriptor parentAsset);
+
+
+ /**
+ * The iterator can only be used once to step through the elements. This method returns
+ * a boolean to indicate if it has got to the end of the list yet.
+ *
+ * @return boolean indicating whether there are more elements.
+ */
+ @Override
+ public boolean hasNext()
+ {
+ return super.pagingIterator.hasNext();
+ }
+
+
+ /**
+ * Return the next element in the iteration.
+ *
+ * @return Comment - next element object that has been cloned.
+ */
+ @Override
+ public Comment next()
+ {
+ return (Comment)super.pagingIterator.next();
+ }
+
+
+ /**
+ * Remove the current element in the iterator. (Null implementation since this iterator works off of cached
+ * elements from the property (metadata) server.)
+ */
+ @Override
+ public void remove()
+ {
+ super.pagingIterator.remove();
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "Comments{" +
+ "pagingIterator=" + pagingIterator +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/ConnectedAssetProperties.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/ConnectedAssetProperties.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/ConnectedAssetProperties.java
new file mode 100644
index 0000000..b9c8db1
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/ConnectedAssetProperties.java
@@ -0,0 +1,137 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+import org.apache.atlas.ocf.ffdc.PropertyServerException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ConnectedAssetProperties is associated with a Connector. Connectors provide access to
+ * assets. ConnectedAssetProperties returns properties (metadata) about the connector's asset.
+ *
+ * It is a generic interface for all types of open metadata assets. However, it assumes the asset's metadata model
+ * inherits from <b>Asset</b> (see model 0010 in Area 0).
+ *
+ * The ConnectedAssetProperties returns metadata about the asset at three levels of detail:
+ * <ul>
+ * <li><b>assetSummary</b> - used for displaying details of the asset in summary lists or hover text</li>
+ * <li><b>assetDetail</b> - used to display all of the information known about the asset with summaries
+ * of the relationships to other metadata entities</li>
+ * <li><b>assetUniverse</b> - used to define the broader context for the asset</li>
+ * </ul>
+ *
+ * ConnectedAssetProperties is a base class for the connector's metadata API that returns null,
+ * for the asset's properties. Metadata repository implementations extend this class to add their
+ * implementation of the refresh() method that calls to the metadata repository to populate the metadata properties.
+ */
+public abstract class ConnectedAssetProperties extends PropertyBase
+{
+ /*
+ * AssetUniverse extends AssetDetails which extends AssetSummary. The interaction with the metadata repository
+ * pulls the asset universe in one single network interaction and the caller can then explore the metadata
+ * property by property without incurring many network interactions (unless there are too many instances
+ * of a particular type of property and one of the iterators is forced to use paging).
+ *
+ * If null is returned, the connector is not linked to a metadata repository.
+ */
+ protected AssetUniverse assetProperties = null;
+
+ private static final Logger log = LoggerFactory.getLogger(ConnectedAssetProperties.class);
+
+ /**
+ * Typical constructor.
+ */
+ public ConnectedAssetProperties()
+ {
+ /*
+ * Nothing to do except initialize superclass.
+ */
+ super();
+ }
+
+
+ /**
+ * Copy/clone constructor.
+ *
+ * @param templateProperties - template to copy.
+ */
+ public ConnectedAssetProperties(ConnectedAssetProperties templateProperties)
+ {
+ super(templateProperties);
+
+ if (templateProperties != null)
+ {
+ AssetUniverse templateAssetUniverse = templateProperties.getAssetUniverse();
+ if (templateAssetUniverse != null)
+ {
+ assetProperties = new AssetUniverse(templateAssetUniverse);
+ }
+ }
+ }
+
+
+ /**
+ * Returns the summary information organized in the assetSummary structure.
+ *
+ * @return AssetSummary - summary object
+ */
+ public AssetSummary getAssetSummary() { return assetProperties; }
+
+
+
+ /**
+ * Returns detailed information about the asset organized in the assetDetail structure.
+ *
+ * @return AssetDetail - detail object
+ */
+ public AssetDetail getAssetDetail() { return assetProperties; }
+
+
+ /**
+ * Returns all of the detail of the asset and information connected to it in organized in the assetUniverse
+ * structure.
+ *
+ * @return AssetUniverse - universe object
+ */
+ public AssetUniverse getAssetUniverse() { return assetProperties; }
+
+
+ /**
+ * Request the values in the ConnectedAssetProperties are refreshed with the current values from the
+ * metadata repository.
+ *
+ * @throws PropertyServerException - there is a problem connecting to the server to retrieve metadata.
+ */
+ public abstract void refresh() throws PropertyServerException;
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "ConnectedAssetProperties{" +
+ "assetProperties=" + assetProperties +
+ '}';
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/cbfdd7fc/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Connection.java
----------------------------------------------------------------------
diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Connection.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Connection.java
new file mode 100644
index 0000000..d34e6f4
--- /dev/null
+++ b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Connection.java
@@ -0,0 +1,364 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.atlas.ocf.properties;
+
+
+/**
+ * The connection is an object that contains the properties needed to create and initialise a connector to access a
+ * specific data assets.
+ *
+ * The properties for a connection are defined in model 0201. They include the following options for connector name:
+ * <ul>
+ * <li>
+ * guid - Globally unique identifier for the connection.
+ * </li>
+ * <li>
+ * url - URL of the connection definition in the metadata repository.
+ * This URL can be stored as a property in another entity to create an explicit link to this connection.
+ * </li>
+ * <li>
+ * qualifiedName - The official (unique) name for the connection.
+ * This is often defined by the IT systems management organization and should be used (when available) on
+ * audit logs and error messages. The qualifiedName is defined in the 0010 model as part of Referenceable.
+ * </li>
+ * <li>
+ * displayName - A consumable name for the connection. Often a shortened form of the qualifiedName for use
+ * on user interfaces and messages. The displayName should be only be used for audit logs and error messages
+ * if the qualifiedName is not set.
+ * </li>
+ * </ul>
+ * Either the guid, qualifiedName or displayName can be used to specify the name for a connection.
+ *
+ * Other properties for the connection include:
+ *
+ * <ul>
+ * <li>
+ * type - information about the TypeDef for Connection
+ * </li>
+ * <li>
+ * description - A full description of the connection covering details of the assets it connects to
+ * along with usage and versioning information.
+ * </li>
+ * <li>
+ * additionalProperties - Any additional properties associated with the connection.
+ * </li>
+ * <li>
+ * securedProperties - Protected properties for secure log on by connector to back end server. These
+ * are protected properties that can only be retrieved by privileged connector code.
+ * </li>
+ * <li>
+ * connectorType - Properties that describe the connector type for the connector.
+ * </li>
+ * <li>
+ * endpoint - Properties that describe the server endpoint where the connector will retrieve the assets.
+ * </li>
+ * </ul>
+
+ * The connection class is simply used to cache the properties for an connection.
+ * It is used by other classes to exchange this information between a metadata repository and a consumer.
+ */
+public class Connection extends Referenceable
+{
+ /*
+ * Attributes of a connector
+ */
+ private String displayName = null;
+ private String description = null;
+ private ConnectorType connectorType = null;
+ private Endpoint endpoint = null;
+
+ /*
+ * Secured properties are protected so they can only be accessed by subclassing this object.
+ */
+ protected AdditionalProperties securedProperties = null;
+
+ /**
+ * Typical Constructor - for constructing a new, independent populated Connection.
+ *
+ * @param type - details of the metadata type for this properties object
+ * @param guid - String - unique id
+ * @param url - String - URL
+ * @param classifications - enumeration of classifications
+ * @param qualifiedName - unique name
+ * @param additionalProperties - additional properties for the referenceable object.
+ * @param meanings - list of glossary terms (summary)
+ * @param displayName - consumable name
+ * @param description - stored description property for the connection.
+ * @param connectorType - connector type to copy
+ * @param endpoint - endpoint properties
+ * @param securedProperties - typically user credentials for the connection
+ */
+ public Connection(ElementType type,
+ String guid,
+ String url,
+ Classifications classifications,
+ String qualifiedName,
+ AdditionalProperties additionalProperties,
+ Meanings meanings,
+ String displayName,
+ String description,
+ ConnectorType connectorType,
+ Endpoint endpoint,
+ AdditionalProperties securedProperties)
+ {
+ super(null, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
+
+ this.displayName = displayName;
+ this.description = description;
+ this.connectorType = connectorType;
+ this.endpoint = endpoint;
+ this.securedProperties = securedProperties;
+ }
+
+ /**
+ * Typical Constructor - for constructing a new, populated Connection as part of connected asset properties.
+ *
+ * @param parentAsset - descriptor for parent asset
+ * @param type - details of the metadata type for this properties object
+ * @param guid - String - unique id
+ * @param url - String - URL
+ * @param classifications - enumeration of classifications
+ * @param qualifiedName - unique name
+ * @param additionalProperties - additional properties for the referenceable object
+ * @param meanings - list of glossary terms (summary)
+ * @param displayName - consumable name
+ * @param description - stored description property for the connection.
+ * @param connectorType - connector type to copy
+ * @param endpoint - endpoint properties
+ * @param securedProperties - typically user credentials for the connection
+ */
+ public Connection(AssetDescriptor parentAsset,
+ ElementType type,
+ String guid,
+ String url,
+ Classifications classifications,
+ String qualifiedName,
+ AdditionalProperties additionalProperties,
+ Meanings meanings,
+ String displayName,
+ String description,
+ ConnectorType connectorType,
+ Endpoint endpoint,
+ AdditionalProperties securedProperties)
+ {
+ super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings);
+
+ this.displayName = displayName;
+ this.description = description;
+ this.connectorType = connectorType;
+ this.endpoint = endpoint;
+ this.securedProperties = securedProperties;
+ }
+
+
+ /**
+ * Copy/clone Constructor to return a copy of a connection object that is not connected to an asset.
+ *
+ * @param templateConnection - Connection to copy
+ */
+ public Connection(Connection templateConnection)
+ {
+ /*
+ * Set parentAsset to null
+ */
+ this(null, templateConnection);
+ }
+
+ /**
+ * Copy/clone Constructor to return a copy of a connection object that is connected to an asset.
+ *
+ * @param parentAsset - description of the asset that this connection is attached to.
+ * @param templateConnection - template object to copy.
+ */
+ public Connection(AssetDescriptor parentAsset, Connection templateConnection)
+ {
+ /*
+ * Save parentAsset
+ */
+ super(parentAsset, templateConnection);
+
+ /*
+ * Copy over properties from the template.
+ */
+ if (templateConnection != null)
+ {
+ displayName = templateConnection.getDisplayName();
+ description = templateConnection.getDescription();
+
+ ConnectorType templateConnectorType = templateConnection.getConnectorType();
+ Endpoint templateEndpoint = templateConnection.getEndpoint();
+ AdditionalProperties templateSecuredProperties = templateConnection.getSecuredProperties();
+
+ if (templateConnectorType != null)
+ {
+ connectorType = new ConnectorType(parentAsset, templateConnectorType);
+ }
+ if (templateEndpoint != null)
+ {
+ endpoint = new Endpoint(parentAsset, templateEndpoint);
+ }
+ if (templateSecuredProperties != null)
+ {
+ securedProperties = new AdditionalProperties(parentAsset, templateSecuredProperties);
+ }
+ }
+ }
+
+
+ /**
+ * Returns the stored display name property for the connection.
+ * Null means no displayName is available.
+ *
+ * @return displayName
+ */
+ public String getDisplayName() { return displayName; }
+
+
+ /**
+ * Returns a formatted string with the connection name. It is used in formatting error messages for the
+ * exceptions thrown by consuming components. It is extremely cautious because most of the exceptions
+ * are reporting a malformed connection object so who knows what else is wrong with it.
+ *
+ * Within the connection are 2 possible properties that could
+ * contain the connection name:
+ * ** qualifiedName - this is a uniqueName and should be there
+ * ** displayName - shorter simpler name but may not be unique - so may not identify the connection in error
+ *
+ * This method inspects these properties and builds up a string to represent the connection name
+ *
+ * @return connection name
+ */
+ public String getConnectionName()
+ {
+ String connectionName = "<Unknown>"; /* if all properties are blank */
+
+ /*
+ * The qualifiedName is preferred because it is unique.
+ */
+ if (qualifiedName != null && (!qualifiedName.equals("")))
+ {
+ /*
+ * Use qualified name.
+ */
+ connectionName = qualifiedName;
+ }
+ else if (displayName != null && (!displayName.equals("")))
+ {
+ /*
+ * The qualifiedName is not set but the displayName is available so use it.
+ */
+ connectionName = displayName;
+ }
+
+ return connectionName;
+ }
+
+
+ /**
+ * Returns the stored description property for the connection.
+ * If no description is provided then null is returned.
+ *
+ * @return description
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+
+ /**
+ * Returns a copy of the properties for this connection's connector type.
+ * A null means there is no connection type.
+ *
+ * @return connector type for the connection
+ */
+ public ConnectorType getConnectorType()
+ {
+ if (connectorType == null)
+ {
+ return connectorType;
+ }
+ else
+ {
+ return new ConnectorType(super.getParentAsset(), connectorType);
+ }
+ }
+
+
+ /**
+ * Returns a copy of the properties for this connection's endpoint.
+ * Null means no endpoint information available.
+ *
+ * @return endpoint for the connection
+ */
+ public Endpoint getEndpoint()
+ {
+ if (endpoint == null)
+ {
+ return endpoint;
+ }
+ else
+ {
+ return new Endpoint(super.getParentAsset(), endpoint);
+ }
+ }
+
+
+ /**
+ * Return a copy of the secured properties. Null means no secured properties are available.
+ * This method is protected so only OCF (or subclasses) can access them. When Connector is passed to calling
+ * OMAS, the secured properties are not available.
+ *
+ * @return secured properties - typically user credentials for the connection
+ */
+ protected AdditionalProperties getSecuredProperties()
+ {
+ if (securedProperties == null)
+ {
+ return securedProperties;
+ }
+ else
+ {
+ return new AdditionalProperties(super.getParentAsset(), securedProperties);
+ }
+ }
+
+
+ /**
+ * Standard toString method.
+ *
+ * @return print out of variables in a JSON-style
+ */
+ @Override
+ public String toString()
+ {
+ return "Connection{" +
+ "displayName='" + displayName + '\'' +
+ ", description='" + description + '\'' +
+ ", connectorType=" + connectorType +
+ ", endpoint=" + endpoint +
+ ", securedProperties=" + securedProperties +
+ ", qualifiedName='" + qualifiedName + '\'' +
+ ", additionalProperties=" + additionalProperties +
+ ", meanings=" + meanings +
+ ", type=" + type +
+ ", guid='" + guid + '\'' +
+ ", url='" + url + '\'' +
+ '}';
+ }
+}
\ No newline at end of file