fixed issue:
https://support.social.isti.cnr.it/ticket/160 git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@101544 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
371c909341
commit
5be62a06ef
|
@ -48693,3 +48693,35 @@ Compiling...
|
|||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||
Compiling...
|
||||
30% complete (ETR: 8 seconds)
|
||||
30% complete (ETR: 8 seconds)
|
||||
30% complete (ETR: 8 seconds)
|
||||
30% complete (ETR: 8 seconds)
|
||||
40% complete (ETR: 8 seconds)
|
||||
50% complete (ETR: 6 seconds)
|
||||
60% complete (ETR: 4 seconds)
|
||||
70% complete (ETR: 3 seconds)
|
||||
80% complete (ETR: 2 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 31.68 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
|
|
|
@ -1004,7 +1004,7 @@ public class GWTWorkspaceBuilder {
|
|||
}
|
||||
|
||||
|
||||
protected List<FileGridModel> buildGXTListFileGridModelItemForSearch(List<SearchItem> listSearchItems) throws InternalErrorException
|
||||
public List<FileGridModel> buildGXTListFileGridModelItemForSearch(List<SearchItem> listSearchItems) throws InternalErrorException
|
||||
{
|
||||
|
||||
List<FileGridModel> listFileGridModel = new ArrayList<FileGridModel>();
|
||||
|
@ -1063,6 +1063,7 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
//OWNER
|
||||
if(item.isShared()){ //IS READ FROM HL ONLY IF THE ITEM IS SHARED
|
||||
fileGridModel.setShared(true); //TEMPORARY SOLUTION: ADDED TO FIX WRONG TYPE SearchFolderItem
|
||||
String portalLogin = item.getOwner();
|
||||
if(portalLogin!=null){
|
||||
String fullName = portalLogin;
|
||||
|
|
|
@ -3,25 +3,16 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.workspace;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
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.folder.items.ExternalFile;
|
||||
import org.gcube.common.homelibrary.home.workspace.search.SearchItem;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FolderModel;
|
||||
import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
||||
import org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl;
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
|
@ -32,16 +23,14 @@ public class SearchTextTest {
|
|||
|
||||
|
||||
protected static Logger logger = Logger.getLogger(SearchTextTest.class);
|
||||
private static String text = "test";
|
||||
public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps/EcologicalModelling"; //PRODUCTION
|
||||
private static String text = "1_Networking Activities";
|
||||
public static String DEFAULT_SCOPE = "/gcube/devsec/devVRE"; //PRODUCTION
|
||||
|
||||
public static String USER = "pasquale.pagano"; //PRODUCTION
|
||||
public static String USER = "francesco.mangiacrapa"; //PRODUCTION
|
||||
|
||||
static GWTWorkspaceBuilder builder = new GWTWorkspaceBuilder();
|
||||
static GWTWorkspaceServiceImpl serviceImpl = new GWTWorkspaceServiceImpl();
|
||||
static Workspace workspace;
|
||||
|
||||
static final String itemID = "8253f5c5-def6-41fd-a3f2-c614855a8b0b";
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
|
@ -62,111 +51,22 @@ public class SearchTextTest {
|
|||
|
||||
// List<SearchItem> listSearchItems = ws.searchByName(text);
|
||||
|
||||
logger.info("Calling search HL..");
|
||||
List<SearchItem> listSearchItems = workspace.searchByName(text);
|
||||
logger.info("HL search returning "+listSearchItems.size()+" items");
|
||||
|
||||
WorkspaceItem item = workspace.getItem(itemID);
|
||||
logger.info("Converting "+listSearchItems.size()+" items");
|
||||
|
||||
List<FileGridModel> listFileGridModels = builder.buildGXTListFileGridModelItemForSearch(listSearchItems);
|
||||
logger.info("Search objects converted, returning");
|
||||
|
||||
FileGridModel wsItem = builder.buildGXTFileGridModelItem(item, null);
|
||||
System.out.println("Item is: "+wsItem.getName() + "; ID: "+wsItem.getIdentifier() + " Last Update: "+wsItem.getLastModification());
|
||||
|
||||
int i = 1;
|
||||
while(item.getParent()!=null){
|
||||
|
||||
item = item.getParent();
|
||||
|
||||
WorkspaceFolder folder = (WorkspaceFolder) item;
|
||||
|
||||
|
||||
FolderModel parent = builder.buildGXTFolderModelItem(folder, null);
|
||||
|
||||
|
||||
System.out.println("Parent "+i+" is: "+parent.getName() + "; ID: "+parent.getIdentifier());
|
||||
i++;
|
||||
for (FileGridModel fileGridModel : listFileGridModels) {
|
||||
logger.info(fileGridModel);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// if(item.getParent()!=null){
|
||||
//
|
||||
//// System.out.println("Parent is: "+item.getParent().getName());
|
||||
// System.out.println("Parent is: "+builder.buildGXTFolderModelItem(item.getParent(), null));
|
||||
// }else
|
||||
// System.out.println("parent is null");
|
||||
//
|
||||
//
|
||||
|
||||
// System.out.println(item.toString());
|
||||
|
||||
// System.out.println("Total item founds: "+listSearchItems.size());
|
||||
/*
|
||||
int i=0;
|
||||
for (SearchItem searchItem : listSearchItems) {
|
||||
|
||||
|
||||
if(searchItem.getType().equals(WorkspaceItemType.FOLDER) || searchItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
|
||||
|
||||
SearchFolder folder = (SearchFolder) searchItem;
|
||||
|
||||
System.out.println(++i+") folder name: "+folder.getName() + " type: "+folder.getType());
|
||||
}else{
|
||||
|
||||
|
||||
if(searchItem.getType().equals(WorkspaceItemType.FOLDER_ITEM)){
|
||||
|
||||
SearchFolderItem folderItem = (SearchFolderItem) searchItem;
|
||||
|
||||
System.out.println(++i+") folderItem id: "+folderItem.getId() +", name: "+folderItem.getName()+", type: "+folderItem.getType());
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
// downloadFile(workspace.getItem(itemID));
|
||||
|
||||
System.out.println("\nend");
|
||||
} catch (Exception e) {
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadFile(WorkspaceItem folderItem) throws InternalErrorException{
|
||||
|
||||
try{
|
||||
|
||||
ExternalFile externalFile = (ExternalFile) folderItem;
|
||||
|
||||
|
||||
System.out.println("EXTERNAL_FILE DOWNLOAD FOR "+externalFile.getId());
|
||||
//COMMENTED 26/03/2013
|
||||
// String itemName = MimeTypeUtil.getNameWithExtension(item.getName(), mimeType);
|
||||
|
||||
File f2 = new File(externalFile.getName());
|
||||
OutputStream out = new FileOutputStream(f2, true); // ap
|
||||
|
||||
System.out.println("1");
|
||||
|
||||
//MODIFIED 22-05-2013 CLOSE STREAM
|
||||
// IOUtils.copy(externalFile.getData(), resp.getOutputStream());
|
||||
InputStream is = externalFile.getData();
|
||||
|
||||
// //REMOVE THIS -- TODO TEMPORARY SOLUTION
|
||||
if(is==null){
|
||||
logger.error("Error during get input stream: IS is null");
|
||||
throw new Exception("Item is not reachable");
|
||||
}
|
||||
|
||||
System.out.println("2");
|
||||
|
||||
IOUtils.copy(is, out);
|
||||
|
||||
is.close();
|
||||
out.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during external item retrieving "+folderItem.getId(),e);
|
||||
// sendError(resp,HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during data retrieving: "+e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue