use of org.uberfire.ext.metadata.model.KObjectKey in project kie-wb-common by kiegroup.
the class KObjectUtil method toKObjectKey.
public static KObjectKey toKObjectKey(final Path path, final String classifier) {
return new KObjectKey() {
@Override
public String getId() {
return sha1(getType().getName() + "|" + classifier + "|" + getKey());
}
@Override
public MetaType getType() {
return META_TYPE;
}
@Override
public String getClusterId() {
final String fsId = ((FileSystemId) path.getFileSystem()).id();
final String segmentId = ((SegmentedPath) path).getSegmentId();
return fsId + CLUSTER_ID_SEGMENT_SEPARATOR + segmentId;
}
@Override
public String getSegmentId() {
return ((SegmentedPath) path).getSegmentId();
}
@Override
public String getKey() {
return path.toUri().toString();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("KObject{" + ", key='" + getKey() + '\'' + ", id='" + getId() + '\'' + ", type=" + getType() + ", clusterId='" + getClusterId() + '\'' + ", segmentId='" + getSegmentId() + '\'');
sb.append('}');
return sb.toString();
}
};
}
Aggregations