Revision b7565ade

b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
492 492
			List<Folder> folders = dao.getFoldersPermittedForGroup(userId, groupId);
493 493
			for (Folder f : folders){
494 494
				f.getPermissions().removeAll(group.getPermissions());
495
				touchFolder(f,owner,now);
495
				touchFolder(f, now);
496 496
				for(FileHeader file : f.getFiles()){
497 497
					file.getPermissions().removeAll(group.getPermissions());
498
					touchFile(file,owner,now);
498
					touchFile(file, now);
499 499
				}
500 500
			}
501
			List<FileHeader> files = dao.getSharedFilesNotInSharedFolders(userId);
501
			List<FileHeader> files = dao.getFilesPermittedForGroup(userId, groupId);
502 502
			for(FileHeader h : files){
503 503
				h.getPermissions().removeAll(group.getPermissions());
504
				touchFile(h,owner,now);
504
				touchFile(h, now);
505 505
			}
506 506
			owner.removeSpecifiedGroup(group);
507 507
			dao.delete(group);
......
2682 2682
	/**
2683 2683
	 * Mark the folder as modified from the specified user and change it's modification date.
2684 2684
	 */
2685
	private void touchFolder(Folder f, User owner, Date now){
2686
		final AuditInfo auditInfo = new AuditInfo();
2687
		auditInfo.setCreatedBy(owner);
2688
		auditInfo.setCreationDate(now);
2689
		auditInfo.setModifiedBy(owner);
2685
	private void touchFolder(Folder f, Date now){
2686
		final AuditInfo auditInfo = f.getAuditInfo();
2690 2687
		auditInfo.setModificationDate(now);
2691
		f.setAuditInfo(auditInfo);
2692 2688
	}
2693 2689

  
2694 2690
	/**
2695 2691
	 * Mark the file as modified from the specified user and change it's modification date.
2696 2692
	 */
2697
	private void touchFile(FileHeader f, User owner, Date now){
2698
		final AuditInfo auditInfo = new AuditInfo();
2699
		auditInfo.setCreatedBy(owner);
2700
		auditInfo.setCreationDate(now);
2701
		auditInfo.setModifiedBy(owner);
2693
	private void touchFile(FileHeader f, Date now){
2694
		final AuditInfo auditInfo = f.getAuditInfo();
2702 2695
		auditInfo.setModificationDate(now);
2703
		f.setAuditInfo(auditInfo);
2704 2696
	}
2705 2697

  
2706 2698
	/**
b/src/gr/ebs/gss/server/ejb/GSSDAO.java
462 462
	public List<AccountingInfo> getAccountingInfo(User user);
463 463

  
464 464
	public AccountingInfo getAccountingInfo(User user, Date date);
465

  
466
	/**
467
	 * Returns a list of files of user with permissions for specified group
468
	 *
469
	 * @param userId the ID of the User
470
	 * @return the list of shared root files
471
	 * @param groupId
472
	 * @throws ObjectNotFoundException if the user cannot be found
473
	 */
474
	public List<FileHeader> getFilesPermittedForGroup(Long userId, Long groupId) throws ObjectNotFoundException;
475

  
465 476
}
b/src/gr/ebs/gss/server/ejb/GSSDAOBean.java
697 697
		}
698 698
		return ai;
699 699
	}
700

  
701
	@Override
702
	public List<FileHeader> getFilesPermittedForGroup(Long userId, Long groupId) {
703
		return manager.createQuery("select distinct f from FileHeader f LEFT JOIN f.permissions p " +
704
					"where f.owner.id=:userId and f.deleted = false and p.group.id=:groupId ").
705
					setParameter("userId", userId).setParameter("groupId", groupId).getResultList();
706
	}
700 707
}

Also available in: Unified diff