private static boolean isTypeUpdateApplicable(AtlasBaseTypeDef oldTypeDef, AtlasBaseTypeDef newTypeDef, boolean checkVersion) { boolean ret = true; if (checkVersion) { String oldTypeVersion = oldTypeDef.getTypeVersion(); String newTypeVersion = newTypeDef.getTypeVersion(); ret = ObjectUtils.compare(newTypeVersion, oldTypeVersion) > 0; } return ret; }
protected boolean isPatchApplicable(TypeDefPatch patch, AtlasBaseTypeDef currentTypeDef) { String currentVersion = currentTypeDef.getTypeVersion(); String applyToVersion = patch.getApplyToVersion(); return currentVersion == null || currentVersion.equalsIgnoreCase(applyToVersion) || currentVersion.startsWith(applyToVersion + "."); } }
protected boolean isPatchApplicable(TypeDefPatch patch, AtlasBaseTypeDef currentTypeDef) { String currentVersion = currentTypeDef.getTypeVersion(); String applyToVersion = patch.getApplyToVersion(); return currentVersion == null || currentVersion.equalsIgnoreCase(applyToVersion) || currentVersion.startsWith(applyToVersion + "."); } }
void updateTypeVertex(AtlasBaseTypeDef typeDef, AtlasVertex vertex) { if (!isTypeVertex(vertex)) { LOG.warn("updateTypeVertex(): not a type-vertex - {}", vertex); return; } updateVertexProperty(vertex, Constants.GUID_PROPERTY_KEY, typeDef.getGuid()); /* * rename of a type is supported yet - as the typename is used to in the name of the edges from this vertex * To support rename of types, he edge names should be derived from an internal-name - not directly the typename * updateVertexProperty(vertex, Constants.TYPENAME_PROPERTY_KEY, typeDef.getName()); */ updateVertexProperty(vertex, Constants.TYPEDESCRIPTION_PROPERTY_KEY, typeDef.getDescription()); updateVertexProperty(vertex, Constants.TYPEVERSION_PROPERTY_KEY, typeDef.getTypeVersion()); updateVertexProperty(vertex, Constants.TYPEOPTIONS_PROPERTY_KEY, AtlasType.toJson(typeDef.getOptions())); markVertexUpdated(vertex); }
if (StringUtils.isBlank(typeDef.getTypeVersion())) { typeDef.setTypeVersion("1.0"); ret.setProperty(Constants.TYPEDESCRIPTION_PROPERTY_KEY, StringUtils.isNotBlank(typeDef.getDescription()) ? typeDef.getDescription() : typeDef.getName()); ret.setProperty(Constants.TYPEVERSION_PROPERTY_KEY, typeDef.getTypeVersion()); ret.setProperty(Constants.GUID_PROPERTY_KEY, typeDef.getGuid()); ret.setProperty(Constants.CREATED_BY_KEY, getCurrentUser());
void updateTypeVertex(AtlasBaseTypeDef typeDef, AtlasVertex vertex) { if (!isTypeVertex(vertex)) { LOG.warn("updateTypeVertex(): not a type-vertex - {}", vertex); return; } updateVertexProperty(vertex, Constants.GUID_PROPERTY_KEY, typeDef.getGuid()); /* * rename of a type is supported yet - as the typename is used to in the name of the edges from this vertex * To support rename of types, he edge names should be derived from an internal-name - not directly the typename * updateVertexProperty(vertex, Constants.TYPENAME_PROPERTY_KEY, typeDef.getName()); */ updateVertexProperty(vertex, Constants.TYPEDESCRIPTION_PROPERTY_KEY, typeDef.getDescription()); updateVertexProperty(vertex, Constants.TYPEVERSION_PROPERTY_KEY, typeDef.getTypeVersion()); updateVertexProperty(vertex, Constants.TYPEOPTIONS_PROPERTY_KEY, AtlasType.toJson(typeDef.getOptions())); if (StringUtils.isNotEmpty(typeDef.getServiceType())) { updateVertexProperty(vertex, Constants.TYPESERVICETYPE_PROPERTY_KEY, typeDef.getServiceType()); } markVertexUpdated(vertex); }
if (StringUtils.isBlank(typeDef.getTypeVersion())) { typeDef.setTypeVersion("1.0"); ret.setProperty(Constants.TYPEVERSION_PROPERTY_KEY, typeDef.getTypeVersion()); ret.setProperty(Constants.GUID_PROPERTY_KEY, typeDef.getGuid()); ret.setProperty(Constants.CREATED_BY_KEY, getCurrentUser());
protected AtlasBaseTypeDef(AtlasBaseTypeDef other) { if (other != null) { this.category = other.category; setGuid(other.getGuid()); setCreatedBy(other.getCreatedBy()); setUpdatedBy(other.getUpdatedBy()); setCreateTime(other.getCreateTime()); setUpdateTime(other.getUpdateTime()); setVersion(other.getVersion()); setName(other.getName()); setDescription(other.getDescription()); setTypeVersion(other.getTypeVersion()); setOptions(other.getOptions()); } else { this.category = TypeCategory.PRIMITIVE; setGuid(null); setCreatedBy(null); setUpdatedBy(null); setCreateTime(null); setUpdateTime(null); setVersion(null); setName(null); setDescription(null); setTypeVersion(null); setOptions(null); } }
protected AtlasBaseTypeDef(AtlasBaseTypeDef other) { if (other != null) { this.category = other.category; setGuid(other.getGuid()); setCreatedBy(other.getCreatedBy()); setUpdatedBy(other.getUpdatedBy()); setCreateTime(other.getCreateTime()); setUpdateTime(other.getUpdateTime()); setVersion(other.getVersion()); setName(other.getName()); setDescription(other.getDescription()); setTypeVersion(other.getTypeVersion()); setOptions(other.getOptions()); } else { this.category = TypeCategory.PRIMITIVE; setGuid(null); setCreatedBy(null); setUpdatedBy(null); setCreateTime(null); setUpdateTime(null); setVersion(null); setName(null); setDescription(null); setTypeVersion(null); setOptions(null); } }