Author: mputz
Date: 2015-01-09 05:45:42 -0500 (Fri, 09 Jan 2015)
New Revision: 9331
Modified:
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
Log:
Backport fixes related to GTNPORTAL-3110
Modified:
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java 2015-01-09
10:00:30 UTC (rev 9330)
+++
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java 2015-01-09
10:45:42 UTC (rev 9331)
@@ -25,6 +25,7 @@
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
+import org.picketlink.idm.api.IdentitySession;
import javax.transaction.Status;
import javax.transaction.UserTransaction;
@@ -71,4 +72,8 @@
orgService.recoverFromIDMError();
}
}
+
+ protected IdentitySession getIdentitySession() throws Exception {
+ return service_.getIdentitySession();
+ }
}
Modified:
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2015-01-09
10:00:30 UTC (rev 9330)
+++
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2015-01-09
10:45:42 UTC (rev 9331)
@@ -1090,11 +1090,6 @@
return jbidGroup;
}
- private IdentitySession getIdentitySession() throws Exception
- {
- return service_.getIdentitySession();
- }
-
private IntegrationCache getIntegrationCache()
{
// TODO: refactor to remove cast. For now to avoid adding new config option and
share existing cache instannce
Modified:
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2015-01-09
10:00:30 UTC (rev 9330)
+++
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2015-01-09
10:45:42 UTC (rev 9331)
@@ -1026,11 +1026,6 @@
}
}
- private IdentitySession getIdentitySession() throws Exception
- {
- return service_.getIdentitySession();
- }
-
private String getGroupNameFromId(String groupId)
{
String[] ids = groupId.split("/");
Modified:
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2015-01-09
10:00:30 UTC (rev 9330)
+++
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2015-01-09
10:45:42 UTC (rev 9331)
@@ -112,8 +112,12 @@
preSave(mt, true);
}
- getIdentitySession().getRoleManager().createRoleType(mt.getName());
-
+ try {
+ getIdentitySession().getRoleManager().createRoleType(mt.getName());
+ } catch (Exception e) {
+ handleException("Error when creating Membership", e);
+ }
+
if (broadcast)
{
postSave(mt, true);
@@ -171,7 +175,12 @@
);
}
- RoleType rt = getIdentitySession().getRoleManager().getRoleType(name);
+ RoleType rt = null;
+ try {
+ rt = getIdentitySession().getRoleManager().getRoleType(name);
+ } catch (Exception e) {
+ handleException("Identity error when finding membership type " +
name, e);
+ }
MembershipType mt = null;
@@ -219,8 +228,12 @@
preDelete(mt);
}
- getIdentitySession().getRoleManager().removeRoleType(mt.getName());
-
+ try {
+ getIdentitySession().getRoleManager().removeRoleType(mt.getName());
+ } catch (Exception e) {
+ handleException("Error occured when removing membership type",
e);
+ }
+
if (broadcast)
{
postDelete(mt);
@@ -244,8 +257,14 @@
);
}
- Collection<RoleType> rts =
getIdentitySession().getRoleManager().findRoleTypes();
-
+ Collection<RoleType> rts;
+ try {
+ rts = getIdentitySession().getRoleManager().findRoleTypes();
+ } catch (Exception e) {
+ handleException("Exception occured when looking for membership
types", e);
+ rts = new LinkedList<RoleType>();
+ }
+
List<MembershipType> mts = new LinkedList<MembershipType>();
for (RoleType rt : rts)
@@ -268,16 +287,15 @@
return mts;
}
- private IdentitySession getIdentitySession() throws Exception
- {
- return service_.getIdentitySession();
- }
+ private void updateMembershipType(MembershipType mt) throws Exception {
+ RoleType rt;
+ try {
+ rt = getIdentitySession().getRoleManager().getRoleType(mt.getName());
+ } catch (Exception e) {
+ handleException("Exception occured when finding role type", e);
+ return;
+ }
- private void updateMembershipType(MembershipType mt) throws Exception
- {
-
- RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName());
-
Map<String, String> props = new HashMap<String, String>();
props.put(MEMBERSHIP_DESCRIPTION, mt.getDescription());
@@ -286,7 +304,11 @@
.put(MEMBERSHIP_MODIFIED_DATE, mt.getModifiedDate() == null ? null :
"" + mt.getModifiedDate().getTime());
props.put(MEMBERSHIP_OWNER, mt.getOwner());
- getIdentitySession().getRoleManager().setProperties(rt, props);
+ try {
+ getIdentitySession().getRoleManager().setProperties(rt, props);
+ } catch (Exception e) {
+ handleException("Exception when updating membership type", e);
+ }
return;
@@ -294,10 +316,15 @@
private void populateMembershipType(MembershipType mt) throws Exception
{
- RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName());
+ Map<String, String> props;
+ try {
+ RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName());
+ props = getIdentitySession().getRoleManager().getProperties(rt);
+ } catch (Exception e) {
+ handleException("Identity error occured when populating membership
type", e);
+ return;
+ }
- Map<String, String> props =
getIdentitySession().getRoleManager().getProperties(rt);
-
mt.setDescription(props.get(MEMBERSHIP_DESCRIPTION));
mt.setOwner(props.get(MEMBERSHIP_OWNER));
Modified:
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2015-01-09
10:00:30 UTC (rev 9330)
+++
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2015-01-09
10:45:42 UTC (rev 9331)
@@ -157,7 +157,7 @@
session.getPersistenceManager().createUser(user.getUserName());
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Identity operation error: ", e);
@@ -233,7 +233,7 @@
foundUser = session.getPersistenceManager().findUser(userName);
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Cannot obtain user: " + userName + "; ",
e);
@@ -267,7 +267,7 @@
{
session.getPersistenceManager().removeUser(foundUser, true);
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Cannot remove user: " + userName + "; ",
e);
@@ -608,7 +608,7 @@
plUser = session.getAttributesManager().findUserByUniqueAttribute(USER_EMAIL,
email);
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Cannot find user by email: " + email + ";
", e );
@@ -766,7 +766,7 @@
{
am.updatePassword(session.getPersistenceManager().findUser(user.getUserName()),
user.getPassword());
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Cannot update password: " + user.getUserName()
+ "; ", e);
@@ -781,7 +781,7 @@
{
am.updateAttributes(user.getUserName(), attrs);
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Cannot update attributes for user: " +
user.getUserName() + "; ", e);
@@ -799,7 +799,7 @@
{
u = session.getPersistenceManager().findUser(userName);
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Cannot obtain user: " + userName + "; ",
e);
@@ -830,7 +830,7 @@
{
attrs = am.getAttributes(new SimpleUser(user.getUserName()));
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Cannot obtain attributes for user: " +
user.getUserName() + "; ", e);
@@ -957,7 +957,7 @@
am.removeAttributes(user.getUserName(), new String[] { USER_DISPLAY_NAME });
}
}
- catch (IdentityException e)
+ catch (Exception e)
{
handleException("Cannot remove displayName attribute of user: " +
user.getUserName() + "; ", e);
}
Modified:
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2015-01-09
10:00:30 UTC (rev 9330)
+++
epp/portal/branches/EPP_5_2_2_GA_BZ1180232/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2015-01-09
10:45:42 UTC (rev 9331)
@@ -337,8 +337,4 @@
}
}
- private IdentitySession getIdentitySession() throws Exception
- {
- return service_.getIdentitySession();
- }
}