Exemplo n.º 1
0
 /*
  * (non-Javadoc)
  *
  * @see cc.kune.core.server.manager.GroupManager#update(java.lang.Long,
  * cc.kune.core.shared.dto.GroupDTO)
  */
 @Override
 public Group update(final Long groupId, final GroupDTO groupDTO) {
   final Group group = find(groupId);
   final String shortName = groupDTO.getShortName();
   final String longName = groupDTO.getLongName();
   if (!longName.equals(group.getLongName())) {
     checkIfLongNameAreInUse(longName);
     group.setLongName(longName);
   }
   if (!shortName.equals(group.getShortName())) {
     checkIfShortNameAreInUse(shortName);
     final String oldDir =
         kuneProperties.get(KuneProperties.UPLOAD_LOCATION)
             + FileUtils.groupToDir(group.getShortName());
     final String newDir =
         kuneProperties.get(KuneProperties.UPLOAD_LOCATION) + FileUtils.groupToDir(shortName);
     if (fileManager.exists(oldDir)) {
       if (fileManager.exists(newDir)) {
         throw new DefaultException("Destination group directory exists");
       }
       fileManager.mv(oldDir, newDir);
     }
     group.setShortName(shortName);
   }
   group.setGroupType(groupDTO.getGroupType());
   setAdmissionType(group);
   final boolean isClosed = group.getGroupType().equals(GroupType.CLOSED);
   setSocialNetwork(group, getDefGroupMode(isClosed), getDefSNVisibility(isClosed));
   persist(group);
   snCache.expire(group);
   return group;
 }
Exemplo n.º 2
0
 /*
  * (non-Javadoc)
  *
  * @see
  * cc.kune.core.server.manager.GroupManager#clearGroupBackImage(cc.kune.domain
  * .Group)
  */
 @Override
 public void clearGroupBackImage(final Group group) {
   final String file = group.getBackgroundImage();
   if (file != null) {
     fileManager.rm(FileUtils.groupToDir(group.getShortName()), file);
   }
   group.setBackgroundImage(null);
   group.setBackgroundMime(null);
 }