cleaned up code

This commit is contained in:
Massimiliano Assante 2020-10-09 16:02:56 +02:00
parent bb93810e9d
commit a851ab923c
1 changed files with 4 additions and 36 deletions

View File

@ -1,32 +1,21 @@
package org.gcube.portlets.user.vreyard;
import java.io.IOException;
import java.util.List;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.DetachedREsClient;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.PrefsPropsUtil;
import com.liferay.portal.util.PortalUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.DetachedREsClient;
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.DetachedREsJAXB;
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.GatewayJAXB;
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.VOJAXB;
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.VREJAXB;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.Gateway;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VO;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE;
/**
* Portlet implementation class VreYard
*/
@ -53,33 +42,12 @@ public class VreYard extends MVCPortlet {
String context = PrefsPropsUtil.getString(PortalUtil.getCompanyId(renderRequest), DEFAULT_CONTEXT_PROPERTY);
String token = PrefsPropsUtil.getString(PortalUtil.getCompanyId(renderRequest), DEFAULT_TOKEN_PROPERTY);
ScopeProvider.instance.set(context);
SecurityTokenProvider.instance.set(token);
DetachedREsClient detachedREsClient = new DetachedREsClient();
DetachedREs detachedREs = detachedREsClient.getDetachedREs();
renderRequest.setAttribute("thedetachedREs", detachedREs);
int totalVREDimissed = 0;
for (Gateway gateway : detachedREs.getGateways().values()) {
_log.info("\n\n");
_log.info("Gateway: " + gateway.getName() + " \nDesc:\n" + gateway.getDescription().trim());
int vreDismissedPerGatew = 0;
for (VO vo : gateway.getVos().values()) {
_log.debug("VO: " + vo.getName());
for (VRE vre : vo.getVres().values()) {
_log.info("VRE name: " + vre.getName() + "\ndescription: " + vre.getDescription().trim()
+ "\nVRE catalogue url: " + vre.getCatalogUrl() + " VRE catalog Portlet URL: "
+ vre.getCatalogPortletURL());
vreDismissedPerGatew++;
}
}
_log.info("\n\t\t\t******** VREs dismissed per " + gateway.getName() + " are: "
+ vreDismissedPerGatew);
totalVREDimissed += vreDismissedPerGatew;
}
_log.debug("\n\nTotal VREs dismissed: " + totalVREDimissed);
} catch (Exception e) {
_log.error(e.getLocalizedMessage(), e);