http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/MapSchemaElement.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/MapSchemaElement.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/MapSchemaElement.java deleted file mode 100644 index 56ffdff..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/MapSchemaElement.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - - -/** - * 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. - */ -public class MapSchemaElement extends SchemaElement -{ - private SchemaElement mapFromElement = null; - private SchemaElement mapToElement = null; - - - /** - * Typical constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - * @param versionNumber - the version number of the schema element - null means no version number. - * @param author - the name of the author of the schema element. Null means the author is unknown. - * @param usage - the usage guidance for this schema element. Null means no guidance available. - * @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else. - * Null means the encoding standard is unknown or there are many choices. - * @param mapFromElement - 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 mapToElement - the type of schema element that represents the property value for the map. - * This is also called the range of the map. - */ - public MapSchemaElement(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings, - String versionNumber, - String author, - String usage, - String encodingStandard, - SchemaElement mapFromElement, - SchemaElement mapToElement) - { - super(parentAsset, - type, - guid, - url, - classifications, - qualifiedName, - additionalProperties, - meanings, - versionNumber, - author, - usage, - encodingStandard); - - this.mapFromElement = mapFromElement; - this.mapToElement = mapToElement; - } - - /** - * 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 parentAsset - description of the asset that this map is attached to. - * @param templateSchema - template object to copy. - */ - public MapSchemaElement(AssetDescriptor parentAsset, MapSchemaElement templateSchema) - { - super(parentAsset, templateSchema); - - if (templateSchema != null) - { - SchemaElement templateMapFromElement = templateSchema.getMapFromElement(); - SchemaElement templateMapToElement = templateSchema.getMapToElement(); - - if (templateMapFromElement != null) - { - mapFromElement = templateMapFromElement.cloneSchemaElement(super.getParentAsset()); - } - - if (templateMapToElement != null) - { - mapToElement = templateMapToElement.cloneSchemaElement(super.getParentAsset()); - } - } - } - - - /** - * 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; - } - - - /** - * 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; - } - - - /** - * Returns a clone of this object as the abstract SchemaElement class. - * - * @param parentAsset - description of the asset that this schema element is attached to. - * @return SchemaElement - */ - @Override - public SchemaElement cloneSchemaElement(AssetDescriptor parentAsset) - { - return new MapSchemaElement(parentAsset, this); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "MapSchemaElement{" + - "mapFromElement=" + mapFromElement + - ", mapToElement=" + mapToElement + - ", qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Meaning.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Meaning.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Meaning.java deleted file mode 100644 index 078b44c..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Meaning.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.atlas.ocf.properties; - -/** - * Meaning is a cut-down summary of a glossary term to aid the asset consumer in understanding the content - * of an asset. - */ -public class Meaning extends ElementHeader -{ - /* - * Attributes of a meaning object definition - */ - protected String name = null; - protected String description = null; - - - /** - * Typical Constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param name - name of the glossary term - * @param description - description of the glossary term. - */ - public Meaning(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String name, - String description) - { - super(parentAsset, type, guid, url, classifications); - - this.name = name; - this.description = description; - } - - - /** - * Copy/clone constructor. - * - * @param parentAsset - descriptor for parent asset - * @param templateMeaning - element to copy - */ - public Meaning(AssetDescriptor parentAsset, Meaning templateMeaning) - { - /* - * Save the parent asset description. - */ - super(parentAsset, 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; - } - - - /** - * Return the description of the glossary term. - * - * @return String description - */ - public String getDescription() - { - return description; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Meaning{" + - "name='" + name + '\'' + - ", description='" + description + '\'' + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - ", classifications=" + classifications + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Meanings.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Meanings.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Meanings.java deleted file mode 100644 index 8f51491..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Meanings.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * Meanings supports an iterator over a list of glossary definitions. Callers can use it to step through the list - * just once. If they want to parse the list again, they could use the copy/clone constructor to create - * a new iterator. - */ -public abstract class Meanings extends AssetPropertyIteratorBase implements Iterator<Meaning> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public Meanings(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public Meanings(AssetDescriptor parentAsset, Meanings template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new Meaning(parentAsset, (Meaning)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract Meanings cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return Meaning - next element object that has been cloned. - */ - @Override - public Meaning next() - { - return (Meaning)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Meanings{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Note.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Note.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Note.java deleted file mode 100644 index 0a81cb6..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Note.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Date; - -/** - * Note defines the properties of a single note in a note log. - */ -public class Note extends Referenceable -{ - /* - * Attributes of a Note - */ - private String text = null; - private Date lastUpdate = null; - private String user = null; - - - /** - * Typical Constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - * @param text - the text of the note - * @param lastUpdate - the last update date for the note. - * @param user - the user id of the person who created the note - */ - public Note(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings, - String text, - Date lastUpdate, - String user) - { - super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings); - - this.text = text; - this.lastUpdate = lastUpdate; - this.user = user; - } - - /** - * Copy/clone constructor. - * - * @param parentAsset - descriptor for parent asset - * @param templateNote - note to copy - */ - public Note(AssetDescriptor parentAsset, Note templateNote) - { - /* - * Save the parent asset description. - */ - super(parentAsset, 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; } - - - /** - * 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()); - } - } - - - /** - * Return the user id of the person who created the note. Null means the user id is not known. - * - * @return String - liking user - */ - public String getUser() { - return user; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Note{" + - "text='" + text + '\'' + - ", lastUpdate=" + lastUpdate + - ", user='" + user + '\'' + - ", qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/NoteLog.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/NoteLog.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/NoteLog.java deleted file mode 100644 index 5340c9a..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/NoteLog.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.atlas.ocf.properties; - -/** - * NoteLog manages a list of notes for an asset - */ -public class NoteLog extends Referenceable -{ - /* - * Attributes of an note log - */ - private String displayName = null; - private String description = null; - private Notes notes = null; - - - /** - * Typical Constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - * @param displayName - consumable name - * @param description - description property stored for the note log. - * @param notes - list of notes for this note log. - */ - public NoteLog(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings, - String displayName, - String description, - Notes notes) - { - super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings); - - this.displayName = displayName; - this.description = description; - this.notes = notes; - } - - - /** - * Copy/clone constructor. - * - * @param parentAsset - descriptor for parent asset - * @param templateNotelog - note log to copy - */ - public NoteLog(AssetDescriptor parentAsset, NoteLog templateNotelog) - { - /* - * Initialize the super class. - */ - super(parentAsset, templateNotelog); - - if (templateNotelog != null) - { - /* - * Copy the values from the supplied template. - */ - displayName = templateNotelog.getDisplayName(); - description = templateNotelog.getDescription(); - - Notes templateNotes = templateNotelog.getNotes(); - if (templateNotes != null) - { - notes = templateNotes.cloneIterator(parentAsset); - } - } - } - - - /** - * 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; - } - - - /** - * 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; - } - - - /** - * Return the list of notes defined for this note log. - * - * @return Notes - list of notes - */ - public Notes getNotes() - { - if (notes == null) - { - return notes; - } - else - { - return notes.cloneIterator(super.getParentAsset()); - } - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "NoteLog{" + - "displayName='" + displayName + '\'' + - ", description='" + description + '\'' + - ", notes=" + notes + - ", qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/NoteLogs.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/NoteLogs.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/NoteLogs.java deleted file mode 100644 index 5f4ac05..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/NoteLogs.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * NoteLogs supports an iterator over a list of note logs. Callers can use it to step through the list - * just once. If they want to parse the list again, they could use the copy/clone constructor to create - * a new iterator. - */ -public abstract class NoteLogs extends AssetPropertyIteratorBase implements Iterator<NoteLog> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public NoteLogs(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public NoteLogs(AssetDescriptor parentAsset, NoteLogs template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new NoteLog(parentAsset, (NoteLog)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract NoteLogs cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return NoteLog - next element object that has been cloned. - */ - @Override - public NoteLog next() - { - return (NoteLog)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "NoteLogs{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Notes.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Notes.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Notes.java deleted file mode 100644 index 077d7fa..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Notes.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * Notes supports an iterator over a list of notes within a note log. Callers can use it to step through the list - * just once. If they want to parse the list again, they could use the copy/clone constructor to create - * a new iterator. - */ -public abstract class Notes extends AssetPropertyIteratorBase implements Iterator<Note> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public Notes(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public Notes(AssetDescriptor parentAsset, Notes template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new Note(parentAsset, (Note)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract Notes cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return Note - next element object that has been cloned. - */ - @Override - public Note next() - { - return (Note)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Notes{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PagingIterator.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PagingIterator.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PagingIterator.java deleted file mode 100644 index 8928041..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PagingIterator.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import org.apache.atlas.ocf.ffdc.OCFErrorCode; -import org.apache.atlas.ocf.ffdc.OCFRuntimeException; -import org.apache.atlas.ocf.ffdc.PropertyServerException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Iterator; - -/** - * PagingIterator supports an iterator over a list of objects that extend AssetPropertyBase. - * Callers can use it to step through the list just once. If they want to parse the list again, - * they could use the copy/clone constructor to create a new iterator. - * - * PagingIterator provides paging support to enable the list in the iterator to be much bigger than - * can be stored in memory. It maintains pointers for the full list, and a potentially smaller - * cached list that is used to batch up elements being retrieved from the property (metadata) server. - * Thus is combines the ability to process very large lists whilst minimising the chatter with the property server. - * - * The class uses a number of pointers and counts. Imagine a list of 4000 columns in a table. - * We can not retrieve all 4000 columns on one call. So we retrieve subsets over a number of REST calls as the - * caller walks through the full list. - * <ul> - * <li> - * totalElement is 4000 - ie how many elements there are in total. - * </li> - * <li> - * maxCacheSize is the maximum elements we can retrieve in one call - * </li> - * <li> - * cachedElementList.size() is how many elements we have in memory at this time. - * </li> - * </ul> - * - * cachedElementList.size() is set to maxCacheSize() for all retrieves except for processing the last cache of elements. - * For example, if the totalElement is 25 and the maxCacheSize() is 10 then we would retrieve 3 caches - - * the first two would have 10 elements in them and the third will have 5 elements. - * In the first 2 retrieves, maxCacheSize and cachedElementList.size() are set to 10. - * In the last one, maxCacheSize==10 and cachedElementList.size()==5. - */ -public class PagingIterator extends AssetPropertyBase implements Iterator<AssetPropertyBase> -{ - private int maxCacheSize = 1; - - private int totalElementCount = 0; - private int cachedElementStart = 0; - private ArrayList<AssetPropertyBase> cachedElementList = new ArrayList<>(); - private int cachedElementPointer = 0; - - private AssetPropertyIteratorBase iterator = null; - - private static final Logger log = LoggerFactory.getLogger(PagingIterator.class); - - - - /** - * Typical Constructor creates an iterator with the supplied list of comments. - * - * @param parentAsset - descriptor of parent asset. - * @param iterator - type-specific iterator that wraps this paging iterator. - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public PagingIterator(AssetDescriptor parentAsset, - AssetPropertyIteratorBase iterator, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset); - - if (log.isDebugEnabled()) - { - log.debug("New PagingIterator:"); - log.debug("==> totalElementCount: " + totalElementCount); - log.debug("==> maxCacheSize: " + maxCacheSize); - } - - - if (totalElementCount > 0) - { - this.totalElementCount = totalElementCount; - } - - if (maxCacheSize > 0) - { - this.maxCacheSize = maxCacheSize; - } - - if (iterator != null) - { - this.iterator = iterator; - } - else - { - /* - * Throw runtime exception to show the caller they are not using the list correctly. - */ - OCFErrorCode errorCode = OCFErrorCode.NO_ITERATOR; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(this.getClass().getSimpleName(), - super.getParentAssetName(), - super.getParentAssetTypeName()); - - throw new OCFRuntimeException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - "next", - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param iterator - type-specific iterator that wraps this paging iterator. - * @param templateIterator - template to copy; null to create an empty iterator - */ - public PagingIterator(AssetDescriptor parentAsset, - AssetPropertyIteratorBase iterator, - PagingIterator templateIterator) - { - super(parentAsset, templateIterator); - - if (templateIterator != null) - { - this.cachedElementStart = 0; - this.cachedElementPointer = 0; - this.cachedElementList = new ArrayList<>(); - - if (templateIterator.totalElementCount > 0) - { - this.totalElementCount = templateIterator.totalElementCount; - } - - if (templateIterator.maxCacheSize > 0) - { - this.maxCacheSize = templateIterator.maxCacheSize; - } - - if (iterator != null) - { - this.iterator = iterator; - } - else - { - /* - * Throw runtime exception to show the caller they are not using the list correctly. - */ - OCFErrorCode errorCode = OCFErrorCode.NO_ITERATOR; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(this.getClass().getSimpleName(), - super.getParentAssetName(), - super.getParentAssetTypeName()); - - throw new OCFRuntimeException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - "next", - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } - - if (templateIterator.cachedElementStart == 0) - { - /* - * The template's cache starts at the beginning of the total list so ok to copy it. - */ - for (AssetPropertyBase templateElement : templateIterator.cachedElementList) - { - this.cachedElementList.add(iterator.cloneElement(parentAsset, templateElement)); - } - } - } - } - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return (cachedElementStart < totalElementCount); - } - - - /** - * Return the next element in the list - * - * @return AssetPropertyBase - next element. - * @throws OCFRuntimeException - if there are no more elements in the list or there are problems retrieving - * elements from the property (metadata) server. - */ - @Override - public AssetPropertyBase next() - { - /* - * Check more elements available - */ - if (this.hasNext()) - { - AssetPropertyBase retrievedElement = null; - - /* - * If the pointer is at the end of the cache then retrieve more content from the property (metadata) - * server. - */ - if (cachedElementPointer == cachedElementList.size()) - { - try - { - cachedElementList = iterator.getCachedList(cachedElementStart, maxCacheSize); - cachedElementPointer = 0; - } - catch (PropertyServerException error) - { - /* - * Problem retrieving next cache. The exception includes a detailed error message, - */ - OCFErrorCode errorCode = OCFErrorCode.PROPERTIES_NOT_AVAILABLE; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(error.getErrorMessage(), - this.toString()); - - throw new OCFRuntimeException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - "next", - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction(), - error); - } - } - - retrievedElement = iterator.cloneElement(getParentAsset(), cachedElementList.get(cachedElementPointer)); - cachedElementPointer++; - cachedElementStart++; - - if (log.isDebugEnabled()) - { - log.debug("Returning next element:"); - log.debug("==> totalElementCount: " + totalElementCount); - log.debug("==> cachedElementPointer: " + cachedElementPointer); - log.debug("==> cachedElementStart:" + cachedElementStart); - log.debug("==> maxCacheSize:" + maxCacheSize); - } - - - return retrievedElement; - } - else - { - /* - * Throw runtime exception to show the caller they are not using the list correctly. - */ - OCFErrorCode errorCode = OCFErrorCode.NO_MORE_ELEMENTS; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(this.getClass().getSimpleName(), - super.getParentAssetName(), - super.getParentAssetTypeName()); - - throw new OCFRuntimeException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - "next", - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } - } - - - /** - * Return the number of elements in the list. - * - * @return elementCount - */ - public int getElementCount() - { - return totalElementCount; - } - - - /** - * Remove the current element in the iterator. - */ - @Override - public void remove() - { - /* - * Nothing to do since the removed element can never be revisited through this instance. - */ - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "PagingIterator{" + - "maxCacheSize=" + maxCacheSize + - ", totalElementCount=" + totalElementCount + - ", cachedElementStart=" + cachedElementStart + - ", cachedElementList=" + cachedElementList + - ", cachedElementPointer=" + cachedElementPointer + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PrimitiveSchemaElement.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PrimitiveSchemaElement.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PrimitiveSchemaElement.java deleted file mode 100644 index ea4b28a..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PrimitiveSchemaElement.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - - -/** - * 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. - */ -public class PrimitiveSchemaElement extends SchemaElement -{ - private String dataType = null; - private String defaultValue = null; - - - /** - * Typical constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - * @param versionNumber - the version number of the schema element - null means no version number. - * @param author - the name of the author of the schema element. Null means the author is unknown. - * @param usage - the usage guidance for this schema element. Null means no guidance available. - * @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else. - * Null means the encoding standard is unknown or there are many choices. - * @param dataType - the name of the data type for this element. Null means unknown data type. - * @param defaultValue - String containing default value for the element - */ - public PrimitiveSchemaElement(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings, - String versionNumber, - String author, - String usage, - String encodingStandard, - String dataType, - String defaultValue) - { - super(parentAsset, - type, - guid, - url, - classifications, - qualifiedName, - additionalProperties, - meanings, - versionNumber, - author, - usage, - encodingStandard); - - this.dataType = dataType; - this.defaultValue = defaultValue; - } - - /** - * 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 parentAsset - description of the asset that this schema element is attached to. - * @param templateSchemaElement - template object to copy. - */ - public PrimitiveSchemaElement(AssetDescriptor parentAsset, PrimitiveSchemaElement templateSchemaElement) - { - super(parentAsset, 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; } - - - /** - * Return the default value for the element. Null means no default value set up. - * - * @return String containing default value - */ - public String getDefaultValue() { return defaultValue; } - - - /** - * Returns a clone of this object as the abstract SchemaElement class. - * - * @param parentAsset - description of the asset that this schema element is attached to. - * @return PrimitiveSchemaElement object - */ - @Override - public SchemaElement cloneSchemaElement(AssetDescriptor parentAsset) - { - return new PrimitiveSchemaElement(parentAsset, this); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "PrimitiveSchemaElement{" + - "dataType='" + dataType + '\'' + - ", defaultValue='" + defaultValue + '\'' + - ", qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PropertyBase.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PropertyBase.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PropertyBase.java deleted file mode 100644 index 124ac59..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/PropertyBase.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.io.Serializable; -import java.util.UUID; - - -/** - * This property header implements any common mechanisms that all property objects need. - */ -public abstract class PropertyBase implements Serializable -{ - private static final long serialVersionUID = 1L; - private 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 - the resulting object will return true if tested with this.equals(template) as - * long as the template object is not null; - * - * @param template - object being copied - */ - public PropertyBase(PropertyBase template) - { - /* - * The hashCode value is replaced with the value from the template so the template object and this - * new object will return equals set to true. - */ - if (template != null) - { - hashCode = template.hashCode(); - } - } - - - /** - * 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. This method may be overridden by subclasses. - */ - public int hashCode() - { - return hashCode; - } - - - /** - * Provide a common implementation of equals for all OCF properties objects. The UUID is unique and - * is randomly assigned and so its hashCode is as good as anything to evaluate the equality of the properties - * object. - * - * @param object - object to test - * @return boolean flag - */ - @Override - public boolean equals(Object object) - { - if (this == object) - { - return true; - } - if (object == null || getClass() != object.getClass()) - { - return false; - } - - PropertyBase that = (PropertyBase) object; - - return hashCode == that.hashCode; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "PropertyBase{" + - "hashCode=" + hashCode + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Rating.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Rating.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Rating.java deleted file mode 100644 index 4ad041d..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Rating.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - - -/** - * Stores information about a 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. - */ -public class Rating extends ElementHeader -{ - /* - * Attributes of a Rating - */ - private StarRating starRating = null; - private String review = null; - private String user = null; - - - /** - * Typical Constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param starRating - StarRating enum - the star value for the rating. - * @param review - String - review comments - * @param user - String - user id of person providing the rating - */ - public Rating(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - StarRating starRating, - String review, - String user) - { - super(parentAsset, type, guid, url, classifications); - - this.starRating = starRating; - this.review = review; - this.user = user; - } - - /** - * Copy/clone constructor. - * - * @param parentAsset - descriptor for parent asset - * @param templateRating - element to copy - */ - public Rating(AssetDescriptor parentAsset, Rating templateRating) - { - /* - * Save the parent asset description. - */ - super(parentAsset, 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; - } - - - /** - * Return the stars for the rating. - * - * @return StarRating - starRating - */ - public StarRating getStarRating() { - return starRating; - } - - - /** - * Return the review comments - null means no review is available. - * - * @return String - review comments - */ - public String getReview() - { - return review; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Rating{" + - "starRating=" + starRating + - ", review='" + review + '\'' + - ", user='" + user + '\'' + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Ratings.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Ratings.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Ratings.java deleted file mode 100644 index 98e25ed..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Ratings.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * Ratings supports an iterator over a list of ratings for an asset. - * Callers can use it to step through the list - * just once. If they want to parse the list again, they could use the copy/clone constructor to create - * a new iterator. - */ -public abstract class Ratings extends AssetPropertyIteratorBase implements Iterator<Rating> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public Ratings(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public Ratings(AssetDescriptor parentAsset, Ratings template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new Rating(parentAsset, (Rating)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract Ratings cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return Rating - next element object that has been cloned. - */ - @Override - public Rating next() - { - return (Rating)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Ratings{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Referenceable.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Referenceable.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Referenceable.java deleted file mode 100644 index 6d75aea..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Referenceable.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.atlas.ocf.properties; - - -/** - * 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. - */ -public class Referenceable extends ElementHeader -{ - /* - * Attributes of a Referenceable - */ - protected String qualifiedName = null; - protected AdditionalProperties additionalProperties = null; - - /* - * Attached glossary terms - */ - protected Meanings meanings = null; - - - /** - * Typical Constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - */ - public Referenceable(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings) - { - super(parentAsset, type, guid, url, classifications); - - this.qualifiedName = qualifiedName; - this.additionalProperties = additionalProperties; - this.meanings = meanings; - } - - - /** - * Copy/clone constructor. - * - * @param parentAsset - descriptor for parent asset - * @param templateReferenceable - element to copy - */ - public Referenceable(AssetDescriptor parentAsset, Referenceable templateReferenceable) - { - /* - * Save the parent asset description. - */ - super(parentAsset, 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(parentAsset, templateAdditionalProperties); - } - - /* - * Create a copy of any glossary terms - */ - Meanings templateMeanings = templateReferenceable.getMeanings(); - if (templateMeanings != null) - { - meanings = templateMeanings.cloneIterator(parentAsset); - } - } - } - - - /** - * 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; - } - - - /** - * 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(super.getParentAsset(), additionalProperties); - } - } - - - /** - * Return a list of the glossary terms attached to this referenceable object. Null means no terms available. - * - * @return list of glossary terms (summary) - */ - public Meanings getMeanings() - { - if (meanings == null) - { - return meanings; - } - else - { - return meanings.cloneIterator(super.getParentAsset()); - } - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Referenceable{" + - "qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAsset.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAsset.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAsset.java deleted file mode 100644 index 877a60b..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAsset.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import org.apache.atlas.ocf.ffdc.PropertyServerException; - -/** - * 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. - */ -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; - - /* - * The detailed properties that are retrieved from the server - */ - private RelatedAssetProperties relatedAssetProperties = null; - - - /** - * Typical constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - * @param displayName - consumable name - * @param description - description property stored for the related asset. - * @param owner - the owner details for this related asset. - * @param relatedAssetProperties - detailed properties of the asset. - */ - public RelatedAsset(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings, - String displayName, - String description, - String owner, - RelatedAssetProperties relatedAssetProperties) - { - super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings); - - this.displayName = displayName; - this.description = description; - this.owner = owner; - this.relatedAssetProperties = relatedAssetProperties; - } - - - /** - * Copy/clone constructor - * - * @param parentAsset - description of the asset that this related asset is attached to. - * @param templateRelatedAsset - template object to copy. - */ - public RelatedAsset(AssetDescriptor parentAsset, RelatedAsset templateRelatedAsset) - { - super(parentAsset, 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; - } - - - /** - * 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; - } - - - /** - * Returns the details of the owner for this related asset. - * - * @return String owner - */ - public String getOwner() { return owner; } - - - /** - * Return the detailed properties for a related asset. - * - * @return a refreshed version of the RelatedAssetProperties - * @throws PropertyServerException - problems communicating with the property (metadata) server - */ - public RelatedAssetProperties getRelatedAssetProperties() throws PropertyServerException - { - if (relatedAssetProperties != null) - { - relatedAssetProperties.refresh(); - } - - return relatedAssetProperties; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "RelatedAsset{" + - "displayName='" + displayName + '\'' + - ", description='" + description + '\'' + - ", owner='" + owner + '\'' + - ", relatedAssetProperties=" + relatedAssetProperties + - ", qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file