public RecordTypeNotFoundException(QName name, Long version) { this.id = null; this.name = name != null ? name.toString() : null; this.version = version; }
public FieldTypeNotFoundException(QName name) { this.name = (name != null) ? name.toString() : null; }
public FieldTypeExistsException(FieldType fieldType) { if (fieldType != null) { this.fieldType = fieldType.getName().toString(); } }
@Override public String getMessage() { String id = fieldName != null ? fieldName.toString() : fieldId.toString(); return "Field '" + id + "' could not be found."; } }
public RecordTypeExistsException(RecordType recordType) { this.recordType = recordType != null ? recordType.getName().toString() : null; }
/** * 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(); } }
public static String toJson(QName qname, Namespaces namespaces) { if (namespaces.usePrefixes()) { return namespaces.getOrMakePrefix(qname.getNamespace()) + "$" + qname.getName(); } else { return qname.toString(); } } }
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: importListener.existsAndEqual(EntityType.RECORD_TYPE, recordType.getName().toString(), null); break; case CANNOT_CREATE_EXISTS: boolean failIfExists = getBoolean(node, FAIL_IF_EXISTS, true); if (!failIfExists) { importListener.allowedFailure(EntityType.RECORD_TYPE, recordType.getName().toString(), null, "cannot create, record type exists"); break; boolean failIfNotExists = getBoolean(node, FAIL_IF_NOT_EXISTS, true); if (!failIfNotExists) { importListener.allowedFailure(EntityType.RECORD_TYPE, recordType.getName().toString(), null, "cannot update, record type does not exist"); break;
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, ftToCreate.getName().toString(), result.getConflictingProperty(), result.getConflictingOldValue(), result.getConflictingNewValue());