http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Lineage.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Lineage.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Lineage.java new file mode 100644 index 0000000..adf97ea --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Lineage.java @@ -0,0 +1,69 @@ +/** + * 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 static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * Lineage shows the origin of the connected asset. It covers: + * <ul> + * <li>Design lineage - the known data movement and data stores that can supply data to this asset.</li> + * <li>Operational lineage - showing the jobs that ran to create this asset</li> + * </ul> + * + * Currently lineage is not implemented in the ConnectedAssetProperties interface because more design work is needed. + * This class is therefore a placeholder for lineage information. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Lineage extends PropertyBase +{ + /** + * Default constructor. + */ + public Lineage() + { + 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 lineage clone to point to the + * asset clone and not the original asset. + * + * @param templateLineage - lineage object to copy. + */ + public Lineage(Lineage templateLineage) + { + super(templateLineage); + + /* + * The open lineage design is still in progress so for the time being, this object does not do anything + * useful + */ + } +} \ 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/Location.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Location.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Location.java new file mode 100644 index 0000000..8f4556a --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Location.java @@ -0,0 +1,111 @@ +/* + * 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; + +/** + * Location describes where the asset is located. The model allows a very flexible definition of location + * that can be set up at different levels of granularity. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Location extends Referenceable +{ + /* + * Properties that make up the location of the asset. + */ + private String displayName = null; + private String description = null; + + + /** + * Default constructor + */ + public Location() + { + super(); + } + + + /** + * Copy/clone constructor + * + * @param templateLocation - template object to copy. + */ + public Location(Location templateLocation) + { + super(templateLocation); + if (templateLocation != null) + { + displayName = templateLocation.getDisplayName(); + description = templateLocation.getDescription(); + } + } + + + /** + * Returns the stored display name property for the location. + * 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 location. + * If a null is supplied it clears the display name. + * + * @param newDisplayName - consumable name + */ + public void setDisplayName(String newDisplayName) + { + displayName = newDisplayName; + } + + + /** + * Returns the stored description property for the location. + * If no description is provided then null is returned. + * + * @return description + */ + public String getDescription() + { + return description; + } + + + /** + * Updates the description property stored for the location. + * If a null is supplied it clears any saved description. + * + * @param newDescription - description + */ + public void setDescription(String newDescription) { description = newDescription; } +} \ 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/MapSchemaElement.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/MapSchemaElement.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/MapSchemaElement.java new file mode 100644 index 0000000..2191318 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/MapSchemaElement.java @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.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; + +/** + * MapSchemaElement describes a schema element of type map. It stores the type of schema element for the domain + * (eg property name) for the map and the schema element for the range (eg property value) for the map. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class MapSchemaElement extends SchemaElement +{ + private SchemaElement mapFromElement = null; + private SchemaElement mapToElement = null; + + + /** + * Default constructor + */ + public MapSchemaElement() + { + 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 templateSchema - template object to copy. + */ + public MapSchemaElement(MapSchemaElement templateSchema) + { + super(templateSchema); + + if (templateSchema != null) + { + SchemaElement templateMapFromElement = templateSchema.getMapFromElement(); + SchemaElement templateMapToElement = templateSchema.getMapToElement(); + + if (templateMapFromElement != null) + { + mapFromElement = templateMapFromElement.cloneSchemaElement(); + } + + if (templateMapToElement != null) + { + mapToElement = templateMapToElement.cloneSchemaElement(); + } + } + } + + + /** + * Return the type of schema element that represents the key or property name for the map. + * This is also called the domain of the map. + * + * @return SchemaElement + */ + public SchemaElement getMapFromElement() + { + return mapFromElement; + } + + + /** + * Set up the type of schema element that represents the key or property name for the map. + * This is also called the domain of the map. + * + * @param mapFromElement - SchemaElement + */ + public void setMapFromElement(SchemaElement mapFromElement) + { + this.mapFromElement = mapFromElement; + } + + + /** + * Return the type of schema element that represents the property value for the map. + * This is also called the range of the map. + * + * @return SchemaElement + */ + public SchemaElement getMapToElement() + { + return mapToElement; + } + + + /** + * Set up the type of schema element that represents the property value for the map. + * This is also called the range of the map. + * + * @param mapToElement - SchemaElement + */ + public void setMapToElement(SchemaElement mapToElement) + { + this.mapToElement = mapToElement; + } + + + /** + * Returns a clone of this object as the abstract SchemaElement class. + * + * @return SchemaElement + */ + @Override + public SchemaElement cloneSchemaElement() + { + return new MapSchemaElement(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/Meaning.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Meaning.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Meaning.java new file mode 100644 index 0000000..0988e70 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Meaning.java @@ -0,0 +1,115 @@ +/* + * 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; + +/** + * Meaning is a cut-down summary of a glossary term to aid the asset consumer in understanding the content + * of an asset. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Meaning extends Referenceable +{ + /* + * Attributes of a meaning object definition + */ + private String name = null; + private String description = null; + + + /** + * Default Constructor + */ + public Meaning() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateMeaning - element to copy + */ + public Meaning(Meaning templateMeaning) + { + super(templateMeaning); + + if (templateMeaning != null) + { + /* + * Copy the values from the supplied meaning object. + */ + name = templateMeaning.getName(); + description = templateMeaning.getDescription(); + } + } + + + /** + * Return the glossary term name. + * + * @return String name + */ + public String getName() + { + return name; + } + + + /** + * Set up the name of the glossary term. + * + * @param name - String + */ + public void setName(String name) + { + this.name = name; + } + + + /** + * Return the description of the glossary term. + * + * @return String description + */ + public String getDescription() + { + return description; + } + + + /** + * Set up the description of the glossary term. + * + * @param description string + */ + public void setDescription(String description) + { + this.description = description; + } +} \ 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/Note.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Note.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Note.java new file mode 100644 index 0000000..6046da6 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Note.java @@ -0,0 +1,140 @@ +/* + * 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; + +/** + * Note defines the properties of a single note in a note log. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Note extends Referenceable +{ + /* + * Attributes of a Note + */ + private String text = null; + private Date lastUpdate = null; + private String user = null; + + + /** + * Default Constructor + */ + public Note() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateNote - note to copy + */ + public Note(Note templateNote) + { + super(templateNote); + + if (templateNote != null) + { + /* + * Copy the properties from the supplied note. + */ + text = templateNote.getText(); + user = templateNote.getUser(); + + Date templateLastUpdate = templateNote.getLastUpdate(); + if (templateLastUpdate != null) + { + lastUpdate = new Date(templateLastUpdate.getTime()); + } + } + } + + + /** + * Return the text of the note. + * + * @return String text + */ + public String getText() { return text; } + + + /** + * Set up the text of the note. + * + * @param text - String + */ + public void setText(String text) { this.text = text; } + + + /** + * Return the last time a change was made to this note. + * + * @return Date last update + */ + public Date getLastUpdate() + { + if (lastUpdate == null) + { + return lastUpdate; + } + else + { + return new Date(lastUpdate.getTime()); + } + } + + + /** + * Set up the last update data for the note. + * + * @param lastUpdate - Date + */ + public void setLastUpdate(Date lastUpdate) { this.lastUpdate = lastUpdate; } + + + /** + * 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 http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/NoteLog.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/NoteLog.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/NoteLog.java new file mode 100644 index 0000000..8c1b34f --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/NoteLog.java @@ -0,0 +1,149 @@ +/* + * 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; + +/** + * NoteLog manages a list of notes for an asset + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class NoteLog extends Referenceable +{ + /* + * Attributes of an note log + */ + private String displayName = null; + private String description = null; + private List<Note> notes = null; + + + /** + * Default Constructor + */ + public NoteLog() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateNotelog - note log to copy + */ + public NoteLog(NoteLog templateNotelog) + { + super(templateNotelog); + + if (templateNotelog != null) + { + /* + * Copy the values from the supplied template. + */ + displayName = templateNotelog.getDisplayName(); + description = templateNotelog.getDescription(); + + List<Note> templateNotes = templateNotelog.getNotes(); + if (templateNotes != null) + { + notes = new ArrayList<>(templateNotes); + } + } + } + + /** + * Returns the stored display name property for the note log. + * 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 note log. + * If a null is supplied it clears the display name. + * + * @param newDisplayName - consumable name + */ + public void setDisplayName(String newDisplayName) + { + displayName = newDisplayName; + } + + + /** + * Returns the stored description property for the note log. + * If no description is provided then null is returned. + * + * @return description + */ + public String getDescription() + { + return description; + } + + + /** + * Updates the description property stored for the note log. + * If a null is supplied it clears any saved description. + * + * @param newDescription - description + */ + public void setDescription(String newDescription) { description = newDescription; } + + + /** + * Return the list of notes defined for this note log. + * + * @return Notes - list of notes + */ + public List<Note> getNotes() + { + if (notes == null) + { + return notes; + } + else + { + return new ArrayList<>(notes); + } + } + + /** + * Set up the list of notes for this note log. + * + * @param notes - Notes list + */ + public void setNotes(List<Note> 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/PrimitiveSchemaElement.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/PrimitiveSchemaElement.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/PrimitiveSchemaElement.java new file mode 100644 index 0000000..7c8d9c2 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/PrimitiveSchemaElement.java @@ -0,0 +1,110 @@ +/* + * 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; + +/** + * PrimitiveSchemaElement describes a schema element that has a primitive type. This class stores which + * type of primitive type it is an a default value if supplied. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class PrimitiveSchemaElement extends SchemaElement +{ + private String dataType = null; + private String defaultValue = null; + + /** + * Defauly constructor + */ + public PrimitiveSchemaElement() + { + 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 - schema element to copy + */ + public PrimitiveSchemaElement(PrimitiveSchemaElement templateSchemaElement) + { + super(templateSchemaElement); + + if (templateSchemaElement != null) + { + dataType = templateSchemaElement.getDataType(); + defaultValue = templateSchemaElement.getDefaultValue(); + } + } + + + /** + * Return the data type for this element. Null means unknown data type. + * + * @return String DataType + */ + public String getDataType() { return dataType; } + + + /** + * Set up the name of the data type for this element. Null means unknown data type. + * + * @param dataType - String DataType + */ + public void setDataType(String dataType) { this.dataType = dataType; } + + + /** + * Return the default value for the element. Null means no default value set up. + * + * @return String containing default value + */ + public String getDefaultValue() { return defaultValue; } + + + /** + * Set up the default value for the element. Null means no default value. + * + * @param defaultValue - String containing default value + */ + public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } + + + /** + * Returns a clone of this object as the abstract SchemaElement class. + * + * @return PrimitiveSchemaElement object + */ + @Override + public SchemaElement cloneSchemaElement() + { + return new PrimitiveSchemaElement(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/PropertyBase.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/PropertyBase.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/PropertyBase.java new file mode 100644 index 0000000..e2c6d7b --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/PropertyBase.java @@ -0,0 +1,78 @@ +/* + * 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 java.util.UUID; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +/** + * This property header implements any common mechanisms that all property objects need. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public abstract class PropertyBase implements Serializable +{ + private static final long serialVersionUID = 1L; + private static final int hashCode = UUID.randomUUID().hashCode(); + + + /** + * Typical Constructor + */ + public PropertyBase() + { + /* + * Nothing to do. This constructor is included so variables are added in this class at a later date + * without impacting the subclasses. + */ + } + + + /** + * Copy/clone Constructor + * + * @param template - object being copied + */ + public PropertyBase(PropertyBase template) + { + /* + * Nothing to do. This constructor is included so variables are added in this class at a later date + * without impacting the subclasses. + */ + } + + + /** + * Provide a common implementation of hashCode for all OCF properties objects. The UUID is unique and + * is randomly assigned and so its hashCode is as good as anything to describe the hash code of the properties + * object. + */ + public int hashCode() + { + return 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/Rating.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Rating.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Rating.java new file mode 100644 index 0000000..3eb44b6 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Rating.java @@ -0,0 +1,140 @@ +/* + * 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; + +/** + * Stores information about a rating connected to an asset. Ratings provide informal feedback on the quality of assets + * and can be added at any time. + * + * Ratings have the userId of the person who added it, a star rating and an optional review comment. + * + * The content of the rating is a personal judgement (which is why the user's id is in the object) + * and there is no formal review of the ratings. However, they can be used as a basis for crowd-sourcing + * feedback to asset owners. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Rating extends ElementHeader +{ + /* + * Attributes of a Rating + */ + private StarRating starRating = null; + private String review = null; + private String user = null; + + + /** + * Default Constructor + */ + public Rating() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateRating - element to copy + */ + public Rating(Rating templateRating) + { + /* + * Save the parent asset description. + */ + super(templateRating); + + if (templateRating != null) + { + /* + * Copy the values from the supplied tag. + */ + user = templateRating.getUser(); + starRating = templateRating.getStarRating(); + review = templateRating.getReview(); + } + } + + + /** + * Return the user id of the person who created the rating. Null means the user id is not known. + * + * @return String - user + */ + public String getUser() { + return user; + } + + + /** + * Set up the user id of the person who created the rating. Null means the user id is not known. + * + * @param user - String - user id of person providing the rating + */ + public void setUser(String user) { + this.user = user; + } + + + /** + * Return the stars for the rating. + * + * @return StarRating - starRating + */ + public StarRating getStarRating() { + return starRating; + } + + + /** + * Set up the star value for the rating. Null means no rating is supplied + * + * @param starRating - StarRating enum + */ + public void setStarRating(StarRating starRating) { this.starRating = starRating; } + + /** + * Return the review comments - null means no review is available. + * + * @return String - review comments + */ + public String getReview() + { + return review; + } + + + /** + * Set up the review comments - null means no review is available. + * + * @param review - String - review comments + */ + public void setReview(String review) { + this.review = review; + } +} \ 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/Referenceable.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Referenceable.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Referenceable.java new file mode 100644 index 0000000..d38ffb6 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Referenceable.java @@ -0,0 +1,170 @@ +/* + * 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; + +/** + * Many open metadata entities are referenceable. It means that they have a qualified name and additional + * properties. In addition the Referenceable class adds support for the parent asset, guid, url and type + * for the entity through extending ElementHeader. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Referenceable extends ElementHeader +{ + protected String qualifiedName = null; + protected AdditionalProperties additionalProperties = null; + protected List<Meaning> meanings = null; + + + /** + * Default Constructor + */ + public Referenceable() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateReferenceable - element to copy + */ + public Referenceable(Referenceable templateReferenceable) + { + /* + * Save the parent asset description. + */ + super(templateReferenceable); + + if (templateReferenceable != null) + { + /* + * Copy the qualified name from the supplied template. + */ + qualifiedName = templateReferenceable.getQualifiedName(); + + /* + * Create a copy of the additional properties since the parent asset may have changed. + */ + AdditionalProperties templateAdditionalProperties = templateReferenceable.getAdditionalProperties(); + if (templateAdditionalProperties != null) + { + additionalProperties = new AdditionalProperties(templateAdditionalProperties); + } + + + /* + * Create a copy of any glossary terms + */ + List<Meaning> templateMeanings = templateReferenceable.getMeanings(); + if (templateMeanings != null) + { + meanings = new ArrayList<>(templateMeanings); + } + } + } + + + /** + * Returns the stored qualified name property for the metadata entity. + * If no qualified name is available then the empty string is returned. + * + * @return qualifiedName + */ + public String getQualifiedName() + { + return qualifiedName; + } + + + /** + * Updates the qualified name property stored for the metadata entity. + * If a null is supplied it means no qualified name is available. + * + * @param newQualifiedName - unique name + */ + public void setQualifiedName(String newQualifiedName) { qualifiedName = newQualifiedName; } + + + /** + * Return a copy of the additional properties. Null means no additional properties are available. + * + * @return AdditionalProperties + */ + public AdditionalProperties getAdditionalProperties() + { + if (additionalProperties == null) + { + return additionalProperties; + } + else + { + return new AdditionalProperties(additionalProperties); + } + } + + + /** + * Set up a new additional properties object. + * + * @param newAdditionalProperties - additional properties for the referenceable object. + */ + public void setAdditionalProperties(AdditionalProperties newAdditionalProperties) + { + additionalProperties = newAdditionalProperties; + } + + + /** + * Return a list of the glossary terms attached to this referenceable object. Null means no terms available. + * + * @return list of glossary terms (summary) + */ + public List<Meaning> getMeanings() + { + if (meanings == null) + { + return meanings; + } + else + { + return new ArrayList<>(meanings); + } + } + + /** + * Set up a list of the glossary terms attached to this referenceable object. Null means no terms available. + * + * @param meanings - list of glossary terms (summary) + */ + public void setMeanings(List<Meaning> meanings) { this.meanings = meanings; } +} \ 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/RelatedAsset.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedAsset.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedAsset.java new file mode 100644 index 0000000..ccc5028 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedAsset.java @@ -0,0 +1,141 @@ +/* + * 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; + +/** + * RelatedAsset describes assets that are related to this asset. For example, if the asset is a data store, the + * related assets could be its supported data sets. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class RelatedAsset extends Referenceable +{ + /* + * Properties that make up the summary properties of the related asset. + */ + private String displayName = null; + private String description = null; + private String owner = null; + + + /** + * Default constructor + */ + public RelatedAsset() + { + super(); + } + + + /** + * Copy/clone constructor + * + * @param templateRelatedAsset - template object to copy. + */ + public RelatedAsset(RelatedAsset templateRelatedAsset) + { + super(templateRelatedAsset); + if (templateRelatedAsset != null) + { + displayName = templateRelatedAsset.getDisplayName(); + description = templateRelatedAsset.getDescription(); + owner = templateRelatedAsset.getOwner(); + } + } + + + /** + * Returns the stored display name property for the related asset. + * 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 related asset. + * If a null is supplied it clears the display name. + * + * @param newDisplayName - consumable name + */ + public void setDisplayName(String newDisplayName) + { + displayName = newDisplayName; + } + + + /** + * Returns the stored description property for the related asset. + * If no description is provided then null is returned. + * + * @return description + */ + public String getDescription() + { + return description; + } + + + /** + * Updates the description property stored for the related asset. + * If a null is supplied it clears any saved description. + * + * @param newDescription - description + */ + public void setDescription(String newDescription) { description = newDescription; } + + + /** + * Returns the details of the owner for this related asset. + * + * @return String owner + */ + public String getOwner() { return owner; } + + + /** + * Set up the owner details for this related asset. This could be the name of the owner, website, userid ... + * If null is supplied, it clears any saved owner details. + * + * @param owner - String + */ + public void setOwner(String owner) { this.owner = owner; } + + + /** + * Return the detailed properties for a related asset. + * + * @return RelatedAssetProperties + */ + public RelatedAssetProperties getRelatedAssetProperties() + { + return new RelatedAssetProperties(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/RelatedAssetProperties.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedAssetProperties.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedAssetProperties.java new file mode 100644 index 0000000..ad6a7bc --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedAssetProperties.java @@ -0,0 +1,143 @@ +/* + * 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.exceptions.PropertyServerException; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +/** + * RelatedAssetProperties returns detailed information about an asset that is related to a connected asset. + * + * It is a generic interface for all types of open metadata assets. However, it assumes the asset's metadata model + * inherits from <b>Asset</b> (see model 0010 in Area 0). + * + * The RelatedAssetProperties returns metadata about the asset at three levels of detail: + * <ul> + * <li><b>assetSummary</b> - used for displaying details of the asset in summary lists or hover text</li> + * <li><b>assetDetail</b> - used to display all of the information known about the asset with summaries + * of the relationships to other metadata entities</li> + * <li><b>assetUniverse</b> - used to define the broader context for the asset</li> + * </ul> + * + * RelatedAssetProperties is a base class for the asset information that returns null, + * for the asset's properties. Metadata repository implementations extend this class to add their + * implementation of the refresh() method that calls to the metadata repository to populate the metadata properties. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class RelatedAssetProperties extends PropertyBase +{ + /* + * AssetUniverse extends AssetDetails which extends AssetSummary. The interaction with the metadata repository + * pulls the asset universe in one single network interaction and the caller can then explore the metadata + * property by property without incurring many network interactions (unless there are too many instances + * of a particular type of property and one of the iterators is forced to use paging). + * + * If null is returned, the caller is not linked to a metadata repository. + */ + protected AssetUniverse assetProperties = null; + protected AssetDescriptor connectedAsset = null; + protected RelatedAsset relatedAsset = null; + + + /** + * Default constructor + */ + public RelatedAssetProperties() + { + } + + /** + * Typical constructor. + * + * @param relatedAsset - asset to extract the full set of properties. + */ + public RelatedAssetProperties(RelatedAsset relatedAsset) + { + this.relatedAsset = relatedAsset; + } + + + /** + * Copy/clone constructor* + * + * @param templateProperties - template to copy + */ + public RelatedAssetProperties(RelatedAssetProperties templateProperties) + { + if (templateProperties != null) + { + AssetUniverse templateAssetUniverse = templateProperties.getAssetUniverse(); + if (templateAssetUniverse != null) + { + assetProperties = new AssetUniverse(templateAssetUniverse); + connectedAsset = templateProperties.connectedAsset; + relatedAsset = templateProperties.relatedAsset; + } + } + } + + + /** + * Returns the summary information organized in the assetSummary structure. + * + * @return AssetSummary - summary object + */ + public AssetSummary getAssetSummary() { return assetProperties; } + + + + /** + * Returns detailed information about the asset organized in the assetDetail structure. + * + * @return AssetDetail - detail object + */ + public AssetDetail getAssetDetail() { return assetProperties; } + + + /** + * Returns all of the detail of the asset and information connected to it in organized in the assetUniverse + * structure. + * + * @return AssetUniverse - universe object + */ + public AssetUniverse getAssetUniverse() { return assetProperties; } + + + /** + * Request the values in the RelatedAssetProperties are refreshed with the current values from the + * metadata repository. + * + * @throws PropertyServerException - there is a problem connecting to the server to retrieve metadata. + */ + public void refresh() throws PropertyServerException + { + /* + * Do nothing - sub classes will override this method. + */ + } +} + http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaReference.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaReference.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaReference.java new file mode 100644 index 0000000..c547390 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaReference.java @@ -0,0 +1,253 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <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; + +/** + * RelatedMediaReference stores information about an link to an external media file 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 RelatedMediaReference extends Referenceable +{ + /* + * Attributes of a related media reference + */ + private String mediaId = 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; + private RelatedMediaType mediaType = null; + private List<RelatedMediaUsage> mediaUsageList = null; + + + /** + * Default Constructor + */ + public RelatedMediaReference() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param templateRelatedMediaReference - element to copy + */ + public RelatedMediaReference(RelatedMediaReference templateRelatedMediaReference) + { + /* + * Initialize the super class. + */ + super(templateRelatedMediaReference); + + if (templateRelatedMediaReference != null) + { + /* + * Copy the values from the supplied template. + */ + mediaId = templateRelatedMediaReference.getMediaId(); + linkDescription = templateRelatedMediaReference.getLinkDescription(); + displayName = templateRelatedMediaReference.getDisplayName(); + uri = templateRelatedMediaReference.getURI(); + resourceDescription = templateRelatedMediaReference.getResourceDescription(); + version = templateRelatedMediaReference.getVersion(); + organization = templateRelatedMediaReference.getOrganization(); + mediaType = templateRelatedMediaReference.getMediaType(); + + List<RelatedMediaUsage> templateMediaUsageList = templateRelatedMediaReference.getMediaUsageList(); + if (templateMediaUsageList != null) + { + mediaUsageList = new ArrayList<RelatedMediaUsage>(templateMediaUsageList); + } + } + } + + + /** + * Return the identifier given to this reference (with respect to this asset). + * + * @return String mediaId + */ + public String getMediaId() { return mediaId; } + + + /** + * Set up the reference identifier for this asset's related media. + * + * @param mediaId String + */ + public void setReferenceId(String mediaId) { this.mediaId = mediaId; } + + + /** + * 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 media reference. + * + * @return String display name. + */ + public String getDisplayName() { return displayName; } + + + /** + * Set up the display name for this media reference. + * + * @param displayName - String + */ + public void setDisplayName(String displayName) { this.displayName = displayName; } + + + /** + * Return the URI used to retrieve the resource for this media reference. + * + * @return String URI + */ + public String getURI() { return uri; } + + + /** + * Set up the URI used to retrieve the resource for this media reference. + * + * @param uri - String + */ + public void setURI(String uri) { this.uri = uri; } + + + /** + * Return the description of this external media. + * + * @return String resource description + */ + public String getResourceDescription() { return resourceDescription; } + + + /** + * Set up the description of this external media. + * + * @param resourceDescription String + */ + public void setResourceDescription(String resourceDescription) { this.resourceDescription = resourceDescription; } + + + /** + * Return the version of the resource that this media 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; } + + + /** + * Return the type of media referenced. + * + * @return RelatedMediaType + */ + public RelatedMediaType getMediaType() { return mediaType; } + + + /** + * Set up the media type. + * + * @param mediaType - RelatedMediaType + */ + public void setMediaType(RelatedMediaType mediaType) { this.mediaType = mediaType; } + + + /** + * Return the list of recommended usage for the related media. Null means no usage guidance is available. + * + * @return List of RelatedMediaUsage + */ + public List<RelatedMediaUsage> getMediaUsageList() + { + if (mediaUsageList != null) + { + return mediaUsageList; + } + else + { + return new ArrayList<RelatedMediaUsage>(mediaUsageList); + } + } + + + /** + * Set up the media usage list. + * + * @param mediaUsageList - List of RelatedMediaUsage + */ + public void setMediaUsageList(List<RelatedMediaUsage> mediaUsageList) + { + this.mediaUsageList = new ArrayList<RelatedMediaUsage>(mediaUsageList); + } +} \ 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/RelatedMediaType.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaType.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaType.java new file mode 100644 index 0000000..7deee26 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaType.java @@ -0,0 +1,90 @@ +/* + * 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; + +/** + * The RelatedMediaType defines the type of resource referenced in a related media reference. + * <ul> + * <li>Image</li> + * <li>Audio</li> + * <li>Document</li> + * <li>Video</li> + * <li>Other</li> + * </ul> + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public enum RelatedMediaType implements Serializable +{ + IMAGE(0, "Image"), + AUDIO(1, "Audio"), + DOCUMENT(2, "Document"), + VIDEO(3, "Video"), + OTHER(99, "Other"); + + private static final long serialVersionUID = 1L; + + private int mediaTypeCode; + private String mediaTypeName; + + + /** + * Typical Constructor + */ + RelatedMediaType(int mediaTypeCode, String mediaTypeName) + { + /* + * Save the values supplied + */ + this.mediaTypeCode = mediaTypeCode; + this.mediaTypeName = mediaTypeName; + + } + + + /** + * Return the code for this enum instance + * + * @return int - media type code + */ + public int getMediaUsageCode() + { + return mediaTypeCode; + } + + + /** + * Return the default name for this enum instance. + * + * @return String - default name + */ + public String getMediaUsageName() + { + return mediaTypeName; + } +} \ 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/RelatedMediaUsage.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaUsage.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaUsage.java new file mode 100644 index 0000000..a429416 --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/RelatedMediaUsage.java @@ -0,0 +1,96 @@ +/* + * 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; + +/** + * The RelatedMediaUsage defines how a related media reference can be used in conjunction with the asset properties. + * These usage options are not mutually exclusive. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public enum RelatedMediaUsage implements Serializable +{ + ICON(0, "Icon", "Provides a small image to represent the asset in tree views and graphs."), + THUMBNAIL(1, "Thumbnail", "Provides a small image about the asset that can be used in lists."), + ILLUSTRATION(2, "Illustration", "Illustrates how the asset works or what it contains. It is complementary to the asset's description."), + USAGE_GUIDANCE(3, "Usage Guidance", "Provides guidance to a person on how to use the asset."), + OTHER(99, "Other", "Another usage."); + + private static final long serialVersionUID = 1L; + + private int mediaUsageCode; + private String mediaUsageName; + private String mediaUsageDescription; + + + /** + * Typical Constructor + */ + RelatedMediaUsage(int mediaUsageCode, String mediaUsageName, String mediaUsageDescription) + { + /* + * Save the values supplied + */ + this.mediaUsageCode = mediaUsageCode; + this.mediaUsageName = mediaUsageName; + this.mediaUsageDescription = mediaUsageDescription; + } + + + /** + * Return the code for this enum instance + * + * @return int - media usage code + */ + public int getMediaUsageCode() + { + return mediaUsageCode; + } + + + /** + * Return the default name for this enum instance. + * + * @return String - default name + */ + public String getMediaUsageName() + { + return mediaUsageName; + } + + + /** + * Return the default description for the media usage pattern for this enum instance. + * + * @return String - default description + */ + public String getMediaUsageDescription() + { + return mediaUsageDescription; + } +} \ 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/Schema.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Schema.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Schema.java new file mode 100644 index 0000000..723e51b --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/Schema.java @@ -0,0 +1,218 @@ +/** + * 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; + +/** + * The Schema object provides information about how the asset structures the data it supports. Schemas are typically + * described as nested structures of linked schema elements. Schemas can also be reused in other schemas. + * + * The schema object can be used to represent a Struct, Array, Set or Map. + * <ul> + * <li> + * A Struct has an ordered list of attributes - the position of an attribute is set up as one of its properties. + * </li> + * <li> + * An Array has one schema attribute and a maximum size plus element count. + * </li> + * <li> + * A Set also has one schema attribute and a maximum size plus element count. + * </li> + * <li> + * A Map is a Set of MapSchemaElements + * </li> + * </ul> + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class Schema extends SchemaElement +{ + public enum SchemaType{ UNKNOWN, STRUCT, ARRAY, SET}; + + /* + * Properties specific to a Schema + */ + SchemaType schemaType = SchemaType.UNKNOWN; + List<SchemaAttribute> schemaAttributes = null; + int maximumElements = 0; + List<SchemaLink> schemaLinks = null; + + + /** + * Default constructor + */ + public Schema() + { + 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 templateSchema - template object to copy. + */ + public Schema(Schema templateSchema) + { + super(templateSchema); + + if (templateSchema != null) + { + List<SchemaAttribute> templateSchemaAttributes = templateSchema.getSchemaAttributes(); + + if (templateSchemaAttributes != null) + { + schemaAttributes = new ArrayList<>(templateSchemaAttributes); + } + schemaType = templateSchema.getSchemaType(); + maximumElements = templateSchema.getMaximumElements(); + + List<SchemaLink> templateSchemaLinks = templateSchema.getSchemaLinks(); + + if (templateSchemaLinks != null) + { + schemaLinks = new ArrayList<>(templateSchemaLinks); + } + } + } + + + /** + * Return the type of the schema. + * + * @return SchemaType + */ + public SchemaType getSchemaType() { return schemaType; } + + + /** + * Set up the type of the schema. + * + * @param schemaType - Struct, Array or Set + */ + public void setSchemaType(SchemaType schemaType) { this.schemaType = schemaType; } + + + /** + * Return the list of schema attributes in this schema. + * + * @return SchemaAttributes + */ + public List<SchemaAttribute> getSchemaAttributes() + { + if (schemaAttributes == null) + { + return schemaAttributes; + } + else + { + return new ArrayList<>(schemaAttributes); + } + } + + + /** + * Set up the list of schema attributes in this schema. + * + * @param schemaAttributes - list of attributes + */ + public void setSchemaAttributes(List<SchemaAttribute> schemaAttributes) { this.schemaAttributes = schemaAttributes; } + + + /** + * Return the maximum elements that can be stored in this schema. This is set up by the caller. + * Zero means not bounded. For a STRUCT the max elements are the number of elements in + * the structure. + * + * @return int maximum number of elements + */ + public int getMaximumElements() + { + if (schemaType == SchemaType.STRUCT) + { + maximumElements = schemaAttributes.size(); + } + + return maximumElements; + } + + + /** + * Set up the maximum elements that can be stored in this schema. This is set up by the caller. + * Zero means not bounded. For a STRUCT the max elements are the number of elements in + * the structure. + * + * @param maximumElements - int maximum number of elements + */ + public void setMaximumElements(int maximumElements) { this.maximumElements = maximumElements; } + + + /** + * Return a list of any links that exist between the schema attributes of this schema (or others). + * These links are typically used for network type schemas such as a grpah schema - or may be used to show + * linkage to an element in another schema. + * + * @return SchemaLinks - list of linked schema attributes + */ + public List<SchemaLink> getSchemaLinks() + { + if (schemaLinks == null) + { + return schemaLinks; + } + else + { + return new ArrayList<>(schemaLinks); + } + } + + + /** + * Set up a list of any links that exist between the schema attributes of this schema (or others). + * These links are typically used for network type schemas such as a graph schema - or may be used to show + * linkage to an element in another schema. + * + * @param schemaLinks - list of linked schema attributes + */ + public void setSchemaLinks(List<SchemaLink> schemaLinks) { this.schemaLinks = schemaLinks; } + + /** + * Returns a clone of this object as the abstract SchemaElement class. + * + * @return a copy of this schema as a SchemaElement + */ + @Override + public SchemaElement cloneSchemaElement() + { + return new Schema(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/SchemaAttribute.java ---------------------------------------------------------------------- diff --git a/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/SchemaAttribute.java b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/SchemaAttribute.java new file mode 100644 index 0000000..c151edf --- /dev/null +++ b/omas-connectedasset/src/main/java/org/apache/atlas/omas/connectedasset/properties/SchemaAttribute.java @@ -0,0 +1,182 @@ +/* + * 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; + +/** + * <p> + * SchemaAttribute describes a single attribute within a schema. The attribute has a name, order in the + * schema and cardinality. + * Its type is another SchemaElement (either Schema or PrimitiveSchemaElement). + * </p> + * <p> + * If it is a PrimitiveSchemaElement it may have an override for the default value within. + * </p> + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class SchemaAttribute extends PropertyBase +{ + String attributeName = null; + int elementPosition = 0; + String cardinality = null; + String defaultValueOverride = null; + SchemaElement attributeType = null; + + + /** + * Default Constructor - sets attribute to null. + */ + public SchemaAttribute() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param template - template schema attribute to copy. + */ + public SchemaAttribute(SchemaAttribute template) + { + super(template); + + if (template != null) + { + attributeName = template.getAttributeName(); + elementPosition = template.getElementPosition(); + cardinality = template.getCardinality(); + defaultValueOverride = template.getDefaultValueOverride(); + + SchemaElement templateAttributeType = template.getAttributeType(); + if (templateAttributeType != null) + { + /* + * SchemaElement is an abstract class with a placeholder method to clone an object + * of its sub-class. When cloneSchemaElement() is called, the implementation in the + * sub-class is called. + */ + attributeType = templateAttributeType.cloneSchemaElement(); + } + } + } + + + /** + * Return the name of this schema attribute. + * + * @return String attribute name + */ + public String getAttributeName() { return attributeName; } + + + /** + * Set up the name of this attribute. + * + * @param attributeName - String + */ + public void setAttributeName(String attributeName) { this.attributeName = attributeName; } + + + /** + * Return the position of this schema attribute in its parent schema. + * + * @return int position in schema - 0 means first + */ + public int getElementPosition() { return elementPosition; } + + + /** + * Set up the position of this schema attribute in its parent schema. + * + * @param elementPosition - int position in schema - 0 means first + */ + public void setElementPosition(int elementPosition) { this.elementPosition = elementPosition; } + + + /** + * Return the cardinality defined for this schema attribute. + * + * @return String cardinality defined for this schema attribute. + */ + public String getCardinality() { return cardinality; } + + + /** + * Set up the cardinality defined for this schema attribute. + * + * @param cardinality - String cardinality defined for this schema attribute. + */ + public void setCardinality(String cardinality) { this.cardinality = cardinality; } + + + /** + * Return any default value for this attribute that would override the default defined in the + * schema element for this attribute's type (note only used is type is primitive). + * + * @return String default value override + */ + public String getDefaultValueOverride() { return defaultValueOverride; } + + + /** + * Set up any default value for this attribute that would override the default defined in the + * schema element for this attribute's type (note only used is type is primitive). + * + * @param defaultValueOverride - String default value override + */ + public void setDefaultValueOverride(String defaultValueOverride) + { + this.defaultValueOverride = defaultValueOverride; + } + + + /** + * Return the SchemaElement that relates to the type of this attribute. + * + * @return SchemaElement + */ + public SchemaElement getAttributeType() + { + if (attributeType == null) + { + return attributeType; + } + else + { + return attributeType.cloneSchemaElement(); + } + } + + + /** + * Set up the SchemaElement that relates to the type of this attribute. + * + * @param attributeType SchemaElement + */ + public void setAttributeType(SchemaElement attributeType) { this.attributeType = attributeType; } +} \ No newline at end of file
