http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ConnectorType.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ConnectorType.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ConnectorType.java new file mode 100644 index 0000000..3c0e8c2 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ConnectorType.java @@ -0,0 +1,173 @@ +/* + * 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.omas.connectedasset.properties; + + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * The ConnectorType describe the implementation details of a particular type of OCF connector. + * The properties for a connector type are defined in model 0201. + * They include: + * + * <ul> + * <li> + * guid - Globally unique identifier for the connector type. + * </li> + * <li> + * url - External link address for the connector type properties in the metadata repository. This URL can be + * stored as a property in another entity to create an explicit link to this connector type. + * </li> + * <li> + * qualifiedName - The official (unique) name for the connector type. This is often defined by the IT + * systems management organization and should be used (when available) on audit logs and error messages. + * </li> + * <li> + * displayName - A consumable name for the connector type. 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> + * <li> + * description - A full description of the connector type covering details of the assets it connects to + * along with usage and versioning information. + * </li> + * <li> + * connectorProviderClassName - The connector provider is the factory for a particular type of connector. + * This property defines the class name for the connector provider that the Connector Broker should use to request + * new connector instances. + * </li> + * <li> + * additionalProperties - Any additional properties that the connector provider needs to know in order to + * create connector instances. + * </li> + * </ul> + * + * The connectorTypeProperties class is simply used to cache the properties for an connector type. + * It is used by other classes to exchange this information between a metadata repository and a consumer. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class ConnectorType extends Referenceable +{ + /* + * Attributes of a connector type + */ + private String displayName = null; + private String description = null; + private String connectorProviderClassName = null; + + /** + * Default Constructor - this is used when Connector Type is used inside a connection object which is itself + * not yet connected to an asset. In this case the ParentAsset is null. + */ + public ConnectorType() + { + super(); + } + + + /** + * Copy/clone constructor for a connectorType that is connected to an asset (either directly or indirectly). + * + * @param templateConnectorType - template object to copy. + */ + public ConnectorType(ConnectorType templateConnectorType) + { + super(templateConnectorType); + + /* + * All properties are initialised as null so only change their default setting if the template is + * not null + */ + if (templateConnectorType != null) + { + displayName = templateConnectorType.getDisplayName(); + description = templateConnectorType.getDescription(); + connectorProviderClassName = templateConnectorType.getConnectorProviderClassName(); + } + } + + + /** + * Returns the stored display name property for the connector type. + * If no display name is available then null is returned. + * + * @return displayName + */ + public String getDisplayName() + { + return displayName; + } + + + /** + * Updates the display name property stored for the connector type. + * If a null is supplied it means no display name is available. + * + * @param newDisplayName - consumable name + */ + public void setDisplayName(String newDisplayName) { displayName = newDisplayName; } + + + /** + * Returns the stored description property for the connector type. + * If no description is available then null is returned. + * + * @return description + */ + public String getDescription() + { + return description; + } + + + /** + * Updates the description property stored for the connector type. + * If a null is supplied it means no description is available. + * + * @param newDescription - description + */ + public void setDescription(String newDescription) { description = newDescription; } + + + /** + * Returns the stored connectorProviderClassName property for the connector type. + * If no connectorProviderClassName is available then null is returned. + * + * @return connectorProviderClassName + */ + public String getConnectorProviderClassName() + { + return connectorProviderClassName; + } + + + /** + * Updates the connectorProviderClassName property stored for the connector type. + * If a null is supplied it means no class name is available. + * + * @param newClassName - class name (including package name) + */ + public void setConnectorProviderClassName(String newClassName) { connectorProviderClassName = newClassName; } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/DerivedSchemaElement.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/DerivedSchemaElement.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/DerivedSchemaElement.java new file mode 100644 index 0000000..8789fb8 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/DerivedSchemaElement.java @@ -0,0 +1,129 @@ +/* + * 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.omas.connectedasset.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.ArrayList; +import java.util.List; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * Derived schema elements are used in views to define elements that are calculated using data from other sources. + * It contains a list of queries and a formula to combine the resulting values. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class DerivedSchemaElement extends PrimitiveSchemaElement +{ + private String formula = null; + private List<SchemaImplementationQuery> queries = null; + + /** + * Default constructor + */ + public DerivedSchemaElement() + { + super(); + } + + + /** + * Copy/clone Constructor - the parentAsset is passed separately to the template because it is also + * likely to be being cloned in the same operation and we want the definitions clone to point to the + * asset clone and not the original asset. + * + * @param templateSchemaElement - template object to copy. + */ + public DerivedSchemaElement(DerivedSchemaElement templateSchemaElement) + { + super(templateSchemaElement); + + if (templateSchemaElement != null) + { + List<SchemaImplementationQuery> templateQueries = templateSchemaElement.getQueries(); + + formula = templateSchemaElement.getFormula(); + queries = new ArrayList<>(templateQueries); + } + } + + + /** + * Return the formula used to combine the values of the queries. Each query is numbers 0, 1, ... and the + * formula has placeholders in it to show how the query results are combined. + * + * @return String formula + */ + public String getFormula() { return formula; } + + + /** + * Set up the formula used to combine the values of the queries. Each query is numbers 0, 1, ... and the + * formula has placeholders in it to show how the query results are combined. + * + * @param formula String formula + */ + public void setFormula(String formula) { this.formula = formula; } + + + /** + * Return the list of queries that are used to create the derived schema element. + * + * @return SchemaImplementationQueries - list of queries + */ + public List<SchemaImplementationQuery> getQueries() + { + if (queries == null) + { + return queries; + } + else + { + return new ArrayList<>(queries); + } + } + + + /** + * Set up the list of queries that are used to create the derived schema element. + * + * @param queries - SchemaImplementationQueries - list of queries + */ + public void setQueries(List<SchemaImplementationQuery> queries) + { + this.queries = queries; + } + + + /** + * Returns a clone of this object as the abstract SchemaElement class. + * + * @return PrimitiveSchemaElement object + */ + @Override + public SchemaElement cloneSchemaElement() + { + return new DerivedSchemaElement(this); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ElementHeader.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ElementHeader.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ElementHeader.java new file mode 100644 index 0000000..60c43ad --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ElementHeader.java @@ -0,0 +1,208 @@ +/* + * 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.omas.connectedasset.properties; + + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.ArrayList; +import java.util.List; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * ElementHeader provides the common identifier and type information for all properties objects + * that link off of the asset and have a guid associated with them. This typically means it is + * represented by an entity in the metadata repository. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public abstract class ElementHeader extends PropertyBase +{ + /* + * Common header for first class elements from a metadata repository + */ + protected ElementType type = null; + protected String guid = null; + protected String url = null; + + /* + * Attached classifications + */ + private List<Classification> classifications = null; + + + /** + * Default Constructor + */ + public ElementHeader() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateHeader - element to copy + */ + public ElementHeader(ElementHeader templateHeader) + { + /* + * Save the parent asset description. + */ + super(templateHeader); + + if (templateHeader != null) + { + /* + * Copy the values from the supplied like. + */ + type = templateHeader.getType(); + guid = templateHeader.getGUID(); + url = templateHeader.getURL(); + } + } + + + /** + * Return the element type properties for this properties object. 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; + } + + + /** + * Set up the type for this properties object. Null means the type information is unknown. + * + * @param type - details of the metadata type for this properties object + */ + public void setType(ElementType type) + { + if (type == null) + { + this.type = null; + } + else + { + this.type = type; + } + } + + + /** + * Return the unique id for the properties object. Null means no guid is assigned. + * + * @return String - unique id + */ + public String getGUID() { + return guid; + } + + + /** + * Set up the unique id for the properties object. Null means no guid is assigned. + * + * @param guid - String - unique id + */ + public void setGUID(String guid) { this.guid = guid; } + + + /** + * Returns the URL to access the properties object in the metadata repository. + * If no url is available then null is returned. + * + * @return String - URL + */ + public String getURL() { + return url; + } + + + /** + * Set up the the URL for the properties object in the metadata repository. Null means + * no url is available. + * + * @param url - String - URL + */ + public void setURL(String url) { + this.url = url; + } + + + /** + * 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 - list of classifications + */ + public List<Classification> getClassifications() + { + if (classifications == null) + { + return classifications; + } + else + { + return new ArrayList<>(classifications); + } + } + + + /** + * Set up the list of classifications for this asset. + * + * @param classifications - list of classifications + */ + public void setClassifications(List<Classification> classifications) + { + if (classifications == null) + { + this.classifications = classifications; + } + else + { + this.classifications = new ArrayList<>(classifications); + } + } + + /** + * Provide a common implementation of hashCode for all OCF properties objects that have a guid. + * The guid is unique and is randomly assigned and so its hashCode is as good as anything to + * describe the hash code of the properties object. If the guid is null then use the superclass implementation. + */ + public int hashCode() + { + if (guid == null) + { + return super.hashCode(); + } + else + { + return guid.hashCode(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ElementType.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ElementType.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ElementType.java new file mode 100644 index 0000000..a7d6c37 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ElementType.java @@ -0,0 +1,237 @@ +/* + * 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.omas.connectedasset.properties; + + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import org.apache.atlas.ocf.properties.ElementOrigin; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * The ElementType provide details of the type information associated with the element. Most consumers + * of the properties do not need this information. It is provided to asset consumers primarily as diagnostic + * information. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class ElementType extends PropertyBase +{ + protected String elementTypeId = null; + protected String elementTypeName = null; + protected long elementTypeVersion = 0; + protected String elementTypeDescription = null; + protected String elementAccessServiceURL = null; + protected ElementOrigin elementOrigin = null; + protected String elementHomeMetadataCollectionId = null; + + + + /** + * Typical Constructor + */ + public ElementType() + { + super(); + + /* + * Nothing to do - all local variables initialized in the declaration + */ + } + + + /** + * Copy/clone constructor + * + * @param templateType - type to clone + */ + public ElementType(ElementType templateType) + { + super(templateType); + + /* + * Copy the properties from the supplied template + */ + this.elementTypeId = templateType.getElementTypeId(); + this.elementTypeName = templateType.getElementTypeName(); + this.elementTypeVersion = templateType.getElementTypeVersion(); + this.elementTypeDescription = templateType.getElementTypeDescription(); + this.elementAccessServiceURL = templateType.getElementAccessServiceURL(); + this.elementHomeMetadataCollectionId = templateType.getElementHomeMetadataCollectionId(); + } + + /** + * Return unique identifier for the element's type. + * + * @return element type id + */ + public String getElementTypeId() + { + return elementTypeId; + } + + + /** + * Set the unique identifier of the element's type. + * + * @param elementTypeId - new identifier for the element's type + */ + public void setElementTypeId(String elementTypeId) + { + this.elementTypeId = elementTypeId; + } + + + /** + * Return name of element's type. + * + * @return - elementTypeName + */ + public String getElementTypeName() + { + return elementTypeName; + } + + + /** + * Set name of element's type. + * + * @param elementTypeName - element type name + */ + public void setElementTypeName(String elementTypeName) + { + this.elementTypeName = elementTypeName; + } + + + /** + * Return the version number for the element type. + * + * @return elementTypeVersion - version number for the element type. + */ + public long getElementTypeVersion() + { + return elementTypeVersion; + } + + + /** + * Set up a new version number for the element type. + * + * @param elementTypeVersion version number for the element type + */ + public void setElementTypeVersion(long elementTypeVersion) + { + this.elementTypeVersion = elementTypeVersion; + } + + + /** + * Return the description for the element type. + * + * @return elementTypeDescription - description for the element type + */ + public String getElementTypeDescription() + { + return elementTypeDescription; + } + + + /** + * Set up a new description for the element type. + * + * @param elementTypeDescription - description of element type + */ + public void setElementTypeDescription(String elementTypeDescription) + { + this.elementTypeDescription = elementTypeDescription; + } + + + /** + * Return the URL of the server where the element was retrieved from. Typically this is + * a server where the OMAS interfaces are activated. If no URL is known for the server then null is returned. + * + * @return elementSourceServerURL - the url of the server where the element came from + */ + public String getElementAccessServiceURL() + { + return elementAccessServiceURL; + } + + + /** + * Set up the name of the server where this metadata element was retrieved from. Typically this is + * a server where the OMAS interfaces are activated. If no URL is known for the server then null is passed in the + * parameter. + * + * @param elementAccessServiceURL - url of the OMAS server + */ + public void setElementAccessServiceURL(String elementAccessServiceURL) + { + this.elementAccessServiceURL = elementAccessServiceURL; + } + + + + /** + * Return the origin of the metadata element. + * + * @return ElementOrigin enum + */ + public ElementOrigin getElementOrigin() { return elementOrigin; } + + + /** + * Set up the origin of the metadata element. + * + * @param elementOrigin - enum + */ + public void setElementOrigin(ElementOrigin elementOrigin) + { + this.elementOrigin = elementOrigin; + } + + + /** + * Returns the unique identifier for the metadata collection that is managed by the repository + * where the element originates (its home repository). + * + * @return String metadata collection id + */ + public String getElementHomeMetadataCollectionId() + { + return elementHomeMetadataCollectionId; + } + + + /** + * Set up the unique identifier for the metadata collection that is managed by the repository + * where the element originates (its home repository). + * + * @param elementHomeMetadataCollectionId - String guid + */ + public void setElementHomeMetadataCollectionId(String elementHomeMetadataCollectionId) + { + this.elementHomeMetadataCollectionId = elementHomeMetadataCollectionId; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/EmbeddedConnection.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/EmbeddedConnection.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/EmbeddedConnection.java new file mode 100644 index 0000000..e2cc0f9 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/EmbeddedConnection.java @@ -0,0 +1,136 @@ +/* + * 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.omas.connectedasset.properties; + + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * The EmbeddedConnection is used within a VirtualConnection. It contains a connection and additional properties + * the VirtualConnection uses when working with the EmbeddedConnection. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class EmbeddedConnection extends PropertyBase +{ + /* + * Attributes of an embedded connection + */ + private AdditionalProperties embeddedConnectionProperties = null; + private Connection embeddedConnection = null; + + + /** + * Default Constructor + */ + public EmbeddedConnection() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateEmbeddedConnection - element to copy + */ + public EmbeddedConnection(EmbeddedConnection templateEmbeddedConnection) + { + super(templateEmbeddedConnection); + + if (templateEmbeddedConnection != null) + { + AdditionalProperties templateConnectionProperties = templateEmbeddedConnection.getEmbeddedConnectionProperties(); + Connection templateConnection = templateEmbeddedConnection.getEmbeddedConnection(); + + if (templateConnectionProperties != null) + { + embeddedConnectionProperties = new AdditionalProperties(templateConnectionProperties); + } + if (templateConnection != null) + { + embeddedConnection = new Connection(templateConnection); + } + } + } + + + /** + * Return the properties for the embedded connection. + * + * @return AdditionalProperties + */ + public AdditionalProperties getEmbeddedConnectionProperties() + { + if (embeddedConnectionProperties == null) + { + return embeddedConnectionProperties; + } + else + { + return new AdditionalProperties(embeddedConnectionProperties); + } + } + + + /** + * Set up the embedded connection's properties. + * + * @param embeddedConnectionProperties - Additional properties + */ + public void setEmbeddedConnectionProperties(AdditionalProperties embeddedConnectionProperties) + { + this.embeddedConnectionProperties = embeddedConnectionProperties; + } + + + /** + * Return the embedded connection. + * + * @return Connection object. + */ + public Connection getEmbeddedConnection() + { + if (embeddedConnection == null) + { + return embeddedConnection; + } + else + { + return new Connection(embeddedConnection); + } + } + + + /** + * Set up the embedded connection. + * + * @param embeddedConnection - Connection + */ + public void setEmbeddedConnection(Connection embeddedConnection) + { + this.embeddedConnection = embeddedConnection; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Endpoint.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Endpoint.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Endpoint.java new file mode 100644 index 0000000..ff9f49b --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Endpoint.java @@ -0,0 +1,236 @@ +/* + * 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.omas.connectedasset.properties; + + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * The Endpoint describes the network information necessary for a connector to connect to the server + * where the Asset is accessible from. The properties for an endpoint are defined in model 0040. + * They include: + * <ul> + * <li> + * type - definition of the specific metadata type for the endpoint. + * </li> + * <li> + * guid - Globally unique identifier for the endpoint. + * </li> + * <li> + * url - External link address for the endpoint properties in the metadata repository. + * This URL can be stored as a property in another entity to create an explicit link to this endpoint. + * </li> + * <li> + * qualifiedName - The official (unique) name for the endpoint. This is often defined by the IT systems management + * organization and should be used (when available) on audit logs and error messages. + * </li> + * <li> + * displayName - A consumable name for the endpoint. 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> + * <li> + * description - A description for the endpoint. + * </li> + * <li> + * address - The location of the asset. For network connected resources, this is typically the + * URL and port number (if needed) for the server where the asset is located + * (or at least accessible by the connector). For file-based resources, this is typically the name of the file. + * </li> + * <li> + * protocol - The communication protocol that the connection should use to connect to the server. + * </li> + * <li> + * encryptionMethod - Describes the encryption method to use (if any). This is an open value allowing + * information needed by the connector user to retrieve all of the information they need to work with + * the endpoint. + * </li> + * <li> + * additionalProperties - Any additional properties that the connector need to know in order to + * access the Asset. + * </li> + * </ul> + * + * The Endpoint class is simply used to cache the properties for an endpoint. + * It is used by other classes to exchange this information between a metadata repository and a consumer. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Endpoint extends Referenceable +{ + /* + * Properties of an Endpoint + */ + private String displayName = null; + private String description = null; + private String address = null; + private String protocol = null; + private String encryptionMethod = null; + + /** + * Default Constructor - used when Endpoint is inside a Connection that is not part of the connected asset + * properties. In this case there is no parent asset. + */ + public Endpoint() + { + super(); + } + + + /** + * Copy/clone constructor for an Endpoint that is connected to an Asset (either directly or indirectly). + * + * @param templateEndpoint - template object to copy. + */ + public Endpoint(Endpoint templateEndpoint) + { + super(templateEndpoint); + + /* + * All properties are initialised as null so only change their default setting if the template is + * not null + */ + if (templateEndpoint != null) + { + displayName = templateEndpoint.getDisplayName(); + address = templateEndpoint.getAddress(); + protocol = templateEndpoint.getProtocol(); + encryptionMethod = templateEndpoint.getEncryptionMethod(); + + AdditionalProperties templateAdditionalProperties = templateEndpoint.getAdditionalProperties(); + + if (templateAdditionalProperties != null) + { + additionalProperties = new AdditionalProperties(templateAdditionalProperties); + } + } + } + + + /** + * Returns the stored display name property for the endpoint. + * If no display name is available then null is returned. + * + * @return displayName + */ + public String getDisplayName() + { + return displayName; + } + + + /** + * Updates the display name property stored for the endpoint. + * If a null is supplied it means there is no display name for the endpoint. + * + * @param newDisplayName - simple name for the endpoint + */ + public void setDisplayName(String newDisplayName) { displayName = newDisplayName; } + + + /** + * Return the description for the endpoint. + * + * @return String description + */ + public String getDescription() + { + return description; + } + + + /** + * Set up the description for the endpoint. + * + * @param description - String description + */ + public void setDescription(String description) + { + this.description = description; + } + + /** + * Returns the stored address property for the endpoint. + * If no network address is available then null is returned. + * + * @return address + */ + public String getAddress() + { + return address; + } + + + /** + * Updates the address property needed to get to the asset. + * If a null is supplied it means there is no address for this endpoint. + * + * @param newAddress - network url for the server + */ + public void setAddress(String newAddress) { address = newAddress; } + + + /** + * Returns the stored protocol property for the endpoint. + * If no protocol is available then null is returned. + * + * @return protocol + */ + public String getProtocol() + { + return protocol; + } + + + /** + * Updates the protocol property stored for the endpoint. + * If a null is supplied it is saved as an empty string. + * + * @param newProtocol - endpoint protocol + */ + public void setProtocol(String newProtocol) { protocol = newProtocol; } + + + /** + * Returns the stored encryptionMethod property for the endpoint. This is an open type allowing the information + * needed to work with a specific encryption mechanism used by the endpoint to be defined. + * If no encryptionMethod property is available (typically because this is an unencrypted endpoint) + * then null is returned. + * + * @return encryption method information + */ + public String getEncryptionMethod() + { + return encryptionMethod; + } + + + /** + * Updates the encryptionMethod property stored for the endpoint. If a null is supplied it means no + * encryption is being used. + * + * @param newEncryptionMethod - encryption mechanism in use + */ + public void setEncryptionMethod(String newEncryptionMethod) { encryptionMethod = newEncryptionMethod; } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ExternalIdentifier.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ExternalIdentifier.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ExternalIdentifier.java new file mode 100644 index 0000000..ea1ef34 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ExternalIdentifier.java @@ -0,0 +1,215 @@ +/* + * 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.omas.connectedasset.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * ExternalIdentifier stores information about an identifier for the asset that is used in an external system. + * This is used for correlating information about the asset across different systems. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class ExternalIdentifier extends Referenceable +{ + /* + * Attributes of an external identifier + */ + private String identifier = null; + private String description = null; + private String usage = null; + private String source = null; + private KeyPattern keyPattern = null; + private Referenceable scope = null; + private String scopeDescription = null; + + + /** + * Default Constructor + */ + public ExternalIdentifier() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateExternalIdentifier - element to copy + */ + public ExternalIdentifier(ExternalIdentifier templateExternalIdentifier) + { + /* + * Initialize the super class. + */ + super(templateExternalIdentifier); + + if (templateExternalIdentifier != null) + { + /* + * Copy the values from the supplied template. + */ + identifier = templateExternalIdentifier.getIdentifier(); + description = templateExternalIdentifier.getDescription(); + usage = templateExternalIdentifier.getUsage(); + source = templateExternalIdentifier.getSource(); + keyPattern = templateExternalIdentifier.getKeyPattern(); + + Referenceable templateScope = templateExternalIdentifier.getScope(); + if (templateScope != null) + { + /* + * Ensure comment replies has this object's parent asset, not the template's. + */ + scope = new Referenceable(templateScope); + } + + scopeDescription = templateExternalIdentifier.getScopeDescription(); + } + } + + + /** + * Return the external identifier for this asset. + * + * @return String identifier + */ + public String getIdentifier() { return identifier; } + + + /** + * Set up the external identifier for the asset. + * @param identifier - String + */ + public void setIdentifier(String identifier) { this.identifier = identifier; } + + + /** + * Return the description of the external identifier. + * + * @return String description + */ + public String getDescription() { return description; } + + + /** + * Set up the description of the external identifier. + * + * @param description - String + */ + public void setDescription(String description) { this.description = description; } + + + /** + * Return details of how, where and when this external identifier is used. + * + * @return String usage + */ + public String getUsage() { return usage; } + + + /** + * Setup the usage guidance for this external identifier. + * + * @param usage - String + */ + public void setUsage(String usage) { this.usage = usage; } + + + /** + * Return details of the source system where this external identifier comes from. + * + * @return String server + */ + public String getSource() { return source; } + + + /** + * Set up the source description for this external identifier. + * + * @param source - String + */ + public void setSource(String source) { this.source = source; } + + + /** + * Return the key pattern that is used with this external identifier. + * + * @return KeyPattern enum + */ + public KeyPattern getKeyPattern() { return keyPattern; } + + + /** + * Set up the name of the key pattern used for this external identifier. + * + * @param keyPattern enum + */ + public void setKeyPattern(KeyPattern keyPattern) { this.keyPattern = keyPattern; } + + + /** + * Return the scope of this external identifier. This depends on the key pattern. It may be a server definition, + * a reference data set or glossary term. + * + * @return Referencable scope + */ + public Referenceable getScope() + { + if (scope == null) + { + return scope; + } + else + { + return new Referenceable(scope); + } + } + + + /** + * Set up the scope description for this external identifier. + * + * @param scope - Referenceable + */ + public void setScope(Referenceable scope) { this.scope = scope; } + + + /** + * Return the text description of the scope for this external identifier. + * + * @return String scope description + */ + public String getScopeDescription() { return scopeDescription; } + + + /** + * Set up the description of the scope for this external identifier. + * + * @param scopeDescription - String + */ + public void setScopeDescription(String scopeDescription) { this.scopeDescription = scopeDescription; } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ExternalReference.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ExternalReference.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ExternalReference.java new file mode 100644 index 0000000..00fc51c --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/ExternalReference.java @@ -0,0 +1,195 @@ +/* + * 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.omas.connectedasset.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * ExternalReference stores information about an link to an external resource that is relevant to this asset. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class ExternalReference extends Referenceable +{ + /* + * Attributes of an external reference + */ + private String referenceId = null; + private String linkDescription = null; + private String displayName = null; + private String uri = null; + private String resourceDescription = null; + private String version = null; + private String organization = null; + + + /** + * Default Constructor + */ + public ExternalReference() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateExternalReference - element to copy + */ + public ExternalReference(ExternalReference templateExternalReference) + { + /* + * Initialize the super class. + */ + super(templateExternalReference); + + if (templateExternalReference != null) + { + /* + * Copy the values from the supplied template. + */ + referenceId = templateExternalReference.getReferenceId(); + linkDescription = templateExternalReference.getLinkDescription(); + displayName = templateExternalReference.getDisplayName(); + uri = templateExternalReference.getURI(); + resourceDescription = templateExternalReference.getResourceDescription(); + version = templateExternalReference.getVersion(); + organization = templateExternalReference.getOrganization(); + } + } + + + /** + * Return the identifier given to this reference (with respect to this asset). + * + * @return String referenceId + */ + public String getReferenceId() { return referenceId; } + + + /** + * Set up the reference identifier for this asset's reference. + * + * @param referenceId String + */ + public void setReferenceId(String referenceId) { this.referenceId = referenceId; } + + + /** + * Return the description of the reference (with respect to this asset). + * + * @return String link description. + */ + public String getLinkDescription() { return linkDescription; } + + + /** + * Set up the description of the reference (with respect to this asset). + * + * @param linkDescription - String + */ + public void setLinkDescription(String linkDescription) { this.linkDescription = linkDescription; } + + + /** + * Return the display name of this external reference. + * + * @return String display name. + */ + public String getDisplayName() { return displayName; } + + + /** + * Set up the display name for this external reference. + * + * @param displayName - String + */ + public void setDisplayName(String displayName) { this.displayName = displayName; } + + + /** + * Return the URI used to retrieve the resource that this external reference represents. + * + * @return String URI + */ + public String getURI() { return uri; } + + + /** + * Set up the URI used to retrieve the resource that this external reference represents. + * + * @param uri - String + */ + public void setURI(String uri) { this.uri = uri; } + + + /** + * Return the description of the resource that this external reference represents. + * + * @return String resource description + */ + public String getResourceDescription() { return resourceDescription; } + + + /** + * Set up the description of the resource that this external reference represents. + * + * @param resourceDescription String + */ + public void setResourceDescription(String resourceDescription) { this.resourceDescription = resourceDescription; } + + + /** + * Return the version of the resource that this external reference represents. + * + * @return String version + */ + public String getVersion() { return version; } + + + /** + * Set up the version of the resource that this external reference represents. + * + * @param version - String + */ + public void setVersion(String version) { this.version = version; } + + + /** + * Return the name of the organization that owns the resource that this external reference represents. + * + * @return String organization name + */ + public String getOrganization() { return organization; } + + + /** + * Set up the name of the organization that owns the resource that this external reference represents. + * + * @param organization - String + */ + public void setOrganization(String organization) { this.organization = organization; } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Feedback.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Feedback.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Feedback.java new file mode 100644 index 0000000..a05658e --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Feedback.java @@ -0,0 +1,210 @@ +/** + * 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.omas.connectedasset.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.ArrayList; +import java.util.List; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * Feedback contains the comments, tags, ratings and likes that consumers of the asset have created. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Feedback extends PropertyBase +{ + /* + * Lists of objects that make up the feedback on the asset. + */ + private List<InformalTag> informalTags = null; + private List<Like> likes = null; + private List<Rating> ratings = null; + private List<Comment> comments = null; + + + /** + * Default Constructor + */ + public Feedback() + { + super(); + } + + + /** + * Copy/clone constructor - the parentAsset is passed separately to the template because it is also + * likely to be being cloned in the same operation and we want the feedback clone to point to the + * asset clone and not the original asset. + * + * @param templateFeedback - template object to copy. + */ + public Feedback(Feedback templateFeedback) + { + super(templateFeedback); + + /* + * Only create a child object if the template is not null. + */ + if (templateFeedback != null) + { + List<InformalTag> templateInformalTags = templateFeedback.getInformalTags(); + List<Like> templateLikes = templateFeedback.getLikes(); + List<Rating> templateRatings = templateFeedback.getRatings(); + List<Comment> templateComments = templateFeedback.getComments(); + + if (templateInformalTags != null) + { + this.informalTags = new ArrayList<>(templateInformalTags); + } + + if (templateLikes != null) + { + this.likes = new ArrayList<>(templateLikes); + } + + if (templateRatings != null) + { + this.ratings = new ArrayList<>(templateRatings); + } + + if (templateComments != null) + { + this.comments = new ArrayList<>(templateComments); + } + } + + } + + + /** + * Returns a copy of the information tags for the asset in an iterator. This iterator can be used to step + * through the tags once. Therefore call getInformalTags() for each scan of the asset's tags. + * + * @return InformalTags - tag list + */ + public List<InformalTag> getInformalTags() + { + if (informalTags == null) + { + return informalTags; + } + else + { + return new ArrayList<>(informalTags); + } + } + + + /** + * Set up the informal tags for the asset. + * + * @param informalTags - list of tags. + */ + public void setInformalTags(List<InformalTag> informalTags) { this.informalTags = informalTags; } + + + /** + * Returns a copy of the likes for the asset in an iterator. This iterator can be used to step + * through the list of like once. Therefore call getLikes() for each scan of the asset's like objects. + * + * @return Likes - like object list + */ + public List<Like> getLikes() + { + if (likes == null) + { + return likes; + } + else + { + return new ArrayList<>(likes); + } + } + + + /** + * Set up the list of likes (one object per person liking the asset) for the asset. + * + * @param likes - list of likes + */ + public void setLikes(List<Like> likes) { this.likes = likes; } + + + /** + * Returns a copy of the ratings for the asset in an iterator. This iterator can be used to step + * through the ratings once. Therefore call getRatings() for each scan of the asset's ratings. + * + * @return Ratings - rating list + */ + public List<Rating> getRatings() + { + if (ratings == null) + { + return ratings; + } + else + { + return new ArrayList<>(ratings); + } + } + + + /** + * Set the list of ratings that people have given the asset. + * + * @param ratings - list of ratings - one Rating object for each person's rating. + */ + public void setRatings(List<Rating> ratings) { + this.ratings = ratings; + } + + + /** + * Returns a copy of the comments for the asset in an iterator. This iterator can be used to step + * through the comments once. Therefore call getComments() for each scan of the asset's comments. + * + * @return Comments - comment list + */ + public List<Comment> getComments() + { + if (comments == null) + { + return comments; + } + else + { + return new ArrayList<>(comments); + } + } + + + /** + * Adds the list of comments for the asset. + * + * @param comments - comments list. + */ + public void setComments(List<Comment> comments) { this.comments = comments; } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/InformalTag.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/InformalTag.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/InformalTag.java new file mode 100644 index 0000000..9a461e4 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/InformalTag.java @@ -0,0 +1,197 @@ +/* + * 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.omas.connectedasset.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import org.apache.atlas.omas.connectedasset.ffdc.ConnectedAssetErrorCode; +import org.apache.atlas.omas.connectedasset.ffdc.exceptions.ConnectedAssetRuntimeException; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * InformalTag stores information about a tag connected to an asset. + * InformalTags provide informal classifications to assets + * and can be added at any time. + * + * InformalTags have the userId of the person who added the tag, the name of the tag and its description. + * + * The content of the tag is a personal judgement (which is why the user's id is in the tag) + * and there is no formal review of the tags. However, they can be used as a basis for crowd-sourcing + * Glossary terms. + * + * Private InformalTags are only returned to the user that created them. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class InformalTag extends ElementHeader +{ + /* + * Attributes of a InformalTag + */ + private boolean isPrivateTag = false; + + private String name = null; + private String description = null; + private String user = null; + + + /** + * Default Constructor + */ + public InformalTag() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateInformalTag - element to copy + */ + public InformalTag(InformalTag templateInformalTag) + { + /* + * Save the parent asset description. + */ + super(templateInformalTag); + + if (templateInformalTag != null) + { + /* + * Copy the values from the supplied tag. + */ + isPrivateTag = templateInformalTag.isPrivateTag(); + user = templateInformalTag.getUser(); + name = templateInformalTag.getName(); + description = templateInformalTag.getDescription(); + } + } + + + /** + * Return boolean flag to say whether the tag is private or not. A private tag is only seen by the + * person who set it up. Public tags are visible to everyone how can sse the asset description. + * + * @return boolean - is private flag + */ + public boolean isPrivateTag() { + return isPrivateTag; + } + + + /** + * Set up boolean flag to say whether the tag is private or not. A private tag is only seen by the + * person who set it up. Public tags are visible to everyone how can sse the asset description. + * + * @param privateTag - boolean - is private flag + */ + public void setPrivateTag(boolean privateTag) { + isPrivateTag = privateTag; + } + + + /** + * Return the user id of the person who created the tag. Null means the user id is not known. + * + * @return String - tagging user + */ + public String getUser() { + return user; + } + + + /** + * Set up the user id of the person who created the tag. Null means the user id is not known. + * + * @param taggingUser - String - tagging user + */ + public void setUser(String taggingUser) { + this.user = taggingUser; + } + + + /** + * Return the name of the tag. It is not valid to have a tag with no name. However, there is a point where + * the tag object is created and the tag name not set, so null is a possible response. + * + * @return String - tag name + */ + public String getName() { + return name; + } + + + /** + * Set up the name of the tag. It is not valid to have a tag with no name. + * + * @param tagName String - tag name + */ + public void setName(String tagName) + { + final String methodName = "setName"; + + if (tagName == null || tagName.equals("")) + { + /* + * Build and throw exception. This should not happen - likely to be a problem in the + * repository connector. + */ + ConnectedAssetErrorCode errorCode = ConnectedAssetErrorCode.NULL_TAG_NAME; + String errorMessage = errorCode.getErrorMessageId() + + errorCode.getFormattedErrorMessage(methodName, + this.getClass().getName()); + + throw new ConnectedAssetRuntimeException(errorCode.getHTTPErrorCode(), + this.getClass().getName(), + methodName, + errorMessage, + errorCode.getSystemAction(), + errorCode.getUserAction()); + } + else + { + this.name = tagName; + } + } + + + /** + * Return the tag description - null means no description is available. + * + * @return String - tag description + */ + public String getDescription() + { + return description; + } + + + /** + * Set up the tag description - null means no description is available. + * + * @param tagDescription - String - tag description + */ + public void setDescription(String tagDescription) { + this.description = tagDescription; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/KeyPattern.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/KeyPattern.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/KeyPattern.java new file mode 100644 index 0000000..78b16f5 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/KeyPattern.java @@ -0,0 +1,98 @@ +/* + * 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.omas.connectedasset.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.io.Serializable; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * A KeyPattern defines the type of External Identifier in use of an asset, or the type of Primary Key used within an + * asset. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public enum KeyPattern implements Serializable +{ + LOCAL_KEY(0, "Local Key", "Unique key allocated and used within the scope of a single system."), + RECYCLED_KEY(1, "Recycled Key", "Key allocated and used within the scope of a single system that is periodically reused for different records."), + NATURAL_KEY(2, "Natural Key", "Key derived from an attribute of the entity, such as email address, passport number."), + MIRROR_KEY(3, "Mirror Key", "Key value copied from another system."), + AGGREGATE_KEY(4, "Aggregate Key", "Key formed by combining keys from multiple systems."), + CALLERS_KEY(5, "Caller's Key", "Key from another system can bey used if system name provided."), + STABLE_KEY(6, "Stable Key", "Key value will remain active even if records are merged."), + OTHER(99, "Other", "Another key pattern."); + + private static final long serialVersionUID = 1L; + + private int keyPatternCode = 99; + private String keyPatternName = ""; + private String keyPatternDescription = ""; + + /** + * Typical Constructor + */ + KeyPattern(int keyPatternCode, String keyPatternName, String keyPatternDescription) + { + /* + * Save the values supplied + */ + this.keyPatternCode = keyPatternCode; + this.keyPatternName = keyPatternName; + this.keyPatternDescription = keyPatternDescription; + } + + + /** + * Return the code for this enum instance + * + * @return int - key pattern code + */ + public int getKeyPatternCode() + { + return keyPatternCode; + } + + + /** + * Return the default name for this enum instance. + * + * @return String - default name + */ + public String getKeyPatternName() + { + return keyPatternName; + } + + + /** + * Return the default description for the key pattern for this enum instance. + * + * @return String - default description + */ + public String getKeyPatternDescription() + { + return keyPatternDescription; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/License.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/License.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/License.java new file mode 100644 index 0000000..dc65a88 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/License.java @@ -0,0 +1,317 @@ +/* + * 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.omas.connectedasset.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.Date; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * <p> + * The data economy brings licensing to data and metadata. Even open data typically has a license. + * License stores the license permission associated with the asset. + * </p> + * <p> + * The license will define the permitted uses and other requirements for using the asset. + * </p> + * + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class License extends Referenceable +{ + /* + * properties of a license + */ + private String licenseTypeGUID = null; + private String licenseTypeName = null; + private String licensee = null; + private String summary = null; + private ExternalReference link = null; + private Date startDate = null; + private Date endDate = null; + private String licenseConditions = null; + private String createdBy = null; + private String custodian = null; + private String notes = null; + + + /** + * Default constructor. + */ + public License() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateLicense - element to copy + */ + public License(License templateLicense) + { + super(templateLicense); + + if (templateLicense != null) + { + licenseTypeGUID = templateLicense.getLicenseTypeGUID(); + licenseTypeName = templateLicense.getLicenseName(); + licensee = templateLicense.getLicensee(); + summary = templateLicense.getSummary(); + + ExternalReference templateLink = templateLicense.getLink(); + if (templateLink != null) + { + link = new ExternalReference(templateLink); + } + + Date templateStartDate = templateLicense.getStartDate(); + if (templateStartDate != null) + { + startDate = new Date(templateStartDate.getTime()); + } + + Date templateEndDate = templateLicense.getEndDate(); + if (templateEndDate != null) + { + endDate = new Date(templateStartDate.getTime()); + } + + licenseConditions = templateLicense.getLicenseConditions(); + createdBy = templateLicense.getCreatedBy(); + custodian = templateLicense.getCustodian(); + notes = templateLicense.getNotes(); + } + } + + + /** + * Return the unique id for the type of license. + * + * @return String license type GUID + */ + public String getLicenseTypeGUID() { return licenseTypeGUID; } + + + /** + * Set up the unique id of the license type. + * + * @param licenseGUID - String license type GUID + */ + public void setLicenseTypeGUID(String licenseGUID) { this.licenseTypeGUID = licenseGUID; } + + + /** + * Return the type of the license. + * + * @return String license type + */ + public String getLicenseName() { return licenseTypeName; } + + + /** + * Set up the type of the license. + * + * @param licenseName - String license type + */ + public void setLicenseName(String licenseName) { this.licenseTypeName = licenseName; } + + + /** + * Get the name of the organization or person that issued the license. + * + * @return String name + */ + public String getLicensee() { return licensee; } + + + /** + * Set up the name of the organization or person that issued the license. + * + * @param licensee - String name + */ + public void setLicensee(String licensee) { this.licensee = licensee; } + + + /** + * Return a brief summary of the license. + * + * @return String summary + */ + public String getSummary() { return summary; } + + + /** + * Set up a brief summary of the license. + * + * @param summary - String + */ + public void setSummary(String summary) { this.summary = summary; } + + + /** + * Return the link to the full text of the license. + * + * @return ExternalReference for full text + */ + public ExternalReference getLink() + { + if (link == null) + { + return link; + } + else + { + return new ExternalReference(link); + } + } + + + /** + * Set up the link to the full text of the license. + * + * @param link - ExternalReference for full text + */ + public void setLink(ExternalReference link) { this.link = link; } + + + /** + * Return the start date for the license. + * + * @return Date + */ + public Date getStartDate() + { + if (startDate == null) + { + return startDate; + } + else + { + return new Date(startDate.getTime()); + } + } + + + /** + * Set up start date for the license. + * + * @param startDate - Date + */ + public void setStartDate(Date startDate) { this.startDate = startDate; } + + + /** + * Return the end date for the license. + * + * @return Date + */ + public Date getEndDate() + { + if (endDate == null) + { + return endDate; + } + else + { + return new Date(endDate.getTime()); + } + } + + + /** + * Set up the end date for the license. + * + * @param endDate - Date + */ + public void setEndDate(Date endDate) { this.endDate = endDate; } + + + /** + * Return any special conditions that apply to the license - such as endorsements. + * + * @return String license conditions + */ + public String getLicenseConditions() { return licenseConditions; } + + + /** + * Set up any special conditions that apply to the license - such as endorsements. + * + * @param conditions - String license conditions + */ + public void setLicenseConditions(String conditions) { this.licenseConditions = conditions; } + + + /** + * Return the name of the person or organization that set up the license agreement for this asset. + * + * @return String name + */ + public String getCreatedBy() { return createdBy; } + + + /** + * Set up the name of the person or organization that set up the license agreement for this asset. + * + * @param createdBy - String name + */ + public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } + + + /** + * Return the name of the person or organization that is responsible for the correct management of the asset + * according to the license. + * + * @return String name + */ + public String getCustodian() { return custodian; } + + + /** + * Set up the name of the person or organization that is responsible for the correct management of the asset + * according to the license. + * + * @param custodian - String name + */ + public void setCustodian(String custodian) { this.custodian = custodian; } + + + /** + * Return the notes for the custodian. + * + * @return String notes + */ + public String getNotes() { return notes; } + + + /** + * Set up the notes from the custodian. + * + * @param notes - String + */ + public void setNotes(String notes) { this.notes = notes; } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Like.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Like.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Like.java new file mode 100644 index 0000000..f491196 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Like.java @@ -0,0 +1,87 @@ +/* + * 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.omas.connectedasset.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * The Like properties object records a single user's "like" of an asset. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Like extends ElementHeader +{ + /* + * Attributes of a Like + */ + private String user = null; + + + /** + * Default Constructor + */ + public Like() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateLike - element to copy + */ + public Like(Like templateLike) + { + super(templateLike); + + if (templateLike != null) + { + /* + * Copy the user name from the supplied like. + */ + user = templateLike.getUser(); + } + } + + + /** + * Return the user id of the person who created the like. Null means the user id is not known. + * + * @return String - liking user + */ + public String getUser() { + return user; + } + + + /** + * Set up the user id of the person who created the like. Null means the user id is not known. + * + * @param user - String - liking user + */ + public void setUser(String user) { + this.user = user; + } +} \ No newline at end of file
