@SuppressWarnings("unchecked") public DR getRole() { return (role == null) ? (DR) DataRole.valueOf(getId()) : role; }
/** * This effectively calls {@code getRole().name()}. * * @return data entities don't really have a name - they derive it from their roles. */ @Override public String getName() { return getRole().name(); }
public static <BE> void validate(Transaction<BE> tx, StructuredData data, BE dataEntity) { CanonicalPath path = tx.extractCanonicalPath(dataEntity); DataRole role = DataRole.valueOf(path.ids().getDataRole()); if (role.isSchema()) { try { JsonNode schema = new JsonNodeReader(new ObjectMapper()) .fromInputStream(BaseData.class.getResourceAsStream("/json-meta-schema.json")); CanonicalPath dataPath = tx.extractCanonicalPath(dataEntity); validate(dataPath, convert(data), schema); } catch (IOException e) { throw new IllegalStateException("Could not load the embedded JSON Schema meta-schema."); } } else { validateIfSchemaFound(tx, data, dataEntity, Query.path().with(navigateToSchema(role)).get()); } }
@SuppressWarnings("unchecked") public DR getRole() { return (role == null) ? (DR) DataRole.valueOf(getId()) : role; }
@Override public String getName() { return getRole().name(); }
@SuppressWarnings("unchecked") @Override public Builder<R> withId(String id) { return withRole((R) DataRole.valueOf(id)); }
/** * This effectively calls {@code getRole().name()}. * * @return data entities don't really have a name - they derive it from their roles. */ @Override public String getName() { return getRole().name(); }
@SuppressWarnings("unchecked") @Override public Builder<R> withId(String id) { return withRole((R) DataRole.valueOf(id)); }
@Override public String getName() { return getRole().name(); }
public DataRole getRole() { return DataRole.valueOf(getId()); }
@Override protected String getProposedId(Transaction<BE> tx, DataEntity.Blueprint<R> blueprint) { if (!dataRoleClass.equals(blueprint.getRole().getClass())) { throw new IllegalArgumentException("Invalid role/id. Admissible values for this data position are: " + Arrays.asList(dataRoleClass.getEnumConstants()).stream().map(DataRole::name)); } return blueprint.getRole().name(); }
public DataRole getRole() { return DataRole.valueOf(getId()); }
public DataEntity(CanonicalPath owner, DataRole role, StructuredData value, String identityHash, String contentHash, String syncHash) { super(null, owner.extend(DataEntity.SEGMENT_TYPE, role.name()).get(), identityHash, contentHash, syncHash); this.value = value; }
public DataEntity(CanonicalPath path, StructuredData value, String identityHash, String contentHash, String syncHash, Map<String, Object> properties) { this(path.up(), DataRole.valueOf(path.getSegment().getElementId()), value, identityHash, contentHash, syncHash, properties); }
public Blueprint(DR role, StructuredData value, Map<String, Object> properties, Map<String, Set<CanonicalPath>> outgoing, Map<String, Set<CanonicalPath>> incoming) { super(role.name(), properties, outgoing, incoming); if (value == null) { value = StructuredData.get().undefined(); } this.role = role; this.value = value; }
public DataEntity(CanonicalPath path, StructuredData value, Map<String, Object> properties) { this(path.up(), DataRole.valueOf(path.getSegment().getElementId()), value, properties); }
public Blueprint(DR role, StructuredData value, Map<String, Object> properties, Map<String, Set<CanonicalPath>> outgoing, Map<String, Set<CanonicalPath>> incoming) { super(role.name(), properties, outgoing, incoming); if (value == null) { value = StructuredData.get().undefined(); } this.role = role; this.value = value; }
CanonicalPath cp = extractCanonicalPath(v); String identityHash = extractIdentityHash(v); e = new DataEntity(cp.up(), DataRole.valueOf(cp.getSegment().getElementId()), loadStructuredData(v, hasData), identityHash, extractContentHash(v), extractSyncHash(v)); break;
public DataEntity(CanonicalPath owner, DataRole role, StructuredData value, String identityHash, String contentHash, String syncHash, Map<String, Object> properties) { super(owner.extend(DataEntity.SEGMENT_TYPE, role.name()).get(), identityHash, contentHash, syncHash, properties); this.value = value; }
public DataEntity(CanonicalPath owner, DataRole role, StructuredData value, Map<String, Object> properties) { super(owner.extend(DataEntity.SEGMENT_TYPE, role.name()).get(), properties); this.value = value; }