@Override public Object eval(Record record, TypeManager typeManager) { return record.getRecordTypeVersion(); } },
@Override public Long getRecordTypeVersion(Scope scope) { return delegate.getRecordTypeVersion(scope); }
@Override public Long getRecordTypeVersion() { return delegate.getRecordTypeVersion(); }
@Override public Long getRecordTypeVersion() { return record.getRecordTypeVersion(); }
@Override public Long getRecordTypeVersion(Scope scope) { return record.getRecordTypeVersion(scope); }
@Override public Object eval(Record record, TypeManager typeManager) { return formatNameVersion(record.getRecordTypeName(), record.getRecordTypeVersion()); } },
private static void printRecordType(Record record, Scope scope, PrintStream out) { out.println(" Record type = " + record.getRecordTypeName(scope) + ", version " + record.getRecordTypeVersion(scope)); }
private static void printRecordValue(PrintStream out, int indent, Record record) { println(out, indent, "Record of type " + record.getRecordTypeName() + ", version " + record.getRecordTypeVersion()); for (Map.Entry<QName, Object> field : record.getFields().entrySet()) { printField(out, indent, field.getKey(), field.getValue()); } }
private void setRecordTypesAfterUpdate(Record record, Record originalRecord, Set<Scope> changedScopes) { // The returned record object after an update should always contain complete record type information for // all the scopes for (Scope scope : Scope.values()) { // For any unchanged or non-existing scope, we reset the record type information to the one of the // original record, so that the returned record object corresponds to the repository state (= same // as when one would do a fresh read) // // Copy over the original record type of a scope if: // - the scope was unchanged. If it was changed, the record type will already have been filled in // by calculateRecordChanges. // - for the non-versioned scope, only copy it over if none of the scopes changed, because the // record type of the non-versioned scope is always brought up to date in case any scope is changed if (!changedScopes.contains(scope) && (scope != Scope.NON_VERSIONED || changedScopes.isEmpty())) { record.setRecordType(scope, originalRecord.getRecordTypeName(scope), originalRecord.getRecordTypeVersion(scope)); } } }
private static void forEachSupertype(Record record, TypeManager typeManager, boolean includeRecordType, SupertypeCallback callback) throws RepositoryException, InterruptedException { RecordType recordType = typeManager.getRecordTypeByName(record.getRecordTypeName(), record.getRecordTypeVersion()); if (includeRecordType) { callback.handle(recordType); } for (Map.Entry<SchemaId, Long> supertype : recordType.getSupertypes().entrySet()) { RecordType supertypeRt = typeManager.getRecordTypeById(supertype.getKey(), supertype.getValue()); callback.handle(supertypeRt); } }
@Override public RecordBuilder add() throws RecordException { if (mode == Mode.NESTED_RECORD_LIST) { if (records == null) { records = new ArrayList<Record>(); } records.add(createRecord()); // Reset, but keep the record type setting (and the default namespace) QName prevRecordTypeName = record.getRecordTypeName(); Long prevRecordTypeVersion = record.getRecordTypeVersion(); reset(); recordType(prevRecordTypeName, prevRecordTypeVersion); return this; } else { throw new IllegalStateException("add should only be called for a nested list of records, current mode is " + mode); } }
/** * Checks if the given record is an instance of the given record type. This does an "instance of" check, * thus also searches the supertypes for a match. */ public static boolean instanceOf(Record record, SchemaId requestedRecordTypeId, TypeManager typeManager) throws InterruptedException, RepositoryException { if (record.getRecordTypeName() == null) { throw new NullPointerException("record type of record is null"); } RecordType recordType = typeManager.getRecordTypeByName(record.getRecordTypeName(), record.getRecordTypeVersion()); if (recordType.getId().equals(requestedRecordTypeId)) { return true; } // Check the ancestor record types return searchParents(recordType, requestedRecordTypeId, typeManager); }
} else { newRecordTypeName = record.getRecordTypeName(); newRecordTypeVersion = useLatestRecordType ? null : record.getRecordTypeVersion(); || !actualRecordTypeVersion.equals(originalRecord.getRecordTypeVersion());
/** * Checks if the given record is an instance of the given record type. This does an "instance of" check, * thus also searches the supertypes for a match. */ public static boolean instanceOf(Record record, QName requestedRecordTypeName, TypeManager typeManager) throws InterruptedException, RepositoryException { if (record.getRecordTypeName() == null) { throw new NullPointerException("record type of record is null"); } if (record.getRecordTypeName().equals(requestedRecordTypeName)) { return true; } // Check the ancestor record types SchemaId searchedRecordType = typeManager.getRecordTypeByName(requestedRecordTypeName, null).getId(); RecordType recordType = typeManager.getRecordTypeByName(record.getRecordTypeName(), record.getRecordTypeVersion()); return searchParents(recordType, searchedRecordType, typeManager); }
} else { RecordType originalScopeRecordType = typeManager.getRecordTypeByName(originalScopeRecordTypeName, originalRecord.getRecordTypeVersion(scope)); if (!recordType.getId().equals(originalScopeRecordType.getId())) { put.add(RecordCf.DATA.bytes, RECORD_TYPE_ID_QUALIFIERS.get(scope), versionOfRTField,
recordNode.put("type", typeToJson(record.getRecordTypeName(), record.getRecordTypeVersion(), namespaces)); long version = record.getRecordTypeVersion(Scope.VERSIONED); recordNode.put("versionedType", typeToJson(versionedTypeName, version, namespaces)); long version = record.getRecordTypeVersion(Scope.VERSIONED_MUTABLE); recordNode.put("versionedMutableType", typeToJson(versionedMutableTypeName, version, namespaces));
writeNullOrVLong(record.getRecordTypeVersion(scope), output);
recordTypeVersion = null; } else if (record.getRecordTypeName() == null) { recordTypeVersion = originalRecord.getRecordTypeVersion(); } else { recordTypeVersion = record.getRecordTypeVersion(); RecordType originalMutableScopeRecordType = typeManager .getRecordTypeByName(originalMutableScopeRecordTypeName, originalRecord.getRecordTypeVersion(mutableScope)); if (!recordType.getId().equals(originalMutableScopeRecordType.getId())) { .equals(originalNextRecord.getRecordTypeVersion(mutableScope))) { put.add(RecordCf.DATA.bytes, RECORD_TYPE_ID_QUALIFIERS.get(mutableScope), version + 1, Bytes.toBytes(originalMutableScopeRecordType.getVersion()));
newRecord.getRecordTypeVersion() == null;