You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/11/05 20:31:32 UTC

[10/40] atlas git commit: ATLAS-2251: Remove TypeSystem and related implementation, to avoid unncessary duplicate of type details in cache

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/IStruct.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/IStruct.java b/typesystem/src/main/java/org/apache/atlas/typesystem/IStruct.java
deleted file mode 100755
index e0f8576..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/IStruct.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem;
-
-/**
- * A marker interface for StructType and TraitType instances.
- */
-public interface IStruct extends IInstance {
-
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedInstance.java
deleted file mode 100755
index c3bb9af..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedInstance.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.types.FieldMapping;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.util.Date;
-
-/**
- * An instance whose structure is associated with a IDataType.
- * This is obtained by a call to 'createInstance' or the result of a Query.
- * A ITypedInstance can only contain information on attributes of the associated Type.
- * Instance can still be invalid because of missing required fields or incorrect multiplicity.
- * But user can only get/set on a known field of the associated type. Type values have to match
- * the IDataType of the associated attribute.
- */
-public interface ITypedInstance extends IInstance {
-
-    FieldMapping fieldMapping();
-
-    boolean getBoolean(String attrName) throws AtlasException;
-
-    byte getByte(String attrName) throws AtlasException;
-
-    short getShort(String attrName) throws AtlasException;
-
-    int getInt(String attrName) throws AtlasException;
-
-    long getLong(String attrName) throws AtlasException;
-
-    float getFloat(String attrName) throws AtlasException;
-
-    double getDouble(String attrName) throws AtlasException;
-
-    BigInteger getBigInt(String attrName) throws AtlasException;
-
-    BigDecimal getBigDecimal(String attrName) throws AtlasException;
-
-    Date getDate(String attrName) throws AtlasException;
-
-    String getString(String attrName) throws AtlasException;
-
-    void setBoolean(String attrName, boolean val) throws AtlasException;
-
-    void setByte(String attrName, byte val) throws AtlasException;
-
-    void setShort(String attrName, short val) throws AtlasException;
-
-    void setInt(String attrName, int val) throws AtlasException;
-
-    void setLong(String attrName, long val) throws AtlasException;
-
-    void setFloat(String attrName, float val) throws AtlasException;
-
-    void setDouble(String attrName, double val) throws AtlasException;
-
-    void setBigInt(String attrName, BigInteger val) throws AtlasException;
-
-    void setBigDecimal(String attrName, BigDecimal val) throws AtlasException;
-
-    void setDate(String attrName, Date val) throws AtlasException;
-
-    void setString(String attrName, String val) throws AtlasException;
-
-    String getSignatureHash(MessageDigest digester) throws AtlasException;
-    
-    boolean isValueSet(String attrName) throws AtlasException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedReferenceableInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedReferenceableInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedReferenceableInstance.java
deleted file mode 100755
index 6dae95c..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedReferenceableInstance.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem;
-
-public interface ITypedReferenceableInstance extends ITypedInstance, IReferenceableInstance {
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedStruct.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedStruct.java b/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedStruct.java
deleted file mode 100755
index ced255c..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/ITypedStruct.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem;
-
-public interface ITypedStruct extends IStruct, ITypedInstance {
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java b/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java
deleted file mode 100755
index 8cad2f8..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.classification.InterfaceAudience;
-import org.apache.atlas.typesystem.persistence.AtlasSystemAttributes;
-import org.apache.atlas.typesystem.persistence.Id;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Represents a Class Instance that has not been associated with a FieldMapping.
- */
-public class Referenceable extends Struct implements IReferenceableInstance {
-
-    private Id id;
-    private final ImmutableMap<String, IStruct> traits;
-    private final ImmutableList<String> traitNames;
-    private AtlasSystemAttributes systemAttributes;
-
-    public Referenceable(String typeName, String... traitNames) {
-        super(typeName);
-        id = new Id(typeName);
-        this.traitNames = ImmutableList.copyOf(traitNames);
-        ImmutableMap.Builder<String, IStruct> b = new ImmutableMap.Builder<>();
-        for (String t : traitNames) {
-            b.put(t, new Struct(t));
-        }
-        traits = b.build();
-        this.systemAttributes = new AtlasSystemAttributes();
-    }
-
-    public Referenceable(String typeName, Map<String, Object> values) {
-        super(typeName, values);
-        id = new Id(typeName);
-        traitNames = ImmutableList.of();
-        traits = ImmutableMap.of();
-        this.systemAttributes = new AtlasSystemAttributes();
-    }
-
-    public Referenceable(String guid, String typeName, Map<String, Object> values) {
-        super(typeName, values);
-        id = new Id(guid, 0, typeName);
-        traitNames = ImmutableList.of();
-        traits = ImmutableMap.of();
-        this.systemAttributes = new AtlasSystemAttributes();
-    }
-
-    /**
-     * Not public - only use during deserialization
-     * @param guid      the unique id
-     * @param typeName  the type name
-     * @param values    the entity attribute values
-     */
-    @InterfaceAudience.Private
-    public Referenceable(String guid, String typeName, Map<String, Object> values, List<String> _traitNames,
-            Map<String, IStruct> _traits) {
-        super(typeName, values);
-        id = new Id(guid, 0, typeName);
-        traitNames = ImmutableList.copyOf(_traitNames);
-        traits = ImmutableMap.copyOf(_traits);
-        this.systemAttributes = new AtlasSystemAttributes();
-    }
-
-    /**
-     * Not public - only use during deserialization
-     * @param id      entity id
-     * @param typeName  the type name
-     * @param values    the entity attribute values
-     */
-    @InterfaceAudience.Private
-    public Referenceable(Id id, String typeName, Map<String, Object> values, List<String> _traitNames,
-                         Map<String, IStruct> _traits) {
-        super(typeName, values);
-        this.id = id;
-        traitNames = ImmutableList.copyOf(_traitNames);
-        traits = ImmutableMap.copyOf(_traits);
-        this.systemAttributes = new AtlasSystemAttributes();
-    }
-
-    /**
-     * Not public - only use during deserialization
-     * @param id      entity id
-     * @param typeName  the type name
-     * @param values    the entity attribute values
-     */
-    @InterfaceAudience.Private
-    public Referenceable(Id id, String typeName, Map<String, Object> values, List<String> _traitNames,
-                         Map<String, IStruct> _traits, AtlasSystemAttributes systemAttributes) {
-        super(typeName, values);
-        this.id = id;
-        traitNames = ImmutableList.copyOf(_traitNames);
-        traits = ImmutableMap.copyOf(_traits);
-        this.systemAttributes = systemAttributes;
-    }
-
-    /**
-     * Construct a Referenceable from the given IReferenceableInstance.
-     *
-     * @param instance  the referenceable instance to copy
-     *
-     * @throws AtlasException if the referenceable can not be created
-     */
-    public Referenceable(IReferenceableInstance instance) throws AtlasException {
-        this(instance.getId(), instance.getTypeName(), instance.getValuesMap(), instance.getTraits(),
-            getTraits(instance));
-    }
-
-    /**
-     * No-arg constructor for serialization.
-     */
-    @SuppressWarnings("unused")
-    private Referenceable() {
-        super(null, null);
-        id = null;
-        traitNames = ImmutableList.of();
-        traits = ImmutableMap.of();
-    }
-
-    @Override
-    public ImmutableList<String> getTraits() {
-        return traitNames;
-    }
-
-    @Override
-    public Id getId() {
-        return id;
-    }
-
-    @Override
-    public IStruct getTrait(String typeName) {
-        return traits.get(typeName);
-    }
-
-    @Override
-    public AtlasSystemAttributes getSystemAttributes(){
-        return systemAttributes;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass() || !super.equalsContents(o)) return false;
-        Referenceable that = (Referenceable) o;
-        return Objects.equals(id, that.id) &&
-                Objects.equals(traits, that.traits) &&
-                Objects.equals(traitNames, that.traitNames);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(super.hashCode(), id, traits, traitNames);
-    }
-
-    /**
-     * Matches traits, values associated with this Referenceable and skips the id match
-     * @param o The Referenceable which needs to be matched with
-     * @return
-     */
-    public boolean equalsContents(Object o) {
-        if(this == o) {
-            return true;
-        }
-        if(o == null) {
-            return false;
-        }
-        if (o.getClass() != getClass()) {
-            return false;
-        }
-
-        if(!super.equalsContents(o)) {
-            return false;
-        }
-
-        Referenceable obj = (Referenceable)o;
-        if (!traitNames.equals(obj.getTraits())) {
-            return false;
-        }
-
-        return true;
-    }
-
-    public String toString() {
-        return "{" +
-            "Id='" + id + '\'' +
-            ", traits=" + traitNames +
-            ", values=" + getValuesMap() +
-            '}';
-    }
-
-    @Override
-    public String toShortString() {
-        return String.format("entity[type=%s guid=%s]", typeName, id._getId());
-    }
-
-    public void replaceWithNewId(Id id) {
-        this.id = id;
-    }
-
-    private static Map<String, IStruct> getTraits(IReferenceableInstance instance) throws AtlasException {
-        Map<String, IStruct> traits = new HashMap<>();
-        for (String traitName : instance.getTraits() ) {
-            traits.put(traitName, new Struct(traitName, instance.getTrait(traitName).getValuesMap()));
-        }
-        return traits;
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java b/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java
deleted file mode 100755
index f8d2e42..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.classification.InterfaceAudience;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public class Struct implements IStruct {
-
-    public final String typeName;
-    private final Map<String, Object> values;
-
-    public Struct(String typeName) {
-        this.typeName = typeName;
-        values = new HashMap<>();
-    }
-
-    @InterfaceAudience.Private
-    public Struct(String typeName, Map<String, Object> values) {
-        this(typeName);
-        if (values != null) {
-            this.values.putAll(values);
-        }
-    }
-
-    /**
-     * No-arg constructor for serialization.
-     */
-    @SuppressWarnings("unused")
-    private Struct() {
-        this("", Collections.<String, Object>emptyMap());
-    }
-
-
-    @Override
-    public String getTypeName() {
-        return typeName;
-    }
-
-    @Override
-    public Object get(String attrName) {
-        return values.get(attrName);
-    }
-
-    @Override
-    public void set(String attrName, Object value) {
-        values.put(attrName, value);
-    }
-
-    @Override
-    public void setNull(String attrName) throws AtlasException {
-        values.put(attrName, null);
-    }
-
-    @Override
-    public Map<String, Object> getValuesMap() {
-        return values;
-    }
-
-    @Override
-    public String toShortString() {
-        return String.format("struct[type=%s]", typeName);
-    }
-
-    @Override
-    public int hashCode() {
-        int result = typeName.hashCode();
-        result = 31 * result + values.hashCode();
-        return result;
-    }
-
-    /**
-     * equalContents instead of equals since values is a mutable attribute and could lead
-     * to incorrect behaviour when added to collections and mutated after that
-     * i.e when the attribute is mutated collections.contains(struct) returns false
-     * due to hashcode having changed for the struct.
-     * @param o
-     * @return
-     */
-    public boolean equalsContents(Object o) {
-        if (this == o) {
-            return true;
-        }
-
-        if (o == null) {
-            return false;
-        }
-
-        if (o.getClass() != getClass()) {
-            return false;
-        }
-
-        Struct obj = (Struct)o;
-        if(!typeName.equals(obj.getTypeName())) {
-            return false;
-        }
-
-        if(!values.equals(obj.getValuesMap())) {
-            return false;
-        }
-
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/AtlasSystemAttributes.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/AtlasSystemAttributes.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/AtlasSystemAttributes.java
deleted file mode 100644
index 3c08a02..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/AtlasSystemAttributes.java
+++ /dev/null
@@ -1,115 +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.typesystem.persistence;
-
-import org.apache.atlas.typesystem.types.TypeSystem;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-public class AtlasSystemAttributes {
-    public  String createdBy;
-    public  String modifiedBy;
-    public Date createdTime;
-    public Date modifiedTime;
-    public SimpleDateFormat simpleDateFormat = TypeSystem.getInstance().getDateFormat();
-
-
-    public AtlasSystemAttributes(String createdBy, String modifiedBy, Date createdTime, Date modifiedTime){
-        this.createdBy = createdBy;
-        this.modifiedBy = modifiedBy;
-        this.createdTime = createdTime;
-        this.modifiedTime = modifiedTime;
-    }
-
-    public AtlasSystemAttributes(){
-        super();
-    }
-
-    public AtlasSystemAttributes(String createdBy, String modifiedBy, String createdTime, String modifiedTime){
-        this.createdBy  = createdBy;
-        this.modifiedBy = modifiedBy;
-
-        try{
-            this.createdTime = simpleDateFormat.parse(createdTime);
-        }catch (ParseException e){
-            //this.createdTime = new Date(0);
-        }
-
-        try{
-            this.modifiedTime = simpleDateFormat.parse(modifiedTime);
-        }catch (ParseException e){
-            //this.modifiedTime = new Date(0);
-        }
-    }
-
-
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-
-        AtlasSystemAttributes sys_attr = (AtlasSystemAttributes) o;
-
-        if (!createdBy.equals(sys_attr.createdBy)) {
-            return false;
-        }
-        if (!modifiedBy.equals(sys_attr.modifiedBy)) {
-            return false;
-        }
-        if (!createdTime.equals(sys_attr.createdTime)) {
-            return false;
-        }
-
-        if(!modifiedTime.equals(sys_attr.modifiedTime)){
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = createdBy.hashCode();
-        result = 31 * result + modifiedBy.hashCode();
-        result = 31 * result + createdTime.hashCode();
-        result = 31 * result + modifiedTime.hashCode();
-        return result;
-    }
-
-    public String getCreatedBy(){
-        return createdBy;
-    }
-
-    public String getModifiedBy(){
-        return modifiedBy;
-    }
-
-    public Date getCreatedTime(){
-        return createdTime;
-    }
-
-    public Date getModifiedTime(){
-        return modifiedTime;
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java
deleted file mode 100755
index e4ebb17..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.persistence;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.IStruct;
-import org.apache.atlas.typesystem.types.DownCastFieldMapping;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class DownCastStructInstance implements IStruct {
-
-    public final String typeName;
-    public final DownCastFieldMapping fieldMapping;
-    public final IStruct backingInstance;
-
-    public DownCastStructInstance(String typeName, DownCastFieldMapping fieldMapping, IStruct backingInstance) {
-        this.typeName = typeName;
-        this.fieldMapping = fieldMapping;
-        this.backingInstance = backingInstance;
-    }
-
-    @Override
-    public String getTypeName() {
-        return typeName;
-    }
-
-    @Override
-    public Object get(String attrName) throws AtlasException {
-        return fieldMapping.get(this, attrName);
-    }
-
-    @Override
-    public void set(String attrName, Object val) throws AtlasException {
-        fieldMapping.set(this, attrName, val);
-    }
-
-    @Override
-    public void setNull(String attrName) throws AtlasException {
-        throw new UnsupportedOperationException("unset on attributes are not allowed");
-    }
-
-    /*
-     * Use only for json serialization
-     * @nonpublic
-     */
-    @Override
-    public Map<String, Object> getValuesMap() throws AtlasException {
-
-        Map<String, Object> m = new HashMap<>();
-        for (String attr : fieldMapping.fieldNameMap.keySet()) {
-            m.put(attr, get(attr));
-        }
-        return m;
-    }
-
-    @Override
-    public String toShortString() {
-        return toString();
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
deleted file mode 100755
index ba05a45..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.persistence;
-
-import com.google.common.collect.ImmutableList;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.utils.ParamChecker;
-import org.apache.atlas.typesystem.IStruct;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.types.FieldMapping;
-import org.apache.atlas.utils.SHA256Utils;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.nio.charset.Charset;
-import java.security.MessageDigest;
-import java.util.Date;
-import java.util.Map;
-import java.util.Objects;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
-
-public class Id implements ITypedReferenceableInstance {
-    public enum EntityState {
-        ACTIVE, DELETED
-    }
-
-    public final String id;
-    public final String typeName;
-    public final int version;
-    public EntityState state;
-    private static AtomicLong s_nextId = new AtomicLong(System.nanoTime());
-    public final AtlasSystemAttributes systemAttributes;
-
-    public Id(String id, int version, String typeName, String state) {
-        id       = ParamChecker.notEmpty(id, "id");
-        typeName = ParamChecker.notEmpty(typeName, "typeName");
-        state    = ParamChecker.notEmptyIfNotNull(state, "state");
-        this.id = id;
-        this.typeName = typeName;
-        this.version = version;
-        if (state == null) {
-            this.state = EntityState.ACTIVE;
-        } else {
-            this.state = EntityState.valueOf(state.toUpperCase());
-        }
-        this.systemAttributes = new AtlasSystemAttributes();
-    }
-
-    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);
-    }
-
-    public Id(long id, int version, String typeName, String state) {
-        this("" + id, version, typeName, state);
-    }
-
-    public Id(String typeName) {
-        this("" + Id.nextNegativeLong(), 0, typeName);
-    }
-
-    public boolean isUnassigned() {
-        try {
-            long l = Long.parseLong(id);
-            return l < 0;
-        } catch (NumberFormatException ne) {
-            return false;
-        }
-    }
-
-    public boolean isAssigned() {
-        try {
-            UUID.fromString(id);
-        } catch (IllegalArgumentException e) {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return String.format("(type: %s, id: %s)", typeName, isUnassigned() ? "<unassigned>" : "" + id);
-    }
-
-    @Override
-    public String toShortString() {
-        return String.format("id[type=%s guid=%s state=%s]", typeName, id, state);
-    }
-
-    @Override
-    public AtlasSystemAttributes getSystemAttributes(){
-        return systemAttributes;
-    }
-
-    public String getClassName() {
-        return typeName;
-    }
-
-    public int getVersion() {
-        return version;
-    }
-
-    public String _getId() {
-        return id;
-    }
-
-    public EntityState getState() {
-        return state;
-    }
-
-    public String getStateAsString() {
-        return state == null ? null : state.name();
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-        Id id1 = (Id) o;
-        return version == id1.version &&
-                Objects.equals(id, id1.id) &&
-                Objects.equals(typeName, id1.typeName) &&
-                state == id1.state;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(id, typeName, version, state);
-    }
-
-    @Override
-    public ImmutableList<String> getTraits() {
-        return null;
-    }
-
-    @Override
-    public Id getId() {
-        return this;
-    }
-
-    @Override
-    public IStruct getTrait(String typeName) {
-        return null;
-    }
-
-    @Override
-    public String getTypeName() {
-        return typeName;
-    }
-
-    @Override
-    public Object get(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    @Override
-    public void set(String attrName, Object val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    @Override
-    public FieldMapping fieldMapping() {
-        return null;
-    }
-
-    @Override
-    public Map<String, Object> getValuesMap() throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setNull(String attrName) throws AtlasException {
-        set(attrName, null);
-    }
-
-    public boolean getBoolean(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public byte getByte(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public short getShort(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public int getInt(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public long getLong(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public float getFloat(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public double getDouble(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public BigInteger getBigInt(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public BigDecimal getBigDecimal(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public Date getDate(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public String getString(String attrName) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setBoolean(String attrName, boolean val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setByte(String attrName, byte val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setShort(String attrName, short val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setInt(String attrName, int val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setLong(String attrName, long val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setFloat(String attrName, float val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setDouble(String attrName, double val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setBigInt(String attrName, BigInteger val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setBigDecimal(String attrName, BigDecimal val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setDate(String attrName, Date val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public void setString(String attrName, String val) throws AtlasException {
-        throw new AtlasException("Get/Set not supported on an Id object");
-    }
-
-    public boolean isValueSet(String attrName) throws AtlasException {
-        throw new AtlasException("Attributes not set on an Id object");
-    }
-
-    @Override
-    public String getSignatureHash(MessageDigest digester) throws AtlasException {
-        digester.update(id.getBytes(Charset.forName("UTF-8")));
-        digester.update(typeName.getBytes(Charset.forName("UTF-8")));
-        byte[] digest = digester.digest();
-        return SHA256Utils.toString(digest);
-    }
-
-    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/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/MapIds.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/MapIds.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/MapIds.java
deleted file mode 100755
index e62f29d..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/MapIds.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.persistence;
-
-import com.google.common.collect.ImmutableCollection;
-import com.google.common.collect.ImmutableMap;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.IReferenceableInstance;
-import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.ObjectGraphWalker;
-
-import java.util.Map;
-
-public class MapIds implements ObjectGraphWalker.NodeProcessor {
-
-    final Map<Id, Id> idToNewIdMap;
-
-    public MapIds(Map<Id, Id> idToNewIdMap) {
-        this.idToNewIdMap = idToNewIdMap;
-    }
-
-    @Override
-    public void processNode(ObjectGraphWalker.Node nd) throws AtlasException {
-
-        IReferenceableInstance ref = null;
-        Id id = null;
-
-        if (nd.attributeName == null) {
-            ref = (IReferenceableInstance) nd.instance;
-            Id newId = idToNewIdMap.get(ref.getId());
-            if (newId != null) {
-                ((ReferenceableInstance) ref).replaceWithNewId(newId);
-            }
-        } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
-            if (nd.value != null && nd.value instanceof IReferenceableInstance) {
-                Id oldId = ((IReferenceableInstance) nd.value).getId();
-                Id newId = idToNewIdMap.get(oldId);
-                /*
-                 * Replace Instances with Ids, irrespective of whether they map to newIds or not.
-                 */
-                newId = newId == null ? oldId : newId;
-                nd.instance.set(nd.attributeName, newId);
-            }
-        } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
-            DataTypes.ArrayType aT = (DataTypes.ArrayType) nd.aInfo.dataType();
-            Object v = aT.mapIds((ImmutableCollection) nd.value, nd.aInfo.multiplicity, idToNewIdMap);
-            nd.instance.set(nd.attributeName, v);
-        } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
-            DataTypes.MapType mT = (DataTypes.MapType) nd.aInfo.dataType();
-            Object v = mT.mapIds((ImmutableMap) nd.value, nd.aInfo.multiplicity, idToNewIdMap);
-            nd.instance.set(nd.attributeName, v);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
deleted file mode 100755
index be2634d..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.persistence;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.IReferenceableInstance;
-import org.apache.atlas.typesystem.IStruct;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.FieldMapping;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.atlas.utils.SHA256Utils;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.util.Date;
-import java.util.HashSet;
-
-/*
- * @todo handle names prefixed by traitName.
- */
-public class ReferenceableInstance extends StructInstance implements ITypedReferenceableInstance {
-
-    private final ImmutableMap<String, ITypedStruct> traits;
-    private final ImmutableList<String> traitNames;
-    private Id id;
-    private AtlasSystemAttributes systemAttributes;
-
-
-    public ReferenceableInstance(Id id, String dataTypeName, AtlasSystemAttributes systemAttributes, FieldMapping fieldMapping, boolean[] nullFlags,
-            boolean[] explicitSets, boolean[] bools, byte[] bytes, short[] shorts, int[] ints, long[] longs, float[] floats, double[] doubles,
-            BigDecimal[] bigDecimals, BigInteger[] bigIntegers, Date[] dates, String[] strings,
-            ImmutableList<Object>[] arrays, ImmutableMap<Object, Object>[] maps, StructInstance[] structs,
-            ReferenceableInstance[] referenceableInstances, Id[] ids, ImmutableMap<String, ITypedStruct> traits) {
-        super(dataTypeName, fieldMapping, nullFlags, explicitSets, bools, bytes, shorts, ints, longs, floats, doubles, bigDecimals,
-                bigIntegers, dates, strings, arrays, maps, structs, referenceableInstances, ids);
-        this.id = id;
-        this.traits = traits;
-        ImmutableList.Builder<String> b = new ImmutableList.Builder<>();
-        for (String t : traits.keySet()) {
-            b.add(t);
-        }
-        this.traitNames = b.build();
-        if (systemAttributes == null){
-            this.systemAttributes = new AtlasSystemAttributes();
-        }
-        else {
-            this.systemAttributes = systemAttributes;
-        }
-    }
-
-    @Override
-    public ImmutableList<String> getTraits() {
-        return traitNames;
-    }
-
-    @Override
-    public Id getId() {
-        return id;
-    }
-
-    @Override
-    public IStruct getTrait(String typeName) {
-        return traits.get(typeName);
-    }
-
-    @Override
-    public AtlasSystemAttributes getSystemAttributes(){
-        return systemAttributes;
-    }
-
-    /**
-     * @nopub
-     * @param id
-     */
-    public void replaceWithNewId(Id id) {
-        this.id = id;
-    }
-
-    @Override
-    public String toString() {
-        try {
-            StringBuilder buf = new StringBuilder();
-            String prefix = "";
-
-            fieldMapping.output(this, buf, prefix, new HashSet<IReferenceableInstance>());
-            return buf.toString();
-
-        } catch (AtlasException me) {
-            throw new RuntimeException(me);
-        }
-    }
-
-    @Override
-    public String toShortString() {
-        String name = null;
-        if (fieldMapping().fields.containsKey("name")) {
-            try {
-                name = getString("name");
-            } catch (AtlasException e) {
-                //ignore if there is no field name
-            }
-        }
-        return String.format("entity[type=%s guid=%s name=%s]", getTypeName(), getId()._getId(), name);
-    }
-
-    @Override
-    public String getSignatureHash(MessageDigest digester) throws AtlasException {
-        ClassType classType = TypeSystem.getInstance().getDataType(ClassType.class, getTypeName());
-        classType.updateSignatureHash(digester, this);
-        byte[] digest = digester.digest();
-        return SHA256Utils.toString(digest);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
deleted file mode 100755
index 766d2d0..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
+++ /dev/null
@@ -1,790 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.persistence;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.types.AttributeInfo;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumType;
-import org.apache.atlas.typesystem.types.EnumValue;
-import org.apache.atlas.typesystem.types.FieldMapping;
-import org.apache.atlas.typesystem.types.StructType;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.atlas.typesystem.types.ValueConversionException;
-import org.apache.atlas.utils.SHA256Utils;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-public class StructInstance implements ITypedStruct {
-    public final String dataTypeName;
-    public final FieldMapping fieldMapping;
-    public final boolean nullFlags[];
-    public final boolean explicitSets[];
-    public final boolean[] bools;
-    public final byte[] bytes;
-    public final short[] shorts;
-    public final int[] ints;
-    public final long[] longs;
-    public final float[] floats;
-    public final double[] doubles;
-    public final BigDecimal[] bigDecimals;
-    public final BigInteger[] bigIntegers;
-    public final Date[] dates;
-    public final String[] strings;
-    public final ImmutableList<Object>[] arrays;
-    public final ImmutableMap<Object, Object>[] maps;
-    public final StructInstance[] structs;
-    public final ReferenceableInstance[] referenceables;
-    public final Id[] ids;
-
-    public StructInstance(String dataTypeName, FieldMapping fieldMapping, boolean[] nullFlags, boolean[] explicitSets, boolean[] bools,
-            byte[] bytes, short[] shorts, int[] ints, long[] longs, float[] floats, double[] doubles,
-            BigDecimal[] bigDecimals, BigInteger[] bigIntegers, Date[] dates, String[] strings,
-            ImmutableList<Object>[] arrays, ImmutableMap<Object, Object>[] maps, StructInstance[] structs,
-            ReferenceableInstance[] referenceables, Id[] ids) {
-        assert dataTypeName != null;
-        this.dataTypeName = dataTypeName;
-        this.fieldMapping = fieldMapping;
-        this.nullFlags = nullFlags;
-        this.explicitSets = explicitSets;
-        this.bools = bools;
-        this.bytes = bytes;
-        this.shorts = shorts;
-        this.ints = ints;
-        this.longs = longs;
-        this.floats = floats;
-        this.doubles = doubles;
-        this.bigDecimals = bigDecimals;
-        this.bigIntegers = bigIntegers;
-        this.dates = dates;
-        this.strings = strings;
-        this.arrays = arrays;
-        this.maps = maps;
-        this.structs = structs;
-        this.referenceables = referenceables;
-        this.ids = ids;
-
-        for (int i = 0; i < nullFlags.length; i++) {
-            nullFlags[i] = true;
-        }
-
-        for (int i = 0; i < explicitSets.length; i++) {
-            explicitSets[i] = false;
-        }
-    }
-
-    @Override
-    public String getTypeName() {
-        return dataTypeName;
-    }
-
-    @Override
-    public FieldMapping fieldMapping() {
-        return fieldMapping;
-    }
-
-    public void set(String attrName, Object val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new ValueConversionException(getTypeName(), val, "Unknown field " + attrName);
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-        Object cVal = null;
-
-        explicitSets[nullPos] = true;
-
-        if (val != null && val instanceof Id) {
-            ClassType clsType = TypeSystem.getInstance().getDataType(ClassType.class, i.dataType().getName());
-            clsType.validateId((Id) val);
-            cVal = val;
-        } else {
-            try {
-                cVal = i.dataType().convert(val, i.multiplicity);
-            } catch(ValueConversionException.NullConversionException e) {
-                throw new ValueConversionException.NullConversionException("For field '" + attrName + "'", e);
-            }
-        }
-        if (cVal == null) {
-            nullFlags[nullPos] = true;
-            return;
-        }
-        nullFlags[nullPos] = false;
-        if (i.dataType() == DataTypes.BOOLEAN_TYPE) {
-            bools[pos] = (Boolean) cVal;
-        } else if (i.dataType() == DataTypes.BYTE_TYPE) {
-            bytes[pos] = (Byte) cVal;
-        } else if (i.dataType() == DataTypes.SHORT_TYPE) {
-            shorts[pos] = (Short) cVal;
-        } else if (i.dataType() == DataTypes.INT_TYPE) {
-            ints[pos] = (Integer) cVal;
-        } else if (i.dataType() == DataTypes.LONG_TYPE) {
-            longs[pos] = (Long) cVal;
-        } else if (i.dataType() == DataTypes.FLOAT_TYPE) {
-            floats[pos] = (Float) cVal;
-        } else if (i.dataType() == DataTypes.DOUBLE_TYPE) {
-            doubles[pos] = (Double) cVal;
-        } else if (i.dataType() == DataTypes.BIGINTEGER_TYPE) {
-            bigIntegers[pos] = (BigInteger) cVal;
-        } else if (i.dataType() == DataTypes.BIGDECIMAL_TYPE) {
-            bigDecimals[pos] = (BigDecimal) cVal;
-        } else if (i.dataType() == DataTypes.DATE_TYPE) {
-            dates[pos] = (Date) cVal;
-        } else if (i.dataType() == DataTypes.STRING_TYPE) {
-            strings[pos] = (String) cVal;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.ENUM) {
-            ints[pos] = ((EnumValue) cVal).ordinal;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
-            arrays[pos] = (ImmutableList) cVal;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
-            maps[pos] = (ImmutableMap) cVal;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.STRUCT
-                || i.dataType().getTypeCategory() == DataTypes.TypeCategory.TRAIT) {
-            structs[pos] = (StructInstance) cVal;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
-            if (cVal instanceof Id) {
-                ids[pos] = (Id) cVal;
-            } else {
-                referenceables[pos] = (ReferenceableInstance) cVal;
-            }
-        } else {
-            throw new AtlasException(String.format("Unknown datatype %s", i.dataType()));
-        }
-    }
-
-    public Object get(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            if ( i.dataType().getTypeCategory() == DataTypes.TypeCategory.PRIMITIVE) {
-                return ((DataTypes.PrimitiveType) i.dataType()).nullValue();
-            } else {
-                return null;
-            }
-        }
-
-        if (i.dataType() == DataTypes.BOOLEAN_TYPE) {
-            return bools[pos];
-        } else if (i.dataType() == DataTypes.BYTE_TYPE) {
-            return bytes[pos];
-        } else if (i.dataType() == DataTypes.SHORT_TYPE) {
-            return shorts[pos];
-        } else if (i.dataType() == DataTypes.INT_TYPE) {
-            return ints[pos];
-        } else if (i.dataType() == DataTypes.LONG_TYPE) {
-            return longs[pos];
-        } else if (i.dataType() == DataTypes.FLOAT_TYPE) {
-            return floats[pos];
-        } else if (i.dataType() == DataTypes.DOUBLE_TYPE) {
-            return doubles[pos];
-        } else if (i.dataType() == DataTypes.BIGINTEGER_TYPE) {
-            return bigIntegers[pos];
-        } else if (i.dataType() == DataTypes.BIGDECIMAL_TYPE) {
-            return bigDecimals[pos];
-        } else if (i.dataType() == DataTypes.DATE_TYPE) {
-            return dates[pos];
-        } else if (i.dataType() == DataTypes.STRING_TYPE) {
-            return strings[pos];
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.ENUM) {
-            return ((EnumType) i.dataType()).fromOrdinal(ints[pos]);
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
-            return arrays[pos];
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
-            return maps[pos];
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.STRUCT
-                || i.dataType().getTypeCategory() == DataTypes.TypeCategory.TRAIT) {
-            return structs[pos];
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
-            if (ids[pos] != null) {
-                return ids[pos];
-            } else {
-                return referenceables[pos];
-            }
-        } else {
-            throw new AtlasException(String.format("Unknown datatype %s", i.dataType()));
-        }
-    }
-
-    public void setNull(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-        nullFlags[nullPos] = true;
-        explicitSets[nullPos] = true;
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-
-        if (i.dataType() == DataTypes.BIGINTEGER_TYPE) {
-            bigIntegers[pos] = null;
-        } else if (i.dataType() == DataTypes.BIGDECIMAL_TYPE) {
-            bigDecimals[pos] = null;
-        } else if (i.dataType() == DataTypes.DATE_TYPE) {
-            dates[pos] = null;
-        } else if (i.dataType() == DataTypes.INT_TYPE) {
-            ints[pos] = 0;
-        } else if (i.dataType() == DataTypes.BOOLEAN_TYPE) {
-            bools[pos] = false;
-        } else if (i.dataType() == DataTypes.STRING_TYPE) {
-            strings[pos] = null;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
-            arrays[pos] = null;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
-            maps[pos] = null;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.STRUCT
-            || i.dataType().getTypeCategory() == DataTypes.TypeCategory.TRAIT) {
-            structs[pos] = null;
-        } else if (i.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
-                ids[pos] = null;
-                referenceables[pos] = null;
-        } else {
-            throw new AtlasException(String.format("Unknown datatype %s", i.dataType()));
-        }
-    }
-
-    /*
-     * Use only for json serialization
-     * @nonpublic
-     */
-    @Override
-    public Map<String, Object> getValuesMap() throws AtlasException {
-        Map<String, Object> m = new HashMap<>();
-        for (String attr : fieldMapping.fields.keySet()) {
-//            int pos = fieldMapping.fieldNullPos.get(attr);
-//            if (  explicitSets[pos] ) {
-                m.put(attr, get(attr));
-//            }
-        }
-        return m;
-    }
-
-    public boolean getBoolean(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.BOOLEAN_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.BOOLEAN_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.BOOLEAN_TYPE.nullValue();
-        }
-
-        return bools[pos];
-    }
-
-    public byte getByte(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.BYTE_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.BYTE_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.BYTE_TYPE.nullValue();
-        }
-
-        return bytes[pos];
-    }
-
-    public short getShort(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.SHORT_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.SHORT_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.SHORT_TYPE.nullValue();
-        }
-
-        return shorts[pos];
-    }
-
-    public int getInt(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-
-        if (i.dataType() != DataTypes.INT_TYPE && !(i.dataType() instanceof EnumType)) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.INT_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.INT_TYPE.nullValue();
-        }
-
-        return ints[pos];
-    }
-
-    public long getLong(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.LONG_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.LONG_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.LONG_TYPE.nullValue();
-        }
-
-        return longs[pos];
-    }
-
-    public float getFloat(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.FLOAT_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.FLOAT_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.FLOAT_TYPE.nullValue();
-        }
-
-        return floats[pos];
-    }
-
-    public double getDouble(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.DOUBLE_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.DOUBLE_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.DOUBLE_TYPE.nullValue();
-        }
-
-        return doubles[pos];
-    }
-
-    public BigInteger getBigInt(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.BIGINTEGER_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.BIGINTEGER_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.BIGINTEGER_TYPE.nullValue();
-        }
-
-        return bigIntegers[pos];
-    }
-
-    public BigDecimal getBigDecimal(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.BIGDECIMAL_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.BIGDECIMAL_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.BIGDECIMAL_TYPE.nullValue();
-        }
-
-        return bigDecimals[pos];
-    }
-
-    public Date getDate(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.DATE_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.DATE_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.DATE_TYPE.nullValue();
-        }
-
-        return dates[pos];
-    }
-
-    public String getString(String attrName) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.STRING_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic get method", attrName,
-                            getTypeName(), DataTypes.STRING_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        if (nullFlags[nullPos]) {
-            return DataTypes.STRING_TYPE.nullValue();
-        }
-
-        return strings[pos];
-    }
-
-    public void setBoolean(String attrName, boolean val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.BOOLEAN_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.BOOLEAN_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = false;
-        bools[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setByte(String attrName, byte val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.BYTE_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.BYTE_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = false;
-        bytes[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setShort(String attrName, short val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.SHORT_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.SHORT_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = false;
-        shorts[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setInt(String attrName, int val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.INT_TYPE && !(i.dataType() instanceof EnumType)) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.INT_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = false;
-        ints[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setLong(String attrName, long val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.LONG_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.LONG_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = false;
-        longs[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setFloat(String attrName, float val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.FLOAT_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.FLOAT_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = false;
-        floats[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setDouble(String attrName, double val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.DOUBLE_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.DOUBLE_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = false;
-        doubles[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setBigInt(String attrName, BigInteger val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.BIGINTEGER_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.BIGINTEGER_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = val == null;
-        bigIntegers[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setBigDecimal(String attrName, BigDecimal val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.BIGDECIMAL_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.BIGDECIMAL_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = val == null;
-        bigDecimals[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setDate(String attrName, Date val) throws AtlasException {
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.DATE_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.DATE_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = val == null;
-        dates[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    public void setString(String attrName, String val) throws AtlasException {
-
-        AttributeInfo i = fieldMapping.fields.get(attrName);
-        if (i == null) {
-            throw new AtlasException(String.format("Unknown field %s for Struct %s", attrName, getTypeName()));
-        }
-
-        if (i.dataType() != DataTypes.STRING_TYPE) {
-            throw new AtlasException(
-                    String.format("Field %s for Struct %s is not a %s, call generic set method", attrName,
-                            getTypeName(), DataTypes.STRING_TYPE.getName()));
-        }
-
-        int pos = fieldMapping.fieldPos.get(attrName);
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-
-        nullFlags[nullPos] = val == null;
-        strings[pos] = val;
-        explicitSets[nullPos] = true;
-    }
-
-    @Override
-    public String toString() {
-        try {
-            StringBuilder buf = new StringBuilder();
-            String prefix = "";
-
-            fieldMapping.output(this, buf, prefix, null);
-            return buf.toString();
-
-        } catch (AtlasException me) {
-            throw new RuntimeException(me);
-        }
-    }
-
-    @Override
-    public String getSignatureHash(MessageDigest digester) throws AtlasException {
-        StructType structType = TypeSystem.getInstance().getDataType(StructType.class, getTypeName());
-        structType.updateSignatureHash(digester, this);
-        byte[] digest = digester.digest();
-        return SHA256Utils.toString(digest);
-    }
-
-    @Override
-    public boolean isValueSet(final String attrName) throws AtlasException {
-        int nullPos = fieldMapping.fieldNullPos.get(attrName);
-        return explicitSets[nullPos];
-    }
-
-    @Override
-    public String toShortString() {
-        return String.format("struct[type=%s]", dataTypeName);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/types/AbstractDataType.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/AbstractDataType.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/AbstractDataType.java
deleted file mode 100755
index 874138b..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/AbstractDataType.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.common.collect.ImmutableSortedMap;
-
-import org.apache.atlas.AtlasConstants;
-import org.apache.atlas.AtlasException;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
-abstract class AbstractDataType<T> implements IDataType<T> {
-
-    public final String name;
-    public final String description;
-    public final String version;
-
-    public AbstractDataType(String name, String description) {
-
-        super();
-        this.name = name;
-        this.description = description;
-        this.version = AtlasConstants.DEFAULT_TYPE_VERSION;
-    }
-
-    public AbstractDataType(String name, String description, String version) {
-
-        super();
-        this.name = name;
-        this.description = description;
-        this.version = version;
-    }
-
-    protected T convertNull(Multiplicity m) throws AtlasException {
-        if (!m.nullAllowed()) {
-            throw new ValueConversionException.NullConversionException(m);
-        }
-        return null;
-    }
-
-    @Override
-    public void output(T val, Appendable buf, String prefix, Set<T> inProcess) throws AtlasException {
-        final String strValue;
-
-        if (val == null) {
-            strValue = "<null>";
-        } else if (val instanceof Map) {
-            ImmutableSortedMap immutableSortedMap = ImmutableSortedMap.copyOf((Map) val);
-            strValue = immutableSortedMap.toString();
-        } else {
-            strValue = val.toString();
-        }
-
-        TypeUtils.outputVal(strValue, buf, prefix);
-    }
-
-    @Override
-    public void output(Appendable buf, Set<String> typesInProcess) throws AtlasException {
-
-        try {
-            buf.append(toString());
-        } catch (IOException e) {
-            throw new AtlasException(e);
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString() {
-        return "{name=" + name + ", description=" + description + "}";
-    }
-
-    /**
-     * Validate that current definition can be updated with the new definition
-     * @param newType
-     */
-    @Override
-    public void validateUpdate(IDataType newType) throws TypeUpdateException {
-        if (!getName().equals(newType.getName()) || !getClass().getName().equals(newType.getClass().getName())) {
-            throw new TypeUpdateException(newType);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public String getDescription() {
-        return description;
-    }
-
-    @Override
-    public String getVersion() {
-        return version;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeDefinition.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeDefinition.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeDefinition.java
deleted file mode 100755
index 5561f0b..0000000
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeDefinition.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import org.apache.atlas.utils.ParamChecker;
-
-import java.util.Objects;
-
-public final class AttributeDefinition {
-
-    public final String name;
-    public final String dataTypeName;
-    public final Multiplicity multiplicity;
-    //A composite is the one whose lifecycle is dependent on the enclosing type and is not just a reference
-    public final boolean isComposite;
-    public final boolean isUnique;
-    public final boolean isIndexable;
-
-    /**
-     * If this is a reference attribute, then the name of the attribute on the Class
-     * that this refers to.
-     */
-    public final String reverseAttributeName;
-
-    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 = ParamChecker.notEmpty(name, "Attribute name");
-        this.dataTypeName = ParamChecker.notEmpty(dataTypeName, "Attribute type");
-        this.multiplicity = multiplicity;
-        this.isComposite = isComposite;
-        this.isUnique = isUnique;
-        this.isIndexable = isIndexable;
-        this.reverseAttributeName = ParamChecker.notEmptyIfNotNull(reverseAttributeName, "Reverse attribute name");
-    }
-
-    @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);
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-}