/** Finds Generic Entity records by all of the specified expressions (ie: combined using OR) *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@return List of GenericValue instances that match the query */ public List findByOr(String entityName, List expressions) throws GenericEntityException { EntityConditionList ecl = new EntityConditionList(expressions, EntityOperator.OR); return findByCondition(entityName, ecl, null, null); }
/** Finds Generic Entity records by all of the specified expressions (ie: combined using AND) *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@return List of GenericValue instances that match the query */ public List findByAnd(String entityName, List expressions) throws GenericEntityException { EntityConditionList ecl = new EntityConditionList(expressions, EntityOperator.AND); return findByCondition(entityName, ecl, null, null); }
/** Finds Generic Entity records by all of the specified expressions (ie: combined using OR) *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@return List of GenericValue instances that match the query */ public List findByOr(String entityName, List expressions) throws GenericEntityException { EntityConditionList ecl = new EntityConditionList(expressions, EntityOperator.OR); return findByCondition(entityName, ecl, null, null); }
/** Finds Generic Entity records by all of the specified expressions (ie: combined using OR) *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending *@return List of GenericValue instances that match the query */ public List findByOr(String entityName, List expressions, List orderBy) throws GenericEntityException { EntityConditionList ecl = new EntityConditionList(expressions, EntityOperator.OR); return findByCondition(entityName, ecl, null, orderBy); }
@Override public List<GenericValue> findByOr(final String entityName, final List<? extends EntityCondition> expressions, final List<String> orderBy) throws DataAccessException { return findByCondition(entityName, new EntityConditionList(expressions, EntityOperator.OR), null, orderBy); }
/** Finds Generic Entity records by all of the specified expressions (ie: combined using AND) *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@return List of GenericValue instances that match the query */ public List findByAnd(String entityName, List expressions) throws GenericEntityException { EntityConditionList ecl = new EntityConditionList(expressions, EntityOperator.AND); return findByCondition(entityName, ecl, null, null); }
/** Finds Generic Entity records by all of the specified expressions (ie: combined using OR) *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending *@return List of GenericValue instances that match the query */ public List findByOr(String entityName, List expressions, List orderBy) throws GenericEntityException { EntityConditionList ecl = new EntityConditionList(expressions, EntityOperator.OR); return findByCondition(entityName, ecl, null, orderBy); }
/** Finds Generic Entity records by all of the specified expressions (ie: combined using AND) *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending *@return List of GenericValue instances that match the query */ public List findByAnd(String entityName, List expressions, List orderBy) throws GenericEntityException { EntityConditionList ecl = new EntityConditionList(expressions, EntityOperator.AND); return findByCondition(entityName, ecl, null, orderBy); }
/** Finds Generic Entity records by all of the specified expressions (ie: combined using AND) *@param entityName The Name of the Entity as defined in the entity XML file *@param expressions The expressions to use for the lookup, each consisting of at least a field name, an EntityOperator, and a value to compare to *@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending *@return List of GenericValue instances that match the query */ public List findByAnd(String entityName, List expressions, List orderBy) throws GenericEntityException { EntityConditionList ecl = new EntityConditionList(expressions, EntityOperator.AND); return findByCondition(entityName, ecl, null, orderBy); }
@Override public List<GenericValue> findByLike(final String entityName, final Map<String, ?> map, final List<String> orderBy) throws DataAccessException { final List<EntityExpr> list = newArrayListWithCapacity(map.size()); for (final Map.Entry<String, ?> entry : map.entrySet()) { list.add(new EntityExpr(entry.getKey(), EntityOperator.LIKE, entry.getValue())); } final EntityCondition condition = new EntityConditionList(list, EntityOperator.AND); return findByCondition(entityName, condition, orderBy); }
public List findByLike(String entityName, Map fields, List orderBy) throws GenericEntityException { List likeExpressions = new LinkedList(); if (fields != null) { Iterator fieldEntries = fields.entrySet().iterator(); while (fieldEntries.hasNext()) { Map.Entry fieldEntry = (Map.Entry) fieldEntries.next(); likeExpressions.add(new EntityExpr((String) fieldEntry.getKey(), EntityOperator.LIKE, fieldEntry.getValue())); } } EntityConditionList ecl = new EntityConditionList(likeExpressions, EntityOperator.AND); return findByCondition(entityName, ecl, null, orderBy); }
public List findByLike(String entityName, Map fields, List orderBy) throws GenericEntityException { List likeExpressions = new LinkedList(); if (fields != null) { Iterator fieldEntries = fields.entrySet().iterator(); while (fieldEntries.hasNext()) { Map.Entry fieldEntry = (Map.Entry) fieldEntries.next(); likeExpressions.add(new EntityExpr((String) fieldEntry.getKey(), EntityOperator.LIKE, fieldEntry.getValue())); } } EntityConditionList ecl = new EntityConditionList(likeExpressions, EntityOperator.AND); return findByCondition(entityName, ecl, null, orderBy); }
public List<GenericValue> findByLike( final String entityName, final Map<String, ?> fields, final List<String> orderBy) throws GenericEntityException { checkIfLocked(); final List<EntityExpr> likeExpressions = new LinkedList<EntityExpr>(); if (fields != null) { for (Map.Entry<String, ?> entry : fields.entrySet()) { likeExpressions.add(new EntityExpr(entry.getKey(), LIKE, entry.getValue())); } } final EntityConditionList ecl = new EntityConditionList(likeExpressions, AND); return findByCondition(entityName, ecl, null, orderBy); }
private List<GenericValue> getFavouriteGVsOfEntityType(final String username, final String entityType, final List<String> fieldToReturnList) { final EntityCondition userCondition = new EntityExpr(Column.USERNAME, EntityOperator.EQUALS, username); final EntityCondition typeCondition = new EntityExpr(Column.ENTITY_TYPE, EntityOperator.EQUALS, entityType); final EntityCondition joinedCondition = new EntityConditionList( Lists.<EntityCondition>newArrayList(userCondition, typeCondition), EntityOperator.AND); final List<String> orderByList = Lists.newArrayList(Column.SEQUENCE + Order.ASCENDING); return delegator.findByCondition(Table.FAVOURITE_ASSOCIATION, joinedCondition, fieldToReturnList, orderByList); }
@Nonnull public List<Comment> getCommentsForUserSince(@Nonnull Issue issue, @Nullable ApplicationUser user, @Nonnull Date since) { EntityCondition issueCommentsCondition = new EntityFieldMap(FieldMap.build("issue", issue.getId(), "type", ActionConstants.TYPE_COMMENT), EntityOperator.AND); EntityCondition dateCondition = new EntityExpr("updated", EntityOperator.GREATER_THAN, new Timestamp(since.getTime())); EntityCondition finalCondition = new EntityConditionList(Arrays.asList(issueCommentsCondition, dateCondition), EntityOperator.AND); // get a List<GenericValue> of comments since date List<GenericValue> commentsSinceDate = delegator.findByCondition(DefaultCommentManager.COMMENT_ENTITY, finalCondition, null, ImmutableList.of("updated DESC", "id ASC")); return getVisibleComments(issue, user, commentsSinceDate); }
private void reindexUsingDatabaseLatest(final DateRange range) throws IndexException, GenericEntityException { final EntityCondition ge = new EntityExpr(UPDATED, EntityOperator.GREATER_THAN_EQUAL_TO, new Timestamp(range.startDate.getTime())); final EntityCondition le = new EntityExpr(UPDATED, EntityOperator.LESS_THAN_EQUAL_TO, new Timestamp(range.endDate.getTime())); final EntityCondition condition = new EntityConditionList(asList(ge, le), EntityOperator.AND); Context context = Contexts.nullContext(); IssuesBatcher batches = issueBatcherFactory.getBatcher(condition); for (IssuesIterable batch : batches) { issueIndexer.reindexIssues(batch, context, IssueIndexingParams.INDEX_ALL, false); } }
/** * Finds Generic Entity records by all of the specified expressions (ie: combined using AND). * * @param entityName The Name of the Entity as defined in the entity XML file * @param expressions The expressions to use for the lookup, each * consisting of at least a field name, an EntityOperator, and a value to * compare to * @return List of GenericValue instances that match the query */ public List<GenericValue> findByAnd(final String entityName, final List<? extends EntityCondition> expressions) throws GenericEntityException { checkIfLocked(); final EntityConditionList ecl = new EntityConditionList(expressions, AND); return findByCondition(entityName, ecl, null, null); }
private List<GenericValue> getFavouriteGVsOfEntityType(final String userKey, final SharedEntity.TypeDescriptor<?> entityType, final List<String> fieldToReturnList) { final EntityCondition userCondition = new EntityExpr(Column.USERKEY, EntityOperator.EQUALS, userKey); final EntityCondition typeCondition = new EntityExpr(Column.ENTITY_TYPE, EntityOperator.EQUALS, entityType.getName()); final EntityCondition joinedCondition = new EntityConditionList(Lists.newArrayList(userCondition, typeCondition), EntityOperator.AND); final List<String> orderByList = Lists.newArrayList(Column.SEQUENCE + Order.ASCENDING); return delegator.findByCondition(Table.FAVOURITE_ASSOCIATION, joinedCondition, fieldToReturnList, orderByList); }
/** * Method for expiring old items. You can actually delete any items but it is typically used to delete old records. * * @param user The user to remove entries for * @param type The type of record to remove * @param entityIds The list of entity ids to remove. */ public void expireOldHistoryItems(@Nonnull ApplicationUser user, @Nonnull UserHistoryItem.Type type, Collection<String> entityIds) { final List<EntityExpr> conditions = asList( new EntityExpr(USER, EQUALS, user.getKey()), new EntityExpr(TYPE, EQUALS, type.getName()), new EntityExpr(ENTITY_ID, IN, entityIds) ); delegator.removeByCondition(TABLE, new EntityConditionList(conditions, AND)); }
@Override protected IssuesIterable computeNext() { if (maxIdNextBatch < 0) { return endOfData(); } // include up to BATCH_SIZE issues in the next batch EntityCondition idCondition = new EntityExpr("id", LESS_THAN_EQUAL_TO, maxIdNextBatch); EntityCondition where = condition == null ? idCondition : new EntityConditionList(ImmutableList.of(idCondition, condition), EntityOperator.AND); maxIdNextBatch -= batchSize; return new SpyingIssuesIterable(delegator, issueFactory, where, orderBy, findOptions().maxResults(batchSize), spy); } }