Updated according to new FolderItemType GCUBE_ITEM

Added categories: FOLDERS, SHARED_FOLDERS

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@115443 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-06-19 10:53:25 +00:00
parent 1e349eb287
commit 6d685b3c30
7 changed files with 47 additions and 535 deletions

View File

@ -14,14 +14,17 @@ public class GXTCategoryItemInterface implements Serializable {
private static final long serialVersionUID = 1L;
//Smart Folder SMF
//VALUE = KEY - THE KEY TO SEARCH BY CATEORY IN HOME LIBRARY
public static final String SMF_BIODIVERSITY = "Biodiversity";
public static final String SMF_DOCUMENTS = "Documents";
public static final String SMF_IMAGES = "Images";
public static final String SMF_REPORTS = "Reports";
public static final String SMF_TIMESERIES = "Time Series";
public static final String SMF_LINKS = "Links";
// public static final String NONE = "None";
public static final String SMF_UNKNOWN = "Unknown";
public static final String SMF_FOLDERS = "Folders";
public static final String SMF_SHARED_FOLDERS = "Shared Folders";
public static final String SMF_GCUBE_ITEMS= "GcubeItems";
GXTCategoryItemInterface(){}

View File

@ -26,6 +26,7 @@ public enum GXTFolderItemTypeEnum implements Serializable {
UNKNOWN_TYPE("Unknow Type"),
ANNOTATION("Annotation"),
FOLDER("Folder"),
GCUBE_ITEM("Gcube Item"),
SHARED_FOLDER("Shared Folder");
protected String label;

View File

@ -268,386 +268,16 @@ public class GWTWorkspaceBuilder {
return sb.toString();
}
// protected GWTExternalFile buildGWTExternalFile(ExternalFile file, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(file.getProperties());
// GWTExternalFile gwtFile = new GWTExternalFile(
// toDate(file.getCreationTime()),
// file.getId(),
// gwtProperties,
// file.getName(),
// file.getOwner().getPortalLogin(),
// file.getDescription(),
// toDate(file.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(file.getLastAction().toString()),
// parent,
// file.getLength(),
// file.getMimeType());
//
// return gwtFile;
// }
//
// protected GWTExternalPDFFile buildGWTExternalPDFFile(ExternalPDFFile pdfFile, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(pdfFile.getProperties());
// GWTExternalPDFFile gwtPDFFile = new GWTExternalPDFFile(
// toDate(pdfFile.getCreationTime()),
// pdfFile.getId(),
// gwtProperties,
// pdfFile.getName(),
// pdfFile.getOwner().getPortalLogin(),
// pdfFile.getDescription(),
// toDate(pdfFile.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(pdfFile.getLastAction().toString()),
// parent,
// pdfFile.getLength(),
// pdfFile.getMimeType(),
// pdfFile.getAuthor(),
// pdfFile.getNumberOfPages(),
// pdfFile.getProducer(),
// pdfFile.getTitle(),
// pdfFile.getVersion());
//
// return gwtPDFFile;
// }
//
// protected GWTExternalImage buildGWTExternalImage(ExternalImage image, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(image.getProperties());
// GWTExternalImage gwtImage = new GWTExternalImage(
// toDate(image.getCreationTime()),
// image.getId(),
// gwtProperties,
// image.getName(),
// image.getOwner().getPortalLogin(),
// image.getDescription(),
// toDate(image.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(image.getLastAction().toString()),
// parent,
// buildImageUrl(image.getId()),
// buildThumbnailUrl(image.getId()),
// image.getWidth(),
// image.getHeight(),
// image.getLength(),
// image.getThumbnailWidth(),
// image.getThumbnailHeight(),
// image.getThumbnailLength(),
// image.getMimeType());
//
// return gwtImage;
// }
//
// protected GWTQuery buildGWTQuery(Query query, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(query.getProperties());
// GWTQuery gwtQuery = new GWTQuery(
// query.getId(),
// query.getName(),
// query.getDescription(),
// query.getOwner().getPortalLogin(),
// toDate(query.getCreationTime()),
// gwtProperties,
// toDate(query.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(query.getLastAction().toString()),
// parent,
// query.getLength());
//
// return gwtQuery;
// }
//
// protected GWTAquaMapsItem buildGWTAquaMapsItem(AquaMapsItem aquamapsItem, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(aquamapsItem.getProperties());
//
// GWTAquaMapsItem gwtAquaMapsItem = new GWTAquaMapsItem(
// aquamapsItem.getId(),
// aquamapsItem.getName(),
// aquamapsItem.getDescription(),
// aquamapsItem.getOwner().getPortalLogin(),
// toDate(aquamapsItem.getCreationTime()),
// gwtProperties,
// toDate(aquamapsItem.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(aquamapsItem.getLastAction().toString()),
// parent,
// aquamapsItem.getLength(),
// aquamapsItem.getMapName(),
// aquamapsItem.getMapType(),
// aquamapsItem.getAuthor(),
// aquamapsItem.getNumberOfSpecies(),
// aquamapsItem.getBoundingBox(),
// aquamapsItem.getPsoThreshold(),
// aquamapsItem.getNumberOfGeneratedImages()
// );
//
// return gwtAquaMapsItem;
// }
//
//
// protected GWTTimeSeries buildGWTTimeSeries(TimeSeries timeseries, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(timeseries.getProperties());
//
// TimeSeriesInfo timeSeriesInfo = timeseries.getTimeSeriesInfo();
//
// GWTTimeSeries gwtTimeSeries = new GWTTimeSeries(
// timeseries.getId(),
// timeseries.getName(),
// timeseries.getDescription(),
// timeseries.getOwner().getPortalLogin(),
// toDate(timeseries.getCreationTime()),
// gwtProperties,
// toDate(timeseries.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(timeseries.getLastAction().toString()),
// parent,
// timeseries.getLength(),
// timeSeriesInfo.getId(),
// timeSeriesInfo.getTitle(),
// timeSeriesInfo.getCreator(),
// timeSeriesInfo.getDescription(),
// timeSeriesInfo.getCreationDate(),
// timeSeriesInfo.getPublisher(),
// timeSeriesInfo.getSourceId(),
// timeSeriesInfo.getSourceName(),
// timeSeriesInfo.getRights(),
// timeSeriesInfo.getDimension(),
// new LinkedList<String>(timeseries.getHeaderLabels())
// );
//
// return gwtTimeSeries;
// }
//
// protected GWTReportTemplate buildGWTReportTemplate(ReportTemplate template, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(template.getProperties());
// GWTReportTemplate gwtTemplate = new GWTReportTemplate(
// template.getId(),
// template.getName(),
// template.getDescription(),
// template.getOwner().getPortalLogin(),
// toDate(template.getCreationTime()),
// gwtProperties,
// toDate(template.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(template.getLastAction().toString()),
// parent,
// template.getLength(),
// toDate(template.getCreated()),
// toDate(template.getLastEdit()),
// template.getAuthor(),
// template.getLastEditBy(),
// template.getNumberOfSections(),
// template.getStatus());
//
// return gwtTemplate;
// }
//
// protected GWTReport buildGWTReport(Report template, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(template.getProperties());
// GWTReport gwtReport = new GWTReport(
// template.getId(),
// template.getName(),
// template.getDescription(),
// template.getOwner().getPortalLogin(),
// toDate(template.getCreationTime()),
// gwtProperties,
// toDate(template.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(template.getLastAction().toString()),
// parent,
// template.getLength(),
// toDate(template.getCreated()),
// toDate(template.getLastEdit()),
// template.getAuthor(),
// template.getLastEditBy(),
// template.getTemplateName(),
// template.getNumberOfSections(),
// template.getStatus()
// );
// return gwtReport;
// }
//
// protected GWTWorkflowReport buildGWTWorkflowReport(WorkflowReport workflowReport, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(workflowReport.getProperties());
// GWTWorkflowReport gwtWorkflowReport = new GWTWorkflowReport(
// workflowReport.getId(),
// workflowReport.getName(),
// workflowReport.getDescription(),
// workflowReport.getOwner().getPortalLogin(),
// toDate(workflowReport.getCreationTime()),
// gwtProperties,
// toDate(workflowReport.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(workflowReport.getLastAction().toString()),
// parent,
// workflowReport.getLength()
// );
// gwtWorkflowReport.setWorkflowStatus(workflowReport.getWorkflowStatus());
// return gwtWorkflowReport;
// }
//
// protected GWTWorkflowTemplate buildGWTWorkflowTemplate(WorkflowTemplate workflowTemplate, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(workflowTemplate.getProperties());
// GWTWorkflowTemplate gwtWorkflowReport = new GWTWorkflowTemplate(
// workflowTemplate.getId(),
// workflowTemplate.getName(),
// workflowTemplate.getDescription(),
// workflowTemplate.getOwner().getPortalLogin(),
// toDate(workflowTemplate.getCreationTime()),
// gwtProperties,
// toDate(workflowTemplate.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(workflowTemplate.getLastAction().toString()),
// parent,
// workflowTemplate.getLength()
// );
// gwtWorkflowReport.setWorkflowStatus(workflowTemplate.getWorkflowStatus());
// return gwtWorkflowReport;
// }
//
// protected GWTImageDocument buildGWTImageDocument(ImageDocument image, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(image.getProperties());
//
// Map<String, GWTDocumentMetadata> gwtmetadatas = getMetadatas(image.getMetadata(), image.getId());
//
// GWTImageDocument gwtImage = new GWTImageDocument(
// toDate(image.getCreationTime()),
// image.getId(),
// gwtProperties,
// image.getName(),
// image.getOwner().getPortalLogin(),
// image.getDescription(),
// toDate(image.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(image.getLastAction().toString()),
// parent,
// buildImageUrl(image.getId()),
// buildThumbnailUrl(image.getId()),
// image.getWidth(),
// image.getHeight(),
// image.getThumbnailWidth(),
// image.getThumbnailHeight(),
// image.getThumbnailLength(),
// image.getLength(),
// image.getMimeType(),
// image.getURI(),
// gwtmetadatas,
// new LinkedHashMap<String, String>(),
// image.getCollectionName(),
// image.getAlternatives().size(),
// image.getParts().size()
//
// );
//
// return gwtImage;
//
// }
//
// protected GWTPDFDocument buildGWTPDFDocument(PDFDocument pdfDocument, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(pdfDocument.getProperties());
//
// Map<String, GWTDocumentMetadata> gwtmetadatas = getMetadatas(pdfDocument.getMetadata(), pdfDocument.getId());
//
// GWTPDFDocument gwtPDF = new GWTPDFDocument(
// toDate(pdfDocument.getCreationTime()),
// pdfDocument.getId(),
// gwtProperties,
// pdfDocument.getName(),
// pdfDocument.getOwner().getPortalLogin(),
// pdfDocument.getDescription(),
// toDate(pdfDocument.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(pdfDocument.getLastAction().toString()),
// parent,
// pdfDocument.getLength(),
// pdfDocument.getURI(),
// pdfDocument.getMimeType(),
// gwtmetadatas,
// new LinkedHashMap<String, String>(),
// pdfDocument.getCollectionName(),
// pdfDocument.getAlternatives().size(),
// pdfDocument.getParts().size(),
// pdfDocument.getAuthor(),
// pdfDocument.getNumberOfPages(),
// pdfDocument.getProducer(),
// pdfDocument.getTitle(),
// pdfDocument.getVersion(),
// "DocumentService?id="+pdfDocument.getId()
// );
//
// return gwtPDF;
//
// }
//
// protected GWTDocument buildGWTDocument(Document document, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(document.getProperties());
//
// Map<String, GWTDocumentMetadata> gwtmetadatas = getMetadatas(document.getMetadata(), document.getId());
//
// GWTDocument gwtPDF = new GWTDocument(
// toDate(document.getCreationTime()),
// document.getId(),
// gwtProperties,
// document.getName(),
// document.getOwner().getPortalLogin(),
// document.getDescription(),
// toDate(document.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(document.getLastAction().toString()),
// parent,
// document.getLength(),
// document.getURI(),
// document.getMimeType(),
// gwtmetadatas,
// new LinkedHashMap<String, String>(),
// document.getCollectionName(),
// document.getAlternatives().size(),
// document.getParts().size()
// );
//
// return gwtPDF;
//
// }
//
// protected GWTMetadata buildGWTMetadata(Metadata metadata, GWTWorkspaceFolder parent) throws InternalErrorException
// {
// GWTProperties gwtProperties = buildGWTProperties(metadata.getProperties());
//
// GWTMetadata gwtMetadata = new GWTMetadata(
// metadata.getId(),
// metadata.getName(),
// metadata.getDescription(),
// metadata.getOwner().getPortalLogin(),
// toDate(metadata.getCreationTime()),
// gwtProperties,
// toDate(metadata.getLastModificationTime()),
// GWTWorkspaceItemAction.valueOf(metadata.getLastAction().toString()),
// parent,
// metadata.getLength(),
// metadata.getURI(),
// metadata.getSchema(),
// metadata.getLanguage(),
// metadata.getCollectionName(),
// "MetadataService?id="+metadata.getId()+"&type="+MetadataFormat.HTML,
// "MetadataService?id="+metadata.getId()+"&type="+MetadataFormat.RAW_XML_AS_HTML
// );
//
// return gwtMetadata;
//
// }
///////////////////////*********************USED
//ADD FRANCESCO
/**
* Builds the gwt workspace image.
*
* @param item the item
* @param isInteralImage the is interal image
* @param fullDetails the full details
* @return the GWT workspace item
* @throws InternalErrorException the internal error exception
*/
@SuppressWarnings("unchecked")
* Builds the gwt workspace image.
*
* @param item the item
* @param isInteralImage the is interal image
* @param fullDetails the full details
* @return the GWT workspace item
* @throws InternalErrorException the internal error exception
*/
@SuppressWarnings("unchecked")
protected GWTWorkspaceItem buildGWTWorkspaceImage(WorkspaceItem item, boolean isInteralImage, boolean fullDetails) throws InternalErrorException
{
@ -732,9 +362,7 @@ public class GWTWorkspaceBuilder {
}
return gwtImage;
}
/**
* Builds the gwt external url.
*
@ -863,10 +491,6 @@ public class GWTWorkspaceBuilder {
"MetadataService?id="+documentId+"&schema="+metadata.getSchemaName()+"&type="+MetadataFormat.RAW_XML_AS_HTML,
"MetadataService?id="+documentId+"&schema="+metadata.getSchemaName()+"&type="+MetadataFormat.FORMATTED_XML);
}
//*****************************************************NEW
/**
* Builds the workspace file model root.
@ -1009,7 +633,6 @@ public class GWTWorkspaceBuilder {
}
return new InfoContactModel(portalLogin, portalLogin, UserUtil.getUserFullName(portalLogin), false);
}
@ -1051,13 +674,10 @@ public class GWTWorkspaceBuilder {
fileModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
fileModel.setShareable(true);
fileModel.setDescription(item.getDescription());
// WorkspaceFolder folder = (WorkspaceFolder) item;
break;
case FOLDER_ITEM:
// fileModel = new FileModel(item.getId(), item.getName(), item.getPath(), (FolderModel) parentFolderModel, false);
fileModel = new FileModel(item.getId(), item.getName(), (FolderModel) parentFolderModel, false, false);
FolderItem folderItem = (FolderItem) item;
fileModel = setFolderItemType(fileModel, folderItem);
@ -1071,10 +691,6 @@ public class GWTWorkspaceBuilder {
fileModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
fileModel.setShareable(true);
fileModel.setDescription(item.getDescription());
// WorkspaceSharedFolder sharedFolder = (WorkspaceSharedFolder) item;
// fileModel.setListShareUser(buildGxtInfoContactFromPortalLogin(sharedFolder.getUsers()));
break;
default:
@ -1082,22 +698,17 @@ public class GWTWorkspaceBuilder {
break;
}
//ACCOUNTING
//REMOVED IS MARK AS READ FROM HL
// fileModel.setMarkAsRead(item.isMarkedAsRead());
if(parentFolderModel!=null && parentFolderModel.isShared()){
fileModel.setShared(true);
fileModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS
// fileModel.setShareable(true);
}
// fileModel.setOwner(new InfoContactModel(item.getOwner().getId(), item.getOwner().getPortalLogin(), "name"));
//// fileModel.setShared(item.isShared());
return fileModel;
}
@ -1141,7 +752,7 @@ public class GWTWorkspaceBuilder {
// fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getCreationDate()), parentFileModel, -1, true, false);
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModified()), parentFileModel, -1, true, false,false);
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_FOLDERS);
fileGridModel.setShareable(true);
break;
@ -1156,7 +767,7 @@ public class GWTWorkspaceBuilder {
//ATTENTION: SEARCH ITEM IS NOT CASTABLE AT WorkspaceSharedFolder
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModified()), parentFileModel, -1, true, true, item.isVreFolder());
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_SHARED_FOLDERS);
fileGridModel.setShareable(true);
break;
@ -1168,8 +779,6 @@ public class GWTWorkspaceBuilder {
}
//TODO ISSHARED IN SEARCH ITEM IN HL TO RETRIEVE SHARE ON WORKSPACEITEM
//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
@ -1184,8 +793,6 @@ public class GWTWorkspaceBuilder {
if(userLogged!=null)
fileGridModel.setOwnerFullName(userLogged.getName());
}
return fileGridModel;
}
@ -1232,18 +839,15 @@ public class GWTWorkspaceBuilder {
switch (item.getType()) {
case FOLDER:
// fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, -1, true, false);
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), item.getName(), toDate(item.getLastModificationTime()), parentFileModel, -1, true, false,false);
fileGridModel.setType(GXTFolderItemTypeEnum.FOLDER.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_FOLDERS);
fileGridModel.setShareable(true);
fileGridModel.setDescription(item.getDescription());
break;
case FOLDER_ITEM:
FolderItem folderItem = (FolderItem) item;
// fileGridModel = new FileGridModel(item.getId(), item.getName(), toDate(item.getCreationTime()), parentFileModel, folderItem.getLength(), false, false);
fileGridModel = new FileGridModel(item.getId(), item.getName(), toDate(item.getLastModificationTime()), parentFileModel, folderItem.getLength(), false, false);
fileGridModel = (FileGridModel) setFolderItemType(fileGridModel, folderItem);
break;
@ -1253,7 +857,7 @@ public class GWTWorkspaceBuilder {
String name = shared.isVreFolder()?shared.getDisplayName():item.getName();
fileGridModel = (FolderGridModel) new FolderGridModel(item.getId(), name, toDate(item.getLastModificationTime()), parentFileModel, -1, true, true, shared.isVreFolder());
fileGridModel.setType(GXTFolderItemTypeEnum.SHARED_FOLDER.toString());
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
fileGridModel.setShortcutCategory(GXTCategoryItemInterface.SMF_SHARED_FOLDERS);
fileGridModel.setShareable(true);
fileGridModel.setDescription(item.getDescription());
break;
@ -1263,8 +867,7 @@ public class GWTWorkspaceBuilder {
break;
}
if(parentFileModel!=null && parentFileModel.isShared()){
fileGridModel.setShared(true);
fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS
@ -1287,10 +890,8 @@ public class GWTWorkspaceBuilder {
// fileGridModel.setOwner(new InfoContactModel(userLogged.getId(), userLogged.getLogin(), userLogged.getName()));
fileGridModel.setOwnerFullName(userLogged.getName());
}
//// fileGridModel.setShared(item.isShared());
return fileGridModel;
}
/**
@ -1368,11 +969,14 @@ public class GWTWorkspaceBuilder {
fileModel.setFolderItemType(GXTFolderItemTypeEnum.METADATA);
fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
break;
case GCUBE_ITEM:
fileModel.setFolderItemType(GXTFolderItemTypeEnum.GCUBE_ITEM);
fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_GCUBE_ITEMS);
break;
default:
fileModel.setFolderItemType(GXTFolderItemTypeEnum.UNKNOWN_TYPE);
fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_UNKNOWN);
fileModel.setType(GXTFolderItemTypeEnum.UNKNOWN_TYPE.toString());
// logger.trace("**************************************UNKNOWN******* filemodel "+ fileModel.getName());
break;
}
@ -1381,9 +985,7 @@ public class GWTWorkspaceBuilder {
}
/**
* Sets the folder item type.
*
@ -1445,7 +1047,6 @@ public class GWTWorkspaceBuilder {
try {
fileModel.setType(imgDoc.getMimeType());
} catch (InternalErrorException e) {
// TODO Auto-generated catch block
logger.error("IMAGE_DOCUMENT InternalErrorException when getting MimeType on "+fileModel.getIdentifier());
}
break;
@ -1457,7 +1058,6 @@ public class GWTWorkspaceBuilder {
try {
fileModel.setType(doc.getMimeType());
} catch (InternalErrorException e) {
// TODO Auto-generated catch block
logger.error("DOCUMENT InternalErrorException when getting MimeType on "+fileModel.getIdentifier());
}
break;
@ -1469,25 +1069,14 @@ public class GWTWorkspaceBuilder {
fileModel.setFolderItemType(GXTFolderItemTypeEnum.METADATA);
fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
break;
//REMOVED BY HL 2.0
// case WORKFLOW_REPORT:
// fileModel.setFolderItemType(GXTFolderItemTypeEnum.WORKFLOW_REPORT);
// fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
// break;
// case WORKFLOW_TEMPLATE:
// fileModel.setFolderItemType(GXTFolderItemTypeEnum.WORKFLOW_TEMPLATE);
// fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_DOCUMENTS);
//// logger.trace("**************************************DOCUMENTS******* filemodel "+ fileModel.getName());
// break;
// case EXTERNAL_RESOURCE_LINK:
// fileModel.setFolderItemType(GXTFolderItemTypeEnum.EXTERNAL_RESOURCE_LINK);
// fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_LINKS);
// break;
case GCUBE_ITEM:
fileModel.setFolderItemType(GXTFolderItemTypeEnum.GCUBE_ITEM);
fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_GCUBE_ITEMS);
break;
default:
fileModel.setFolderItemType(GXTFolderItemTypeEnum.UNKNOWN_TYPE);
fileModel.setShortcutCategory(GXTCategoryItemInterface.SMF_UNKNOWN);
fileModel.setType(GXTFolderItemTypeEnum.UNKNOWN_TYPE.toString());
// logger.trace("**************************************UNKNOWN******* filemodel "+ fileModel.getName());
break;
}
@ -1501,15 +1090,13 @@ public class GWTWorkspaceBuilder {
* @return the publi link for folder item
* @throws InternalErrorException the internal error exception
*/
public String getPubliLinkForFolderItem(FolderItem worspaceFolderItem) throws InternalErrorException{
public String getPublicLinkForFolderItem(FolderItem worspaceFolderItem) throws InternalErrorException{
if(worspaceFolderItem==null)
return "";
try{
switch(worspaceFolderItem.getFolderItemType())
{
switch(worspaceFolderItem.getFolderItemType()){
case EXTERNAL_IMAGE:
return ((ExternalImage) worspaceFolderItem).getPublicLink();
case EXTERNAL_FILE:
@ -1624,15 +1211,12 @@ public class GWTWorkspaceBuilder {
folder.setShareable(true);
folder.setDescription(wsFolder.getDescription());
// folder.setOwner(wsFolder.getOwner());
if(parent != null && parent.isShared()){
folder.setShared(true);
folder.setShareable(false);
}
return folder;
}
/**
@ -1707,6 +1291,8 @@ public class GWTWorkspaceBuilder {
return GXTCategoryItemInterface.SMF_DOCUMENTS;
case METADATA:
return GXTCategoryItemInterface.SMF_DOCUMENTS;
case GCUBE_ITEM:
return GXTCategoryItemInterface.SMF_GCUBE_ITEMS;
default:
return GXTCategoryItemInterface.SMF_UNKNOWN;
}
@ -1729,24 +1315,12 @@ public class GWTWorkspaceBuilder {
public List<FileGridModel> filterListFileGridModelItemByCategory(List<SearchItem> listSearchItem, String category) throws InternalErrorException {
List<FileGridModel> filteredList = new ArrayList<FileGridModel>();
logger.trace("filterListFileGridModelItemByCategory - Category:" + category + "listSearchItem size " + listSearchItem.size());
//FOR DEBUG
// System.out.println("filterListFileGridModelItemByCategory - Category:" + category + "listSearchItem size " + listSearchItem.size());
for(SearchItem searchItem: listSearchItem){
logger.trace("wsItem: " + searchItem.getName());
// FOR DEBUG
// System.out.println("wsItem: " + searchItem.getName());
if(category.equals(getFolderItemTypeCategory(searchItem))){
filteredList.add(buildGXTFileGridModelItemForSearch(searchItem,null));
}
if(category.equals(getFolderItemTypeCategory(searchItem)))
filteredList.add(buildGXTFileGridModelItemForSearch(searchItem,null));
}
return filteredList;
}
@ -1797,16 +1371,9 @@ public class GWTWorkspaceBuilder {
public List<ScopeModel> buildGXTListScopeModel(List<String> listFilteredScopes, Map<String, String> mapPortalScopes) {
List<ScopeModel> listScopeModel = new ArrayList<ScopeModel>();
// listScopeModel.add(AllScope.getScopeModel());
for(String scope: listFilteredScopes)
listScopeModel.add(new ScopeModel(mapPortalScopes.get(scope),scope));
// listScopeModel.add(new ScopeModel("1", "Aquamaps"));
// listScopeModel.add(new ScopeModel("2", "VTI"));
// listScopeModel.add(new ScopeModel("3", "TimeSeries"));
return listScopeModel;
}
@ -1959,19 +1526,14 @@ public class GWTWorkspaceBuilder {
*/
public MessageModel buildGXTMessageModel(WorkspaceMessage mess, List<WorkspaceItem> listWorkspaceItems, String messageType) throws InternalErrorException {
List<FileModel> listAttachs = buildGXTListFileModelItemForAttachs(listWorkspaceItems);
// List<InfoContactModel> listContacts = new ArrayList<InfoContactModel>();
// mess.getAddresses();
// listContacts.add(new InfoContactModel("1", "Empty"));
return new MessageModel(mess.getId(), mess.getSubject(), buildGXTInfoContactModel(mess.getSender()), toDate(mess.getSendTime()), mess.getBody(), listAttachs, mess.getAddresses(), messageType, mess.isRead());
}
/**
* Builds the gxt info contact model.
*
@ -2015,13 +1577,9 @@ public class GWTWorkspaceBuilder {
bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.FAILED, item.getNumberOfRequests(), item.getFailures());
else
bulk = new BulkCreatorModel(item.getId(), item.getDestinationFolder().getName(), item.getStatus(), BulkCreatorModel.FAILED, item.getNumberOfRequests(), item.getFailures());
}
listBulkCreatorModel.add(bulk);
}
return listBulkCreatorModel;
}
@ -2074,10 +1632,7 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.READ)){
AccountingEntryRead read = (AccountingEntryRead) accountingEntry;
af.setOperation(GxtAccountingEntryType.READ);
// af.setDescription(GxtAccountingEntryType.READ.getName() + " by "+user.getName());
af.setDescription(read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName());
String msg = "";
@ -2096,10 +1651,7 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CUT)){
af.setOperation(GxtAccountingEntryType.CUT);
AccountingEntryCut cut = (AccountingEntryCut) accountingEntry;
// af.setDescription(GxtAccountingEntryType.CUT.getName()+ " "+cut.getItemName()+" by "+user.getName());
String msg = "";
if(cut.getItemName()==null || cut.getItemName().isEmpty())
@ -2108,8 +1660,6 @@ public class GWTWorkspaceBuilder {
msg = cut.getItemName()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName();
af.setDescription(msg);
// af.setDescription(cut.getItemName()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName());
}
break;
@ -2118,10 +1668,8 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.PASTE)){
af.setOperation(GxtAccountingEntryType.PASTE);
af.setOperation(GxtAccountingEntryType.PASTE);
AccountingEntryPaste paste = (AccountingEntryPaste) accountingEntry;
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " from "+paste.getFromPath()+" by "+user.getName());
}
@ -2131,8 +1679,7 @@ public class GWTWorkspaceBuilder {
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.REMOVE)){
af.setOperation(GxtAccountingEntryType.REMOVE);
af.setOperation(GxtAccountingEntryType.REMOVE);
AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry;
String msg = "";
@ -2142,9 +1689,6 @@ public class GWTWorkspaceBuilder {
msg = rem.getItemName() + " "+GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName();
af.setDescription(msg);
// af.setDescription(GxtAccountingEntryType.REMOVE.getName() + " "+rem.getItemName()+" by "+user.getName());
// af.setDescription(rem.getItemName() + " "+GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName());
}
break;
@ -2163,9 +1707,6 @@ public class GWTWorkspaceBuilder {
msg = ren.getOldItemName() +" "+GxtAccountingEntryType.RENAME.getName()+ " by "+user.getName();
af.setDescription(msg);
// af.setDescription(GxtAccountingEntryType.RENAME.getName()+" from "+ren.getOldItemName() + " by "+user.getName());
// af.setDescription(ren.getOldItemName() +" "+GxtAccountingEntryType.RENAME.getName()+ " by "+user.getName());
}
break;
@ -2184,8 +1725,6 @@ public class GWTWorkspaceBuilder {
msg = acc.getItemName() + " "+GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
af.setDescription(msg);
// af.setDescription(acc.getItemName() + " "+GxtAccountingEntryType.ADD.getName()+ " by "+user.getName());
}
break;
@ -2204,9 +1743,6 @@ public class GWTWorkspaceBuilder {
msg = acc.getItemName() +" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
af.setDescription(msg);
// af.setDescription(GxtAccountingEntryType.UPDATE.getName()+ " "+acc.getItemName() +" by "+user.getName());
// af.setDescription(acc.getItemName() +" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName());
}
break;
@ -2221,12 +1757,9 @@ public class GWTWorkspaceBuilder {
String msg = "";
if(acc.getItemName()==null || acc.getItemName().isEmpty())
msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " workspace folder";
// msg = GxtAccountingEntryType.SHARE.getName()+" by "+user.getName();
else
msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " workspace folder "+acc.getItemName();
// msg = acc.getItemName() +" "+GxtAccountingEntryType.SHARE.getName()+" by "+user.getName();
if(acc.getMembers()!=null && acc.getMembers().size()>0){
msg+=" with "+UserUtil.separateFullNameToCommaForPortalLogin(acc.getMembers());
@ -2254,15 +1787,10 @@ public class GWTWorkspaceBuilder {
}
break;
}
listAccFields.add(af);
}
}
logger.trace("get accounting readers converting completed - returning size "+listAccFields.size());
return listAccFields;
@ -2285,15 +1813,12 @@ public class GWTWorkspaceBuilder {
for (AccountingEntryRead accReader : readers) {
GxtAccountingField af = new GxtAccountingField();
InfoContactModel user = buildGxtInfoContactFromPortalLogin(accReader.getUser());
af.setUser(user);
af.setDate(toDate(accReader.getDate()));
af.setOperation(GxtAccountingEntryType.READ);
// af.setDescription(GxtAccountingEntryType.READ.getName() +" by "+user.getName());
String msg = "";
if(accReader.getItemName()==null || accReader.getItemName().isEmpty())
msg = GxtAccountingEntryType.READ.getName() + " by "+user.getName();
@ -2301,9 +1826,6 @@ public class GWTWorkspaceBuilder {
msg = accReader.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName();
af.setDescription(msg);
// af.setDescription(accReader.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName());
listAccFields.add(af);
}
@ -2547,11 +2069,7 @@ public class GWTWorkspaceBuilder {
WorkspaceSharedFolder theFolder = (WorkspaceSharedFolder) item;
return theFolder.getDescription();
}
case GCUBE_ITEM:{
GCubeItem theGcubeItem = (GCubeItem) item;
return theGcubeItem.getDescription();
}
case SMART_FOLDER:{
WorkspaceSmartFolder theFolder = (WorkspaceSmartFolder) item;
return theFolder.getDescription();
@ -2616,9 +2134,7 @@ public class GWTWorkspaceBuilder {
}
return null;
}
/**
* Gets the gcube item properties.
*

View File

@ -2820,7 +2820,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
if(wsItem.getType().equals(WorkspaceItemType.FOLDER_ITEM)){
FolderItem folderItem = (FolderItem) wsItem;
String smpUri = builder.getPubliLinkForFolderItem(folderItem);
String smpUri = builder.getPublicLinkForFolderItem(folderItem);
if(smpUri==null || smpUri.isEmpty())
throw new Exception("Sorry, public link on "+wsItem.getName() +" is not available");

View File

@ -46,7 +46,7 @@ public class ScopeUtilFilter {
public List<String> convertListScopeToPortlet(List<String> listScopes){
logger.trace("Scope converting...");
logger.trace("List Scope converting..."+listScopes);
List<String> scopesConverted = new ArrayList<String>();
scopesConverted.add(ALLSCOPE);
@ -60,9 +60,7 @@ public class ScopeUtilFilter {
for (String scope : listScopes) {
if(scope.compareTo(scopeRoot)==0){ //CASE SCOPE IS ROOT
logger.trace("found scope root "+scope+" added to list without converting");
hashScopesFiltered.put(scopeRoot, scopeRoot);
scopesConverted.add(scopeRoot);
@ -78,13 +76,9 @@ public class ScopeUtilFilter {
// System.out.println("end "+end);
if(index!=-1){ //CASE SCOPE ROOT IS FOUND
String filerString = scope.substring(index+start, scope.length());
hashScopesFiltered.put(filerString, scope);
scopesConverted.add(filerString);
scopesConverted.add(filerString);
logger.trace("scope "+scope+ " is converted in: "+filerString);
}else{ //CASE SCOPE ROOT NOT IS FOUND
@ -92,9 +86,7 @@ public class ScopeUtilFilter {
}
}
}
logger.trace("Scope converting was completed");
return scopesConverted;
}

View File

@ -104,7 +104,7 @@ public class SinglePublicLinkTest {
if(wsItem.getType().equals(WorkspaceItemType.FOLDER_ITEM)){
FolderItem folderItem = (FolderItem) wsItem;
String smpUri = builder.getPubliLinkForFolderItem(folderItem);
String smpUri = builder.getPublicLinkForFolderItem(folderItem);
if(smpUri==null || smpUri.isEmpty())
throw new Exception("Sorry, public link on "+wsItem.getName() +" is not available");

View File

@ -182,7 +182,7 @@ public class UriResolverReaderRR {
FolderItem folderItem = (FolderItem) wsItem;
System.out.println("get public link...");
String smpUri = builder.getPubliLinkForFolderItem(folderItem);
String smpUri = builder.getPublicLinkForFolderItem(folderItem);
System.out.println("smpUri "+smpUri);
System.out.println("get uriResolver...");