added methos for getting setting Sites Custom Attributes

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@125626 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-03-17 14:19:34 +00:00
parent 5a6d648905
commit 9a646d8ac5
2 changed files with 53 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package org.gcube.vomanagement.usermanagement;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@ -159,5 +160,19 @@ public interface GroupManager {
* @throws GroupRetrievalFault
*/
Boolean isVRE(long groupId) throws UserManagementSystemException, GroupRetrievalFault;
/**
*
* @param groupId the LR groupId
* @param attributeKey the name of the attribute you want to read its value
* @return the attributeKey value if existing, null otherwise
*/
Serializable readCustomAttr(long groupId, String attributeKey) throws GroupRetrievalFault;
/**
*
* @param groupId
* @param attributeKey the name of the attribute you want to save
* @param value the value
* @throws GroupRetrievalFault
*/
void saveCustomAttr(long groupId, String attributeKey, Serializable value) throws GroupRetrievalFault;
}

View File

@ -1,5 +1,6 @@
package org.gcube.vomanagement.usermanagement.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -102,7 +103,7 @@ public class LiferayGroupManager implements GroupManager {
}
return group;
}
@Override
public GCubeGroup createRootVO(String rootVOName, String description) throws UserManagementNameException, UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault, UserManagementPortalException {
Group group = null;
@ -120,8 +121,8 @@ public class LiferayGroupManager implements GroupManager {
}
@Override
public GCubeGroup createVO(String virtualOrgName, long rootVOGroupId, String description) throws UserManagementNameException,
UserManagementSystemException, UserRetrievalFault,
GroupRetrievalFault, UserManagementPortalException {
UserManagementSystemException, UserRetrievalFault,
GroupRetrievalFault, UserManagementPortalException {
Group group = null;
try {
group = createGroup(virtualOrgName, description, rootVOGroupId);
@ -136,8 +137,8 @@ public class LiferayGroupManager implements GroupManager {
}
@Override
public GCubeGroup createVRE(String virtualResearchEnvName, long virtualOrgGroupId, String description) throws UserManagementNameException,
UserManagementSystemException, UserRetrievalFault,
GroupRetrievalFault, UserManagementPortalException {
UserManagementSystemException, UserRetrievalFault,
GroupRetrievalFault, UserManagementPortalException {
Group group = null;
try {
group = createGroup(virtualResearchEnvName, description, virtualOrgGroupId);
@ -361,6 +362,37 @@ public class LiferayGroupManager implements GroupManager {
public String getScope(long groupId) throws UserManagementSystemException, GroupRetrievalFault {
return getInfrastructureScope(groupId);
}
/**
* {@inheritDoc}
*/
@Override
public Serializable readCustomAttr(long groupId, String attributeKey) throws GroupRetrievalFault {
try {
Group g = GroupLocalServiceUtil.getGroup(groupId);
if (g.getExpandoBridge().hasAttribute(attributeKey)) {
g.getExpandoBridge().getAttribute(attributeKey);
} else
return null;
} catch (PortalException e1) {
throw new GroupRetrievalFault("Group not existing (I think you better check)", e1);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}/**
* {@inheritDoc}
*/
@Override
public void saveCustomAttr(long groupId, String attributeKey, Serializable value) throws GroupRetrievalFault {
try {
Group g = GroupLocalServiceUtil.getGroup(groupId);
g.getExpandoBridge().setAttribute(attributeKey, value);
} catch (PortalException e1) {
throw new GroupRetrievalFault("Group not existing (I think you better check)", e1);
} catch (Exception e) {
e.printStackTrace();
}
}
}