incubator-atlas git commit: ATLAS-1912: fix for defects reported by Coverity scan

2017-07-07 Thread madhan
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 1c4e8b7ff -> ee8c81df4


ATLAS-1912: fix for defects reported by Coverity scan

Signed-off-by: Madhan Neethiraj 


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/ee8c81df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/ee8c81df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/ee8c81df

Branch: refs/heads/master
Commit: ee8c81df45801fa3798c19f3999b635140e835f7
Parents: 1c4e8b7
Author: David Radley 
Authored: Fri Jul 7 20:42:45 2017 -0700
Committer: Madhan Neethiraj 
Committed: Fri Jul 7 20:57:37 2017 -0700

--
 .../java/org/apache/atlas/AtlasErrorCode.java   |  1 +
 .../graph/v1/AtlasRelationshipDefStoreV1.java   | 26 +---
 2 files changed, 18 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee8c81df/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
--
diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java 
b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
index 73dd33a..e8afed1 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
@@ -100,6 +100,7 @@ public enum AtlasErrorCode {
 INSTANCE_NOT_FOUND(404, "ATLAS-404-00-00B", "Given instance is invalid/not 
found: {0}"),
 RELATIONSHIP_GUID_NOT_FOUND(404, "ATLAS-404-00-00C", "Given relationship 
guid {0} is invalid/not found"),
 RELATIONSHIP_CRUD_INVALID_PARAMS(404, "ATLAS-404-00-00D", "Invalid 
relationship creation/updation parameters passed : {0}"),
+RELATIONSHIPDEF_END_TYPE_NAME_NOT_FOUND(404, "ATLAS-404-00-00E", 
"RelationshipDef {0} endDef typename {0} cannot be found"),
 // All data conflict errors go here
 TYPE_ALREADY_EXISTS(409, "ATLAS-409-00-001", "Given type {0} already 
exists"),
 TYPE_HAS_REFERENCES(409, "ATLAS-409-00-002", "Given type {0} has 
references"),

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee8c81df/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
--
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
index bd7416e..ddf0af9 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
@@ -78,15 +78,23 @@ public class AtlasRelationshipDefStoreV1 extends 
AtlasAbstractDefStoreV1 impleme
 
 updateVertexPreCreate(relationshipDef, (AtlasRelationshipType) type, 
relationshipDefVertex);
 
-final AtlasRelationshipEndDef endDef1 = relationshipDef.getEndDef1();
-final String type1 = endDef1.getType();
-final AtlasRelationshipEndDef endDef2 = relationshipDef.getEndDef2();
-final String type2 = endDef2.getType();
-final String name1 = endDef1.getName();
-final String name2 = endDef2.getName();
-AtlasVertex end1TypeVertex = typeDefStore.findTypeVertexByName(type1);
-
-AtlasVertex end2TypeVertex = typeDefStore.findTypeVertexByName(type2);
+final AtlasRelationshipEndDef endDef1= 
relationshipDef.getEndDef1();
+final AtlasRelationshipEndDef endDef2= 
relationshipDef.getEndDef2();
+final String  type1  = endDef1.getType();
+final String  type2  = endDef2.getType();
+final String  name1  = endDef1.getName();
+final String  name2  = endDef2.getName();
+final AtlasVertex end1TypeVertex = 
typeDefStore.findTypeVertexByName(type1);
+final AtlasVertex end2TypeVertex = 
typeDefStore.findTypeVertexByName(type2);
+
+if (end1TypeVertex == null) {
+throw new 
AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_END_TYPE_NAME_NOT_FOUND, 
relationshipDef.getName(), type1);
+}
+
+if (end2TypeVertex == null) {
+throw new 
AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_END_TYPE_NAME_NOT_FOUND, 
relationshipDef.getName(), type2);
+}
+
 // create an edge between the relationshipDef and each of the 
entityDef vertices.
 AtlasEdge edge1 = typeDefStore.getOrCreateEdge(relationshipDefVertex, 
end1TypeVertex, 

[2/4] incubator-atlas git commit: updated documentation for import API

2017-07-07 Thread madhan
updated documentation for import API

(cherry picked from commit 1c4e8b7ffa34a9194d2a6d060c1f335a52c6dce0)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/bc3f0ace
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/bc3f0ace
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/bc3f0ace

Branch: refs/heads/0.8-incubating
Commit: bc3f0ace09a40fd1c287d8f31281ab20ee1e349f
Parents: 82ce3d3
Author: ashutoshm 
Authored: Fri Jul 7 11:14:41 2017 -0700
Committer: Madhan Neethiraj 
Committed: Fri Jul 7 16:54:30 2017 -0700

--
 docs/src/site/twiki/Import-API-Options.twiki | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/bc3f0ace/docs/src/site/twiki/Import-API-Options.twiki
--
diff --git a/docs/src/site/twiki/Import-API-Options.twiki 
b/docs/src/site/twiki/Import-API-Options.twiki
index 9acfee1..8588784 100644
--- a/docs/src/site/twiki/Import-API-Options.twiki
+++ b/docs/src/site/twiki/Import-API-Options.twiki
@@ -45,15 +45,7 @@ To use the option, set the contents of _importOptions.json_ 
to:
 
 {
   "options": {
-
-   "transforms": {
-"hive_table": {
-  "qualifiedName": [
-  "lowercase",
-  "replace:@cl1:@cl2"
-]
-  }
-}
+"transforms": "{ \"hive_table\": { \"qualifiedName\": [ 
\"replace:@cl1:@cl2\" ] }, \"hive_db\": { \"qualifiedName\": [ 
\"replace:@cl1:@cl2\" ] } }"
   }
 }
 



[4/4] incubator-atlas git commit: Coverity fixes for ATLAS-1880

2017-07-07 Thread madhan
Coverity fixes for ATLAS-1880

(cherry picked from commit d22fa7eba93d3a97800f4a5f2b5c3935223f7625)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/92f30b0e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/92f30b0e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/92f30b0e

Branch: refs/heads/0.8-incubating
Commit: 92f30b0e38e50037a819cc9867041d0330ddc485
Parents: fdfbfb0
Author: apoorvnaik 
Authored: Mon Jul 3 09:29:05 2017 -0700
Committer: Madhan Neethiraj 
Committed: Fri Jul 7 16:55:39 2017 -0700

--
 .../src/main/java/org/apache/atlas/discovery/GremlinStep.java   | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/92f30b0e/repository/src/main/java/org/apache/atlas/discovery/GremlinStep.java
--
diff --git 
a/repository/src/main/java/org/apache/atlas/discovery/GremlinStep.java 
b/repository/src/main/java/org/apache/atlas/discovery/GremlinStep.java
index 5565781..1056b3e 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/GremlinStep.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/GremlinStep.java
@@ -363,6 +363,7 @@ public class GremlinStep implements PipelineStep {
 break;
 case ENDS_WITH:
 query.has(qualifiedAttributeName, 
MatchingOperator.REGEX, getSuffixRegex(attrValue));
+break;
 case IN:
 LOG.warn("{}: unsupported operator. Ignored", 
operator);
 break;



[3/4] incubator-atlas git commit: ATLAS-1897 : UI - Render HTML element based on attribute data-type while assigning Tag to entity.

2017-07-07 Thread madhan
ATLAS-1897 : UI - Render HTML element based on attribute data-type while 
assigning Tag to entity.

(cherry picked from commit c4fd42b86bfe1f4654460ba621714bcea3336fbb)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/fdfbfb04
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/fdfbfb04
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/fdfbfb04

Branch: refs/heads/0.8-incubating
Commit: fdfbfb04b200c04cb49f3249e97de7c71fb3f5d9
Parents: bc3f0ac
Author: Kalyani 
Authored: Wed Jun 28 17:10:12 2017 +0530
Committer: Madhan Neethiraj 
Committed: Fri Jul 7 16:55:09 2017 -0700

--
 .../public/js/views/tag/addTagModalView.js  | 42 ++--
 1 file changed, 38 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/fdfbfb04/dashboardv2/public/js/views/tag/addTagModalView.js
--
diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js 
b/dashboardv2/public/js/views/tag/addTagModalView.js
index 7eaf23c..97d80bd 100644
--- a/dashboardv2/public/js/views/tag/addTagModalView.js
+++ b/dashboardv2/public/js/views/tag/addTagModalView.js
@@ -26,6 +26,7 @@ define(['require',
 'utils/UrlLinks',
 'utils/Enums',
 'utils/Messages',
+'daterangepicker'
 ], function(require, AddTagModalViewTmpl, VTagList, VCommonList, Modal, 
VEntity, Utils, UrlLinks, Enums, Messages) {
 'use strict';
 
@@ -82,7 +83,12 @@ define(['require',
 };
 tagAttributeNames.each(function(i, item) {
 var selection = $(item).data("key");
-tagAttributes[selection] = $(item).val() || null;
+var datatypeSelection = $(item).data("type");
+if (datatypeSelection === "date") {
+tagAttributes[selection] = Date.parse($(item).val()) 
|| null;
+} else {
+tagAttributes[selection] = $(item).val() || null;
+}
 });
 
 if (that.multiple) {
@@ -271,16 +277,44 @@ define(['require',
 _.each(enumValue, function(key, value) {
 str += '' + key.value + 
'';
 })
-that.ui.tagAttribute.append('' + name + '' +
+that.ui.tagAttribute.append('' + name + '' + ' (' + typeName + ')' +
 '' + str + '');
 } else {
-that.ui.tagAttribute.append('' + name + '' +
-'');
+var textElement = that.getElement(name, typeName);
+that.ui.tagAttribute.append('' + name + '' + ' (' + typeName + ')' + 
textElement);
+}
+});
+that.$('input[data-type="date"]').each(function() {
+if (!$(this).data('daterangepicker')) {
+var dateObj = { "singleDatePicker": true, 
"showDropdowns": true };
+if (that.tagModel) {
+var formatDate = Number(this.value);
+dateObj["startDate"] = new Date(formatDate);
+}
+$(this).daterangepicker(dateObj);
+}
+});
+that.$('select[data-type="boolean"]').each(function() {
+var labelName = $(this).data('key');
+if (that.tagModel) {
+this.value = that.tagModel.attributes[labelName];
 }
 });
 this.showAttributeBox();
 }
 },
+getElement: function(labelName, typeName) {
+var value = this.tagModel && this.tagModel.attributes ? 
(this.tagModel.attributes[labelName] || "") : "",
+type = (typeName === "int" || typeName === "long" || typeName 
=== "float" || typeName === "byte" || typeName === "double" || typeName === 
"short") ? "number" : "text";
+if (typeName === "boolean") {
+return ' ' +
+'--Select true or false--' +
+'true' +
+'false';
+} else {
+return '';
+}
+},
 saveTagData: function(options) {
 var that = this;
 this.entityModel = new VEntity();



[1/4] incubator-atlas git commit: updated documentation for import API

2017-07-07 Thread madhan
Repository: incubator-atlas
Updated Branches:
  refs/heads/0.8-incubating 7c348b5ec -> 92f30b0e3


updated documentation for import API

Signed-off-by: Madhan Neethiraj 
(cherry picked from commit 958c48c2c1807e68dd8cceda6857ec065c083a4b)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/82ce3d3f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/82ce3d3f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/82ce3d3f

Branch: refs/heads/0.8-incubating
Commit: 82ce3d3f2033834c6d616172e83f611d4c8ea620
Parents: 7c348b5
Author: ashutoshm 
Authored: Fri Jun 30 16:54:12 2017 -0700
Committer: Madhan Neethiraj 
Committed: Fri Jul 7 16:54:05 2017 -0700

--
 docs/src/site/twiki/Export-API.twiki |   2 +-
 docs/src/site/twiki/Export-HDFS-API.twiki|   2 +-
 docs/src/site/twiki/Import-API-Options.twiki | 121 ++
 docs/src/site/twiki/Import-API.twiki |  17 +--
 docs/src/site/twiki/Import-Export-API.twiki  |   7 +-
 5 files changed, 138 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/82ce3d3f/docs/src/site/twiki/Export-API.twiki
--
diff --git a/docs/src/site/twiki/Export-API.twiki 
b/docs/src/site/twiki/Export-API.twiki
index 4027f3d..0df6629 100644
--- a/docs/src/site/twiki/Export-API.twiki
+++ b/docs/src/site/twiki/Export-API.twiki
@@ -138,7 +138,7 @@ The _metrics_ contains the number of types and entities 
exported as part of the
 Below are sample CURL calls that demonstrate Export of _!QuickStart_ database.
 
 
-curl -X POST -u admin:admin -H "Content-Type: application/json" -H 
"Cache-Control: no-cache" -d '{
+curl -X POST -u adminuser:password -H "Content-Type: application/json" -H 
"Cache-Control: no-cache" -d '{
 "itemsToExport": [
 { "typeName": "DB", "uniqueAttributes": { "name": "Sales" }
 { "typeName": "DB", "uniqueAttributes": { "name": "Reporting" }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/82ce3d3f/docs/src/site/twiki/Export-HDFS-API.twiki
--
diff --git a/docs/src/site/twiki/Export-HDFS-API.twiki 
b/docs/src/site/twiki/Export-HDFS-API.twiki
index 64ba123..6c20060 100644
--- a/docs/src/site/twiki/Export-HDFS-API.twiki
+++ b/docs/src/site/twiki/Export-HDFS-API.twiki
@@ -66,7 +66,7 @@ To export entities that represent HDFS path, use the Export 
API using the _match
 Below are sample CURL calls that performs export operation on the _Sample HDFS 
Setup_ shown above.
 
 
-curl -X POST -u admin:admin -H "Content-Type: application/json" -H 
"Cache-Control: no-cache" -d '{
+curl -X POST -u adminuser:password -H "Content-Type: application/json" -H 
"Cache-Control: no-cache" -d '{
 "itemsToExport": [
 { "typeName": "hdfs_path", "uniqueAttributes": { "name": 
"FinanceAll" }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/82ce3d3f/docs/src/site/twiki/Import-API-Options.twiki
--
diff --git a/docs/src/site/twiki/Import-API-Options.twiki 
b/docs/src/site/twiki/Import-API-Options.twiki
new file mode 100644
index 000..9acfee1
--- /dev/null
+++ b/docs/src/site/twiki/Import-API-Options.twiki
@@ -0,0 +1,121 @@
+---+ Import API Options
+
+Import API options are specified as _options_ JSON. Since the API accepts 
multi-part form data, it is possible to sepecify multipls input streams within 
the CURL call.
+
+---+++ Examples Using CURL Calls
+
+curl -g -X POST -u adminuser:password -H "Content-Type: multipart/form-data"
+-H "Cache-Control: no-cache"
+-F request=@importOptions.json
+-F data=@quickStartDB.zip
+"http://localhost:21000/api/atlas/admin/import;
+
+
+To use the defaults, set the contents of _importOptions.json_ to:
+
+{
+  "options": {
+  }
+}
+
+
+
+---+++ Options
+Following options are supported for Import process:
+
+   * Specify transforms during import operation.
+   * Resume import by specifying starting entity guid.
+   * Optionally import type definition.
+
+--- Transforms
+
+During the import process, the attribute value of the incoming entity can be 
changed.
+
+This is possible by specifying entity type and at attribute to be modified and 
then the manner in which it needs to be modified.
+
+Right now these are the transforms that can be applied:
+   * _lowercase_ Converts the attribute value to lower case.
+   * _replace_ This performs a string find and replace operation. It takes two 
parameters, the first is the string to search for and the next one is the 
string to 

incubator-atlas git commit: updated documentation for import API

2017-07-07 Thread madhan
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 497dcc079 -> 1c4e8b7ff


updated documentation for import API


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/1c4e8b7f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/1c4e8b7f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/1c4e8b7f

Branch: refs/heads/master
Commit: 1c4e8b7ffa34a9194d2a6d060c1f335a52c6dce0
Parents: 497dcc0
Author: ashutoshm 
Authored: Fri Jul 7 11:14:41 2017 -0700
Committer: Madhan Neethiraj 
Committed: Fri Jul 7 16:49:39 2017 -0700

--
 docs/src/site/twiki/Import-API-Options.twiki | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1c4e8b7f/docs/src/site/twiki/Import-API-Options.twiki
--
diff --git a/docs/src/site/twiki/Import-API-Options.twiki 
b/docs/src/site/twiki/Import-API-Options.twiki
index 9acfee1..8588784 100644
--- a/docs/src/site/twiki/Import-API-Options.twiki
+++ b/docs/src/site/twiki/Import-API-Options.twiki
@@ -45,15 +45,7 @@ To use the option, set the contents of _importOptions.json_ 
to:
 
 {
   "options": {
-
-   "transforms": {
-"hive_table": {
-  "qualifiedName": [
-  "lowercase",
-  "replace:@cl1:@cl2"
-]
-  }
-}
+"transforms": "{ \"hive_table\": { \"qualifiedName\": [ 
\"replace:@cl1:@cl2\" ] }, \"hive_db\": { \"qualifiedName\": [ 
\"replace:@cl1:@cl2\" ] } }"
   }
 }