public RecordTypeNotFoundException(SchemaId id, Long version) { this.id = id != null ? id.toString() : null; this.name = null; this.version = version; }
public FieldTypeNotFoundException(SchemaId id) { this.id = (id != null) ? id.toString() : null; }
@Override public String getMessage() { String id = fieldName != null ? fieldName.toString() : fieldId.toString(); return "Field '" + id + "' could not be found."; } }
private void collectSubTypes(SchemaId recordTypeId, Set<SchemaId> result, Deque<SchemaId> parents, boolean recursive) throws InterruptedException, RepositoryException { // the parent-stack is to protect against endless loops in the type hierarchy. If a type is a subtype // of itself, it will not be included in the result. Thus if record type A extends (directly or indirectly) // from A, and we search the subtypes of A, then the resulting set will not include A. parents.push(recordTypeId); Set<SchemaId> subtypes = getRecordTypeById(recordTypeId, null).getSupertypes().keySet(); for (SchemaId subtype : subtypes) { if (!parents.contains(subtype)) { result.add(subtype); if (recursive) { collectSubTypes(subtype, result, parents, recursive); } } else { // Loop detected in type hierarchy throw new RepositoryException( "Error while refreshing subtypes of record type " + recordTypeId.toString()); } } parents.pop(); }
/** * Tries to look up the name of the record type, but returns the id if it fails. */ private String getNameSafe(SchemaId schemaId) { try { return getRecordTypeById(schemaId, null).getName().toString(); } catch (Exception e) { return schemaId.toString(); } }
indent += 2; for (SchemaId id : failedFieldTypes) { println(out, indent, id.toString());
public static ObjectNode toJson(RecordType recordType, WriteOptions options, Namespaces namespaces, boolean includeName) { ObjectNode rtNode = JsonNodeFactory.instance.objectNode(); rtNode.put("id", recordType.getId().toString()); if (includeName) { rtNode.put("name", QNameConverter.toJson(recordType.getName(), namespaces)); } ArrayNode fieldsNode = rtNode.putArray("fields"); for (FieldTypeEntry entry : recordType.getFieldTypeEntries()) { ObjectNode entryNode = fieldsNode.addObject(); entryNode.put("id", entry.getFieldTypeId().toString()); entryNode.put("mandatory", entry.isMandatory()); } rtNode.put("version", recordType.getVersion()); ArrayNode supertypesNode = rtNode.putArray("supertypes"); for (Map.Entry<SchemaId, Long> supertype : recordType.getSupertypes().entrySet()) { ObjectNode entryNode = supertypesNode.addObject(); entryNode.put("id", supertype.getKey().toString()); entryNode.put("version", supertype.getValue()); } return rtNode; }
public static ObjectNode toJson(FieldType fieldType, Namespaces namespaces, boolean includeName) { ObjectNode fieldNode = JsonNodeFactory.instance.objectNode(); fieldNode.put("id", fieldType.getId().toString()); if (includeName) { fieldNode.put("name", QNameConverter.toJson(fieldType.getName(), namespaces)); } fieldNode.put("scope", fieldType.getScope().toString().toLowerCase()); fieldNode.put("valueType", ValueTypeNSConverter.toJson(fieldType.getValueType().getName(), namespaces)); return fieldNode; } }
public SolrInputDocument build() throws InterruptedException, RepositoryException { solrDoc.setField("lily.id", recordId.toString()); solrDoc.setField("lily.table", table); solrDoc.setField("lily.key", key); solrDoc.setField("lily.vtagId", vtag.toString()); solrDoc.setField("lily.vtag", typeManager.getFieldTypeById(vtag).getName().getName()); solrDoc.setField("lily.version", version); return solrDoc; }
case CREATED: importListener.created(EntityType.FIELD_TYPE, newFieldType.getName().toString(), newFieldType.getId() .toString()); break; case UP_TO_DATE:
public FieldType importFieldType(FieldType fieldType) throws RepositoryException, ImportConflictException, ImportException, JsonFormatException, InterruptedException { ImportResult<FieldType> result = FieldTypeImport.importFieldType(fieldType, ImportMode.CREATE_OR_UPDATE, IdentificationMode.NAME, fieldType.getName(), repository.getTypeManager()); FieldType newFieldType = result.getEntity(); switch (result.getResultType()) { case CREATED: importListener.created(EntityType.FIELD_TYPE, newFieldType.getName().toString(), newFieldType.getId().toString()); break; case UP_TO_DATE: importListener.existsAndEqual(EntityType.FIELD_TYPE, newFieldType.getName().toString(), null); break; case CONFLICT: importListener.conflict(EntityType.FIELD_TYPE, fieldType.getName().toString(), result.getConflictingProperty(), result.getConflictingOldValue(), result.getConflictingNewValue()); break; default: throw new ImportException("Unexpected import result type for field type: " + result.getResultType()); } return newFieldType; }
importListener.created(EntityType.RECORD_TYPE, newRecordType.getName().toString(), newRecordType.getId().toString()); break; case UPDATED: importListener.updated(EntityType.RECORD_TYPE, newRecordType.getName().toString(), newRecordType.getId().toString(), newRecordType.getVersion()); break; case UP_TO_DATE: