Author: thanh_tung_do
Date: 2010-06-09 07:04:13 -0400 (Wed, 09 Jun 2010)
New Revision: 3277
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java
Log:
GTNPORTAL-1214: Display exception message if membership was deleted
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java 2010-06-09
09:29:29 UTC (rev 3276)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java 2010-06-09
11:04:13 UTC (rev 3277)
@@ -98,30 +98,31 @@
UIApplication uiApp = event.getRequestContext().getUIApplication();
UIPopupWindow uiPopup = uiForm.getParent();
OrganizationService service =
uiForm.getApplicationComponent(OrganizationService.class);
+
Membership formMembership =
service.getMembershipHandler().findMembership(uiForm.membershipId);
+ if (formMembership == null)
+ {
+ uiApp.addMessage(new
ApplicationMessage("UIGroupEditMembershipForm.msg.membership-delete", null));
+ uiPopup.setUIComponent(null);
+ uiPopup.setShow(false);
+ return;
+ }
String userName = formMembership.getUserName();
Group group = service.getGroupHandler().findGroupById(uiForm.groupId);
User user = service.getUserHandler().findUserByName(userName);
MembershipHandler memberShipHandler = service.getMembershipHandler();
- String memberShipType = uiForm.getUIFormSelectBox(MEMBER_SHIP).getValue();
- try
+ String memberShipTypeStr = uiForm.getUIFormSelectBox(MEMBER_SHIP).getValue();
+ MembershipType membershipType =
service.getMembershipTypeHandler().findMembershipType(memberShipTypeStr);
+ Membership membership =
+ memberShipHandler.findMembershipByUserGroupAndType(userName, group.getId(),
membershipType.getName());
+ if (membership != null)
{
- MembershipType membershipType =
service.getMembershipTypeHandler().findMembershipType(memberShipType);
- Membership membership =
- memberShipHandler.findMembershipByUserGroupAndType(userName,
group.getId(), membershipType.getName());
- if (membership != null)
- {
- uiApp.addMessage(new
ApplicationMessage("UIGroupEditMembershipForm.msg.membership-exist", null));
- return;
- }
- memberShipHandler.removeMembership(uiForm.membershipId, true);
- memberShipHandler.linkMembership(user, group, membershipType, true);
+ uiApp.addMessage(new
ApplicationMessage("UIGroupEditMembershipForm.msg.membership-exist", null));
+ return;
}
- catch (Exception e)
- {
- // membership removed
- uiApp.addMessage(new
ApplicationMessage("UIGroupEditMembershipForm.msg.membership-delete", null));
- }
+ memberShipHandler.removeMembership(uiForm.membershipId, true);
+ memberShipHandler.linkMembership(user, group, membershipType, true);
+
uiPopup.setUIComponent(null);
uiPopup.setShow(false);
}