Commit a5f971a3 by Kapildeo Nayak Committed by nixonrodrigues

ATLAS-3019 Handle NPE while transform and adding replicatedTo in import-export

parent 22041f51
......@@ -6,9 +6,9 @@
* 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.
......@@ -40,9 +40,9 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
public class AtlasExportRequest implements Serializable {
......@@ -83,7 +83,7 @@ public class AtlasExportRequest implements Serializable {
}
public String getFetchTypeOptionValue() {
if(MapUtils.isEmpty(getOptions()) || !getOptions().containsKey(OPTION_FETCH_TYPE)) {
if (MapUtils.isEmpty(getOptions()) || !getOptions().containsKey(OPTION_FETCH_TYPE)) {
return FETCH_TYPE_FULL;
}
......@@ -96,17 +96,17 @@ public class AtlasExportRequest implements Serializable {
}
public boolean getSkipLineageOptionValue() {
if(MapUtils.isEmpty(getOptions()) ||
if (MapUtils.isEmpty(getOptions()) ||
!getOptions().containsKey(AtlasExportRequest.OPTION_SKIP_LINEAGE)) {
return false;
}
Object o = getOptions().get(AtlasExportRequest.OPTION_SKIP_LINEAGE);
if(o instanceof String) {
if (o instanceof String) {
return Boolean.parseBoolean((String) o);
}
if(o instanceof Boolean) {
if (o instanceof Boolean) {
return (Boolean) o;
}
......@@ -142,7 +142,13 @@ public class AtlasExportRequest implements Serializable {
@JsonIgnore
public String getOptionKeyReplicatedTo() {
return isReplicationOptionSet() ? (String) options.get(OPTION_KEY_REPLICATED_TO) : StringUtils.EMPTY;
String replicateToServerName = isReplicationOptionSet() ? (String) options.get(OPTION_KEY_REPLICATED_TO) : StringUtils.EMPTY;
if (replicateToServerName == null) {
return StringUtils.EMPTY;
} else {
return replicateToServerName;
}
}
public StringBuilder toString(StringBuilder sb) {
......
......@@ -64,7 +64,11 @@ public class ImportTransforms {
getTransforms().put(subType, attribtueTransformMap);
} else {
for (Map.Entry<String, List<ImportTransformer>> entry : attribtueTransformMap.entrySet()) {
if((getTransforms().get(subType).containsKey(entry.getKey()))){
getTransforms().get(subType).get(entry.getKey()).addAll(entry.getValue());
} else {
LOG.warn("Attribute {} does not exist for Type : {}", entry.getKey(), parentType);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment