use of org.uberfire.java.nio.base.FileSystemId 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();
}
};
}
use of org.uberfire.java.nio.base.FileSystemId in project kie-wb-common by kiegroup.
the class KObjectUtil method toKObject.
public static KObject toKObject(final Path path, final String classifier, final Set<KProperty<?>> indexElements) {
return new KObject() {
@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 Iterable<KProperty<?>> getProperties() {
return indexElements;
}
@Override
public boolean fullText() {
return false;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("KObject{" + ", key='" + getKey() + '\'' + ", id='" + getId() + '\'' + ", type=" + getType() + ", clusterId='" + getClusterId() + '\'' + ", segmentId='" + getSegmentId() + '\'');
for (KProperty<?> xproperty : getProperties()) {
sb.append(", " + xproperty.getName() + "='" + xproperty.getValue() + '\'');
}
sb.append('}');
return sb.toString();
}
};
}
Aggregations