/* * (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; }
/* * (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); }
/* * (non-Javadoc) * * @see * cc.kune.core.server.manager.GroupManager#createGroup(cc.kune.domain.Group, * cc.kune.domain.User, java.lang.String) */ @Override public Group createGroup(final Group group, final User user, final String publicDescrip) throws GroupShortNameInUseException, GroupLongNameInUseException, UserMustBeLoggedException { checkIfShortNameAreInUse(group.getShortName()); checkIfLongNameAreInUse(group.getLongName()); final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF); if (User.isKnownUser(user)) { setAdmissionType(group); final String licName = group.getDefaultLicense().getShortName(); final License license = licenseFinder.findByShortName(licName); group.setDefaultLicense(license); group.setWorkspaceTheme(defaultSiteWorkspaceTheme); final boolean isClosed = group.getGroupType().equals(GroupType.CLOSED); initSocialNetwork( group, user.getUserGroup(), getDefGroupMode(isClosed), getDefSNVisibility(isClosed)); final String title = i18n.t("About [%s]", group.getLongName()); initGroup( user, group, serverToolRegistry.getToolsRegisEnabledForGroups(), title, publicDescrip); snCache.expire(user.getUserGroup()); return group; } else { throw new UserMustBeLoggedException(); } }