/** * Convenience factory method, preferable to * {@link #QueryDefault(Class, String, Object...) constructor} because will * automatically genericize. */ public static <Q> QueryDefault<Q> create(final Class<Q> resultType, final String queryName, final Object... paramArgs) { return new QueryDefault<Q>(resultType, queryName, paramArgs); }
/** * Convenience factory method, preferable to * {@link #QueryDefault(Class, String, Object...) constructor} because will * automatically genericize. */ public static <Q> QueryDefault<Q> create(final Class<Q> resultType, final String queryName, final Object... paramArgs) { return new QueryDefault<Q>(resultType, queryName, paramArgs); }
/** * Convenience factory method, preferable to * {@link #QueryDefault(Class, String, Map) constructor} because will * automatically genericize. */ public static <Q> QueryDefault<Q> create(final Class<Q> resultType, final String queryName, final Map<String, Object> argumentsByParameterName) { return new QueryDefault<Q>(resultType, queryName, argumentsByParameterName); }
protected UserSettingJdo doFind(final String user, final String key) { return repositoryService.firstMatch( new QueryDefault<>(UserSettingJdo.class, "findByUserAndKey", "user",user, "key", key)); } //endregion
@Override public List<ToDoItem> findByAtPathAndComplete( final String atPath, final boolean complete) { return container.allMatches( new QueryDefault<>(ToDoItem.class, "findByAtPathAndComplete", "atPath", atPath, "complete", complete)); }
@Override public List<ToDoItem> findByAtPathAndDescriptionContains( final String atPath, final String description) { return container.allMatches( new QueryDefault<>(ToDoItem.class, "findByAtPathAndDescriptionContains", "atPath", atPath, "description", description)); }
/** * Returns all document templates for the specified {@link DocumentType} and exact application tenancy, ordered by date (desc). */ @Programmatic public List<DocumentTemplate> findByTypeAndAtPath(final DocumentType documentType, final String atPath) { return repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByTypeAndAtPath", "type", documentType, "atPath", atPath)); }
/** * Returns all templates for a type, ordered by application tenancy and date desc. */ @Programmatic public List<DocumentTemplate> findByType(final DocumentType documentType) { return repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByType", "type", documentType)); }
@Programmatic @SuppressWarnings({ "unchecked", "rawtypes" }) public List<UserSetting> listAll() { return (List)repositoryService.allMatches( new QueryDefault<>(UserSettingJdo.class, "findAll")); }
@Programmatic public List<T> findByNamedQueryAll(String queryName, Map<String, Object> argumentByParameterName) { final Query<T> query = new QueryDefault<T>(entityClass, queryName, argumentByParameterName); return this.allMatches(query); }
/** * Returns all document templates, ordered by most specific to provided application tenancy first, and then by date (desc). */ public List<DocumentTemplate> findByApplicableToAtPath(final String atPath) { final List<DocumentTemplate> templates = repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByApplicableToAtPath", "atPath", atPath)); removeTemplatesWithSameDocumentType(templates); return templates; }
/** * Returns all document templates for the specified {@link DocumentType} and exact application tenancy, ordered by date (desc). */ @Programmatic public List<DocumentTemplate> findByTypeAndAtPath(final DocumentType documentType, final String atPath) { return repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByTypeAndAtPath", "type", documentType, "atPath", atPath)); }
@Programmatic public List<Paperclip> findByDocument(final DocumentAbstract document) { return repositoryService.allMatches( new QueryDefault<>(Paperclip.class, "findByDocument", "document", document)); } //endregion
@Programmatic public List<Paperclip> findByDocument(final DocumentAbstract document) { return repositoryService.allMatches( new QueryDefault<>(Paperclip.class, "findByDocument", "document", document)); } //endregion
/** * Returns the document template, if any for the specified {@link DocumentType} and exact application tenancy, and exact date. */ @Programmatic public DocumentTemplate findByTypeAndAtPathAndDate(final DocumentType documentType, final String atPath, final LocalDate date) { return repositoryService.firstMatch( new QueryDefault<>(DocumentTemplate.class, "findByTypeAndAtPathAndDate", "type", documentType, "atPath", atPath, "date", date)); }
@Programmatic @SuppressWarnings({ "unchecked", "rawtypes" }) public List<UserSetting> listAllFor( final String user) { return (List)repositoryService.allMatches( new QueryDefault<>(UserSettingJdo.class, "findByUser", "user", user)); }
@Programmatic public T findByNamedQueryFirstOnly(String queryName, Map<String, Object> argumentByParameterName) { final Query<T> query = new QueryDefault<T>(entityClass, queryName, argumentByParameterName); return this.firstMatch(query); }
/** * Returns all document templates for the specified {@link DocumentType}, ordered by type, then most specific to * provided application tenancy, and then by date (desc). */ @Programmatic public List<DocumentTemplate> findByTypeAndApplicableToAtPath(final DocumentType documentType, final String atPath) { return repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByTypeAndApplicableToAtPath", "type", documentType, "atPath", atPath)); }
@ActionSemantics(Of.SAFE) @MemberOrder(sequence = "1") public BusRulesEntity findById(int id) { final Query<BusRulesEntity> query = new QueryDefault<BusRulesEntity>(BusRulesEntity.class, BusRulesEntity.class.getName() + "#pk", "id", id); return this.firstMatch(query); }
@Action(semantics = SemanticsOf.SAFE) @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT) @MemberOrder(sequence = "2") public List<SimpleObject> findByName(@ParameterLayout(named = "Name") final String name) { return container.allMatches(new QueryDefault<>(SimpleObject.class, "findByName", "name", name)); }