Beispiel #1
0
 public long getNumberOfEntriesSharedWithUser(String userId) {
   Account account = DAOFactory.getAccountDAO().getByEmail(userId);
   GroupController groupController = new GroupController();
   Group publicGroup = groupController.createOrRetrievePublicGroup();
   Set<Group> accountGroups = account.getGroups();
   accountGroups.remove(publicGroup);
   return dao.sharedEntryCount(account, accountGroups);
 }
Beispiel #2
0
  public List<PartData> getEntriesSharedWithUser(
      String userId, ColumnField field, boolean asc, int start, int limit) {
    Account account = DAOFactory.getAccountDAO().getByEmail(userId);
    GroupController groupController = new GroupController();
    Group publicGroup = groupController.createOrRetrievePublicGroup();
    Set<Group> accountGroups = account.getGroups();
    accountGroups.remove(publicGroup);
    List<Entry> entries =
        dao.sharedWithUserEntries(account, accountGroups, field, asc, start, limit);

    ArrayList<PartData> data = new ArrayList<>();
    for (Entry entry : entries) {
      PartData info = ModelToInfoFactory.createTableViewData(userId, entry, false);
      info.setViewCount(DAOFactory.getAuditDAO().getHistoryCount(entry));
      data.add(info);
    }
    return data;
  }