private Set<PersistentResource> getRelationCheckedUnfiltered(String relationName) { return getRelation(relationName, Optional.empty(), Optional.empty(), Optional.empty(), true); }
relations = parentResource.getRelation(fieldName, ids.get(), filter, sorting, pagination); } else { relations = parentResource.getRelationCheckedFiltered(fieldName,
relations = parentResource.getRelation(fieldName, ids.get(), filter, sorting, pagination); } else { relations = parentResource.getRelationCheckedFiltered(fieldName,
private Set<PersistentResource> getRelationUncheckedUnfiltered(String relationName) { return getRelation(relationName, Optional.empty(), Optional.empty(), Optional.empty(), false); }
@Override public void handle(StateContext state, SubCollectionRelationshipContext ctx) { String id = ctx.entity().id().getText(); String subCollection = ctx.entity().term().getText(); PersistentResource childRecord; try { childRecord = resource.getRelation(subCollection, id); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(subCollection); } String relationName = ctx.relationship().term().getText(); try { Optional<FilterExpression> filterExpression = state.getRequestScope().getExpressionForRelation(resource, subCollection); childRecord.getRelationCheckedFiltered(relationName, filterExpression, Optional.empty(), Optional.empty()); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(relationName); } state.setState(new RelationshipTerminalState(childRecord, relationName)); } }
private Set<PersistentResource> getRelationUncheckedUnfiltered(String relationName) { return getRelation(relationName, Optional.empty(), Optional.empty(), Optional.empty(), false); }
@Override public void handle(StateContext state, SubCollectionRelationshipContext ctx) { String id = ctx.entity().id().getText(); String subCollection = ctx.entity().term().getText(); PersistentResource childRecord; try { childRecord = resource.getRelation(subCollection, id); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(subCollection); } String relationName = ctx.relationship().term().getText(); try { Optional<FilterExpression> filterExpression = state.getRequestScope().getExpressionForRelation(resource, subCollection); childRecord.getRelationCheckedFiltered(relationName, filterExpression, Optional.empty(), Optional.empty()); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(relationName); } state.setState(new RelationshipTerminalState(childRecord, relationName)); } }
private Set<PersistentResource> getRelationCheckedUnfiltered(String relationName) { return getRelation(relationName, Optional.empty(), Optional.empty(), Optional.empty(), true); }
/** * Get collection of resources from relation field. * * @param relationName field * @return collection relation */ public Set<PersistentResource> getRelationCheckedFiltered(String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination) { return filter(ReadPermission.class, getRelation(relationName, filterExpression, sorting, pagination, true)); }
/** * Get collection of resources from relation field. * * @param relationName field * @return collection relation */ public Set<PersistentResource> getRelationCheckedFiltered(String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination) { return filter(ReadPermission.class, getRelation(relationName, filterExpression, sorting, pagination, true)); }
/** * Get relation looking for a _single_ id. * * NOTE: Filter expressions for this type are _not_ applied at this level. * * @param relation relation name * @param id single id to lookup * @return The PersistentResource of the sought id or null if does not exist. */ public PersistentResource getRelation(String relation, String id) { Set<PersistentResource> resources = getRelation(relation, Collections.singletonList(id), Optional.empty(), Optional.empty(), Optional.empty()); if (resources.isEmpty()) { return null; } // If this is an in-memory object (i.e. UUID being created within tx), datastore may not be able to filter. // If we get multiple results back, make sure we find the right id first. for (PersistentResource resource : resources) { if (resource.matchesId(id)) { return resource; } } return null; }
/** * Get relation looking for a _single_ id. * * NOTE: Filter expressions for this type are _not_ applied at this level. * * @param relation relation name * @param id single id to lookup * @return The PersistentResource of the sought id or null if does not exist. */ public PersistentResource getRelation(String relation, String id) { Set<PersistentResource> resources = getRelation(relation, Collections.singletonList(id), Optional.empty(), Optional.empty(), Optional.empty()); if (resources.isEmpty()) { return null; } // If this is an in-memory object (i.e. UUID being created within tx), datastore may not be able to filter. // If we get multiple results back, make sure we find the right id first. for (PersistentResource resource : resources) { if (resource.matchesId(id)) { return resource; } } return null; }
getRelation(relation, Optional.ofNullable(filterExpression), sorting, pagination, true));
getRelation(relation, Optional.ofNullable(filterExpression), sorting, pagination, true));
@Override public void handle(StateContext state, SubCollectionSubCollectionContext ctx) { String id = ctx.entity().id().getText(); String subCollection = ctx.entity().term().getText(); try { state.setState(new RecordState(resource.getRelation(subCollection, id))); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(subCollection); } }
@Override public void handle(StateContext state, SubCollectionReadEntityContext ctx) { String id = ctx.entity().id().getText(); String subCollection = ctx.entity().term().getText(); try { PersistentResource nextRecord = resource.getRelation(subCollection, id); state.setState(new RecordTerminalState(nextRecord)); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(subCollection); } }
@Override public void handle(StateContext state, SubCollectionSubCollectionContext ctx) { String id = ctx.entity().id().getText(); String subCollection = ctx.entity().term().getText(); try { state.setState(new RecordState(resource.getRelation(subCollection, id))); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(subCollection); } }
@Override public void handle(StateContext state, SubCollectionReadEntityContext ctx) { String id = ctx.entity().id().getText(); String subCollection = ctx.entity().term().getText(); try { PersistentResource nextRecord = resource.getRelation(subCollection, id); state.setState(new RecordTerminalState(nextRecord)); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(subCollection); } }