porting of java classes done
This commit is contained in:
parent
8a0c2e0823
commit
c6e827efa3
|
@ -1,10 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="PerformFISH-Apps-portlet">
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="storagehub-client-wrapper-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/storagehub-client-wrapper/storagehub-client-wrapper">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/PerformFISH-Apps/target/classes"/>
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="PerformFISH-Apps-portlet"/>
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
</project-modules>
|
||||
|
|
20
pom.xml
20
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<artifactId>PerformFISH-Apps-portlet</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>PerformFISH-Apps Portlet</name>
|
||||
<version>1.3.2-SNAPSHOT</version>
|
||||
<version>1.4.0-SNAPSHOT</version>
|
||||
<description>
|
||||
PerformFISH Apps is a set of portlet for the implementation of the Form Submission useful to calculate KPIs
|
||||
</description>
|
||||
|
@ -40,22 +40,25 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.0-SNAPSHOT</version>
|
||||
<version>3.6.1-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>storagehub-client-wrapper</artifactId>
|
||||
<version>[1.1.0-SNAPSHOT ,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
<version>1.0.4-4.15.0-162683</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>registry-publisher</artifactId>
|
||||
<version>1.2.9-4.15.0-151412</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
|
@ -65,7 +68,6 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>storagehub-icons-library</artifactId>
|
||||
<version>1.1.1-4.13.1-173244</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
|
@ -85,46 +87,38 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>storagehub-client-library</artifactId>
|
||||
<version>1.0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>storagehub-model</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<version>1.1.0-4.15.0-178670</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<version>2.10.2-4.13.1-164488</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-jcr</artifactId>
|
||||
<version>2.11.5-4.13.1-169333</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-model</artifactId>
|
||||
<version>1.8.1-4.13.1-164481</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-client</artifactId>
|
||||
<version>2.0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>common-authorization</artifactId>
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
|
|
|
@ -3,7 +3,9 @@ package org.gcube.portlets.user.performfish;
|
|||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.portlet.ActionRequest;
|
||||
import javax.portlet.ActionResponse;
|
||||
|
@ -12,9 +14,10 @@ import javax.portlet.PortletRequestDispatcher;
|
|||
import javax.portlet.RenderRequest;
|
||||
import javax.portlet.RenderResponse;
|
||||
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType;
|
||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||
import org.gcube.common.storagehubwrapper.shared.ACLType;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
||||
import org.gcube.portlets.user.performfish.bean.CompanyMember;
|
||||
import org.gcube.portlets.user.performfish.util.Utils;
|
||||
import org.gcube.portlets.user.performfish.util.comparators.CompanyMemberComparator;
|
||||
|
@ -81,11 +84,15 @@ public class AssociateUsersToCompany extends MVCPortlet {
|
|||
GCubeTeam team = rm.getTeam(teamId);
|
||||
WorkspaceFolder wsFolder = Utils.getWSCompanyFolder(currentUsername, context, team);
|
||||
if (wsFolder.isShared()) {
|
||||
Workspace ws = Utils.getWS(currentUsername, context);
|
||||
WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) wsFolder;
|
||||
List<String> usersToShareWith = Arrays.asList(usernamesToAssociateToCompany);
|
||||
Set<String> usersSetToShareWith = new HashSet<>();
|
||||
for (String username : usersSetToShareWith) {
|
||||
usersSetToShareWith.add(username);
|
||||
}
|
||||
_log.info("Sharing with users =>"+usersToShareWith.toString());
|
||||
sharedFolder.share(usersToShareWith);
|
||||
sharedFolder.setACL(usersToShareWith, ACLType.WRITE_ALL);
|
||||
ws.shareFolder(sharedFolder.getId(), usersSetToShareWith, ACLType.WRITE_ALL);
|
||||
for (int i = 0; i < usernamesToAssociateToCompany.length; i++) {
|
||||
_log.info("sharing OK associateing user to team =>"+usernamesToAssociateToCompany[i]);
|
||||
long userId = um.getUserByUsername(usernamesToAssociateToCompany[i]).getUserId();
|
||||
|
|
|
@ -35,19 +35,17 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.homelibary.model.versioning.WorkspaceVersion;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
import org.gcube.common.storagehub.model.service.Version;
|
||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
||||
import org.gcube.portlets.user.performfish.bean.PublishAnonymisedJob;
|
||||
import org.gcube.portlets.user.performfish.bean.SubmittedForm;
|
||||
import org.gcube.portlets.user.performfish.util.ImportedBatchChecker;
|
||||
|
@ -123,10 +121,11 @@ public class CompanyFarmRepository extends MVCPortlet {
|
|||
username,
|
||||
context,
|
||||
theCompany, theFarm);
|
||||
|
||||
List<WorkspaceItem> companyFiles = sharedFolder.getChildren(true);
|
||||
Workspace ws = Utils.getWS(username, context);
|
||||
List<? extends WorkspaceItem> companyFiles = ws.getChildren(sharedFolder.getId(), true);
|
||||
|
||||
Collections.sort(companyFiles, new WSItemComparator());
|
||||
List<ExternalFile> filteredFiles = new ArrayList<>();
|
||||
List<FileItem> filteredFiles = new ArrayList<>();
|
||||
PortletPreferences portletPreferences = request.getPreferences();
|
||||
String selectedPhase = GetterUtil.getString(portletPreferences.getValue(PHASE_PREFERENCE_ATTR_NAME, StringPool.BLANK));
|
||||
_log.debug("selectedPhase: "+selectedPhase);
|
||||
|
@ -137,8 +136,8 @@ public class CompanyFarmRepository extends MVCPortlet {
|
|||
for (WorkspaceItem workspaceItem : companyFiles) {
|
||||
if (workspaceItem.getName().contains(adjustedPhaseName) ||
|
||||
((selectedPhase.compareTo("Grow") == 0) && workspaceItem.getName().contains("Farm Data")) ) {
|
||||
if (workspaceItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) workspaceItem;
|
||||
if (workspaceItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) workspaceItem;
|
||||
filteredFiles.add(file);
|
||||
}
|
||||
}
|
||||
|
@ -146,8 +145,8 @@ public class CompanyFarmRepository extends MVCPortlet {
|
|||
}
|
||||
else {
|
||||
for (WorkspaceItem workspaceItem : companyFiles) {
|
||||
if (workspaceItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) workspaceItem;
|
||||
if (workspaceItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) workspaceItem;
|
||||
filteredFiles.add(file);
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +165,7 @@ public class CompanyFarmRepository extends MVCPortlet {
|
|||
}
|
||||
}
|
||||
|
||||
private List<SubmittedForm> getSubmittedFormPublishAndAnonimStatus(RenderRequest renderRequest, String context, long farmId, List<ExternalFile> filteredFiles) throws Exception {
|
||||
private List<SubmittedForm> getSubmittedFormPublishAndAnonimStatus(RenderRequest renderRequest, String context, long farmId, List<FileItem> filteredFiles) throws Exception {
|
||||
List<SubmittedForm> toReturn = new ArrayList<>();
|
||||
|
||||
String authorizationToken = "";
|
||||
|
@ -222,7 +221,7 @@ public class CompanyFarmRepository extends MVCPortlet {
|
|||
}
|
||||
//
|
||||
StorageHubClient shub = new StorageHubClient();
|
||||
for (ExternalFile externalFile : filteredFiles) {
|
||||
for (FileItem externalFile : filteredFiles) {
|
||||
String publicURL = shub.open(externalFile.getId()).asFile().getPublicLink().toString();
|
||||
PublishAnonymisedJob job = jobs.get(publicURL);
|
||||
if (job != null) {
|
||||
|
@ -248,9 +247,9 @@ public class CompanyFarmRepository extends MVCPortlet {
|
|||
String context = Utils.getCurrentContext(httpReq);
|
||||
Workspace ws = Utils.getWS(currentUser.getUsername(), context) ;
|
||||
WorkspaceItem theItem = ws.getItem(itemId);
|
||||
if (theItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) theItem;
|
||||
List<WorkspaceVersion> versions = file.getVersionHistory();
|
||||
if (theItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) theItem;
|
||||
List<WorkspaceFileVersion> versions = ws.getListVersionsForFile(file.getId());
|
||||
request.setAttribute("versions", versions); //pass to the JSP
|
||||
} else {
|
||||
response.setRenderParameter("jspPage", PFISHConstants.OPERATION_ERROR_PATH);
|
||||
|
@ -296,14 +295,14 @@ public class CompanyFarmRepository extends MVCPortlet {
|
|||
WorkspaceItem theItem;
|
||||
try {
|
||||
theItem = ws.getItem(versionDownloadItemId);
|
||||
if (theItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) theItem;
|
||||
InputStream is = file.downloadVersion(versionDownloadName);
|
||||
if (theItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) theItem;
|
||||
InputStream is = ws.downloadFile(file.getId(), authToken, versionDownloadName, context).getStream();
|
||||
HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(resourceResponse);
|
||||
HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest);
|
||||
ServletResponseUtil.sendFile(httpReq,httpRes, versionDownloadName+"_"+file.getName(), is, "application/download");
|
||||
}
|
||||
} catch (ItemNotFoundException | InternalErrorException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,16 +21,14 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.homelibary.model.versioning.WorkspaceVersion;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
||||
import org.gcube.portlets.user.performfish.bean.Farm;
|
||||
import org.gcube.portlets.user.performfish.util.PFISHConstants;
|
||||
import org.gcube.portlets.user.performfish.util.Utils;
|
||||
|
@ -76,20 +74,21 @@ public class CompanyPrivateRepository extends MVCPortlet {
|
|||
//look for company farms
|
||||
Connection conn = DatabaseConnection.getInstance(Utils.getCurrentContext(groupId)).getConnection();
|
||||
List<Farm> companyFarms = DBUtil.listFarmsByCompanyId(conn, theCompany.getTeamId());
|
||||
LinkedHashMap<Farm, List<ExternalFile>> theFiles = new LinkedHashMap<>();
|
||||
LinkedHashMap<Farm, List<FileItem>> theFiles = new LinkedHashMap<>();
|
||||
for (Farm farm : companyFarms) {
|
||||
GCubeTeam theFarm = rm.getTeam(farm.getFarmId());
|
||||
farm.setName(theFarm.getTeamName());
|
||||
Workspace ws = Utils.getWS(currentUser.getUsername(), currentContext) ;
|
||||
WorkspaceFolder farmFolder = Utils.getWSFarmFolder(
|
||||
currentUser.getUsername(),
|
||||
currentContext,
|
||||
theCompany, theFarm);
|
||||
List<WorkspaceItem> farmItems = farmFolder.getChildren(true);
|
||||
List<? extends WorkspaceItem> farmItems = ws.getChildren(farmFolder.getId(), true);
|
||||
Collections.sort(farmItems, new WSItemComparator());
|
||||
List<ExternalFile> farmFiles = new ArrayList<>();
|
||||
List<FileItem> farmFiles = new ArrayList<>();
|
||||
for (WorkspaceItem workspaceItem : farmItems) {
|
||||
if (workspaceItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) workspaceItem;
|
||||
if (workspaceItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) workspaceItem;
|
||||
farmFiles.add(file);
|
||||
}
|
||||
}
|
||||
|
@ -122,9 +121,9 @@ public class CompanyPrivateRepository extends MVCPortlet {
|
|||
String context = Utils.getCurrentContext(httpReq);
|
||||
Workspace ws = Utils.getWS(currentUser.getUsername(), context) ;
|
||||
WorkspaceItem theItem = ws.getItem(itemId);
|
||||
if (theItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) theItem;
|
||||
List<WorkspaceVersion> versions = file.getVersionHistory();
|
||||
if (theItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) theItem;
|
||||
List<WorkspaceFileVersion> versions = ws.getListVersionsForFile(file.getId());
|
||||
request.setAttribute("versions", versions); //pass to the JSP
|
||||
} else {
|
||||
response.setRenderParameter("jspPage", PFISHConstants.OPERATION_ERROR_PATH);
|
||||
|
@ -143,7 +142,7 @@ public class CompanyPrivateRepository extends MVCPortlet {
|
|||
String versionDownloadItemId = ParamUtil.getString(resourceRequest, "versionDownloadItemId", null);
|
||||
String versionDownloadName = ParamUtil.getString(resourceRequest, "versionDownloadName", null);
|
||||
|
||||
setAuthorizationToken(resourceRequest);
|
||||
String authToken = setAuthorizationToken(resourceRequest);
|
||||
//check if is a file download
|
||||
if (fileToDownloadId != null) {
|
||||
String selectedItemId = fileToDownloadId;
|
||||
|
@ -165,14 +164,14 @@ public class CompanyPrivateRepository extends MVCPortlet {
|
|||
WorkspaceItem theItem;
|
||||
try {
|
||||
theItem = ws.getItem(versionDownloadItemId);
|
||||
if (theItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) theItem;
|
||||
InputStream is = file.downloadVersion(versionDownloadName);
|
||||
if (theItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) theItem;
|
||||
InputStream is = ws.downloadFile(file.getId(), authToken, versionDownloadName, context).getStream();
|
||||
HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(resourceResponse);
|
||||
HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest);
|
||||
ServletResponseUtil.sendFile(httpReq,httpRes, versionDownloadName+"_"+file.getName(), is, "application/download");
|
||||
}
|
||||
} catch (ItemNotFoundException | InternalErrorException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -185,11 +184,12 @@ public class CompanyPrivateRepository extends MVCPortlet {
|
|||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private void setAuthorizationToken(ResourceRequest request) {
|
||||
private String setAuthorizationToken(ResourceRequest request) {
|
||||
GCubeUser currentUser = Utils.getCurrentUser(request);
|
||||
String scope = Utils.getCurrentContext(request);
|
||||
String authorizationToken = Utils.getCurrentUserToken(scope, currentUser.getUsername());
|
||||
SecurityTokenProvider.instance.set(authorizationToken);
|
||||
return authorizationToken;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.net.URLEncoder;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.portlet.PortletException;
|
||||
import javax.portlet.PortletPreferences;
|
||||
|
@ -20,15 +21,11 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||
import org.gcube.common.homelibrary.util.WorkspaceUtil;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.storagehub.client.dsl.FileContainer;
|
||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||
import org.gcube.portlets.user.performfish.util.PFISHConstants;
|
||||
import org.gcube.portlets.user.performfish.util.Utils;
|
||||
import org.gcube.vomanagement.usermanagement.RoleManager;
|
||||
|
@ -95,19 +92,20 @@ public class EmptyFormsDocumentsDisplay extends MVCPortlet {
|
|||
Workspace ws = Utils.getWS("guest", context) ;
|
||||
String selectedPhase = GetterUtil.getString(portletPreferences.getValue(PFISHConstants.PHASE_PREFERENCE_ATTR_NAME, StringPool.BLANK));
|
||||
//in theChildren expected to find 3 subfolders: Utils.SHOW_HATCHERY, SHOW_PRE_ONGROWING ..
|
||||
for (WorkspaceItem item : ws.getItem(folderId).getChildren()) {
|
||||
|
||||
for (WorkspaceItem item : ws.getChildren(folderId, true)) {
|
||||
if (item.getName().equalsIgnoreCase(selectedPhase)) {
|
||||
List<? extends WorkspaceItem> thefiles = item.getChildren();
|
||||
List<ExternalFile> theSheets = new ArrayList<>();
|
||||
List<ExternalFile> theInstructions = new ArrayList<>();
|
||||
List<? extends WorkspaceItem> thefiles = ws.getChildren(item.getId());
|
||||
List<FileItem> theSheets = new ArrayList<>();
|
||||
List<FileItem> theInstructions = new ArrayList<>();
|
||||
List<String >theSheetNames = new ArrayList<>();
|
||||
//separate from instructions
|
||||
for (WorkspaceItem workspaceItem : thefiles) {
|
||||
if (workspaceItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) workspaceItem;
|
||||
if (file.getMimeType().equals(XLS_MIMETYPE) || file.getMimeType().equals(XLSX_MIMETYPE)) { //is a form
|
||||
if (workspaceItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) workspaceItem;
|
||||
if (file.getContentType().equals(XLS_MIMETYPE) || file.getContentType().equals(XLSX_MIMETYPE)) { //is a form
|
||||
theSheets.add(file);
|
||||
theSheetNames.add("'"+file.getName()+"'"); //serializing for Javascript
|
||||
theSheetNames.add("'"+file.getFileName()+"'"); //serializing for Javascript
|
||||
}
|
||||
else
|
||||
theInstructions.add(file);
|
||||
|
@ -159,7 +157,8 @@ public class EmptyFormsDocumentsDisplay extends MVCPortlet {
|
|||
ScopeProvider.instance.set(context);
|
||||
Workspace workspace = Utils.getWS(username, context) ;
|
||||
String wsItemId = uploadToUserWorkspace(workspace, fileName, contentType, new ByteArrayInputStream(FileUtil.getBytes(multipartFile)));
|
||||
String toReturn = workspace.getItem(wsItemId).getPublicLink(false);
|
||||
|
||||
String toReturn = workspace.getPublicLinkForFile(wsItemId).toString();
|
||||
fileObject.put("fileName", fileName);
|
||||
fileObject.put("urlEncoded", URLEncoder.encode(toReturn, "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
|
@ -177,14 +176,14 @@ public class EmptyFormsDocumentsDisplay extends MVCPortlet {
|
|||
WorkspaceItem theItem;
|
||||
try {
|
||||
theItem = ws.getItem(fileToDownloadId);
|
||||
if (theItem instanceof ExternalFile) {
|
||||
ExternalFile file = (ExternalFile) theItem;
|
||||
InputStream is = file.getData();
|
||||
if (theItem instanceof FileItem) {
|
||||
FileItem file = (FileItem) theItem;
|
||||
InputStream is = ws.downloadFile(fileToDownloadId, theItem.getName(), null, null).getStream();
|
||||
HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(resourceResponse);
|
||||
HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(resourceRequest);
|
||||
ServletResponseUtil.sendFile(httpReq,httpRes, file.getName(), is, "application/download");
|
||||
ServletResponseUtil.sendFile(httpReq,httpRes, file.getFileName(), is, "application/download");
|
||||
}
|
||||
} catch (ItemNotFoundException | InternalErrorException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -205,16 +204,21 @@ public class EmptyFormsDocumentsDisplay extends MVCPortlet {
|
|||
private String uploadToUserWorkspace(Workspace ownerWS, String fileName, String mimeType,InputStream fileData) throws Exception {
|
||||
WorkspaceFolder attachmentDirectory = null;
|
||||
try{
|
||||
attachmentDirectory = (WorkspaceFolder) ownerWS.getItemByPath(ownerWS.getRoot().getPath() + "/" + ATTACHMENT_FOLDER);
|
||||
} catch (ItemNotFoundException e) {
|
||||
attachmentDirectory = (WorkspaceFolder) ownerWS.getItemByPath(ownerWS.getRoot().getId(), ATTACHMENT_FOLDER);
|
||||
} catch (Exception e) {
|
||||
_log.info(ATTACHMENT_FOLDER + " Workspace Folder does not exists, creating it ");
|
||||
attachmentDirectory = ownerWS.getRoot().createFolder(ATTACHMENT_FOLDER, "Folder created automatically by the System");
|
||||
attachmentDirectory = ownerWS.createFolder(ATTACHMENT_FOLDER, "Folder created automatically by the System", ownerWS.getRoot().getId());
|
||||
}
|
||||
System.out.println("attachmentDirectory="+attachmentDirectory);
|
||||
String itemName = WorkspaceUtil.getUniqueName(fileName, attachmentDirectory);
|
||||
FolderItem item = WorkspaceUtil.createExternalFile(attachmentDirectory, itemName, "System created upon user form submission " + new Date(), mimeType, fileData);
|
||||
|
||||
String itemName = getUniqueName(fileName);
|
||||
WorkspaceItem item = ownerWS.uploadFile(attachmentDirectory.getId(), fileData, itemName, "System created upon user form submission " + new Date());
|
||||
String toReturn = item.getId();
|
||||
_log.debug("Uploaded " + item.getName() + " - Returned Workspace id=" +toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private String getUniqueName(String filename) {
|
||||
return UUID.randomUUID().toString().substring(0, 8) + "_" + filename;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@ package org.gcube.portlets.user.performfish;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.portlet.ActionRequest;
|
||||
import javax.portlet.ActionResponse;
|
||||
|
@ -11,8 +13,9 @@ import javax.portlet.PortletRequestDispatcher;
|
|||
import javax.portlet.RenderRequest;
|
||||
import javax.portlet.RenderResponse;
|
||||
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
||||
import org.gcube.portlets.user.performfish.bean.CompanyMember;
|
||||
import org.gcube.portlets.user.performfish.bean.Farm;
|
||||
import org.gcube.portlets.user.performfish.util.PFISHConstants;
|
||||
|
@ -94,9 +97,12 @@ public class ManageCompanyUsers extends MVCPortlet {
|
|||
WorkspaceFolder wsFolder = Utils.getWSCompanyFolder(currentUsername, context, team);
|
||||
if (wsFolder.isShared()) {
|
||||
WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) wsFolder;
|
||||
Workspace ws = Utils.getWS(currentUsername, context);
|
||||
for (int i = 0; i < usernamesToRemoveFromCompany.length; i++) {
|
||||
_log.info("Unsharing user =>"+usernamesToRemoveFromCompany[i]);
|
||||
sharedFolder.unShare(usernamesToRemoveFromCompany[i]);
|
||||
Set<String> userNamesToUnshare = new HashSet<>();
|
||||
userNamesToUnshare.add(usernamesToRemoveFromCompany[i]);
|
||||
ws.unshareFolder(sharedFolder.getId(), userNamesToUnshare);
|
||||
_log.info("Unsharing OK removing user from team =>"+usernamesToRemoveFromCompany[i]);
|
||||
long userId = um.getUserByUsername(usernamesToRemoveFromCompany[i]).getUserId();
|
||||
TeamLocalServiceUtil.deleteUserTeam(userId, team.getTeamId());
|
||||
|
|
|
@ -13,7 +13,7 @@ import javax.portlet.PortletRequestDispatcher;
|
|||
import javax.portlet.RenderRequest;
|
||||
import javax.portlet.RenderResponse;
|
||||
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||
import org.gcube.portlets.user.performfish.bean.Farm;
|
||||
import org.gcube.portlets.user.performfish.util.PFISHConstants;
|
||||
import org.gcube.portlets.user.performfish.util.Utils;
|
||||
|
@ -100,7 +100,7 @@ public class ManageFarms extends MVCPortlet {
|
|||
GCubeTeam theCompany = RM.getTeam(companyId);
|
||||
_log.info("Trying Delete Farm with name " + theFarm.getTeamName() + " of Company: " + theCompany.getTeamName());
|
||||
WorkspaceFolder farmFolder = Utils.getWSFarmFolder(username, context, theCompany, theFarm);
|
||||
Utils.getWS(username, context).removeItem(farmFolder.getId());
|
||||
Utils.getWS(username, context).deleteItem(farmFolder.getId());
|
||||
_log.info(username + " Deleted Farm Folder with Id = "+farmId + " deleting farm row DB now ");
|
||||
boolean resultDeleteFarmDB = DBUtil.deleteFarm(conn, farmId);
|
||||
if (!resultDeleteFarmDB) {
|
||||
|
|
|
@ -25,12 +25,11 @@ import org.apache.http.HttpResponse;
|
|||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||
import org.gcube.portlets.user.performfish.util.Utils;
|
||||
import org.gcube.portlets.user.performfish.util.ValidationResult;
|
||||
import org.gcube.portlets.user.performfish.util.db.DBUtil;
|
||||
|
@ -67,7 +66,7 @@ public class SubmittedFormValidation extends MVCPortlet {
|
|||
try {
|
||||
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(request));
|
||||
String[] farmIds = ParamUtil.getParameterValues(httpReq, Utils.ENCODED_FARM_PARAM);
|
||||
|
||||
|
||||
GCubeTeam theFarm = null;
|
||||
theCompany = Utils.checkBelongingToOneCompanyOnly(request, response, this);
|
||||
if (farmIds == null || farmIds.length == 0) {
|
||||
|
@ -161,20 +160,11 @@ public class SubmittedFormValidation extends MVCPortlet {
|
|||
GCubeTeam theFarm = new LiferayRoleManager().getTeam(farmId);
|
||||
Workspace ws = Utils.getWS(username, context);
|
||||
WorkspaceFolder companyRepoFolder = Utils.getWSFarmFolder(username, context, theCompany, theFarm);
|
||||
WorkspaceItem overwriteItem = ws.find(fileName, companyRepoFolder.getId());
|
||||
|
||||
String toReturn = "";
|
||||
if (overwriteItem == null) {
|
||||
ExternalFile item = companyRepoFolder.createExternalFileItem(fileName, "User form submission on " + new Date(), XSLX_MIME, fileData);
|
||||
toReturn = item.getId();
|
||||
}
|
||||
else {
|
||||
ws.updateItem(overwriteItem.getId(), fileData);
|
||||
toReturn = overwriteItem.getId();
|
||||
_log.debug("updateItem with id: "+overwriteItem.getId()+ ", is completed");
|
||||
}
|
||||
WorkspaceItem item = ws.uploadFile(context, fileData, fileName, "User form submission on " + new Date());
|
||||
//ExternalFile item = companyRepoFolder.createExternalFileItem(fileName, "User form submission on " + new Date(), XSLX_MIME, fileData);
|
||||
toReturn = item.getId();
|
||||
_log.info("Uploaded " + fileName + " - Returned Workspace id=" +toReturn);
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
@ -214,7 +204,7 @@ public class SubmittedFormValidation extends MVCPortlet {
|
|||
List<String> resultLines = new ArrayList<>();
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.split("=").length > 1)
|
||||
resultLines.add(line.substring(line.indexOf("=")+1));
|
||||
resultLines.add(line.substring(line.indexOf("=")+1));
|
||||
else
|
||||
resultLines.add("Validation is successful");
|
||||
}
|
||||
|
@ -330,5 +320,5 @@ public class SubmittedFormValidation extends MVCPortlet {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.portlets.user.performfish.bean;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
||||
import org.gcube.portlets.user.performfish.util.Utils;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
|
@ -11,7 +11,7 @@ public class SubmittedForm implements Serializable {
|
|||
private static String UNPUBLISHED_LABEL = "Unpublished";
|
||||
private static String SUBMITTER_NONE = null;
|
||||
|
||||
private ExternalFile file;
|
||||
private FileItem file;
|
||||
private String status;
|
||||
private String submitterIdentity;
|
||||
private long endTimeinMillis = -1;
|
||||
|
@ -21,7 +21,7 @@ public class SubmittedForm implements Serializable {
|
|||
this.submitterIdentity = SUBMITTER_NONE;
|
||||
}
|
||||
|
||||
public SubmittedForm(ExternalFile file, String status, String submitterIdentity, long endTimeinMillis) {
|
||||
public SubmittedForm(FileItem file, String status, String submitterIdentity, long endTimeinMillis) {
|
||||
super();
|
||||
this.file = file;
|
||||
this.status = status;
|
||||
|
@ -29,7 +29,7 @@ public class SubmittedForm implements Serializable {
|
|||
this.endTimeinMillis = endTimeinMillis;
|
||||
}
|
||||
|
||||
public SubmittedForm(ExternalFile file) {
|
||||
public SubmittedForm(FileItem file) {
|
||||
super();
|
||||
this.file = file;
|
||||
this.status = UNPUBLISHED_LABEL;
|
||||
|
@ -47,11 +47,11 @@ public class SubmittedForm implements Serializable {
|
|||
return batchType;
|
||||
}
|
||||
|
||||
public ExternalFile getFormFile() {
|
||||
public FileItem getFormFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFormFile(ExternalFile file) {
|
||||
public void setFormFile(FileItem file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,9 @@ import java.sql.Connection;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.portlet.PortletException;
|
||||
import javax.portlet.PortletRequestDispatcher;
|
||||
|
@ -24,16 +26,16 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.authorization.library.provider.UserInfo;
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.GCoreEndpoint.Profile.Endpoint;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
||||
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||
import org.gcube.common.storagehubwrapper.shared.ACLType;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
||||
import org.gcube.portlets.user.performfish.bean.Association;
|
||||
import org.gcube.portlets.user.performfish.bean.Company;
|
||||
import org.gcube.portlets.user.performfish.bean.CompanyMember;
|
||||
|
@ -689,8 +691,9 @@ public class Utils {
|
|||
String authorizationToken = PortalContext.getConfiguration().getCurrentUserToken(context, username);
|
||||
SecurityTokenProvider.instance.set(authorizationToken);
|
||||
ScopeProvider.instance.set(context);
|
||||
try {
|
||||
return HomeLibrary.getUserWorkspace(username);
|
||||
try {
|
||||
StorageHubWrapper wrap = new StorageHubWrapper(currentUsername, authorizationToken);
|
||||
return wrap.getWorkspace();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -712,7 +715,7 @@ public class Utils {
|
|||
WorkspaceFolder folder = null;
|
||||
String companyName = team.getTeamName();
|
||||
try {
|
||||
ws = HomeLibrary.getUserWorkspace(username);
|
||||
ws = getWS(currentUsername, context);
|
||||
String destinationFolderId = ws.getRoot().getId();
|
||||
String name = companyName+PFISHConstants.COMPANY_WS_FOLDER_SUFFIX;
|
||||
String description = "Data belonging to " + companyName;
|
||||
|
@ -720,36 +723,21 @@ public class Utils {
|
|||
if (!ws.exists(name, destinationFolderId)) {
|
||||
_log.info(companyName + " company folder does not exists, triggering creation ... ");
|
||||
folder = ws.createFolder(name, description, destinationFolderId);
|
||||
folder.setHidden(PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
String folderId = folder.getId();
|
||||
ws.setFolderAsHidden(folderId, PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
_log.info("Company folder created succesfully for " + companyName + " adding other company users (if any)");
|
||||
List<String> users = new ArrayList<>();
|
||||
Set<String> users = new HashSet<>();
|
||||
for (GCubeUser member : UM.listUsersByTeam(team.getTeamId())) {
|
||||
users.add(member.getUsername());
|
||||
}
|
||||
WorkspaceSharedFolder sharedFolder = folder.share(users);
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ex) {}
|
||||
if (sharedFolder.isShared()) {
|
||||
sharedFolder.setACL(users, ACLType.WRITE_ALL);
|
||||
_log.info("ACL Set correctly ...");
|
||||
} else {
|
||||
while (!sharedFolder.isShared()) {
|
||||
_log.info("Trying to Set ACL ...");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ex) {}
|
||||
if (sharedFolder.isShared()) {
|
||||
sharedFolder.setACL(users, ACLType.WRITE_ALL);
|
||||
_log.info("ACL Set correctly after at least one attempt...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ws.shareFolder(folderId, users, ACLType.WRITE_ALL);
|
||||
_log.info("company folder created ...");
|
||||
}
|
||||
else {
|
||||
_log.info(companyName + " company folder exists, returning id ... ");
|
||||
folder = (WorkspaceFolder) ws.find(name, destinationFolderId);
|
||||
folder.setHidden(PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
_log.info(companyName + " company folder exists, returning id and setting hidden?... " + PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
folder = (WorkspaceFolder) ws.find(name, destinationFolderId);
|
||||
ws.setFolderAsHidden(folder.getId(), PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -776,7 +764,7 @@ public class Utils {
|
|||
String companyName = company.getTeamName();
|
||||
try {
|
||||
WorkspaceFolder companyFolder = getWSCompanyFolder(currentUsername, context, company);
|
||||
ws = HomeLibrary.getUserWorkspace(username);
|
||||
ws = getWS(currentUsername, context);
|
||||
String destinationFolderId = companyFolder.getId();
|
||||
String name = Long.toString(farm.getTeamId()); //the farm folder is the unique id of the farm
|
||||
String description = new StringBuilder("Forms submitted by farm ")
|
||||
|
@ -785,7 +773,7 @@ public class Utils {
|
|||
if (!ws.exists(name, destinationFolderId)) {
|
||||
_log.info(companyName + " farm folder does not exists, triggering creation ... ");
|
||||
folder = ws.createFolder(name, description, destinationFolderId);
|
||||
folder.setHidden(PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
ws.setFolderAsHidden(folder.getId(), PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
_log.info("Farm folder created succesfully for " + companyName);
|
||||
}
|
||||
else {
|
||||
|
@ -793,7 +781,7 @@ public class Utils {
|
|||
SecurityTokenProvider.instance.set(authorizationToken);
|
||||
ScopeProvider.instance.set(context);
|
||||
folder = (WorkspaceFolder) ws.find(name, destinationFolderId);
|
||||
folder.setHidden(PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
ws.setFolderAsHidden(folder.getId(), PFISHConstants.HIDE_COMPANY_SHARED_FOLDER);
|
||||
_log.info(farm.getTeamName() + " farm folder id = " + folder.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,16 @@ package org.gcube.portlets.user.performfish.util.comparators;
|
|||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||
|
||||
|
||||
public class WSItemComparator implements Comparator<WorkspaceItem> {
|
||||
@Override
|
||||
public int compare(WorkspaceItem o1, WorkspaceItem o2) {
|
||||
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
|
||||
public class WSItemComparator implements Comparator<WorkspaceItem> {
|
||||
@Override
|
||||
public int compare(WorkspaceItem o1, WorkspaceItem o2) {
|
||||
try {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
} catch (InternalErrorException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,4 +26,3 @@ User currentUser = (User) request.getAttribute(WebKeys.USER);
|
|||
|
||||
<a class="btn btn-large btn-primary" href="${normalState}"><i
|
||||
class="icon icon-angle-left"></i> Close</a>
|
||||
<div
|
|
@ -26,4 +26,3 @@ User currentUser = (User) request.getAttribute(WebKeys.USER);
|
|||
|
||||
<a class="btn btn-large btn-primary" href="${normalState}"><i
|
||||
class="icon icon-angle-left"></i> Close</a>
|
||||
<div
|
|
@ -58,9 +58,9 @@
|
|||
<%@page import="org.gcube.portlets.user.performfish.util.db.DBUtil"%>
|
||||
<%@page import="org.gcube.portlets.user.performfish.util.PFISHConstants"%>
|
||||
<%@page import=" org.gcube.portlets.user.performfish.bean.*"%>
|
||||
<%@page import="org.gcube.common.homelibrary.home.workspace.WorkspaceItem"%>
|
||||
<%@page import="org.gcube.common.homelibary.model.versioning.WorkspaceVersion"%>
|
||||
<%@page import="org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile"%>
|
||||
<%-- <%@page import="org.gcube.common.homelibrary.home.workspace.WorkspaceItem"%> --%>
|
||||
<%-- <%@page import="org.gcube.common.homelibary.model.versioning.WorkspaceVersion"%> --%>
|
||||
<%-- <%@page import="org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile"%> --%>
|
||||
<%@page import="org.gcube.portal.stohubicons.IconsManager"%>
|
||||
<%@page import="org.gcube.common.storagehub.model.items.GenericFileItem"%>
|
||||
|
||||
|
|
Loading…
Reference in New Issue