Java Code Examples for org.apache.atlas.model.instance.AtlasEntityHeader#setGuid()
The following examples show how to use
org.apache.atlas.model.instance.AtlasEntityHeader#setGuid() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtlasAuthorizer.java From atlas with Apache License 2.0 | 6 votes |
default void scrubEntityHeader(AtlasEntityHeader entity) { entity.setGuid("-1"); if(entity.getAttributes() != null) { entity.getAttributes().clear(); } if(entity.getClassifications() != null) { entity.getClassifications().clear(); } if(entity.getClassificationNames() != null) { entity.getClassificationNames().clear(); } if(entity.getMeanings() != null) { entity.getMeanings().clear(); } if(entity.getMeaningNames() != null) { entity.getMeaningNames().clear(); } }
Example 2
Source File: AtlasEntityChangeNotifier.java From atlas with Apache License 2.0 | 5 votes |
private void doFullTextMapping(String guid) { if(AtlasRepositoryConfiguration.isFreeTextSearchEnabled() || !AtlasRepositoryConfiguration.isFullTextSearchEnabled()) { return; } AtlasEntityHeader entityHeader = new AtlasEntityHeader(); entityHeader.setGuid(guid); doFullTextMapping(Collections.singletonList(entityHeader)); }
Example 3
Source File: BulkFetchAndUpdate.java From atlas with Apache License 2.0 | 5 votes |
private AtlasEntityHeaders removeEntityGuids(AtlasEntityHeaders headers) { Map<String, AtlasEntityHeader> uniqueNameEntityHeaderMap = new HashMap<>(); for (AtlasEntityHeader header : headers.getGuidHeaderMap().values()) { String uniqueName = getUniqueName(header); if (StringUtils.isEmpty(uniqueName)) { displayCrLf("UniqueName is empty. Ignoring: " + header.getGuid()); LOG.warn("UniqueName is empty. Ignoring: {}", AtlasJson.toJson(header)); continue; } displayCrLf("Processing: " + uniqueName); if (header.getStatus() == DELETED) { continue; } String key = String.format("%s:%s", header.getTypeName(), uniqueName); header.setGuid(null); boolean keyFound = uniqueNameEntityHeaderMap.containsKey(key); if (!keyFound) { uniqueNameEntityHeaderMap.put(key, header); } updateClassificationsForHeader(header, uniqueNameEntityHeaderMap.get(key), keyFound); displayCrLf("Processing: " + uniqueName); } displayCrLf("Processed: " + uniqueNameEntityHeaderMap.size()); headers.setGuidHeaderMap(uniqueNameEntityHeaderMap); return headers; }
Example 4
Source File: EntityGraphMapper.java From incubator-atlas with Apache License 2.0 | 5 votes |
private AtlasEntityHeader constructHeader(AtlasEntity entity, final AtlasEntityType type, AtlasVertex vertex) { AtlasEntityHeader header = new AtlasEntityHeader(entity.getTypeName()); header.setGuid(getIdFromVertex(vertex)); for (AtlasAttribute attribute : type.getUniqAttributes().values()) { header.setAttribute(attribute.getName(), entity.getAttribute(attribute.getName())); } return header; }
Example 5
Source File: EntityNotificationListenerV2.java From atlas with Apache License 2.0 | 4 votes |
private AtlasEntityHeader toNotificationHeader(AtlasEntity entity) { AtlasEntityHeader ret = new AtlasEntityHeader(entity.getTypeName(), entity.getGuid(), new HashMap<>()); Object name = entity.getAttribute(NAME); Object displayText = name != null ? name : entity.getAttribute(QUALIFIED_NAME); ret.setGuid(entity.getGuid()); ret.setStatus(entity.getStatus()); ret.setIsIncomplete(entity.getIsIncomplete()); setAttribute(ret, NAME, name); setAttribute(ret, DESCRIPTION, entity.getAttribute(DESCRIPTION)); setAttribute(ret, OWNER, entity.getAttribute(OWNER)); setAttribute(ret, CREATE_TIME, entity.getAttribute(CREATE_TIME)); if (displayText != null) { ret.setDisplayText(displayText.toString()); } AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entity.getTypeName()); if (entityType != null) { for (AtlasAttribute attribute : entityType.getAllAttributes().values()) { if (attribute.getAttributeDef().getIsUnique() || attribute.getAttributeDef().getIncludeInNotification()) { Object attrValue = entity.getAttribute(attribute.getName()); if (attrValue != null) { ret.setAttribute(attribute.getName(), attrValue); } } } if (CollectionUtils.isNotEmpty(entity.getClassifications())) { List<AtlasClassification> classifications = new ArrayList<>(entity.getClassifications().size()); List<String> classificationNames = new ArrayList<>(entity.getClassifications().size()); for (AtlasClassification classification : getAllClassifications(entity.getClassifications())) { classifications.add(classification); classificationNames.add(classification.getTypeName()); } ret.setClassifications(classifications); ret.setClassificationNames(classificationNames); } } return ret; }
Example 6
Source File: AtlasEntityChangeNotifier.java From incubator-atlas with Apache License 2.0 | 4 votes |
private void doFullTextMapping(String guid) { AtlasEntityHeader entityHeader = new AtlasEntityHeader(); entityHeader.setGuid(guid); doFullTextMapping(Collections.singletonList(entityHeader)); }