[kune-commits] r1443 - in trunk/src: main/java/cc/kune/common/client/tooltip main/java/cc/kune/common/client/ui main/java/cc/kune/core/client/errors main/java/cc/kune/core/client/groups/newgroup main/java/cc/kune/core/client/sitebar/spaces main/java/cc/kune/core/client/sn/actions/registry main/java/cc/kune/core/client/ui main/java/cc/kune/core/server/manager/impl main/java/cc/kune/core/shared/dto main/java/cc/kune/gspace/client/actions main/java/cc/kune/gspace/client/viewers main/webapp/others test/java/cc/kune/core/server/integration/kuneservice
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sat Jul 9 22:52:00 CEST 2011
Author: vjrj_
Date: 2011-07-09 22:52:00 +0200 (Sat, 09 Jul 2011)
New Revision: 1443
Modified:
trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java
trunk/src/main/java/cc/kune/common/client/ui/MaskWidget.java
trunk/src/main/java/cc/kune/common/client/ui/MaskWidgetView.java
trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupView.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java
trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/cc/kune/core/shared/dto/GroupType.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentTitleWidget.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
trunk/src/main/webapp/others/kune-client-actions.xml
trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java
Log:
Closed groups; Rename title tooltip; Tooltip fixed
Modified: trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -176,6 +176,7 @@
}
public void showTemporally() {
+ show();
timers.showTemporally();
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/common/client/ui/EditableLabel.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -53,13 +53,15 @@
InlineLabel label;
@UiField
TextBox textbox;
- private String tooltip;
+ private Tooltip tooltip;
+ private String tooltipText;
+
public EditableLabel() {
initWidget(uiBinder.createAndBindUi(this));
label.setStylePrimaryName("k-editableLabel");
editable = false;
- tooltip = "";
+ tooltipText = "";
}
@Override
@@ -67,32 +69,6 @@
return addHandler(handler, EditEvent.getType());
}
- public void blink() {
- if (editable) {
- blinkTimer(true, new SimpleCallback() {
- @Override
- public void onCallback() {
- blinkTimer(false, new SimpleCallback() {
- @Override
- public void onCallback() {
- blinkTimer(true, new SimpleCallback() {
- @Override
- public void onCallback() {
- blinkTimer(false, new SimpleCallback() {
- @Override
- public void onCallback() {
- // nothing
- }
- });
- }
- });
- }
- });
- }
- });
- }
- }
-
private void blinkTimer(final boolean add, final SimpleCallback callback) {
new Timer() {
@Override
@@ -130,6 +106,32 @@
}
}
+ public void highlightTitle() {
+ if (editable) {
+ blinkTimer(true, new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ blinkTimer(false, new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ blinkTimer(true, new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ blinkTimer(false, new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ tooltip.showTemporally();
+ }
+ });
+ }
+ });
+ }
+ });
+ }
+ });
+ }
+ }
+
@UiHandler("textbox")
void onBlur(final BlurEvent event) {
finishEdit();
@@ -156,7 +158,7 @@
public void setEditable(final boolean editable) {
this.editable = editable;
- Tooltip.to(label, editable ? tooltip : "");
+ tooltip = Tooltip.to(label, editable ? tooltipText : "");
}
public void setText(final String text) {
@@ -165,7 +167,7 @@
}
public void setTooltip(final String tooltip) {
- this.tooltip = tooltip;
+ this.tooltipText = tooltip;
}
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/MaskWidget.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/MaskWidget.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/common/client/ui/MaskWidget.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -35,53 +35,58 @@
public class MaskWidget extends PopupPanel implements MaskWidgetView {
- interface MaskWidgetUiBinder extends UiBinder<Widget, MaskWidget> {
- }
- private static MaskWidgetUiBinder uiBinder = GWT.create(MaskWidgetUiBinder.class);
- @UiField
- FlowPanel flow;
- @UiField
- Image icon;
- @UiField
- Label label;
+ interface MaskWidgetUiBinder extends UiBinder<Widget, MaskWidget> {
+ }
+ private static MaskWidgetUiBinder uiBinder = GWT.create(MaskWidgetUiBinder.class);
+ @UiField
+ FlowPanel flow;
+ @UiField
+ Image icon;
+ @UiField
+ Label label;
- @UiField
- SimplePanel mainPanel;
+ @UiField
+ SimplePanel mainPanel;
- public MaskWidget() {
- super(false, false);
- add(uiBinder.createAndBindUi(this));
- setStyleName("k-mask");
- }
+ public MaskWidget() {
+ super(false, false);
+ add(uiBinder.createAndBindUi(this));
+ setStyleName("k-mask");
+ }
- @Override
- @Nonnull
- public void mask(final IsWidget widget) {
- mask(widget, "");
- }
+ @Override
+ public boolean isShowing() {
+ return super.isShowing();
+ }
- @Override
- @Nonnull
- public void mask(final IsWidget widget, final String message) {
- label.setText(message);
- setPopupPositionAndShow(new PositionCallback() {
- @Override
- public void setPosition(final int offsetWidth, final int offsetHeight) {
- final Widget asWidget = widget.asWidget();
- final int w = asWidget.getOffsetWidth();
- final int h = asWidget.getOffsetHeight();
- MaskWidget.this.setPopupPosition(asWidget.getAbsoluteLeft(), asWidget.getAbsoluteTop());
- getElement().getStyle().setWidth(w, Unit.PX);
- getElement().getStyle().setHeight(h, Unit.PX);
- flow.getElement().getStyle().setTop((h - flow.getOffsetHeight()) / 2d, Unit.PX);
- flow.getElement().getStyle().setLeft((w - flow.getOffsetWidth()) / 2d, Unit.PX);
- }
- });
- }
+ @Override
+ @Nonnull
+ public void mask(final IsWidget widget) {
+ mask(widget, "");
+ }
- @Override
- public void unMask() {
- hide();
- }
+ @Override
+ @Nonnull
+ public void mask(final IsWidget widget, final String message) {
+ label.setText(message);
+ setPopupPositionAndShow(new PositionCallback() {
+ @Override
+ public void setPosition(final int offsetWidth, final int offsetHeight) {
+ final Widget asWidget = widget.asWidget();
+ final int w = asWidget.getOffsetWidth();
+ final int h = asWidget.getOffsetHeight();
+ MaskWidget.this.setPopupPosition(asWidget.getAbsoluteLeft(), asWidget.getAbsoluteTop());
+ getElement().getStyle().setWidth(w, Unit.PX);
+ getElement().getStyle().setHeight(h, Unit.PX);
+ flow.getElement().getStyle().setTop((h - flow.getOffsetHeight()) / 2d, Unit.PX);
+ flow.getElement().getStyle().setLeft((w - flow.getOffsetWidth()) / 2d, Unit.PX);
+ }
+ });
+ }
+ @Override
+ public void unMask() {
+ hide();
+ }
+
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/MaskWidgetView.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/MaskWidgetView.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/common/client/ui/MaskWidgetView.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -23,10 +23,12 @@
public interface MaskWidgetView {
- void mask(IsWidget widget);
+ boolean isShowing();
- void mask(IsWidget widget, String message);
+ void mask(IsWidget widget);
- void unMask();
+ void mask(IsWidget widget, String message);
+ void unMask();
+
}
Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -81,6 +81,7 @@
logException(caught);
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
i18n.t("You do not have rights to perform that action")));
+ goHome();
} else if (caught instanceof SessionExpiredException) {
logException(caught);
doSessionExpired();
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -46,6 +46,7 @@
public class NewGroupPanel extends ViewImpl implements NewGroupView {
private static final int BIG_FIELD_WIDTH = 280;
public static final String CANCEL_BUTTON = "k-ngp-cancel-bt";
+ public static final String CLOSED_GROUP_TYPE_ID = "k-ngp-type_of_group_closed";
public static final String COMM_GROUP_TYPE_ID = "k-ngp-type_of_group_comm";
public static final String ERROR_MSG_BAR = "k-ngp-error-mb";
private static final int LABEL_WIDTH = 100;
@@ -60,10 +61,11 @@
public static final String TAGS_FIELD = "k-ngp-tags";
public static final String TYPEOFGROUP_FIELD = "k-ngp-type_of_group";
+ private Radio closedRadio;
private Radio communityRadio;
private final BasicTopDialog dialog;
+
private final FormPanel form;
-
private final I18nTranslationService i18n;
private TextField<String> longNameField;
private final MaskWidgetView mask;
@@ -81,11 +83,11 @@
public NewGroupPanel(final I18nTranslationService i18n, final NotifyLevelImages img,
final MaskWidgetView mask) {
final Builder builder = new BasicTopDialog.Builder(NEWGROUP_WIZARD, false, true).autoscroll(true).height(
- "300px").title(i18n.t("Register a new group"));
+ "340px").title(i18n.t("Register a new group"));
builder.icon("k-newgroup-icon");
builder.firstButtonTitle(i18n.t("Register")).firstButtonId(REGISTER_BUTTON);
builder.sndButtonTitle(i18n.t("Cancel")).sndButtonId(CANCEL_BUTTON);
- builder.tabIndexStart(9);
+ builder.tabIndexStart(10);
dialog = builder.build();
this.i18n = i18n;
this.mask = mask;
@@ -195,12 +197,18 @@
+ "but organizations must be a legal entity."), ORG_GROUP_TYPE_ID);
orgRadio.setTabIndex(7);
+ closedRadio = DefaultFormUtils.createRadio(groupTypeFieldSet, i18n.t("Closed"), TYPEOFGROUP_FIELD,
+ i18n.t("Closed groups are social groups of persons "
+ + "like family, friends, buddies, etc, which are moderated to new members "
+ + "and with private contents (by default)"), CLOSED_GROUP_TYPE_ID);
+ closedRadio.setTabIndex(8);
+
communityRadio = DefaultFormUtils.createRadio(groupTypeFieldSet, i18n.t("Community"),
TYPEOFGROUP_FIELD, i18n.t("Communities are social groups of persons "
+ "with shared interests, which are open to new members "
+ "(for instance the environmental community or the LGBT community). "
+ "They rarely are a legal entity."), COMM_GROUP_TYPE_ID);
- communityRadio.setTabIndex(8);
+ communityRadio.setTabIndex(9);
return form;
}
@@ -257,6 +265,11 @@
}
@Override
+ public boolean isClosed() {
+ return closedRadio.getValue();
+ }
+
+ @Override
public boolean isCommunity() {
return communityRadio.getValue();
}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -114,6 +114,8 @@
return GroupType.PROJECT;
} else if (getView().isOrganization()) {
return GroupType.ORGANIZATION;
+ } else if (getView().isClosed()) {
+ return GroupType.CLOSED;
} else {
return GroupType.COMMUNITY;
}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupView.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupView.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupView.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -28,42 +28,44 @@
public interface NewGroupView extends View {
- void clearData();
+ void clearData();
- void focusOnShorName();
+ void focusOnShorName();
- HasCloseHandlers<PopupPanel> getClose();
+ HasCloseHandlers<PopupPanel> getClose();
- HasClickHandlers getFirstBtn();
+ HasClickHandlers getFirstBtn();
- String getLongName();
+ String getLongName();
- String getPublicDesc();
+ String getPublicDesc();
- HasClickHandlers getSecondBtn();
+ HasClickHandlers getSecondBtn();
- String getShortName();
+ String getShortName();
- String getTags();
+ String getTags();
- void hide();
+ void hide();
- void hideMessage();
+ void hideMessage();
- boolean isCommunity();
+ boolean isClosed();
- boolean isFormValid();
+ boolean isCommunity();
- boolean isOrganization();
+ boolean isFormValid();
- boolean isProject();
+ boolean isOrganization();
- void maskProcessing();
+ boolean isProject();
- void setMessage(String message, NotifyLevel level);
+ void maskProcessing();
- void show();
+ void setMessage(String message, NotifyLevel level);
- void unMask();
+ void show();
+ void unMask();
+
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -20,6 +20,7 @@
package cc.kune.core.client.sitebar.spaces;
import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.common.client.ui.MaskWidgetView;
import cc.kune.core.client.auth.SignIn;
import cc.kune.core.client.events.WindowFocusEvent;
import cc.kune.core.client.init.AppStartEvent;
@@ -96,7 +97,7 @@
public SpaceSelectorPresenter(final EventBus eventBus, final StateManager stateManager,
final SpaceSelectorView view, final SpaceSelectorProxy proxy, final GSpaceArmor armor,
final Session session, final Provider<SignIn> signIn, final GSpaceBackManager backManager,
- final I18nTranslationService i18n) {
+ final I18nTranslationService i18n, final MaskWidgetView mask) {
super(eventBus, view, proxy);
this.stateManager = stateManager;
this.armor = armor;
@@ -136,7 +137,7 @@
eventBus.addHandler(WindowFocusEvent.getType(), new WindowFocusEvent.WindowFocusHandler() {
@Override
public void onWindowFocus(final WindowFocusEvent event) {
- if (event.isHasFocus()) {
+ if (event.isHasFocus() && !mask.isShowing()) {
showTooltipWithDelay();
}
}
@@ -252,19 +253,21 @@
}
private void showTooltipNow() {
- switch (currentSpace) {
- case homeSpace:
- getView().showHomeSpaceTooltip();
- break;
- case userSpace:
- getView().showUserSpaceTooltip();
- break;
- case groupSpace:
- getView().showGroupSpaceTooltip();
- break;
- case publicSpace:
- getView().showPublicSpaceTooltip();
- break;
+ if (currentSpace != null) {
+ switch (currentSpace) {
+ case homeSpace:
+ getView().showHomeSpaceTooltip();
+ break;
+ case userSpace:
+ getView().showUserSpaceTooltip();
+ break;
+ case groupSpace:
+ getView().showGroupSpaceTooltip();
+ break;
+ case publicSpace:
+ getView().showPublicSpaceTooltip();
+ break;
+ }
}
}
@@ -274,6 +277,6 @@
public void run() {
showTooltipNow();
}
- }.schedule(500);
+ }.schedule(200);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -81,6 +81,7 @@
final MenuRadioItemDescriptor moderatedItem = membersModeration.get().withModeration(
AdmissionType.Moderated);
final MenuRadioItemDescriptor openItem = membersModeration.get().withModeration(AdmissionType.Open);
+
addImpl(OPTIONS_MENU);
addImpl(optionsTitle);
addImpl(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(
@@ -91,8 +92,7 @@
addImpl(onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins")));
addImpl(moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join")));
addImpl(openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join")));
- // add(closedItem.withParent(MODERATION_SUBMENU).withText(
- // i18n.t("closed for new members")));
+ addImpl(closedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("closed for new members")));
final ButtonDescriptor joinBtn = new ButtonDescriptor(joinGroupAction);
final ButtonDescriptor unJoinBtn = new ButtonDescriptor(unJoinGroupAction);
Modified: trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/client/ui/DefaultFormUtils.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -21,6 +21,9 @@
import cc.kune.common.client.tooltip.Tooltip;
+import com.extjs.gxt.ui.client.event.BaseEvent;
+import com.extjs.gxt.ui.client.event.Events;
+import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.Radio;
@@ -33,9 +36,18 @@
radio.setId(id);
fieldSet.add(radio);
- if (radioTip != null) {
- Tooltip.to(radio, radioTip);
- }
+ radio.addListener(Events.OnMouseOver, new Listener<BaseEvent>() {
+ private Tooltip tooltip;
+
+ @Override
+ public void handleEvent(final BaseEvent be) {
+ if (radioTip != null && tooltip == null) {
+ tooltip = Tooltip.to(radio, radioTip);
+ tooltip.show();
+ tooltip.hide();
+ }
+ }
+ });
radio.setBoxLabel(radioLabel);
return radio;
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -47,6 +47,7 @@
import cc.kune.core.shared.SearcherConstants;
import cc.kune.core.shared.domain.AdmissionType;
import cc.kune.core.shared.domain.GroupListMode;
+import cc.kune.core.shared.domain.SocialNetworkVisibility;
import cc.kune.core.shared.dto.GroupType;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.domain.AccessLists;
@@ -129,8 +130,14 @@
throws GroupNameInUseException, UserMustBeLoggedException {
final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
if (User.isKnownUser(user)) {
+ GroupListMode publicVisibility = GroupListMode.EVERYONE;
+ SocialNetworkVisibility snVisibility = SocialNetworkVisibility.anyone;
if (group.getGroupType().equals(GroupType.COMMUNITY)) {
group.setAdmissionType(AdmissionType.Open);
+ } else if (group.getGroupType().equals(GroupType.CLOSED)) {
+ group.setAdmissionType(AdmissionType.Closed);
+ publicVisibility = GroupListMode.NORMAL;
+ snVisibility = SocialNetworkVisibility.onlymembers;
} else if (group.getGroupType().equals(GroupType.ORGANIZATION)) {
group.setAdmissionType(AdmissionType.Moderated);
} else if (group.getGroupType().equals(GroupType.PROJECT)) {
@@ -142,7 +149,7 @@
final License license = licenseFinder.findByShortName(licName);
group.setDefaultLicense(license);
group.setWorkspaceTheme(defaultSiteWorkspaceTheme);
- initSocialNetwork(group, user.getUserGroup());
+ initSocialNetwork(group, user.getUserGroup(), publicVisibility, snVisibility);
final String title = i18n.t("About [%s]", group.getLongName());
initGroup(user, group, serverToolRegistry.getToolsForGroupsKeys(), title, publicDescrip);
return group;
@@ -177,7 +184,7 @@
userGroup.setWorkspaceTheme(defaultSiteWorkspaceTheme);
userGroup.setDefaultContent(null);
user.setUserGroup(userGroup);
- initSocialNetwork(userGroup, userGroup);
+ initSocialNetwork(userGroup, userGroup, GroupListMode.EVERYONE, SocialNetworkVisibility.anyone);
final String title = i18n.t("[%s] Bio", user.getName());
final String body = i18n.t("This user has not written its biography yet");
@@ -244,14 +251,16 @@
}
}
- private void initSocialNetwork(final Group group, final Group userGroup) {
+ private void initSocialNetwork(final Group group, final Group userGroup,
+ final GroupListMode publicVisibility, final SocialNetworkVisibility snVisibility) {
final SocialNetwork network = group.getSocialNetwork();
final AccessLists lists = network.getAccessLists();
lists.getEditors().setMode(GroupListMode.NOBODY);
- lists.getViewers().setMode(GroupListMode.EVERYONE);
+ lists.getViewers().setMode(publicVisibility);
if (!group.getGroupType().equals(GroupType.ORPHANED_PROJECT)) {
network.addAdmin(userGroup);
}
+ network.setVisibility(snVisibility);
}
@Override
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/SocialNetworkManagerDefault.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -23,7 +23,6 @@
import javax.persistence.EntityManager;
-
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.AlreadyGroupMemberException;
import cc.kune.core.client.errors.AlreadyUserMemberException;
@@ -54,302 +53,311 @@
import com.google.inject.Singleton;
@Singleton
-public class SocialNetworkManagerDefault extends DefaultManager<SocialNetwork, Long> implements SocialNetworkManager {
+public class SocialNetworkManagerDefault extends DefaultManager<SocialNetwork, Long> implements
+ SocialNetworkManager {
- private final AccessRightsService accessRightsService;
- private final GroupFinder finder;
- private final UserManager userManager;
+ private final AccessRightsService accessRightsService;
+ private final GroupFinder finder;
+ private final UserManager userManager;
- @Inject
- public SocialNetworkManagerDefault(final Provider<EntityManager> provider, final GroupFinder finder,
- final AccessRightsService accessRightsService, final UserManager userManager) {
- super(provider, SocialNetwork.class);
- this.finder = finder;
- this.accessRightsService = accessRightsService;
- this.userManager = userManager;
- }
+ @Inject
+ public SocialNetworkManagerDefault(final Provider<EntityManager> provider, final GroupFinder finder,
+ final AccessRightsService accessRightsService, final UserManager userManager) {
+ super(provider, SocialNetwork.class);
+ this.finder = finder;
+ this.accessRightsService = accessRightsService;
+ this.userManager = userManager;
+ }
- @Override
- public void acceptJoinGroup(final User userLogged, final Group group, final Group inGroup) throws DefaultException,
- AccessViolationException {
- final SocialNetwork sn = inGroup.getSocialNetwork();
- checkUserLoggedIsAdmin(userLogged, sn);
- final List<Group> pendingCollabs = sn.getPendingCollaborators().getList();
- if (pendingCollabs.contains(group)) {
- sn.addCollaborator(group);
- sn.removePendingCollaborator(group);
- } else {
- throw new DefaultException("User is not a pending collaborator");
- }
+ @Override
+ public void acceptJoinGroup(final User userLogged, final Group group, final Group inGroup)
+ throws DefaultException, AccessViolationException {
+ final SocialNetwork sn = inGroup.getSocialNetwork();
+ checkUserLoggedIsAdmin(userLogged, sn);
+ final List<Group> pendingCollabs = sn.getPendingCollaborators().getList();
+ if (pendingCollabs.contains(group)) {
+ sn.addCollaborator(group);
+ sn.removePendingCollaborator(group);
+ } else {
+ throw new DefaultException("User is not a pending collaborator");
}
+ }
- void addAdmin(final User newAdmin, final Group group) {
- final SocialNetwork sn = group.getSocialNetwork();
- sn.addAdmin(newAdmin.getUserGroup());
- }
+ void addAdmin(final User newAdmin, final Group group) {
+ final SocialNetwork sn = group.getSocialNetwork();
+ sn.addAdmin(newAdmin.getUserGroup());
+ }
- @Override
- public void addGroupToAdmins(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
- checkGroupAddingToSelf(group, inGroup);
- final SocialNetwork sn = inGroup.getSocialNetwork();
- checkUserLoggedIsAdmin(userLogged, sn);
- checkGroupIsNotAlreadyAMember(group, sn);
- sn.addAdmin(group);
- if (sn.isPendingCollab(group)) {
- sn.removePendingCollaborator(group);
- }
+ @Override
+ public void addGroupToAdmins(final User userLogged, final Group group, final Group inGroup)
+ throws DefaultException {
+ checkGroupAddingToSelf(group, inGroup);
+ final SocialNetwork sn = inGroup.getSocialNetwork();
+ checkUserLoggedIsAdmin(userLogged, sn);
+ checkGroupIsNotAlreadyAMember(group, sn);
+ sn.addAdmin(group);
+ if (sn.isPendingCollab(group)) {
+ sn.removePendingCollaborator(group);
}
+ }
- @Override
- public void addGroupToCollabs(final User userLogged, final Group group, final Group inGroup)
- throws DefaultException {
- checkGroupAddingToSelf(group, inGroup);
- final SocialNetwork sn = inGroup.getSocialNetwork();
- checkUserLoggedIsAdmin(userLogged, sn);
- checkGroupIsNotAlreadyAMember(group, sn);
- sn.addCollaborator(group);
- if (sn.isPendingCollab(group)) {
- sn.removePendingCollaborator(group);
- }
+ @Override
+ public void addGroupToCollabs(final User userLogged, final Group group, final Group inGroup)
+ throws DefaultException {
+ checkGroupAddingToSelf(group, inGroup);
+ final SocialNetwork sn = inGroup.getSocialNetwork();
+ checkUserLoggedIsAdmin(userLogged, sn);
+ checkGroupIsNotAlreadyAMember(group, sn);
+ sn.addCollaborator(group);
+ if (sn.isPendingCollab(group)) {
+ sn.removePendingCollaborator(group);
}
+ }
- @Override
- public void addGroupToViewers(final User userLogged, final Group group, final Group inGroup)
- throws DefaultException {
- checkGroupAddingToSelf(group, inGroup);
- final SocialNetwork sn = inGroup.getSocialNetwork();
- checkUserLoggedIsAdmin(userLogged, sn);
- checkGroupIsNotAlreadyAMember(group, sn);
- sn.addViewer(group);
- if (sn.isPendingCollab(group)) {
- sn.removePendingCollaborator(group);
- }
+ @Override
+ public void addGroupToViewers(final User userLogged, final Group group, final Group inGroup)
+ throws DefaultException {
+ checkGroupAddingToSelf(group, inGroup);
+ final SocialNetwork sn = inGroup.getSocialNetwork();
+ checkUserLoggedIsAdmin(userLogged, sn);
+ checkGroupIsNotAlreadyAMember(group, sn);
+ sn.addViewer(group);
+ if (sn.isPendingCollab(group)) {
+ sn.removePendingCollaborator(group);
}
+ }
- private void checkGroupAddingToSelf(final Group group, final Group inGroup) throws DefaultException {
- if (group.equals(inGroup)) {
- throwGroupMemberException(group);
- }
+ private void checkGroupAddingToSelf(final Group group, final Group inGroup) throws DefaultException {
+ if (group.equals(inGroup)) {
+ throwGroupMemberException(group);
}
+ }
- private void checkGroupIsNotAlreadyAMember(final Group group, final SocialNetwork sn) throws DefaultException {
- if (sn.isAdmin(group) || sn.isCollab(group) || sn.isViewer(group) && notEveryOneCanView(sn)) {
- throwGroupMemberException(group);
- }
+ private void checkGroupIsNotAlreadyAMember(final Group group, final SocialNetwork sn)
+ throws DefaultException {
+ if (sn.isAdmin(group) || sn.isCollab(group) || sn.isViewer(group) && notEveryOneCanView(sn)) {
+ throwGroupMemberException(group);
}
+ }
- private void checkUserLoggedIsAdmin(final User userLogged, final SocialNetwork sn) throws AccessViolationException {
- if (!accessRightsService.get(userLogged, sn.getAccessLists()).isAdministrable()) {
- throw new AccessViolationException();
- }
+ private void checkUserLoggedIsAdmin(final User userLogged, final SocialNetwork sn)
+ throws AccessViolationException {
+ if (!accessRightsService.get(userLogged, sn.getAccessLists()).isAdministrable()) {
+ throw new AccessViolationException();
}
+ }
- @Override
- public void deleteMember(final User userLogged, final Group group, final Group inGroup) throws DefaultException,
- AccessViolationException {
- final SocialNetwork sn = inGroup.getSocialNetwork();
+ @Override
+ public void deleteMember(final User userLogged, final Group group, final Group inGroup)
+ throws DefaultException, AccessViolationException {
+ final SocialNetwork sn = inGroup.getSocialNetwork();
- checkUserLoggedIsAdmin(userLogged, sn);
- unJoinGroup(group, inGroup);
- }
+ checkUserLoggedIsAdmin(userLogged, sn);
+ unJoinGroup(group, inGroup);
+ }
- @Override
- public void denyJoinGroup(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
- final SocialNetwork sn = inGroup.getSocialNetwork();
- checkUserLoggedIsAdmin(userLogged, sn);
- final List<Group> pendingCollabs = sn.getPendingCollaborators().getList();
- if (pendingCollabs.contains(group)) {
- sn.removePendingCollaborator(group);
- } else {
- throw new DefaultException("Person/Group is not a pending collaborator");
- }
+ @Override
+ public void denyJoinGroup(final User userLogged, final Group group, final Group inGroup)
+ throws DefaultException {
+ final SocialNetwork sn = inGroup.getSocialNetwork();
+ checkUserLoggedIsAdmin(userLogged, sn);
+ final List<Group> pendingCollabs = sn.getPendingCollaborators().getList();
+ if (pendingCollabs.contains(group)) {
+ sn.removePendingCollaborator(group);
+ } else {
+ throw new DefaultException("Person/Group is not a pending collaborator");
}
+ }
- @Override
- public ParticipationData findParticipation(final User userLogged, final Group group)
- throws AccessViolationException {
- get(userLogged, group); // check access
- final Long groupId = group.getId();
- final List<Group> adminInGroups = finder.findAdminInGroups(groupId);
- // Don't show self user group
- if (group.isPersonal()) {
- adminInGroups.remove(group);
- }
- // adminInGroups.remove(userLogged.getUserGroup());
- final List<Group> collabInGroups = finder.findCollabInGroups(groupId);
- return new ParticipationData(adminInGroups, collabInGroups);
+ @Override
+ public ParticipationData findParticipation(final User userLogged, final Group group)
+ throws AccessViolationException {
+ get(userLogged, group); // check access
+ final Long groupId = group.getId();
+ final List<Group> adminInGroups = finder.findAdminInGroups(groupId);
+ // Don't show self user group
+ if (group.isPersonal()) {
+ adminInGroups.remove(group);
}
+ // adminInGroups.remove(userLogged.getUserGroup());
+ final List<Group> collabInGroups = finder.findCollabInGroups(groupId);
+ return new ParticipationData(adminInGroups, collabInGroups);
+ }
- @Override
- public SocialNetwork get(final User petitioner, final Group group) throws AccessViolationException {
- final SocialNetwork sn = group.getSocialNetwork();
- if (!sn.getAccessLists().getViewers().includes(petitioner.getUserGroup())) {
- throw new AccessViolationException();
- }
- return sn;
+ @Override
+ public SocialNetwork get(final User petitioner, final Group group) throws AccessViolationException {
+ final SocialNetwork sn = group.getSocialNetwork();
+ if (!sn.getAccessLists().getViewers().includes(petitioner.getUserGroup())
+ && !sn.getAccessLists().getEditors().includes(petitioner.getUserGroup())
+ && !sn.getAccessLists().getAdmins().includes(petitioner.getUserGroup())) {
+ throw new AccessViolationException();
}
+ return sn;
+ }
- @Override
- public SocialNetworkData getSocialNetworkData(final User userLogged, final Group group) {
- final SocialNetworkData socialNetData = new SocialNetworkData();
- socialNetData.setGroupMembers(get(userLogged, group));
- final AccessRights groupRights = accessRightsService.get(userLogged, group.getAccessLists());
- socialNetData.setGroupRights(groupRights);
- socialNetData.setUserParticipation(findParticipation(userLogged, group));
- socialNetData.setGroupMembers(get(userLogged, group));
- if (group.isPersonal()) {
- final UserBuddiesData userBuddies = userManager.getUserBuddies(group.getShortName());
- final User userGroup = userManager.findByShortname(group.getShortName());
- socialNetData.setUserBuddies(userBuddies);
- final UserSNetVisibility buddiesVisibility = userGroup.getSNetVisibility();
- socialNetData.setIsBuddiesVisible(true);
- switch (buddiesVisibility) {
- case anyone:
- break;
- case onlyyou:
- if (userLogged.equals(User.UNKNOWN_USER) || !userLogged.getUserGroup().equals(group)) {
- socialNetData.setIsBuddiesVisible(false);
- socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
- }
- break;
- case yourbuddies:
- final boolean notMe = !userLogged.equals(userGroup);
- final boolean notABuddie = !userBuddies.contains(userLogged.getShortName());
- if (notMe && notABuddie) {
- socialNetData.setIsBuddiesVisible(false);
- socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
- }
- break;
- }
- socialNetData.setUserBuddiesVisibility(buddiesVisibility);
- } else {
- final SocialNetworkVisibility visibility = group.getSocialNetwork().getVisibility();
- socialNetData.setIsMembersVisible(true);
- switch (visibility) {
- case anyone:
- break;
- case onlyadmins:
- if (!groupRights.isAdministrable()) {
- socialNetData.setIsMembersVisible(false);
- socialNetData.setGroupMembers(SocialNetwork.EMPTY);
- }
- break;
- case onlymembers:
- if (!groupRights.isEditable()) {
- socialNetData.setIsMembersVisible(false);
- socialNetData.setGroupMembers(SocialNetwork.EMPTY);
- }
- break;
- }
- socialNetData.setSocialNetworkVisibility(visibility);
- socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
+ @Override
+ public SocialNetworkData getSocialNetworkData(final User userLogged, final Group group) {
+ final SocialNetworkData socialNetData = new SocialNetworkData();
+ socialNetData.setGroupMembers(get(userLogged, group));
+ final AccessRights groupRights = accessRightsService.get(userLogged, group.getAccessLists());
+ socialNetData.setGroupRights(groupRights);
+ socialNetData.setUserParticipation(findParticipation(userLogged, group));
+ socialNetData.setGroupMembers(get(userLogged, group));
+ if (group.isPersonal()) {
+ final UserBuddiesData userBuddies = userManager.getUserBuddies(group.getShortName());
+ final User userGroup = userManager.findByShortname(group.getShortName());
+ socialNetData.setUserBuddies(userBuddies);
+ final UserSNetVisibility buddiesVisibility = userGroup.getSNetVisibility();
+ socialNetData.setIsBuddiesVisible(true);
+ switch (buddiesVisibility) {
+ case anyone:
+ break;
+ case onlyyou:
+ if (userLogged.equals(User.UNKNOWN_USER) || !userLogged.getUserGroup().equals(group)) {
+ socialNetData.setIsBuddiesVisible(false);
+ socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
}
- return socialNetData;
+ break;
+ case yourbuddies:
+ final boolean notMe = !userLogged.equals(userGroup);
+ final boolean notABuddie = !userBuddies.contains(userLogged.getShortName());
+ if (notMe && notABuddie) {
+ socialNetData.setIsBuddiesVisible(false);
+ socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
+ }
+ break;
+ }
+ socialNetData.setUserBuddiesVisibility(buddiesVisibility);
+ } else {
+ final SocialNetworkVisibility visibility = group.getSocialNetwork().getVisibility();
+ socialNetData.setIsMembersVisible(true);
+ switch (visibility) {
+ case anyone:
+ break;
+ case onlyadmins:
+ if (!groupRights.isAdministrable()) {
+ socialNetData.setIsMembersVisible(false);
+ socialNetData.setGroupMembers(SocialNetwork.EMPTY);
+ }
+ break;
+ case onlymembers:
+ if (!groupRights.isEditable()) {
+ socialNetData.setIsMembersVisible(false);
+ socialNetData.setGroupMembers(SocialNetwork.EMPTY);
+ }
+ break;
+ }
+ socialNetData.setSocialNetworkVisibility(visibility);
+ socialNetData.setUserBuddies(UserBuddiesData.EMPTY);
}
+ return socialNetData;
+ }
- private boolean isClosed(final AdmissionType admissionType) {
- return admissionType.equals(AdmissionType.Closed);
- }
+ private boolean isClosed(final AdmissionType admissionType) {
+ return admissionType.equals(AdmissionType.Closed);
+ }
- private boolean isModerated(final AdmissionType admissionType) {
- return admissionType.equals(AdmissionType.Moderated);
- }
+ private boolean isModerated(final AdmissionType admissionType) {
+ return admissionType.equals(AdmissionType.Moderated);
+ }
- private boolean isOpen(final AdmissionType admissionType) {
- return admissionType.equals(AdmissionType.Open);
- }
+ private boolean isOpen(final AdmissionType admissionType) {
+ return admissionType.equals(AdmissionType.Open);
+ }
- private boolean notEveryOneCanView(final SocialNetwork sn) {
- return !sn.getAccessLists().getViewers().getMode().equals(GroupListMode.EVERYONE);
- }
+ private boolean notEveryOneCanView(final SocialNetwork sn) {
+ return !sn.getAccessLists().getViewers().getMode().equals(GroupListMode.EVERYONE);
+ }
- @Override
- public SocialNetworkRequestResult requestToJoin(final User userLogged, final Group inGroup)
- throws DefaultException, UserMustBeLoggedException {
- final SocialNetwork sn = inGroup.getSocialNetwork();
- if (!User.isKnownUser(userLogged)) {
- throw new UserMustBeLoggedException();
- }
- final AdmissionType admissionType = inGroup.getAdmissionType();
- if (admissionType == null) {
- throw new ServerException("No admissionType");
- }
- final Group userGroup = userLogged.getUserGroup();
- checkGroupIsNotAlreadyAMember(userGroup, sn);
- if (isModerated(admissionType)) {
- sn.addPendingCollaborator(userGroup);
- return SocialNetworkRequestResult.moderated;
- } else if (isOpen(admissionType)) {
- if (inGroup.getGroupType().equals(GroupType.ORPHANED_PROJECT)) {
- sn.addAdmin(userGroup);
- inGroup.setGroupType(GroupType.PROJECT);
- inGroup.setAdmissionType(AdmissionType.Moderated);
- persist(inGroup, Group.class);
- } else {
- sn.addCollaborator(userGroup);
- }
- return SocialNetworkRequestResult.accepted;
- } else if (isClosed(admissionType)) {
- return SocialNetworkRequestResult.denied;
- } else {
- throw new DefaultException("State not expected in SocialNetworkManagerDefault class");
- }
+ @Override
+ public SocialNetworkRequestResult requestToJoin(final User userLogged, final Group inGroup)
+ throws DefaultException, UserMustBeLoggedException {
+ final SocialNetwork sn = inGroup.getSocialNetwork();
+ if (!User.isKnownUser(userLogged)) {
+ throw new UserMustBeLoggedException();
}
+ final AdmissionType admissionType = inGroup.getAdmissionType();
+ if (admissionType == null) {
+ throw new ServerException("No admissionType");
+ }
+ final Group userGroup = userLogged.getUserGroup();
+ checkGroupIsNotAlreadyAMember(userGroup, sn);
+ if (isModerated(admissionType)) {
+ sn.addPendingCollaborator(userGroup);
+ return SocialNetworkRequestResult.moderated;
+ } else if (isOpen(admissionType)) {
+ if (inGroup.getGroupType().equals(GroupType.ORPHANED_PROJECT)) {
+ sn.addAdmin(userGroup);
+ inGroup.setGroupType(GroupType.PROJECT);
+ inGroup.setAdmissionType(AdmissionType.Moderated);
+ persist(inGroup, Group.class);
+ } else {
+ sn.addCollaborator(userGroup);
+ }
+ return SocialNetworkRequestResult.accepted;
+ } else if (isClosed(admissionType)) {
+ return SocialNetworkRequestResult.denied;
+ } else {
+ throw new DefaultException("State not expected in SocialNetworkManagerDefault class");
+ }
+ }
- @Override
- public void setAdminAsCollab(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
- final SocialNetwork sn = inGroup.getSocialNetwork();
- checkUserLoggedIsAdmin(userLogged, sn);
- if (sn.isAdmin(group)) {
- if (sn.getAccessLists().getAdmins().getList().size() == 1) {
- throw new LastAdminInGroupException();
- }
- sn.removeAdmin(group);
- sn.addCollaborator(group);
- } else {
- throw new DefaultException("Person/Group is not an admin");
- }
+ @Override
+ public void setAdminAsCollab(final User userLogged, final Group group, final Group inGroup)
+ throws DefaultException {
+ final SocialNetwork sn = inGroup.getSocialNetwork();
+ checkUserLoggedIsAdmin(userLogged, sn);
+ if (sn.isAdmin(group)) {
+ if (sn.getAccessLists().getAdmins().getList().size() == 1) {
+ throw new LastAdminInGroupException();
+ }
+ sn.removeAdmin(group);
+ sn.addCollaborator(group);
+ } else {
+ throw new DefaultException("Person/Group is not an admin");
}
+ }
- @Override
- public void setCollabAsAdmin(final User userLogged, final Group group, final Group inGroup) throws DefaultException {
- final SocialNetwork sn = inGroup.getSocialNetwork();
- checkUserLoggedIsAdmin(userLogged, sn);
- if (sn.isCollab(group)) {
- sn.removeCollaborator(group);
- sn.addAdmin(group);
- } else {
- throw new DefaultException("Person/Group is not a collaborator");
- }
+ @Override
+ public void setCollabAsAdmin(final User userLogged, final Group group, final Group inGroup)
+ throws DefaultException {
+ final SocialNetwork sn = inGroup.getSocialNetwork();
+ checkUserLoggedIsAdmin(userLogged, sn);
+ if (sn.isCollab(group)) {
+ sn.removeCollaborator(group);
+ sn.addAdmin(group);
+ } else {
+ throw new DefaultException("Person/Group is not a collaborator");
}
+ }
- private void throwGroupMemberException(final Group group) throws DefaultException {
- if (group.isPersonal()) {
- throw new AlreadyUserMemberException();
- } else {
- throw new AlreadyGroupMemberException();
- }
+ private void throwGroupMemberException(final Group group) throws DefaultException {
+ if (group.isPersonal()) {
+ throw new AlreadyUserMemberException();
+ } else {
+ throw new AlreadyGroupMemberException();
}
+ }
- @Override
- public void unJoinGroup(final Group groupToUnJoin, final Group inGroup) throws DefaultException {
- final SocialNetwork sn = inGroup.getSocialNetwork();
+ @Override
+ public void unJoinGroup(final Group groupToUnJoin, final Group inGroup) throws DefaultException {
+ final SocialNetwork sn = inGroup.getSocialNetwork();
- if (sn.isAdmin(groupToUnJoin)) {
- if (sn.getAccessLists().getAdmins().getList().size() == 1) {
- if (sn.getAccessLists().getEditors().getList().size() > 0) {
- throw new LastAdminInGroupException();
- } else {
- inGroup.setGroupType(GroupType.ORPHANED_PROJECT);
- inGroup.setAdmissionType(AdmissionType.Open);
- }
- }
- sn.removeAdmin(groupToUnJoin);
- } else if (sn.isCollab(groupToUnJoin)) {
- sn.removeCollaborator(groupToUnJoin);
+ if (sn.isAdmin(groupToUnJoin)) {
+ if (sn.getAccessLists().getAdmins().getList().size() == 1) {
+ if (sn.getAccessLists().getEditors().getList().size() > 0) {
+ throw new LastAdminInGroupException();
} else {
- throw new DefaultException("Person/Group is not a collaborator");
+ inGroup.setGroupType(GroupType.ORPHANED_PROJECT);
+ inGroup.setAdmissionType(AdmissionType.Open);
}
+ }
+ sn.removeAdmin(groupToUnJoin);
+ } else if (sn.isCollab(groupToUnJoin)) {
+ sn.removeCollaborator(groupToUnJoin);
+ } else {
+ throw new DefaultException("Person/Group is not a collaborator");
}
+ }
}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/GroupType.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/GroupType.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/core/shared/dto/GroupType.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -22,5 +22,5 @@
import com.google.gwt.user.client.rpc.IsSerializable;
public enum GroupType implements IsSerializable {
- ORGANIZATION, COMMUNITY, PROJECT, ORPHANED_PROJECT, PERSONAL
+ CLOSED, COMMUNITY, ORGANIZATION, ORPHANED_PROJECT, PERSONAL, PROJECT
}
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -75,7 +75,7 @@
stateManager.setRetrievedStateAndGo(state);
NotifyUser.hideProgress();
NotifyUser.info(i18n.tWithNT("[%s] created", "New folder created, for instance", newName));
- folderViewer.blinkTitle();
+ folderViewer.highlightTitle();
}
});
cache.removeContent(session.getCurrentStateToken());
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -78,7 +78,7 @@
stateManager.setRetrievedStateAndGo(state);
NotifyUser.hideProgress();
NotifyUser.info(i18n.tWithNT("[%s] created", "New folder created, for instance", newName));
- folderViewer.blinkTitle();
+ folderViewer.highlightTitle();
}
});
cache.removeContent(session.getCurrentStateToken());
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -70,8 +70,8 @@
}
@Override
- public void blinkTitle() {
- contentTitle.blink();
+ public void highlightTitle() {
+ contentTitle.highlightTitle();
}
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentTitleWidget.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentTitleWidget.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentTitleWidget.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -53,10 +53,6 @@
initWidget(flow);
}
- public void blink() {
- editableTitle.blink();
- }
-
public void edit() {
editableTitle.edit();
}
@@ -65,6 +61,10 @@
return editableTitle;
}
+ public void highlightTitle() {
+ editableTitle.highlightTitle();
+ }
+
public void setText(final String text) {
editableTitle.setText(text);
}
@@ -83,7 +83,7 @@
titleIcon.setVisible(hasIcon);
editableTitle.setText(title);
if (editable) {
- editableTitle.setTooltip(i18n.t("Click to edit"));
+ editableTitle.setTooltip(i18n.t("Click to rename"));
} else {
editableTitle.setTooltip("");
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -125,7 +125,7 @@
@Override
public void blinkTitle() {
- contentTitle.blink();
+ contentTitle.highlightTitle();
}
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -81,7 +81,7 @@
void attach();
- void blinkTitle();
+ void highlightTitle();
void clear();
@@ -176,8 +176,8 @@
}
}
- public void blinkTitle() {
- getView().blinkTitle();
+ public void highlightTitle() {
+ getView().highlightTitle();
}
String calculateStyle(final int pos, final int length) {
Modified: trunk/src/main/webapp/others/kune-client-actions.xml
===================================================================
--- trunk/src/main/webapp/others/kune-client-actions.xml 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/main/webapp/others/kune-client-actions.xml 2011-07-09 20:52:00 UTC (rev 1443)
@@ -14,10 +14,10 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>Quick Notify</name>
- <installerUrl>http://code.google.com/p/wave-projects/source/browse/gadgets/wave-quick-notify-installer.xml
+ <installerUrl>http://code.google.com/p/wave-projects/source/browse/gadgets/wave-quick-notify-installer.xml
</installerUrl>
<gadgetUrl>http://wave-projects.googlecode.com/hg/gadgets/wave-quick-notify.xml
</gadgetUrl>
@@ -25,10 +25,10 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>tasklistbot</name>
- <installerUrl>http://tasklistbot.appspot.com/TaskList.xml
+ <installerUrl>http://tasklistbot.appspot.com/TaskList.xml
</installerUrl>
<gadgetUrl>http://everybodywave.appspot.com/gadget/foobar/main.xml
</gadgetUrl>
@@ -39,7 +39,7 @@
<extension>
<name>Yes/No/Mini</name>
- <installerUrl>http://mysite.verizon.net/zmyaro/mystuff/wave/ynmini.xml
+ <installerUrl>http://mysite.verizon.net/zmyaro/mystuff/wave/ynmini.xml
</installerUrl>
<gadgetUrl>http://mysite.verizon.net/zmyaro/projects/wave/gadgets/ynmini.xml
</gadgetUrl>
@@ -47,10 +47,10 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>Yes/No/Maybe/+</name>
- <installerUrl>http://everybodywave.appspot.com/gadget/foobar/xt.xml
+ <installerUrl>http://everybodywave.appspot.com/gadget/foobar/xt.xml
</installerUrl>
<gadgetUrl>http://everybodywave.appspot.com/gadget/foobar/main.xml
</gadgetUrl>
@@ -58,10 +58,10 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>Shorten URL with goo.gl</name>
- <installerUrl>http://haru1ban-wave.googlecode.com/svn/trunk/goo_gl/manifest.xml
+ <installerUrl>http://haru1ban-wave.googlecode.com/svn/trunk/goo_gl/manifest.xml
</installerUrl>
<gadgetUrl>http://haru1ban-wave.googlecode.com/svn/trunk/goo_gl/goo_gl.xml
</gadgetUrl>
@@ -69,10 +69,10 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>Poll</name>
- <installerUrl>http://wave.samuirai.de/install_poll.xml
+ <installerUrl>http://wave.samuirai.de/install_poll.xml
</installerUrl>
<gadgetUrl>http://wave.samuirai.de/poll.xml
</gadgetUrl>
@@ -80,10 +80,10 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>TaskToDo</name>
- <installerUrl>http://www.voizle.com/ToDoInstaller.xml
+ <installerUrl>http://www.voizle.com/ToDoInstaller.xml
</installerUrl>
<gadgetUrl>http://www.voizle.com/ToDo.xml
</gadgetUrl>
@@ -94,7 +94,7 @@
<extension>
<name>Picasa Gadget</name>
- <installerUrl>http://wave-picasa.googlecode.com/svn/trunk/manifest_wave_picasa.xml
+ <installerUrl>http://wave-picasa.googlecode.com/svn/trunk/manifest_wave_picasa.xml
</installerUrl>
<gadgetUrl>http://wave-picasa.googlecode.com/svn/trunk/picasa.xml
</gadgetUrl>
@@ -102,10 +102,10 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>Map</name>
- <installerUrl>http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/mappy/installer.xml
+ <installerUrl>http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/mappy/installer.xml
</installerUrl>
<gadgetUrl>http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/gadgets/mappy/map_v2.xml
</gadgetUrl>
@@ -113,10 +113,10 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>MindMap</name>
- <installerUrl>http://cactus-wave.appspot.com/mindmap.xml
+ <installerUrl>http://cactus-wave.appspot.com/mindmap.xml
</installerUrl>
<gadgetUrl>http://cactus-wave.appspot.com/net.brucecooper.mindmapgadget.MindMapGadget/net.brucecooper.mindmapgadget.client.MindMapGadget.gadget.xml
</gadgetUrl>
@@ -135,7 +135,7 @@
</iconUrl>
<iconCss></iconCss>
</extension>
-
+
<extension>
<name>waffle</name>
<installerUrl>http://www.waffle.dk/install.xml
@@ -186,12 +186,14 @@
<guiActionDescriptors>
- <guiActionDescriptor>
+ <guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>Map</extensionName>
<name>New Map</name>
<path>Gadget»Media</path>
- <description>Collaborate on a map of placemarks, paths, and shapes with other participants. Great for planning events and trips.</description>
+ <description>Collaborate on a map of placemarks, paths, and shapes
+ with other participants. Great for planning events and trips.
+ </description>
<new-content-title>New Map</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
@@ -209,7 +211,7 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>Picasa Gadget</extensionName>
@@ -233,13 +235,14 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>TaskToDo</extensionName>
<name>New To-Do list</name>
<path>Gadget»Tasks</path>
- <description>Make your To-Do list and mark your progress.</description>
+ <description>Make your To-Do list and mark your progress.
+ </description>
<new-content-title>New To-Do list</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
@@ -257,13 +260,14 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>Shorten URL with goo.gl</extensionName>
<name>New Shorten URL</name>
<path>Gadget»Links</path>
- <description>Shorten url with goo.gl, the new Google url shortener.(http://goo.gl/)</description>
+ <description>Shorten url with goo.gl, the new Google url
+ shortener.(http://goo.gl/)</description>
<new-content-title>New Shorten URL</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
@@ -281,14 +285,16 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
-
+
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>Poll</extensionName>
<name>New Advanced Poll</name>
<path>Gadget»Voting</path>
- <description>You can add a poll to your Wave. Accordingly you can embed the result with the Google Chart API into your Wave.</description>
+ <description>You can add a poll to your Wave. Accordingly you can
+ embed the result with the Google Chart API into your Wave.
+ </description>
<new-content-title>New Advanced Poll</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
@@ -306,14 +312,15 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
-
+
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>Yes/No/Maybe/+</extensionName>
<name>New Yes/No/Maybe/+ Voting</name>
<path>Gadget»Voting</path>
- <description>Same as Google's Yes/No/Maybe, only you can edit the titles and add new ones.</description>
+ <description>Same as Google's Yes/No/Maybe, only you can edit the
+ titles and add new ones.</description>
<new-content-title>New Yes/No/Maybe/+ Voting</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
@@ -331,13 +338,14 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>Yes/No/Mini</extensionName>
<name>New Yes/no/Mini Voting</name>
<path>Gadget»Voting</path>
- <description>A miniature version of the Yes/No/Maybe gadget.</description>
+ <description>A miniature version of the Yes/No/Maybe gadget.
+ </description>
<new-content-title>New Yes/no/Mini Voting</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
@@ -355,7 +363,7 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>tasklistbot</extensionName>
@@ -379,13 +387,14 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>Quick Notify</extensionName>
<name>New Notification</name>
<path>Gadget»Organization</path>
- <description>Quickly send a short email with a custom message to all participants.</description>
+ <description>Quickly send a short email with a custom message to
+ all participants.</description>
<new-content-title>New Notification</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
@@ -403,14 +412,15 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
-
+
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>MindMap</extensionName>
<name>New MindMap</name>
<path>Gadget»Organization</path>
- <description>Collaborate using a hierarchical mind map.</description>
+ <description>Collaborate using a hierarchical mind map.
+ </description>
<new-content-title>New MindMap</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
@@ -428,13 +438,14 @@
used yet) -->
<participants>ask</participants>
</guiActionDescriptor>
-
+
<guiActionDescriptor>
<type>wave-gadget</type>
<extensionName>Image</extensionName>
<name>New Image</name>
<path>Gadget»Media</path>
- <description>Lets you insert, resize and annotate any image from the web.</description>
+ <description>Lets you insert, resize and annotate any image from
+ the web.</description>
<new-content-title>New image</new-content-title>
<new-content-textintro></new-content-textintro>
<enabled>true</enabled>
Modified: trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java 2011-07-09 16:44:34 UTC (rev 1442)
+++ trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java 2011-07-09 20:52:00 UTC (rev 1443)
@@ -30,6 +30,7 @@
import cc.kune.core.server.integration.IntegrationTest;
import cc.kune.core.server.integration.IntegrationTestHelper;
import cc.kune.core.shared.domain.AdmissionType;
+import cc.kune.core.shared.domain.GroupListMode;
import cc.kune.core.shared.dto.GroupDTO;
import cc.kune.core.shared.dto.GroupType;
import cc.kune.core.shared.dto.LicenseDTO;
@@ -40,108 +41,134 @@
public class GroupServiceTest extends IntegrationTest {
- @Inject
- GroupFinder groupFinder;
+ @Inject
+ GroupFinder groupFinder;
- @Inject
- GroupService service;
+ @Inject
+ GroupService service;
- @Inject
- UserSession session;
+ @Inject
+ UserSession session;
- @Test
- public void createCommunity() throws Exception {
- doLogin();
+ @Test
+ public void createClosed() throws Exception {
+ doLogin();
- final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", GroupType.COMMUNITY);
+ final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative",
+ GroupType.CLOSED);
- final LicenseDTO license = new LicenseDTO();
- license.setShortName("by-sa-v3.0");
- group.setDefaultLicense(license);
- service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
+ final LicenseDTO license = new LicenseDTO();
+ license.setShortName("by-sa-v3.0");
+ group.setDefaultLicense(license);
+ service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
- final Group groupCreated = groupFinder.findByShortName("ysei");
- assertEquals(groupCreated.getShortName(), group.getShortName());
- assertEquals(groupCreated.getLongName(), group.getLongName());
+ final Group groupCreated = groupFinder.findByShortName("ysei");
+ assertEquals(groupCreated.getShortName(), group.getShortName());
+ assertEquals(groupCreated.getLongName(), group.getLongName());
+ assertEquals(groupCreated.getAdmissionType(), AdmissionType.Closed);
+ assertEquals(groupCreated.getGroupType(), GroupType.CLOSED);
+ assertEquals(GroupListMode.NORMAL,
+ groupCreated.getSocialNetwork().getAccessLists().getViewers().getMode());
+ }
- assertEquals(groupCreated.getAdmissionType(), AdmissionType.Open);
- assertEquals(groupCreated.getGroupType(), GroupType.COMMUNITY);
- }
+ @Test
+ public void createCommunity() throws Exception {
+ doLogin();
- @Test(expected = Exception.class)
- public void createGroupNotLogged() throws Exception {
- final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", GroupType.PROJECT);
- service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
- }
+ final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative",
+ GroupType.COMMUNITY);
- @Test(expected = UserMustBeLoggedException.class)
- public void createGroupNullUserHash() throws Exception {
- doLogin();
- final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", GroupType.PROJECT);
- service.createNewGroup(null, group, "Public desc", "tag1 tag2", null);
- }
+ final LicenseDTO license = new LicenseDTO();
+ license.setShortName("by-sa-v3.0");
+ group.setDefaultLicense(license);
+ service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
- @Test
- public void createGroupUserLogged() throws Exception {
- doLogin();
+ final Group groupCreated = groupFinder.findByShortName("ysei");
+ assertEquals(groupCreated.getShortName(), group.getShortName());
+ assertEquals(groupCreated.getLongName(), group.getLongName());
- final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", GroupType.PROJECT);
+ assertEquals(groupCreated.getAdmissionType(), AdmissionType.Open);
+ assertEquals(groupCreated.getGroupType(), GroupType.COMMUNITY);
+ }
- final LicenseDTO license = new LicenseDTO();
- license.setShortName("by-sa-v3.0");
- group.setDefaultLicense(license);
- service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
+ @Test(expected = Exception.class)
+ public void createGroupNotLogged() throws Exception {
+ final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative",
+ GroupType.PROJECT);
+ service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
+ }
- final Group groupCreated = groupFinder.findByShortName("ysei");
- assertEquals(groupCreated.getShortName(), group.getShortName());
- assertEquals(groupCreated.getLongName(), group.getLongName());
+ @Test(expected = UserMustBeLoggedException.class)
+ public void createGroupNullUserHash() throws Exception {
+ doLogin();
+ final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative",
+ GroupType.PROJECT);
+ service.createNewGroup(null, group, "Public desc", "tag1 tag2", null);
+ }
- assertEquals(groupCreated.getAdmissionType(), AdmissionType.Moderated);
- assertEquals(groupCreated.getGroupType(), GroupType.PROJECT);
- }
+ @Test
+ public void createGroupUserLogged() throws Exception {
+ doLogin();
- @Test
- public void createOrganization() throws Exception {
- doLogin();
+ final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative",
+ GroupType.PROJECT);
- final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative", GroupType.ORGANIZATION);
+ final LicenseDTO license = new LicenseDTO();
+ license.setShortName("by-sa-v3.0");
+ group.setDefaultLicense(license);
+ service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
- final LicenseDTO license = new LicenseDTO();
- license.setShortName("by-sa-v3.0");
- group.setDefaultLicense(license);
- service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
+ final Group groupCreated = groupFinder.findByShortName("ysei");
+ assertEquals(groupCreated.getShortName(), group.getShortName());
+ assertEquals(groupCreated.getLongName(), group.getLongName());
- final Group groupCreated = groupFinder.findByShortName("ysei");
- assertEquals(groupCreated.getShortName(), group.getShortName());
- assertEquals(groupCreated.getLongName(), group.getLongName());
- assertEquals(groupCreated.getAdmissionType(), AdmissionType.Moderated);
- assertEquals(groupCreated.getGroupType(), GroupType.ORGANIZATION);
- }
+ assertEquals(groupCreated.getAdmissionType(), AdmissionType.Moderated);
+ assertEquals(groupCreated.getGroupType(), GroupType.PROJECT);
+ }
- @Test
- public void createOrphanedProject() throws Exception {
- doLogin();
+ @Test
+ public void createOrganization() throws Exception {
+ doLogin();
- final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative",
- GroupType.ORPHANED_PROJECT);
+ final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative",
+ GroupType.ORGANIZATION);
- final LicenseDTO license = new LicenseDTO();
- license.setShortName("by-sa-v3.0");
- group.setDefaultLicense(license);
- service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
+ final LicenseDTO license = new LicenseDTO();
+ license.setShortName("by-sa-v3.0");
+ group.setDefaultLicense(license);
+ service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
- final Group groupCreated = groupFinder.findByShortName("ysei");
- assertEquals(groupCreated.getShortName(), group.getShortName());
- assertEquals(groupCreated.getLongName(), group.getLongName());
- assertEquals(groupCreated.getAdmissionType(), AdmissionType.Open);
- assertEquals(groupCreated.getGroupType(), GroupType.ORPHANED_PROJECT);
- assertEquals(0, groupCreated.getSocialNetwork().getAccessLists().getAdmins().getList().size());
- assertEquals(0, groupCreated.getSocialNetwork().getAccessLists().getEditors().getList().size());
- }
+ final Group groupCreated = groupFinder.findByShortName("ysei");
+ assertEquals(groupCreated.getShortName(), group.getShortName());
+ assertEquals(groupCreated.getLongName(), group.getLongName());
+ assertEquals(groupCreated.getAdmissionType(), AdmissionType.Moderated);
+ assertEquals(groupCreated.getGroupType(), GroupType.ORGANIZATION);
+ }
- @Before
- public void init() {
- new IntegrationTestHelper(this);
- }
+ @Test
+ public void createOrphanedProject() throws Exception {
+ doLogin();
+ final GroupDTO group = new GroupDTO("ysei", "Yellow Submarine Environmental Initiative",
+ GroupType.ORPHANED_PROJECT);
+
+ final LicenseDTO license = new LicenseDTO();
+ license.setShortName("by-sa-v3.0");
+ group.setDefaultLicense(license);
+ service.createNewGroup(session.getHash(), group, "Public desc", "tag1 tag2", null);
+
+ final Group groupCreated = groupFinder.findByShortName("ysei");
+ assertEquals(groupCreated.getShortName(), group.getShortName());
+ assertEquals(groupCreated.getLongName(), group.getLongName());
+ assertEquals(groupCreated.getAdmissionType(), AdmissionType.Open);
+ assertEquals(groupCreated.getGroupType(), GroupType.ORPHANED_PROJECT);
+ assertEquals(0, groupCreated.getSocialNetwork().getAccessLists().getAdmins().getList().size());
+ assertEquals(0, groupCreated.getSocialNetwork().getAccessLists().getEditors().getList().size());
+ }
+
+ @Before
+ public void init() {
+ new IntegrationTestHelper(this);
+ }
+
}
More information about the kune-commits
mailing list