예제 #1
0
  @Override
  public int swapCommentGroupRestriction(String groupName, String swapGroup) {
    if (groupName == null) {
      throw new IllegalArgumentException("You must provide a non null group name.");
    }

    if (swapGroup == null) {
      throw new IllegalArgumentException("You must provide a non null swap group name.");
    }

    return delegator.bulkUpdateByAnd(
        "Action",
        FieldMap.build("level", swapGroup),
        FieldMap.build("level", groupName, "type", ActionConstants.TYPE_COMMENT));
  }
예제 #2
0
 @Override
 public ChangeItemBean delete(Comment comment) {
   ChangeItemBean changeItemBean = constructChangeItemBeanForCommentDelete(comment);
   // TODO: move this into the Store (when it gets created)
   delegator.removeByAnd(
       "Action", FieldMap.build("id", comment.getId(), "type", ActionConstants.TYPE_COMMENT));
   this.jsonEntityPropertyManager.deleteByEntity(
       EntityPropertyType.COMMENT_PROPERTY.getDbEntityName(), comment.getId());
   return changeItemBean;
 }
예제 #3
0
  @Override
  public long getCountForCommentsRestrictedByGroup(String groupName) {
    if (groupName == null) {
      throw new IllegalArgumentException("You must provide a non null group name.");
    }

    EntityCondition condition =
        new EntityFieldMap(
            FieldMap.build("level", groupName, "type", ActionConstants.TYPE_COMMENT),
            EntityOperator.AND);
    List commentCount =
        delegator.findByCondition(
            "ActionCount", condition, EasyList.build("count"), Collections.EMPTY_LIST);
    if (commentCount != null && commentCount.size() == 1) {
      GenericValue commentCountGV = (GenericValue) commentCount.get(0);
      return commentCountGV.getLong("count").longValue();
    } else {
      throw new DataAccessException("Unable to access the count for the Action table");
    }
  }