public RelationNotFoundException(SegmentType sourceEntityType, String nameOrId, Filter[][] filters, String message, Throwable cause) { this(sourceEntityType == null ? null : sourceEntityType.getSimpleName(), nameOrId, filters, message, cause); }
public EntityNotFoundException(SegmentType entityType, Filter[][] filters) { this(entityType == null ? null : entityType.getSimpleName(), filters); }
public RelationNotFoundException(SegmentType sourceEntityType, String nameOrId, Filter[] filters, String message, Throwable cause) { this(sourceEntityType == null ? null : sourceEntityType.getSimpleName(), nameOrId, oneElem(filters), message, cause); }
protected void checkPathLegal(Path targetPath) { if (!context.entityClass.getSimpleName().equals(targetPath.getSegment().getElementType().getSimpleName())) { throw new IllegalArgumentException("Current position in the inventory traversal expects entities of type " + context.entityClass.getSimpleName() + " which is incompatible with the provided path: " + targetPath); } }
/** * Constructs a new entity * * @param name the human readable name of the entity, can be null * @param path the path of the entity, must not be null * @param properties the additional user-defined properties, can be null */ Entity(String name, CanonicalPath path, Map<String, Object> properties) { super(path, properties); this.name = name; if (!segmentTypeFromType(this.getClass()).equals(path.getSegment().getElementType())) { throw new IllegalArgumentException("Invalid path specified. Trying to create " + this.getClass().getSimpleName() + " but the path points to " + path.getSegment().getElementType().getSimpleName()); } }
/** * Constructs a new entity * * @param name the human readable name of the entity, can be null * @param path the path of the entity, must not be null * @param properties the additional user-defined properties, can be null */ Entity(String name, CanonicalPath path, Map<String, Object> properties) { super(path, properties); this.name = name; if (!segmentTypeFromType(this.getClass()).equals(path.getSegment().getElementType())) { throw new IllegalArgumentException("Invalid path specified. Trying to create " + this.getClass().getSimpleName() + " but the path points to " + path.getSegment().getElementType().getSimpleName()); } }
@Override protected EntityAndPendingNotifications<BE, MetadataPack> wireUpNewEntity(BE entity, MetadataPack.Blueprint blueprint, CanonicalPath parentPath, BE parent, Transaction<BE> tx) { Set<Notification<?, ?>> newRels = new HashSet<>(); blueprint.getMembers().forEach((p) -> { try { BE member = tx.find(p); BE rel = tx.relate(entity, member, incorporates.name(), null); Relationship r = tx.convert(rel, Relationship.class); newRels.add(new Notification<>(r, r, created())); } catch (ElementNotFoundException e) { throw new EntityNotFoundException(p.getSegment().getElementType().getSimpleName(), Query.filters(Query.to(p))); } }); MetadataPack entityObject = tx.convert(entity, MetadataPack.class); return new EntityAndPendingNotifications<>(entity, entityObject, newRels); }