Added getBaseLayout method for Organizations

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/custom-portal-handler@96391 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-06-03 13:03:27 +00:00
parent b138d0ae37
commit de284a421c
3 changed files with 48 additions and 1 deletions

View File

@ -18,4 +18,8 @@
date="2014-04-02">
<Change>Added getAdministratorUsername method in ScopeHelper</Change>
</Changeset>
<Changeset component="org.gcube.portal.custom-portal-handler.1-6-0"
date="2014-06-03">
<Change>Added getBaseLayout method for Organizations</Change>
</Changeset>
</ReleaseNotes>

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<version>1.5.0-SNAPSHOT</version>
<version>1.6.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Custom Portal Handler</name>
<description>

View File

@ -10,7 +10,11 @@ import java.io.InputStream;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.portal.custom.communitymanager.OrganizationManager;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.communitymanager.PortletsIdManager;
import org.gcube.portal.custom.communitymanager.components.GCUBELayoutTab;
import org.gcube.portal.custom.communitymanager.components.GCUBEPortlet;
import org.gcube.portal.custom.communitymanager.components.GCUBESiteLayout;
import org.gcube.portal.custom.communitymanager.types.GCUBELayoutType;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.RoleManager;
import org.gcube.vomanagement.usermanagement.UserManager;
@ -19,6 +23,8 @@ import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayRoleManager;
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
import org.gcube.vomanagement.usermanagement.model.GroupModel;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.model.Group;
@ -200,6 +206,43 @@ public class OrganizationManagerImpl extends OrganizationsUtil implements Organi
_log.info("Created" + voName + " with id " + voToCreate.getOrganizationId());
return voToCreate.getOrganizationId();
}
/**
*
* @return the built layout of a rootVO
* @throws SystemException .
* @throws PortalException .
*/
public GCUBESiteLayout getBaseLayout(String voName, OrganizationManagerImpl orgManager, boolean isVO, String username) throws PortalException, SystemException {
GCUBESiteLayout siteLayout = null;
String email = validateUser(username).getEmailAddress();
siteLayout = new GCUBESiteLayout(OrganizationManagerImpl.getCompany(), voName, email);
siteLayout.addTab(new GCUBELayoutTab(voName, GCUBELayoutType.ONE_COL,
new GCUBEPortlet("gCube Loggedin", PortletsIdManager.getLRPortletId(PortletsIdManager.GCUBE_LOGGEDIN))));
//create tab Users and Roles with 2 subtabs
GCUBELayoutTab usersAndRoles = new GCUBELayoutTab("Administration", GCUBELayoutType.ONE_COL,
new GCUBEPortlet("Navigation", PortletsIdManager.getLRPortletId(PortletsIdManager.LR_NAVIGATION)));
GCUBELayoutTab usersTab = new GCUBELayoutTab("Manage User and Requests", GCUBELayoutType.ONE_COL,
new GCUBEPortlet("Users", PortletsIdManager.getLRPortletId(PortletsIdManager.GCUBE_USERS_MANAGE)));
GCUBELayoutTab usersAddTab = new GCUBELayoutTab("Add new Users", GCUBELayoutType.ONE_COL,
new GCUBEPortlet("Users", PortletsIdManager.getLRPortletId(PortletsIdManager.GCUBE_ADD_USERS_MANAGE)));
GCUBELayoutTab rolesTab = new GCUBELayoutTab("Add new Roles", GCUBELayoutType.ONE_COL,
new GCUBEPortlet("Roles", PortletsIdManager.getLRPortletId(PortletsIdManager.GCUBE_ROLES_MANAGE)));
usersAndRoles.addSubTab(usersTab);
usersAndRoles.addSubTab(usersAddTab);
usersAndRoles.addSubTab(rolesTab);
//add the tab
siteLayout.addTab(usersAndRoles);
if (isVO)
siteLayout.addTab(new GCUBELayoutTab("Resources Management", GCUBELayoutType.ONE_COL,
new GCUBEPortlet("Resources Management", PortletsIdManager.getLRPortletId(PortletsIdManager.RESOURCES_MANAGEMENT))));
else
siteLayout.addTab(new GCUBELayoutTab("Calendar", GCUBELayoutType.ONE_COL,
new GCUBEPortlet("Calendar", PortletsIdManager.getLRPortletId(PortletsIdManager.LR_CALENDAR)), true));
return siteLayout;
}
/***
* simple helper method