private void setupBindingsForTypeNameAttrNameAttrValue(ExportContext context, String typeName, Object attrValue, AtlasAttribute attribute) { context.bindings.clear(); context.bindings.put("typeName", typeName); context.bindings.put("attrName", attribute.getQualifiedName()); context.bindings.put("attrValue", attrValue); }
public String getQualifiedAttributeName(String attrName) throws AtlasBaseException { if (allAttributes.containsKey(attrName)) { return allAttributes.get(attrName).getQualifiedName(); } else if (relationshipAttributes.containsKey(attrName)) { return relationshipAttributes.get(attrName).getQualifiedName(); } throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, entityDef.getName()); }
public String getQualifiedAttributeName(String attrName) throws AtlasBaseException { if (allAttributes.containsKey(attrName)) { return allAttributes.get(attrName).getQualifiedName(); } else if (relationshipAttributes.containsKey(attrName)) { return relationshipAttributes.get(attrName).getQualifiedName(); } throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, entityDef.getName()); }
attrQualifiedName = attribute.getQualifiedName();
relation = EDGE_LABEL_PREFIX + attribute.getQualifiedName(); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_RELATIONSHIP_ATTRIBUTE, relation, attribute.getTypeName()); sortOrder = null; } else { sortByAttributeName = sortByAttribute.getQualifiedName();
String propertyKey = attributeInfo.getQualifiedName(); AttributeValueMap mapForAttribute = new AttributeValueMap(); for(int idx = 0; idx < instancesForClass.size(); idx++) {
LOG.debug("{}: is ownedRef, attrType={}", attr.getQualifiedName(), attrType.getTypeName()); entities.add(entity); } else { LOG.warn("{}: not replacing objIdList with entityList - entity not found guid={}", attr.getQualifiedName(), entityGuid); LOG.debug("{}: replaced objIdList with entityList", attr.getQualifiedName()); LOG.warn("{}: not replacing objIdList with entityList - elementType {} is not an entityType", attr.getQualifiedName(), elemTypeName); LOG.debug("{}: replaced objId with entity guid={}", attr.getQualifiedName(), entityGuid); LOG.warn("{}: not replacing objId with entity - entity not found guid={}", attr.getQualifiedName(), entityGuid); LOG.warn("{}: not replacing objId with entity - unexpected attribute-type {}", attr.getQualifiedName(), attrType.getTypeName());
ret = predicate.generatePredicate(attribute.getQualifiedName(), attrValue, attrClass);
context.bindings.put("attrName", attribute.getQualifiedName()); context.bindings.put("attrValue", attrValue);
return String.format(queryTemplate, attribute.getQualifiedName(), bindName); } else { return EMPTY_STRING;
private Object mapVertexToAttribute(AtlasVertex entityVertex, AtlasAttribute attribute, AtlasEntityExtInfo entityExtInfo, final boolean isMinExtInfo) throws AtlasBaseException { Object ret = null; AtlasType attrType = attribute.getAttributeType(); String edgeLabel = EDGE_LABEL_PREFIX + attribute.getQualifiedName(); boolean isOwnedAttribute = attribute.isOwnedRef(); AtlasRelationshipEdgeDirection edgeDirection = attribute.getRelationshipEdgeDirection();
LOG.warn("Length of indexed attribute {} is {} characters, longer than safe-limit {}; trimming to {} - attempt #{}", ctx.getAttribute().getQualifiedName(), value.length(), INDEXED_STR_SAFE_LEN, trimmedLength, requestContext.getAttemptCount()); LOG.warn("Length of indexed attribute {} is {} characters, longer than safe-limit {}", ctx.getAttribute().getQualifiedName(), value.length(), INDEXED_STR_SAFE_LEN);
private Object mapVertexToAttribute(AtlasVertex entityVertex, AtlasAttribute attribute, AtlasEntityExtInfo entityExtInfo, final boolean isMinExtInfo) throws AtlasBaseException { Object ret = null; AtlasType attrType = attribute.getAttributeType(); String edgeLabel = EDGE_LABEL_PREFIX + attribute.getQualifiedName(); boolean isOwnedAttribute = attribute.isOwnedRef(); AtlasRelationshipEdgeDirection edgeDirection = attribute.getRelationshipEdgeDirection();
/** * For the given type, finds an unique attribute and checks if there is an existing instance with the same * unique value * * @param classType * @param instance * @return * @throws AtlasException */ public AtlasVertex getVertexForInstanceByUniqueAttribute(AtlasEntityType classType, Referenceable instance) throws AtlasException { if (LOG.isDebugEnabled()) { LOG.debug("Checking if there is an instance with the same unique attributes for instance {}", instance.toShortString()); } AtlasVertex result = null; for (AtlasAttribute attributeInfo : classType.getUniqAttributes().values()) { String propertyKey = attributeInfo.getQualifiedName(); try { result = findVertex(propertyKey, instance.get(attributeInfo.getName()), ENTITY_TYPE_PROPERTY_KEY, classType.getTypeName(), STATE_PROPERTY_KEY, Id.EntityState.ACTIVE.name()); if (LOG.isDebugEnabled()) { LOG.debug("Found vertex by unique attribute : {}={}", propertyKey, instance.get(attributeInfo.getName())); } } catch (EntityNotFoundException e) { //Its ok if there is no entity with the same unique value } } return result; }
private Object mapPrimitiveValue(AttributeMutationContext ctx) { boolean isIndexableStrAttr = ctx.getAttributeDef().getIsIndexable() && ctx.getAttrType() instanceof AtlasBuiltInTypes.AtlasStringType; Object ret = ctx.getValue(); // Janus bug, when an indexed string attribute has a value longer than a certain length then the reverse indexed key generated by JanusGraph // exceeds the HBase row length's hard limit (Short.MAX). This trimming and hashing procedure is to circumvent that limitation if (ret != null && isIndexableStrAttr) { String value = (String) ctx.getValue(); if (value.length() > INDEXED_STR_MAX_ALLOWED_LEN) { LOG.warn("Indexed-String-Attribute: {} exceeds {} characters, trimming and appending checksum", ctx.getAttribute().getQualifiedName(), INDEXED_STR_MAX_ALLOWED_LEN); String sha256Hex = DigestUtils.shaHex(value); // Storing SHA checksum in case verification is needed after retrieval ret = value.substring(0, (INDEXED_STR_MAX_ALLOWED_LEN - 1) - sha256Hex.length()) + ":" + sha256Hex; } } AtlasGraphUtilsV2.setEncodedProperty(ctx.getReferringVertex(), ctx.getVertexProperty(), ret); return ret; }
public static String getEdgeLabel(AtlasAttribute aInfo) throws AtlasException { return GraphHelper.EDGE_LABEL_PREFIX + aInfo.getQualifiedName(); }
public String getQualifiedAttributeName(String attrName) throws AtlasBaseException { if ( allAttributes.containsKey(attrName)) { return allAttributes.get(attrName).getQualifiedName(); } throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, structDef.getName()); }
public String getQualifiedAttributeName(String attrName) throws AtlasBaseException { if ( allAttributes.containsKey(attrName)) { return allAttributes.get(attrName).getQualifiedName(); } throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_ATTRIBUTE, attrName, structDef.getName()); }
private String getLegacyEdgeLabel(AtlasEntityType entityType, String attributeName) { String ret = null; AtlasAttribute attribute = entityType.getAttribute(attributeName); if (attribute != null) { ret = "__" + attribute.getQualifiedName(); } return ret; } }
private String getLegacyEdgeLabel(AtlasEntityType entityType, String attributeName) { String ret = null; AtlasAttribute attribute = entityType.getAttribute(attributeName); if (attribute != null) { ret = "__" + attribute.getQualifiedName(); } return ret; }