http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/instance/AtlasSystemAttributes.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/instance/AtlasSystemAttributes.java b/intg/src/main/java/org/apache/atlas/v1/model/instance/AtlasSystemAttributes.java new file mode 100644 index 0000000..43eca0b --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/instance/AtlasSystemAttributes.java @@ -0,0 +1,123 @@ +/** + * 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.v1.model.instance; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.Date; +import java.util.Objects; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class AtlasSystemAttributes implements Serializable { + private static final long serialVersionUID = 1L; + + private String createdBy; + private String modifiedBy; + private Date createdTime; + private Date modifiedTime; + + + public AtlasSystemAttributes() { + } + + public AtlasSystemAttributes(AtlasSystemAttributes that) { + if (that != null) { + this.createdBy = that.createdBy; + this.modifiedBy = that.modifiedBy; + this.createdTime = that.createdTime; + this.modifiedTime = that.modifiedTime; + } + } + + public AtlasSystemAttributes(String createdBy, String modifiedBy, Date createdTime, Date modifiedTime){ + this.createdBy = createdBy; + this.modifiedBy = modifiedBy; + this.createdTime = createdTime; + this.modifiedTime = modifiedTime; + } + + public String getCreatedBy(){ + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getModifiedBy(){ + return modifiedBy; + } + + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + public Date getCreatedTime(){ + return createdTime; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public Date getModifiedTime(){ + return modifiedTime; + } + + public void setModifiedTime(Date modifiedTime) { + this.modifiedTime = modifiedTime; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + AtlasSystemAttributes obj = (AtlasSystemAttributes) o; + + return Objects.equals(createdBy, obj.createdBy) && + Objects.equals(modifiedBy, obj.modifiedBy) && + Objects.equals(createdTime, obj.createdTime) && + Objects.equals(modifiedTime, obj.modifiedTime); + } + + @Override + public int hashCode() { + return Objects.hash(createdBy, modifiedBy, createdTime, modifiedTime); + } +}
http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/instance/Id.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/instance/Id.java b/intg/src/main/java/org/apache/atlas/v1/model/instance/Id.java new file mode 100644 index 0000000..1b250f0 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/instance/Id.java @@ -0,0 +1,171 @@ +/** + * 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.v1.model.instance; + + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class Id implements Serializable { + private static final long serialVersionUID = 1L; + + @JsonIgnore + private static AtomicLong s_nextId = new AtomicLong(System.nanoTime()); + + public enum EntityState { ACTIVE, DELETED } + + private String id; + private String typeName; + private int version; + private EntityState state; + + + public Id() { + } + + public Id(Id that) { + if (that != null) { + this.id = that.id; + this.typeName = that.typeName; + this.version = that.version; + this.state = that.state; + } + } + + public Id(String typeName) { + this("" + nextNegativeLong(), 0, typeName); + } + + public Id(String id, int version, String typeName) { + this(id, version, typeName, null); + } + + public Id(long id, int version, String typeName) { + this(id, version, typeName, null); + } + + public Id(long id, int version, String typeName, String state) { + this("" + id, version, typeName, state); + } + + public Id(String id, int version, String typeName, String state) { + this.id = id; + this.typeName = typeName; + this.version = version; + this.state = state == null ? EntityState.ACTIVE : EntityState.valueOf(state.toUpperCase()); + } + + // for serialization backward compatibility + public String getJsonClass() { + return "org.apache.atlas.typesystem.json.InstanceSerialization$_Id"; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } + + public EntityState getState() { + return state; + } + + public void setState(EntityState state) { + this.state = state; + } + + @JsonIgnore + public String _getId() { + return id; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + Id obj = (Id) o; + + return version == obj.version && + Objects.equals(id, obj.id) && + Objects.equals(typeName, obj.typeName) && + Objects.equals(state, obj.state); + } + + @Override + public int hashCode() { + return Objects.hash(id, typeName, version, state); + } + + + + private static long nextNegativeLong() { + long ret = s_nextId.getAndDecrement(); + + if (ret > 0) { + ret *= -1; + } else if (ret == 0) { + ret = Long.MIN_VALUE; + } + + return ret; + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/instance/Referenceable.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/instance/Referenceable.java b/intg/src/main/java/org/apache/atlas/v1/model/instance/Referenceable.java new file mode 100644 index 0000000..44b7a5c --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/instance/Referenceable.java @@ -0,0 +1,201 @@ +/** + * 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.v1.model.instance; + + + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class Referenceable extends Struct implements Serializable { + private static final long serialVersionUID = 1L; + + private Id id; + private Map<String, Struct> traits = new HashMap<>(); + private List<String> traitNames = new ArrayList<>(); + private AtlasSystemAttributes systemAttributes; + + + public Referenceable() { + super(); + } + + public Referenceable(Referenceable that) { + super(that); + + if (that != null) { + this.id = new Id(that.id); + + if (that.traits != null) { + this.traits.putAll(that.traits); + } + + if (that.traitNames != null) { + this.traitNames.addAll(that.traitNames); + } + + this.systemAttributes = new AtlasSystemAttributes(that.systemAttributes); + } + } + + public Referenceable(String typeName, String... traitNames) { + super(typeName); + + this.id = new Id(typeName); + this.systemAttributes = null; + + if (traitNames != null) { + for (String traitName : traitNames) { + this.traitNames.add(traitName); + this.traits.put(traitName, new Struct(traitName)); + } + } + } + + public Referenceable(String typeName, Map<String, Object> values) { + this(new Id(typeName), typeName, values, null, null); + } + + public Referenceable(String guid, String typeName, Map<String, Object> values) { + this(new Id(guid, 0, typeName), typeName, values, null, null, null); + } + + public Referenceable(String guid, String typeName, Map<String, Object> values, AtlasSystemAttributes systemAttributes) { + this(new Id(guid, 0, typeName), typeName, values, systemAttributes, null, null); + } + + public Referenceable(String guid, String typeName, Map<String, Object> values, AtlasSystemAttributes systemAttributes, List<String> traitNames, Map<String, Struct> traits) { + this(new Id(guid, 0, typeName), typeName, values, systemAttributes, traitNames, traits); + } + + public Referenceable(String guid, String typeName, Map<String, Object> values, List<String> traitNames, Map<String, Struct> traits) { + this(new Id(guid, 0, typeName), typeName, values, null, traitNames, traits); + } + + public Referenceable(Id id, String typeName, Map<String, Object> values, List<String> traitNames, Map<String, Struct> traits) { + this(id, typeName, values, null, traitNames, traits); + } + + public Referenceable(Id id, String typeName, Map<String, Object> values, AtlasSystemAttributes systemAttributes, List<String> traitNames, Map<String, Struct> traits) { + super(typeName, values); + + this.id = id; + this.systemAttributes = systemAttributes; + + if (traitNames != null) { + this.traitNames = traitNames; + } + + if (traits != null) { + this.traits = traits; + } + } + + + // for serialization backward compatibility + public String getJsonClass() { + return "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference"; + } + + public Id getId() { + return id; + } + + public void setId(Id id) { + this.id = id; + } + + public Map<String, Struct> getTraits() { + return traits; + } + + public void setTraits(Map<String, Struct> traits) { + this.traits = traits; + } + + public List<String> getTraitNames() { + return traitNames; + } + + public void setTraitNames(List<String> traitNames) { + this.traitNames = traitNames; + } + + public AtlasSystemAttributes getSystemAttributes() { + return systemAttributes; + } + + public void setSystemAttributes(AtlasSystemAttributes systemAttributes) { + this.systemAttributes = systemAttributes; + } + + @JsonIgnore + public Struct getTrait(String name) { + return traits != null ? traits.get(name) : null; + } + + @JsonIgnore + public String toShortString() { + return String.format("entity[type=%s guid=%s]", getTypeName(), id._getId()); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || o.getClass() != getClass()) { + return false; + } + + Referenceable obj = (Referenceable)o; + + return Objects.equals(id, obj.id) && + Objects.equals(traits, obj.traits) && + Objects.equals(traitNames, obj.traitNames) && + Objects.equals(systemAttributes, obj.systemAttributes); + } + + @Override + public int hashCode() { + return Objects.hash(id, traits, traitNames, systemAttributes); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/instance/Struct.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/instance/Struct.java b/intg/src/main/java/org/apache/atlas/v1/model/instance/Struct.java new file mode 100644 index 0000000..53e00ca --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/instance/Struct.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 + * + * 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.v1.model.instance; + + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class Struct implements Serializable { + private static final long serialVersionUID = 1L; + + private String typeName; + private Map<String, Object> values; + + + public Struct() { + } + + public Struct(Struct that) { + if (that != null) { + this.typeName = that.typeName; + + if (that.values != null) { + this.values = new HashMap<>(that.values); + } + } + } + + public Struct(String typeName) { + this(typeName, null); + } + + public Struct(String typeName, Map<String, Object> values) { + this.typeName = typeName; + this.values = values; + } + + // for serialization backward compatibility + public String getJsonClass() { + return "org.apache.atlas.typesystem.json.InstanceSerialization$_Struct"; + } + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public Map<String, Object> getValues() { + return values; + } + + public void setValues(Map<String, Object> values) { + this.values = values; + } + + @JsonIgnore + public Map<String, Object> getValuesMap() { + return values; + } + + @JsonIgnore + public void set(String attrName, Object attrValue) { + if (values == null) { + values = new HashMap<>(); + } + + values.put(attrName, attrValue); + } + + @JsonIgnore + public Object get(String attrName) { + return values != null ? values.get(attrName) : null; + } + + @JsonIgnore + public void setNull(String attrName) { + if (values != null) { + values.remove(attrName); + } + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || o.getClass() != getClass()) { + return false; + } + + Struct obj = (Struct)o; + + return Objects.equals(typeName, obj.typeName) && + Objects.equals(values, obj.values); + } + + @Override + public int hashCode() { + return Objects.hash(typeName, values); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java b/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java new file mode 100644 index 0000000..6afc624 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java @@ -0,0 +1,159 @@ +/** + * 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.v1.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import java.io.Serializable; +import java.util.Objects; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class AttributeDefinition implements Serializable { + private static final long serialVersionUID = 1L; + + private String name; + private String dataTypeName; + private Multiplicity multiplicity; + private boolean isComposite; // A composite is the one whose lifecycle is dependent on the enclosing type and is not just a reference + private boolean isUnique; + private boolean isIndexable; + private String reverseAttributeName; // If this is a reference attribute, then the name of the attribute on the Class that this refers to. + + + + public AttributeDefinition() { + } + + public AttributeDefinition(String name, String dataTypeName, Multiplicity multiplicity) { + this(name, dataTypeName, multiplicity, false, false, true, null); + } + + public AttributeDefinition(String name, String dataTypeName, Multiplicity multiplicity, boolean isComposite, + String reverseAttributeName) { + this(name, dataTypeName, multiplicity, isComposite, false, false, reverseAttributeName); + } + + public AttributeDefinition(String name, String dataTypeName, Multiplicity multiplicity, boolean isComposite, boolean isUnique, boolean isIndexable, String reverseAttributeName) { + this.name = name; + this.dataTypeName = dataTypeName; + this.multiplicity = multiplicity; + this.isComposite = isComposite; + this.isUnique = isUnique; + this.isIndexable = isIndexable; + this.reverseAttributeName = reverseAttributeName; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDataTypeName() { + return dataTypeName; + } + + public void setDataTypeName(String dataTypeName) { + this.dataTypeName = dataTypeName; + } + + public Multiplicity getMultiplicity() { + return multiplicity; + } + + public void setMultiplicity(Multiplicity multiplicity) { + this.multiplicity = multiplicity; + } + + public boolean getIsComposite() { + return isComposite; + } + + public void setIsComposite(boolean isComposite) { + this.isComposite = isComposite; + } + + public boolean getIsUnique() { + return isUnique; + } + + public void setIsUnique(boolean isUnique) { + this.isUnique = isUnique; + } + + public boolean getIsIndexable() { + return isIndexable; + } + + public void setIsIndexable(boolean isIndexable) { + this.isIndexable = isIndexable; + } + + public String getReverseAttributeName() { + return reverseAttributeName; + } + + public void setReverseAttributeName(String reverseAttributeName) { + this.reverseAttributeName = reverseAttributeName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + AttributeDefinition that = (AttributeDefinition) o; + + return isComposite == that.isComposite && + isUnique == that.isUnique && + isIndexable == that.isIndexable && + Objects.equals(name, that.name) && + Objects.equals(dataTypeName, that.dataTypeName) && + Objects.equals(multiplicity, that.multiplicity) && + Objects.equals(reverseAttributeName, that.reverseAttributeName); + } + + @Override + public int hashCode() { + return Objects.hash(name, dataTypeName, multiplicity, isComposite, isUnique, isIndexable, reverseAttributeName); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/typedef/ClassTypeDefinition.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/ClassTypeDefinition.java b/intg/src/main/java/org/apache/atlas/v1/model/typedef/ClassTypeDefinition.java new file mode 100644 index 0000000..8fae175 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/ClassTypeDefinition.java @@ -0,0 +1,51 @@ +/** + * 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.v1.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class ClassTypeDefinition extends HierarchicalTypeDefinition implements Serializable { + private static final long serialVersionUID = 1L; + + + public ClassTypeDefinition() { + } + + public ClassTypeDefinition(String typeName, String typeDescription, String typeVersion, List<AttributeDefinition> attributeDefinitions, Set<String> superTypes) { + super(typeName, typeDescription, typeVersion, attributeDefinitions, "org.apache.atlas.typesystem.types.ClassType", superTypes); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/typedef/EnumTypeDefinition.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/EnumTypeDefinition.java b/intg/src/main/java/org/apache/atlas/v1/model/typedef/EnumTypeDefinition.java new file mode 100644 index 0000000..d2fdaf8 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/EnumTypeDefinition.java @@ -0,0 +1,174 @@ +/** + * 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.v1.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.List; +import java.util.Objects; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class EnumTypeDefinition implements Serializable { + private static final long serialVersionUID = 1L; + + private String name; + private String description; + private String version; + private List<EnumValue> enumValues; + + + public EnumTypeDefinition() { + } + + public EnumTypeDefinition(String name, String description, String version, List<EnumValue> enumValues) { + this.name = name; + this.description = description; + this.version = version; + this.enumValues = enumValues; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public List<EnumValue> getEnumValues() { + return enumValues; + } + + public void setEnumValues(List<EnumValue> enumValues) { + this.enumValues = enumValues; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + EnumTypeDefinition that = (EnumTypeDefinition) o; + + return Objects.equals(name, that.name) && + Objects.equals(description, that.description) && + Objects.equals(version, that.version) && + Objects.equals(enumValues, that.enumValues); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, version, enumValues); + } + + + @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) + @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) + @JsonIgnoreProperties(ignoreUnknown=true) + @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) + public static class EnumValue implements Serializable { + private static final long serialVersionUID = 1L; + + private String value; + private int ordinal; + + public EnumValue() { + } + + public EnumValue(String value, int ordinal) { + this.value = value; + this.ordinal = ordinal; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public int getOrdinal() { + return ordinal; + } + + public void setOrdinal(int ordinal) { + this.ordinal = ordinal; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + EnumValue that = (EnumValue) o; + + return ordinal == that.ordinal && + Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hash(value, ordinal); + } + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/typedef/HierarchicalTypeDefinition.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/HierarchicalTypeDefinition.java b/intg/src/main/java/org/apache/atlas/v1/model/typedef/HierarchicalTypeDefinition.java new file mode 100644 index 0000000..65d63a7 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/HierarchicalTypeDefinition.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 + * + * 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.v1.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class HierarchicalTypeDefinition extends StructTypeDefinition implements Serializable { + private static final long serialVersionUID = 1L; + + + private String hierarchicalMetaTypeName = "org.apache.atlas.typesystem.types.TraitType"; + private Set<String> superTypes; + + + public HierarchicalTypeDefinition() { + } + + public HierarchicalTypeDefinition(String typeName, String typeDescription, String typeVersion, List<AttributeDefinition> attributeDefinitions, String hierarchicalMetaTypeName, Set<String> superTypes) { + super(typeName, typeDescription, typeVersion, attributeDefinitions); + + this.hierarchicalMetaTypeName = hierarchicalMetaTypeName; + this.superTypes = superTypes; + } + + public String getHierarchicalMetaTypeName() { + return hierarchicalMetaTypeName; + } + + public void setHierarchicalMetaTypeName(String hierarchicalMetaTypeName) { + this.hierarchicalMetaTypeName = hierarchicalMetaTypeName; + } + + public Set<String> getSuperTypes() { + return superTypes; + } + + public void setSuperTypes(Set<String> superTypes) { + this.superTypes = superTypes; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass() || !super.equals(o)) { + return false; + } + + HierarchicalTypeDefinition that = (HierarchicalTypeDefinition) o; + + return Objects.equals(superTypes, that.superTypes) && + Objects.equals(hierarchicalMetaTypeName, that.hierarchicalMetaTypeName); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), superTypes, hierarchicalMetaTypeName); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/typedef/Multiplicity.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/Multiplicity.java b/intg/src/main/java/org/apache/atlas/v1/model/typedef/Multiplicity.java new file mode 100644 index 0000000..8ac5732 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/Multiplicity.java @@ -0,0 +1,113 @@ +/** + * 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.v1.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import java.io.Serializable; +import java.util.Objects; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class Multiplicity implements Serializable { + private static final long serialVersionUID = 1L; + + public static final Multiplicity OPTIONAL = new Multiplicity(0, 1, false); + public static final Multiplicity REQUIRED = new Multiplicity(1, 1, false); + public static final Multiplicity COLLECTION = new Multiplicity(1, Integer.MAX_VALUE, false); + public static final Multiplicity SET = new Multiplicity(1, Integer.MAX_VALUE, true); + + private int lower; + private int upper; + private boolean isUnique; + + public Multiplicity() { + this(Multiplicity.REQUIRED); + } + + public Multiplicity(Multiplicity copyFrom) { + this(copyFrom.lower, copyFrom.upper, copyFrom.isUnique); + } + + public Multiplicity(int lower, int upper, boolean isUnique) { + this.lower = lower; + this.upper = upper; + this.isUnique = isUnique; + } + + public int getLower() { + return lower; + } + + public void setLower(int lower) { + this.lower = lower; + } + + public int getUpper() { + return upper; + } + + public void setUpper(int upper) { + this.upper = upper; + } + + public boolean getIsUnique() { + return isUnique; + } + + public void setIsUnique(boolean isUnique) { + this.isUnique = isUnique; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + Multiplicity that = (Multiplicity) o; + + return lower == that.lower && + upper == that.upper && + isUnique == that.isUnique; + } + + @Override + public int hashCode() { + return Objects.hash(lower, upper, isUnique); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/typedef/StructTypeDefinition.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/StructTypeDefinition.java b/intg/src/main/java/org/apache/atlas/v1/model/typedef/StructTypeDefinition.java new file mode 100644 index 0000000..842439d --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/StructTypeDefinition.java @@ -0,0 +1,119 @@ +/** + * 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.v1.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.List; +import java.util.Objects; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class StructTypeDefinition implements Serializable { + private static final long serialVersionUID = 1L; + + private String typeName; + private String typeDescription; + private String typeVersion; + private List<AttributeDefinition> attributeDefinitions; + + + public StructTypeDefinition() { + } + + public StructTypeDefinition(String typeName, String typeDescription, List<AttributeDefinition> attributeDefinitions) { + this(typeName, typeDescription, "1.0", attributeDefinitions); + } + + public StructTypeDefinition(String typeName, String typeDescription, String typeVersion, List<AttributeDefinition> attributeDefinitions) { + this.typeName = typeName; + this.typeDescription = typeDescription; + this.typeVersion = typeVersion; + this.attributeDefinitions = attributeDefinitions; + } + + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public String getTypeDescription() { + return typeDescription; + } + + public void setTypeDescription(String typeDescription) { + this.typeDescription = typeDescription; + } + + public String getTypeVersion() { + return typeVersion; + } + + public void setTypeVersion(String typeVersion) { + this.typeVersion = typeVersion; + } + + public List<AttributeDefinition> getAttributeDefinitions() { + return attributeDefinitions; + } + + public void setAttributeDefinitions(List<AttributeDefinition> attributeDefinitions) { + this.attributeDefinitions = attributeDefinitions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + StructTypeDefinition that = (StructTypeDefinition) o; + + return Objects.equals(typeName, that.typeName) && + Objects.equals(typeDescription, that.typeDescription) && + Objects.equals(typeVersion, that.typeVersion) && + Objects.equals(attributeDefinitions, that.attributeDefinitions); + } + + @Override + public int hashCode() { + return Objects.hash(typeName, typeDescription, typeVersion, attributeDefinitions); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/typedef/TraitTypeDefinition.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/TraitTypeDefinition.java b/intg/src/main/java/org/apache/atlas/v1/model/typedef/TraitTypeDefinition.java new file mode 100644 index 0000000..9caf62a --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/TraitTypeDefinition.java @@ -0,0 +1,51 @@ +/** + * 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.v1.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class TraitTypeDefinition extends HierarchicalTypeDefinition implements Serializable { + private static final long serialVersionUID = 1L; + + + public TraitTypeDefinition() { + } + + public TraitTypeDefinition(String typeName, String typeDescription, String typeVersion, List<AttributeDefinition> attributeDefinitions, Set<String> superTypes) { + super(typeName, typeDescription, typeVersion, attributeDefinitions, "org.apache.atlas.typesystem.types.TraitType", superTypes); + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/model/typedef/TypesDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/TypesDef.java b/intg/src/main/java/org/apache/atlas/v1/model/typedef/TypesDef.java new file mode 100644 index 0000000..1e67839 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/TypesDef.java @@ -0,0 +1,91 @@ +/** + * 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.v1.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.List; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class TypesDef implements Serializable { + private static final long serialVersionUID = 1L; + + private List<EnumTypeDefinition> enumTypes; + private List<StructTypeDefinition> structTypes; + private List<TraitTypeDefinition> traitTypes; + private List<ClassTypeDefinition> classTypes; + + + public TypesDef() { + } + + public TypesDef(List<EnumTypeDefinition> enumTypes, List<StructTypeDefinition> structTypes, List<TraitTypeDefinition> traitTypes, List<ClassTypeDefinition> classTypes) { + this.enumTypes = enumTypes; + this.structTypes = structTypes; + this.traitTypes = traitTypes; + this.classTypes = classTypes; + } + + + public List<EnumTypeDefinition> getEnumTypes() { + return enumTypes; + } + + public void setEnumTypes(List<EnumTypeDefinition> enumTypes) { + this.enumTypes = enumTypes; + } + + public List<StructTypeDefinition> getStructTypes() { + return structTypes; + } + + public void setStructTypes(List<StructTypeDefinition> structTypes) { + this.structTypes = structTypes; + } + + public List<TraitTypeDefinition> getTraitTypes() { + return traitTypes; + } + + public void setTraitTypes(List<TraitTypeDefinition> traitTypes) { + this.traitTypes = traitTypes; + } + + public List<ClassTypeDefinition> getClassTypes() { + return classTypes; + } + + public void setClassTypes(List<ClassTypeDefinition> classTypes) { + this.classTypes = classTypes; + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java b/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java new file mode 100644 index 0000000..864623a --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java @@ -0,0 +1,112 @@ +/** + * 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.v1.typesystem.types.utils; + + +import org.apache.atlas.v1.model.typedef.AttributeDefinition; +import org.apache.atlas.v1.model.typedef.ClassTypeDefinition; +import org.apache.atlas.v1.model.typedef.Multiplicity; +import org.apache.atlas.v1.model.typedef.TraitTypeDefinition; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +public class TypesUtil { + public static ClassTypeDefinition createClassTypeDef(String name, String description, Set<String> superTypes, AttributeDefinition... attributes) { + ClassTypeDefinition ret = new ClassTypeDefinition(name, description, "1.0", Arrays.asList(attributes), superTypes); + + return ret; + } + + public static ClassTypeDefinition createClassTypeDef(String name, String description, String typeVersion, Set<String> superTypes, AttributeDefinition... attributes) { + ClassTypeDefinition ret = new ClassTypeDefinition(name, description, typeVersion, Arrays.asList(attributes), superTypes); + + return ret; + } + + public static TraitTypeDefinition createTraitTypeDef(String name, String description, Set<String> superTypes, AttributeDefinition... attributes) { + return createTraitTypeDef(name, description, superTypes, Arrays.asList(attributes)); + } + + public static TraitTypeDefinition createTraitTypeDef(String name, String description, String typeVersion, Set<String> superTypes, AttributeDefinition... attributes) { + return createTraitTypeDef(name, description, typeVersion, superTypes, Arrays.asList(attributes)); + } + + public static TraitTypeDefinition createTraitTypeDef(String name, String description, Set<String> superTypes, List<AttributeDefinition> attributes) { + TraitTypeDefinition ret = new TraitTypeDefinition(name, description, "1.0", attributes, superTypes); + + return ret; + } + + public static TraitTypeDefinition createTraitTypeDef(String name, String description, String typeVersion, Set<String> superTypes, List<AttributeDefinition> attributes) { + TraitTypeDefinition ret = new TraitTypeDefinition(name, description, typeVersion, attributes, superTypes); + + return ret; + } + + public static AttributeDefinition createUniqueRequiredAttrDef(String name, String dataTypeName) { + AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.REQUIRED, false, true, true, null); + + return ret; + } + + public static AttributeDefinition createRequiredAttrDef(String name, String dataTypeName) { + AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.REQUIRED, false, false, true, null); + + return ret; + } + + public static AttributeDefinition createOptionalAttrDef(String name, String dataTypeName) { + AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.OPTIONAL, false, false, true, null); + + return ret; + } + + public static class Pair<L, R> { + public L left; + public R right; + + public Pair(L left, R right) { + this.left = left; + this.right = right; + } + + public static <L, R> Pair<L, R> of(L left, R right) { + return new Pair<>(left, right); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + Pair p = (Pair)o; + + return Objects.equals(left, p.left) && Objects.equals(right, p.right); + } + + public int hashCode() { return Objects.hash(left, right); } + } +} http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java ---------------------------------------------------------------------- diff --git a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java index efe0b88..f412217 100644 --- a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java +++ b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java @@ -21,7 +21,7 @@ package org.apache.atlas.hook; import com.google.common.annotations.VisibleForTesting; import org.apache.atlas.ApplicationProperties; import org.apache.atlas.kafka.NotificationProvider; -import org.apache.atlas.model.v1.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Referenceable; import org.apache.atlas.notification.NotificationException; import org.apache.atlas.notification.NotificationInterface; import org.apache.atlas.notification.hook.HookNotification; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/main/java/org/apache/atlas/notification/AbstractMessageDeserializer.java ---------------------------------------------------------------------- diff --git a/notification/src/main/java/org/apache/atlas/notification/AbstractMessageDeserializer.java b/notification/src/main/java/org/apache/atlas/notification/AbstractMessageDeserializer.java index 67bbb22..5bfe90e 100644 --- a/notification/src/main/java/org/apache/atlas/notification/AbstractMessageDeserializer.java +++ b/notification/src/main/java/org/apache/atlas/notification/AbstractMessageDeserializer.java @@ -27,8 +27,8 @@ import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.type.AtlasType; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/main/java/org/apache/atlas/notification/AbstractNotification.java ---------------------------------------------------------------------- diff --git a/notification/src/main/java/org/apache/atlas/notification/AbstractNotification.java b/notification/src/main/java/org/apache/atlas/notification/AbstractNotification.java index 9dcda57..988d98a 100644 --- a/notification/src/main/java/org/apache/atlas/notification/AbstractNotification.java +++ b/notification/src/main/java/org/apache/atlas/notification/AbstractNotification.java @@ -26,7 +26,7 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import org.apache.atlas.AtlasException; import org.apache.atlas.ha.HAConfiguration; -import org.apache.atlas.model.v1.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Referenceable; import org.apache.atlas.notification.AtlasNotificationBaseMessage.CompressionKind; import org.apache.atlas.type.AtlasType; import org.apache.commons.configuration.Configuration; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotification.java ---------------------------------------------------------------------- diff --git a/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotification.java b/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotification.java index 9ccb699..96e2e2f 100644 --- a/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotification.java +++ b/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotification.java @@ -18,8 +18,8 @@ package org.apache.atlas.notification.entity; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import java.util.List; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotificationImpl.java ---------------------------------------------------------------------- diff --git a/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotificationImpl.java b/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotificationImpl.java index ce3cde6..ab8e4c8 100644 --- a/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotificationImpl.java +++ b/notification/src/main/java/org/apache/atlas/notification/entity/EntityNotificationImpl.java @@ -18,8 +18,8 @@ package org.apache.atlas.notification.entity; import org.apache.atlas.AtlasException; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.commons.collections.CollectionUtils; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/main/java/org/apache/atlas/notification/hook/HookNotification.java ---------------------------------------------------------------------- diff --git a/notification/src/main/java/org/apache/atlas/notification/hook/HookNotification.java b/notification/src/main/java/org/apache/atlas/notification/hook/HookNotification.java index d80c466..ca596ea 100644 --- a/notification/src/main/java/org/apache/atlas/notification/hook/HookNotification.java +++ b/notification/src/main/java/org/apache/atlas/notification/hook/HookNotification.java @@ -22,8 +22,8 @@ import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.typedef.TypesDef; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.typedef.TypesDef; import org.apache.atlas.type.AtlasType; import org.apache.commons.lang.StringUtils; import org.codehaus.jettison.json.JSONArray; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/test/java/org/apache/atlas/kafka/KafkaConsumerTest.java ---------------------------------------------------------------------- diff --git a/notification/src/test/java/org/apache/atlas/kafka/KafkaConsumerTest.java b/notification/src/test/java/org/apache/atlas/kafka/KafkaConsumerTest.java index 2b9a96d..071a725 100644 --- a/notification/src/test/java/org/apache/atlas/kafka/KafkaConsumerTest.java +++ b/notification/src/test/java/org/apache/atlas/kafka/KafkaConsumerTest.java @@ -19,8 +19,8 @@ package org.apache.atlas.kafka; import kafka.message.MessageAndMetadata; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.notification.*; import org.apache.atlas.notification.AtlasNotificationMessage; import org.apache.atlas.notification.entity.EntityNotificationImplTest; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java ---------------------------------------------------------------------- diff --git a/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java b/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java index e300d8b..5e3cf41 100644 --- a/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java +++ b/notification/src/test/java/org/apache/atlas/kafka/KafkaNotificationTest.java @@ -19,7 +19,7 @@ package org.apache.atlas.kafka; import org.apache.atlas.ApplicationProperties; -import org.apache.atlas.model.v1.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Referenceable; import org.apache.atlas.notification.NotificationConsumer; import org.apache.atlas.notification.NotificationInterface; import org.apache.atlas.notification.hook.HookNotification; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/test/java/org/apache/atlas/notification/entity/EntityMessageDeserializerTest.java ---------------------------------------------------------------------- diff --git a/notification/src/test/java/org/apache/atlas/notification/entity/EntityMessageDeserializerTest.java b/notification/src/test/java/org/apache/atlas/notification/entity/EntityMessageDeserializerTest.java index 4d8d991..faafb87 100644 --- a/notification/src/test/java/org/apache/atlas/notification/entity/EntityMessageDeserializerTest.java +++ b/notification/src/test/java/org/apache/atlas/notification/entity/EntityMessageDeserializerTest.java @@ -18,8 +18,8 @@ package org.apache.atlas.notification.entity; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.notification.AbstractNotification; import org.testng.annotations.Test; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/test/java/org/apache/atlas/notification/entity/EntityNotificationImplTest.java ---------------------------------------------------------------------- diff --git a/notification/src/test/java/org/apache/atlas/notification/entity/EntityNotificationImplTest.java b/notification/src/test/java/org/apache/atlas/notification/entity/EntityNotificationImplTest.java index 7530431..81a0784 100644 --- a/notification/src/test/java/org/apache/atlas/notification/entity/EntityNotificationImplTest.java +++ b/notification/src/test/java/org/apache/atlas/notification/entity/EntityNotificationImplTest.java @@ -18,8 +18,8 @@ package org.apache.atlas.notification.entity; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasTypeRegistry; import org.testng.annotations.Test; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/test/java/org/apache/atlas/notification/hook/HookMessageDeserializerTest.java ---------------------------------------------------------------------- diff --git a/notification/src/test/java/org/apache/atlas/notification/hook/HookMessageDeserializerTest.java b/notification/src/test/java/org/apache/atlas/notification/hook/HookMessageDeserializerTest.java index 3e1c3dd..758abad 100644 --- a/notification/src/test/java/org/apache/atlas/notification/hook/HookMessageDeserializerTest.java +++ b/notification/src/test/java/org/apache/atlas/notification/hook/HookMessageDeserializerTest.java @@ -18,8 +18,8 @@ package org.apache.atlas.notification.hook; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.notification.AbstractNotification; import org.apache.atlas.notification.entity.EntityNotificationImplTest; import org.apache.atlas.notification.hook.HookNotification.EntityUpdateRequest; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/notification/src/test/java/org/apache/atlas/notification/hook/HookNotificationTest.java ---------------------------------------------------------------------- diff --git a/notification/src/test/java/org/apache/atlas/notification/hook/HookNotificationTest.java b/notification/src/test/java/org/apache/atlas/notification/hook/HookNotificationTest.java index 786fbfe..9ea688c 100644 --- a/notification/src/test/java/org/apache/atlas/notification/hook/HookNotificationTest.java +++ b/notification/src/test/java/org/apache/atlas/notification/hook/HookNotificationTest.java @@ -17,7 +17,7 @@ */ package org.apache.atlas.notification.hook; -import org.apache.atlas.model.v1.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Referenceable; import org.apache.atlas.type.AtlasType; import org.testng.annotations.Test; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java b/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java index 36a2d54..47d4e1d 100644 --- a/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java +++ b/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java @@ -23,8 +23,8 @@ import org.apache.atlas.EntityAuditEvent; import org.apache.atlas.EntityAuditEvent.EntityAuditAction; import org.apache.atlas.RequestContextV1; import org.apache.atlas.listener.EntityChangeListener; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasStructType; import org.apache.atlas.type.AtlasType; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/converters/AtlasClassificationFormatConverter.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasClassificationFormatConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasClassificationFormatConverter.java index 39e7c2f..d91772c 100644 --- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasClassificationFormatConverter.java +++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasClassificationFormatConverter.java @@ -21,7 +21,7 @@ import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.TypeCategory; import org.apache.atlas.model.instance.AtlasClassification; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasTypeRegistry; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java index 940890c..a529dc1 100644 --- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java +++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java @@ -24,10 +24,10 @@ import org.apache.atlas.model.instance.AtlasClassification; import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity.Status; import org.apache.atlas.model.instance.AtlasObjectId; -import org.apache.atlas.model.v1.instance.AtlasSystemAttributes; -import org.apache.atlas.model.v1.instance.Id; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.AtlasSystemAttributes; +import org.apache.atlas.v1.model.instance.Id; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasType; @@ -39,7 +39,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java index 29c74dc..da76c5a 100644 --- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java +++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasEnumFormatConverter.java @@ -21,7 +21,7 @@ package org.apache.atlas.repository.converters; import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.TypeCategory; import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef; -import org.apache.atlas.model.v1.typedef.EnumTypeDefinition.EnumValue; +import org.apache.atlas.v1.model.typedef.EnumTypeDefinition.EnumValue; import org.apache.atlas.type.AtlasEnumType; import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasTypeRegistry; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java index 6f27fff..87448ee 100644 --- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java +++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java @@ -30,8 +30,8 @@ import org.apache.atlas.model.instance.EntityMutationResponse; import org.apache.atlas.model.instance.EntityMutations.EntityOperation; import org.apache.atlas.model.instance.GuidMapping; import org.apache.atlas.model.legacy.EntityResult; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.repository.converters.AtlasFormatConverter.ConverterContext; import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasEntityType; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java index e03a6a9..a5b6d84 100644 --- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java +++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java @@ -23,8 +23,8 @@ import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.TypeCategory; import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasObjectId; -import org.apache.atlas.model.v1.instance.Id; -import org.apache.atlas.model.v1.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Id; +import org.apache.atlas.v1.model.instance.Referenceable; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasTypeRegistry; @@ -102,7 +102,7 @@ public class AtlasObjectIdConverter extends AtlasAbstractFormatConverter { return ret; } - private boolean hasAnyAssignedAttribute(org.apache.atlas.model.v1.instance.Referenceable rInstance) { + private boolean hasAnyAssignedAttribute(org.apache.atlas.v1.model.instance.Referenceable rInstance) { boolean ret = false; Map<String, Object> attributes = rInstance.getValues(); http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/converters/AtlasStructFormatConverter.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasStructFormatConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasStructFormatConverter.java index b03eda3..70b23c5 100644 --- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasStructFormatConverter.java +++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasStructFormatConverter.java @@ -23,7 +23,7 @@ import org.apache.atlas.model.TypeCategory; import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.instance.AtlasStruct; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.type.*; import org.apache.atlas.type.AtlasBuiltInTypes.AtlasObjectIdType; import org.apache.atlas.type.AtlasStructType.AtlasAttribute; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java b/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java index 564f459..33f092e 100644 --- a/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java +++ b/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java @@ -37,13 +37,13 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinali import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef; import org.apache.atlas.model.typedef.AtlasTypeDefHeader; import org.apache.atlas.model.typedef.AtlasTypesDef; -import org.apache.atlas.model.v1.typedef.AttributeDefinition; -import org.apache.atlas.model.v1.typedef.ClassTypeDefinition; -import org.apache.atlas.model.v1.typedef.EnumTypeDefinition; -import org.apache.atlas.model.v1.typedef.Multiplicity; -import org.apache.atlas.model.v1.typedef.StructTypeDefinition; -import org.apache.atlas.model.v1.typedef.TraitTypeDefinition; -import org.apache.atlas.model.v1.typedef.TypesDef; +import org.apache.atlas.v1.model.typedef.AttributeDefinition; +import org.apache.atlas.v1.model.typedef.ClassTypeDefinition; +import org.apache.atlas.v1.model.typedef.EnumTypeDefinition; +import org.apache.atlas.v1.model.typedef.Multiplicity; +import org.apache.atlas.v1.model.typedef.StructTypeDefinition; +import org.apache.atlas.v1.model.typedef.TraitTypeDefinition; +import org.apache.atlas.v1.model.typedef.TypesDef; import org.apache.atlas.repository.store.graph.v1.AtlasStructDefStoreV1; import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasEntityType; @@ -53,7 +53,7 @@ import org.apache.atlas.type.AtlasStructType.AtlasAttribute; import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeUtil; -import org.apache.atlas.model.v1.typedef.EnumTypeDefinition.EnumValue; +import org.apache.atlas.v1.model.typedef.EnumTypeDefinition.EnumValue; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java index fab8ffc..a0a3df1 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java @@ -30,8 +30,8 @@ import org.apache.atlas.model.instance.AtlasEntity.Status; import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.instance.AtlasRelationship; import org.apache.atlas.model.typedef.AtlasRelationshipDef; -import org.apache.atlas.model.v1.instance.Id; -import org.apache.atlas.model.v1.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Id; +import org.apache.atlas.v1.model.instance.Referenceable; import org.apache.atlas.type.AtlasStructType.AtlasAttribute; import org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection; import org.apache.atlas.repository.Constants; @@ -46,18 +46,12 @@ import org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasRelationshipType; import org.apache.atlas.type.AtlasType; -import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.typesystem.exception.EntityNotFoundException; -import org.apache.atlas.typesystem.exception.TypeNotFoundException; -import org.apache.atlas.typesystem.types.DataTypes; -import org.apache.atlas.typesystem.types.DataTypes.TypeCategory; -import org.apache.atlas.typesystem.types.utils.TypesUtil; import org.apache.atlas.util.AttributeValueMap; import org.apache.atlas.util.IndexedInstance; import org.apache.atlas.utils.ParamChecker; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.codehaus.jettison.json.JSONArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -72,7 +66,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.Stack; import java.util.UUID; import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection.BOTH; http://git-wip-us.apache.org/repos/asf/atlas/blob/eacf8513/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java index 88b76cc..1d5a6ac 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java @@ -18,7 +18,6 @@ package org.apache.atlas.repository.store.graph.v1; -import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasException; import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.listener.EntityChangeListener; @@ -26,8 +25,8 @@ import org.apache.atlas.model.instance.AtlasClassification; import org.apache.atlas.model.instance.AtlasEntityHeader; import org.apache.atlas.model.instance.EntityMutationResponse; import org.apache.atlas.model.instance.EntityMutations.EntityOperation; -import org.apache.atlas.model.v1.instance.Referenceable; -import org.apache.atlas.model.v1.instance.Struct; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; import org.apache.atlas.repository.Constants; import org.apache.atlas.repository.converters.AtlasInstanceConverter; import org.apache.atlas.repository.graph.FullTextMapperV2;