http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Annotations.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Annotations.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Annotations.java deleted file mode 100644 index 2b7e99d..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Annotations.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * 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; - -import java.util.Iterator; - -/** - * Annotations supports an iterator over a list of annotations. 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 Annotations extends AssetPropertyIteratorBase implements Iterator<Annotation> -{ - /** - * 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 Annotations(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 Annotations(AssetDescriptor parentAsset, Annotations 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 Annotation(parentAsset, (Annotation)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract Annotations 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 Annotation - next element object that has been cloned. - */ - @Override - public Annotation next() - { - return (Annotation)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 "Annotations{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetDescriptor.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetDescriptor.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetDescriptor.java deleted file mode 100644 index 63d8fd4..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetDescriptor.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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; - -/** - * This is the base class for a connected asset. It is passed to all of the embedded property objects so the name - * and type can be used for error messages and other diagnostics. It also carries the URL of the asset in the - * metadata repository where this is known to enable properties to be retrieved on request. - */ -public abstract class AssetDescriptor extends PropertyBase -{ - /* - * Derived name and type for use by nested property object for messages/debug. If these default values - * are seen it is a sign that the asset properties are not being populated from the metadata repository. - */ - private String assetName = "<Unknown>"; - private String assetTypeName = "<Unknown>"; - - /* - * URL where the metadata about the asset is located. It remains null if no repository is known. - */ - private String url = null; - - /* - * Unique id for the asset. - */ - private String guid = null; - - - /** - * Typical constructor - the asset descriptor is effectively empty - and the protected - * set methods need to be called to add useful content to it. - */ - public AssetDescriptor() - { - /* - * Nothing to do except call superclass - */ - super(); - } - - - /** - * Explicit constructor - the asset descriptor is explicitly given the url for the asset. - * - * @param guid - unique id for the asset - * @param url - URL for the asset in the metadata repository - */ - public AssetDescriptor(String guid, String url) - { - super(); - - this.guid = guid; - this.url = url; - } - - - /** - * Copy/clone Constructor - used to copy the asset descriptor for a new consumer. - * - * @param templateAssetDescriptor - template asset descriptor to copy. - */ - public AssetDescriptor(AssetDescriptor templateAssetDescriptor) - { - super(); - - this.guid = templateAssetDescriptor.getGUID(); - this.assetName = templateAssetDescriptor.getAssetName(); - this.assetTypeName = templateAssetDescriptor.getAssetTypeName(); - this.url = templateAssetDescriptor.getURL(); - } - - - /** - * Method to enable a subclass to set up the asset name. - * - * @param assetName - String - name of asset for messages etc - */ - protected void setAssetName(String assetName) - { - this.assetName = assetName; - } - - - /** - * Method to enable a subclass to set up the asset type name. - * - * @param assetTypeName - String - new type name - */ - protected void setAssetTypeName(String assetTypeName) - { - this.assetTypeName = assetTypeName; - } - - - /** - * Return the unique id for this element. - * - * @return guid - unique id - */ - public String getGUID() { - return guid; - } - - - /** - * Return the name of the asset - for use in messages and other diagnostics. - * - * @return String - asset name - */ - public String getAssetName() - { - return assetName; - } - - - /** - * Return the name of the asset's type - for use in messages and other diagnostics. - * - * @return String - asset type name - */ - public String getAssetTypeName() - { - return assetTypeName; - } - - - /** - * Return the URL of the asset in the metadata repository if supported. - * - * @return String - URL - */ - public String getURL() { return url; } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "AssetDescriptor{" + - "assetName='" + assetName + '\'' + - ", assetTypeName='" + assetTypeName + '\'' + - ", url='" + url + '\'' + - ", guid='" + guid + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetDetail.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetDetail.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetDetail.java deleted file mode 100644 index c0bd56d..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetDetail.java +++ /dev/null @@ -1,332 +0,0 @@ -/** - * 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; - -/** - * AssetDetail extends AssetSummary to provide all of the properties related to this asset. It includes: - * <ul> - * <li>AssetProperties - properties unique to the particular type of asset including any vendor-specific facets.</li> - * <li>ExternalIdentifiers - list of identifiers for this asset that are used in other systems.</li> - * <li>RelatedMediaReferences - list of links to external media (images, audio, video) about this asset.</li> - * <li>NoteLogs - list of NoteLogs for this asset, often providing more detail on how to use the asset and - * its current status.</li> - * <li>ExternalReferences - list of links to additional information about this asset.</li> - * <li>Connections - list of connections defined to access this asset.</li> - * <li>Licenses - list of licenses associated with the asset.</li> - * <li>Certifications - list of certifications that have been awarded to this asset.</li> - * </ul> - */ -public class AssetDetail extends AssetSummary -{ - private AdditionalProperties assetProperties = null; - private ExternalIdentifiers externalIdentifiers = null; - private RelatedMediaReferences relatedMediaReferences = null; - private NoteLogs noteLogs = null; - private ExternalReferences externalReferences = null; - private Connections connections = null; - private Licenses licenses = null; - private Certifications certifications = null; - - - /** - * Typical constructor - initialize superclasses - * - * @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 - */ - public AssetDetail(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) - { - super(type, - guid, - url, - qualifiedName, - displayName, - shortDescription, - description, - owner, - classifications); - - this.assetProperties = assetProperties; - this.externalIdentifiers = externalIdentifiers; - this.relatedMediaReferences = relatedMediaReferences; - this.noteLogs = noteLogs; - this.externalReferences = externalReferences; - this.connections = connections; - this.licenses = licenses; - this.certifications = certifications; - } - - /** - * Copy/clone constructor. Note, this is a deep copy - * - * @param templateAssetDetail - template to copy - */ - public AssetDetail(AssetDetail templateAssetDetail) - { - /* - * Initialize superclass - */ - super(templateAssetDetail); - - /* - * Copy details from template, ensuring the parentAsset is this object, not the template's. - */ - if (templateAssetDetail != null) - { - AdditionalProperties templateAssetProperties = templateAssetDetail.getAssetProperties(); - ExternalIdentifiers templateExternalIdentifiers = templateAssetDetail.getExternalIdentifiers(); - RelatedMediaReferences templateRelatedMediaReferences = templateAssetDetail.getRelatedMediaReferences(); - NoteLogs templateNoteLogs = templateAssetDetail.getNoteLogs(); - ExternalReferences templateExternalReferences = templateAssetDetail.getExternalReferences(); - Connections templateConnections = templateAssetDetail.getConnections(); - Licenses templateLicenses = templateAssetDetail.getLicenses(); - Certifications templateCertifications = templateAssetDetail.getCertifications(); - - if (templateAssetProperties != null) - { - assetProperties = new AdditionalProperties(this, templateAssetProperties); - } - if (templateExternalIdentifiers != null) - { - externalIdentifiers = templateExternalIdentifiers.cloneIterator(this); - } - if (templateRelatedMediaReferences != null) - { - relatedMediaReferences = templateRelatedMediaReferences.cloneIterator(this); - } - if (templateNoteLogs != null) - { - noteLogs = templateNoteLogs.cloneIterator(this); - } - if (templateExternalReferences != null) - { - externalReferences = templateExternalReferences.cloneIterator(this); - } - if (templateConnections != null) - { - connections = templateConnections.cloneIterator(this); - } - if (templateLicenses != null) - { - licenses = templateLicenses.cloneIterator(this); - } - if (templateCertifications != null) - { - certifications = templateCertifications.cloneIterator(this); - } - } - } - - - /** - * Return the set of properties that are specific to the particular type of asset. The caller is given their - * own copy of the property object. The properties are named entityName.attributeName. The values are all strings. - * - * @return AdditionalProperties - asset properties using the name of attributes from the model. - */ - public AdditionalProperties getAssetProperties() - { - if (assetProperties == null) - { - return assetProperties; - } - else - { - return new AdditionalProperties(this, assetProperties); - } - } - - - /** - * Return an enumeration of the external identifiers for this asset (or null if none). - * - * @return ExternalIdentifiers enumeration - */ - public ExternalIdentifiers getExternalIdentifiers() - { - if (externalIdentifiers == null) - { - return externalIdentifiers; - } - else - { - return externalIdentifiers.cloneIterator(this); - } - } - - - /** - * Return an enumeration of references to the related media associated with this asset. - * - * @return RelatedMediaReferences enumeration - */ - public RelatedMediaReferences getRelatedMediaReferences() - { - if (relatedMediaReferences == null) - { - return relatedMediaReferences; - } - else - { - return relatedMediaReferences.cloneIterator(this); - } - } - - - /** - * Return an enumeration of NoteLogs linked to this asset. - * - * @return Notelogs iterator - */ - public NoteLogs getNoteLogs() - { - if (noteLogs == null) - { - return noteLogs; - } - else - { - return noteLogs.cloneIterator(this); - } - } - - - /** - * Return the enumeration of external references associated with this asset. - * - * @return ExternalReferences iterator - */ - public ExternalReferences getExternalReferences() - { - if (externalReferences == null) - { - return externalReferences; - } - else - { - return externalReferences.cloneIterator(this); - } - } - - - /** - * Return an enumeration of the connections defined for this asset. - * - * @return Connections enumeration - */ - public Connections getConnections() - { - if (connections == null) - { - return connections; - } - else - { - return connections.cloneIterator(this); - } - } - - - /** - * Return the list of licenses associated with the asset. - * - * @return Licenses - */ - public Licenses getLicenses() - { - if (licenses == null) - { - return licenses; - } - else - { - return licenses.cloneIterator(this); - } - } - - - /** - * Return the list of certifications awarded to the asset. - * - * @return Certifications - list of certifications - */ - public Certifications getCertifications() - { - if (certifications == null) - { - return certifications; - } - else - { - return certifications.cloneIterator(this); - } - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "AssetDetail{" + - "assetProperties=" + assetProperties + - ", externalIdentifiers=" + externalIdentifiers + - ", relatedMediaReferences=" + relatedMediaReferences + - ", noteLogs=" + noteLogs + - ", externalReferences=" + externalReferences + - ", connections=" + connections + - ", licenses=" + licenses + - ", certifications=" + certifications + - '}'; - } -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetPropertyBase.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetPropertyBase.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetPropertyBase.java deleted file mode 100644 index c98ea7b..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetPropertyBase.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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 AssetPropertyBase class is a base class for all properties that link off of the connected asset. - * It manages the information about the parent asset. - */ -public abstract class AssetPropertyBase extends PropertyBase -{ - private AssetDescriptor parentAsset = null; - - /** - * Typical constructor that sets the link to the connected asset to null - * - * @param parentAsset - descriptor of asset that his property relates to. - */ - protected AssetPropertyBase(AssetDescriptor parentAsset) - { - /* - * Initialize superclass and save the parent asset. - */ - super(); - this.parentAsset = parentAsset; - } - - - /** - * Copy/clone constructor - sets up details of the parent asset from the template - * - * @param parentAsset - descriptor of asset that his property relates to. - * @param template - AssetPropertyBase to copy - */ - protected AssetPropertyBase(AssetDescriptor parentAsset, AssetPropertyBase template) - { - /* - * Initialize superclass and save the parentAsset - */ - super(template); - this.parentAsset = parentAsset; - } - - - /** - * Return the asset descriptor of the parent asset. - * - * @return AssetDescriptor - */ - protected AssetDescriptor getParentAsset() { return parentAsset; } - - - /** - * Return the name of the connected asset that this property is connected to. - * - * @return String name of the connected asset - */ - protected String getParentAssetName() - { - String parentAssetName = "<Unknown>"; - - if (parentAsset != null) - { - parentAssetName = parentAsset.getAssetName(); - } - - return parentAssetName; - } - - - /** - * Return the type of the connected asset that this property relates to. - * - * @return String name of the connected asset's type. - */ - protected String getParentAssetTypeName() - { - String parentAssetTypeName = "<Unknown>"; - - if (parentAsset != null) - { - parentAssetTypeName = parentAsset.getAssetTypeName(); - } - - return parentAssetTypeName; - } - - - /** - * An equals() method for subclasses to check they are connected to the same parent asset. - * - * @param testObject - object to test - * @return boolean indicating whether this object is connected to equivalent parent assets. - */ - @Override - public boolean equals(Object testObject) - { - if (this == testObject) - { - return true; - } - if (testObject == null || getClass() != testObject.getClass()) - { - return false; - } - - AssetPropertyBase that = (AssetPropertyBase) testObject; - - return parentAsset != null ? parentAsset.equals(that.parentAsset) : that.parentAsset == null; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "AssetPropertyBase{" + - "parentAsset=" + parentAsset + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetPropertyIteratorBase.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetPropertyIteratorBase.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetPropertyIteratorBase.java deleted file mode 100644 index 5bb30eb..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetPropertyIteratorBase.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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 java.util.ArrayList; - -public abstract class AssetPropertyIteratorBase extends AssetPropertyBase -{ - protected PagingIterator pagingIterator = null; - - /** - * Typical Constructor creates an iterator with the supplied list of comments. - * - * @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. - */ - protected AssetPropertyIteratorBase(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - /* - * Initialize superclass. - */ - super(parentAsset); - - pagingIterator = new PagingIterator(parentAsset, this, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor - sets up details of the parent asset from the template - * - * @param parentAsset - descriptor of asset that his property relates to. - * @param template - AssetPropertyBaseImpl to copy - */ - protected AssetPropertyIteratorBase(AssetDescriptor parentAsset, AssetPropertyIteratorBase template) - { - /* - * Initialize superclass. - */ - super(parentAsset, template); - - if (template != null) - { - pagingIterator = new PagingIterator(parentAsset, this, template.pagingIterator); - } - } - - - /** - * Return the number of elements in the list. - * - * @return elementCount - */ - public int getElementCount() - { - if (pagingIterator == null) - { - return 0; - } - else - { - return pagingIterator.getElementCount(); - } - } - - - /** - * Method implemented by a subclass that ensures the cloning process is a deep clone. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected abstract AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template); - - - /** - * Method implemented by subclass to retrieve the next cached list of elements. - * - * @param cacheStartPointer - where to start the cache. - * @param maximumSize - maximum number of elements in the cache. - * @return list of elements corresponding to the supplied cache pointers. - * @throws PropertyServerException - there is a problem retrieving elements from the property (metadata) server. - */ - protected abstract ArrayList<AssetPropertyBase> getCachedList(int cacheStartPointer, - int maximumSize) throws PropertyServerException; -} http://git-wip-us.apache.org/repos/asf/atlas/blob/68b47923/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 deleted file mode 100644 index ef40770..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetSummary.java +++ /dev/null @@ -1,253 +0,0 @@ -/** - * 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/68b47923/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 deleted file mode 100644 index 6d352b9..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/AssetUniverse.java +++ /dev/null @@ -1,338 +0,0 @@ -/** - * 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/68b47923/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 deleted file mode 100644 index c0ffeeb..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certification.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * 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/68b47923/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 deleted file mode 100644 index 0db0edd..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Certifications.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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/68b47923/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 deleted file mode 100644 index 5fee198..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classification.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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/68b47923/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 deleted file mode 100644 index 9ff493c..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Classifications.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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/68b47923/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 deleted file mode 100644 index d80db87..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Comment.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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
