2018-06-26 14:58:41 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.common.storagehubwrapper.server.converter;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.gcube.common.storagehub.model.Metadata;
|
|
|
|
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
2019-09-13 16:34:49 +02:00
|
|
|
import org.gcube.common.storagehub.model.items.ExternalLink;
|
2018-06-26 14:58:41 +02:00
|
|
|
import org.gcube.common.storagehub.model.items.ExternalURL;
|
|
|
|
import org.gcube.common.storagehub.model.items.FolderItem;
|
2018-09-24 16:18:06 +02:00
|
|
|
import org.gcube.common.storagehub.model.items.GCubeItem;
|
2018-06-26 14:58:41 +02:00
|
|
|
import org.gcube.common.storagehub.model.items.GenericFileItem;
|
|
|
|
import org.gcube.common.storagehub.model.items.Item;
|
|
|
|
import org.gcube.common.storagehub.model.items.PDFFileItem;
|
|
|
|
import org.gcube.common.storagehub.model.items.SharedFolder;
|
2018-09-24 11:25:04 +02:00
|
|
|
import org.gcube.common.storagehub.model.items.TrashItem;
|
2018-06-26 14:58:41 +02:00
|
|
|
import org.gcube.common.storagehub.model.items.VreFolder;
|
|
|
|
import org.gcube.common.storagehub.model.items.nodes.Accounting;
|
|
|
|
import org.gcube.common.storagehub.model.items.nodes.Content;
|
|
|
|
import org.gcube.common.storagehub.model.items.nodes.ImageContent;
|
|
|
|
import org.gcube.common.storagehub.model.items.nodes.PDFContent;
|
|
|
|
import org.gcube.common.storagehub.model.items.nodes.accounting.AccountEntry;
|
2018-10-12 14:19:09 +02:00
|
|
|
import org.gcube.common.storagehub.model.service.Version;
|
2018-06-26 14:58:41 +02:00
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.FileItem;
|
2018-09-24 16:18:06 +02:00
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.GcubeItem;
|
2018-06-26 14:58:41 +02:00
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.ImageFile;
|
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.PDFFile;
|
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.PropertyMap;
|
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.URLFile;
|
2019-09-13 16:34:49 +02:00
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.URLFileItem;
|
2018-10-12 14:19:09 +02:00
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
|
2018-06-26 14:58:41 +02:00
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFolder;
|
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceSharedFolder;
|
2018-06-26 16:13:03 +02:00
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItemType;
|
2018-07-05 18:24:28 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
2018-06-26 14:58:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The Class HLMapper.
|
|
|
|
*
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
2022-04-28 11:29:25 +02:00
|
|
|
* Jun 20, 2018
|
2018-06-26 14:58:41 +02:00
|
|
|
*/
|
|
|
|
public class HLMapper {
|
|
|
|
|
2018-07-05 18:24:28 +02:00
|
|
|
private static Logger logger = LoggerFactory.getLogger(HLMapper.class);
|
|
|
|
|
2019-09-13 16:34:49 +02:00
|
|
|
/**
|
|
|
|
* To URL file.
|
|
|
|
*
|
|
|
|
* @param extLink the ext link
|
|
|
|
* @return the URL file
|
|
|
|
* @throws Exception the exception
|
|
|
|
*/
|
|
|
|
public static URLFile toURLFile(ExternalLink extLink) throws Exception {
|
|
|
|
return (URLFile) toWorkspaceItem(extLink, false, false, false);
|
|
|
|
}
|
2018-06-26 14:58:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* To workspace item.
|
|
|
|
*
|
2022-04-28 11:29:25 +02:00
|
|
|
* @param <T> the generic type
|
2018-06-26 14:58:41 +02:00
|
|
|
* @param item the item
|
|
|
|
* @return the t
|
2019-09-13 16:34:49 +02:00
|
|
|
* @throws Exception the exception
|
2018-06-26 14:58:41 +02:00
|
|
|
*/
|
2022-04-28 11:29:25 +02:00
|
|
|
public static <T extends WorkspaceItem> T toWorkspaceItem(Item item) throws Exception {
|
2018-06-26 14:58:41 +02:00
|
|
|
|
|
|
|
return toWorkspaceItem(item, false, false, false);
|
|
|
|
}
|
|
|
|
|
2018-06-26 17:23:09 +02:00
|
|
|
/**
|
|
|
|
* To accounting entries.
|
|
|
|
*
|
|
|
|
* @param item the item
|
|
|
|
* @return the list
|
|
|
|
*/
|
2022-04-28 11:29:25 +02:00
|
|
|
public static List<AccountEntry> toAccountingEntries(Item item) {
|
2018-06-26 17:23:09 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
List<AccountEntry> accountingEntries = null;
|
2018-06-26 17:23:09 +02:00
|
|
|
|
|
|
|
Accounting accounting = item.getAccounting();
|
2022-04-28 11:29:25 +02:00
|
|
|
if (accounting != null) {
|
|
|
|
accountingEntries = accounting.getEntries();
|
|
|
|
}
|
2018-06-26 17:23:09 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
return accountingEntries;
|
|
|
|
}
|
2018-09-24 16:18:06 +02:00
|
|
|
|
2018-06-26 17:23:09 +02:00
|
|
|
/**
|
|
|
|
* To property map.
|
|
|
|
*
|
2018-09-24 16:18:06 +02:00
|
|
|
* @param metadata the metadata
|
2018-06-26 17:23:09 +02:00
|
|
|
* @return the property map
|
|
|
|
*/
|
2022-04-28 11:29:25 +02:00
|
|
|
public static PropertyMap toPropertyMap(Metadata metadata) {
|
2018-09-24 16:18:06 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
PropertyMap pm = null;
|
|
|
|
if (metadata != null)
|
2018-12-03 11:36:59 +01:00
|
|
|
pm = new PropertyMap(metadata.getMap());
|
2018-06-26 17:23:09 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
// IN CASE OF EMPTY MAP RETURNS NULL
|
|
|
|
if (pm != null && pm.getValues() != null && pm.getValues().isEmpty())
|
2018-11-21 11:49:19 +01:00
|
|
|
pm = null;
|
|
|
|
|
2018-06-26 17:23:09 +02:00
|
|
|
return pm;
|
|
|
|
}
|
|
|
|
|
2018-10-12 14:19:09 +02:00
|
|
|
/**
|
|
|
|
* To workspace file version.
|
|
|
|
*
|
|
|
|
* @param fileVersion the file version
|
|
|
|
* @return the workspace file version
|
|
|
|
*/
|
2022-04-28 11:29:25 +02:00
|
|
|
public static WorkspaceFileVersion toWorkspaceFileVersion(Version fileVersion) {
|
2018-10-12 14:19:09 +02:00
|
|
|
WorkspaceFileVersion wsFileVersion = new WorkspaceFileVersion();
|
|
|
|
wsFileVersion.setId(fileVersion.getId());
|
|
|
|
wsFileVersion.setName(fileVersion.getName());
|
|
|
|
wsFileVersion.setCreated(fileVersion.getCreated());
|
2018-10-12 17:31:59 +02:00
|
|
|
wsFileVersion.setCurrentVersion(fileVersion.isCurrent());
|
2022-04-28 11:29:25 +02:00
|
|
|
// TODO MUST BE TERMINATED
|
2018-10-12 14:19:09 +02:00
|
|
|
return wsFileVersion;
|
|
|
|
}
|
|
|
|
|
2018-06-26 14:58:41 +02:00
|
|
|
/**
|
|
|
|
* To workspace item.
|
|
|
|
*
|
2022-04-28 11:29:25 +02:00
|
|
|
* @param <T> the generic type
|
|
|
|
* @param item the item
|
|
|
|
* @param withAccounting the with accounting
|
|
|
|
* @param withFileDetails the with file details
|
2018-09-24 16:18:06 +02:00
|
|
|
* @param withMapProperties the with map properties
|
2018-06-26 14:58:41 +02:00
|
|
|
* @return the t
|
2019-09-13 16:34:49 +02:00
|
|
|
* @throws Exception the exception
|
2018-06-26 14:58:41 +02:00
|
|
|
*/
|
2022-04-28 11:29:25 +02:00
|
|
|
public static <T extends WorkspaceItem> T toWorkspaceItem(Item item, boolean withAccounting,
|
|
|
|
boolean withFileDetails, boolean withMapProperties) throws Exception {
|
2018-10-16 15:18:59 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
try {
|
|
|
|
List<AccountEntry> accountingEntries = null;
|
2018-10-16 15:18:59 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
if (withAccounting)
|
2018-10-16 15:18:59 +02:00
|
|
|
accountingEntries = toAccountingEntries(item);
|
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceItem theItem = null;
|
|
|
|
WorkspaceItemType type = null;
|
|
|
|
Boolean isFolder = false;
|
2018-10-16 15:18:59 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
String itemName = item.getName();
|
|
|
|
boolean isRoot = false;
|
2018-10-16 15:18:59 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
logger.trace("The item: " + item);
|
|
|
|
logger.trace("Converting Item: " + item.getName() + " with id: " + item.getId());
|
2018-11-22 12:49:47 +01:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
// THE ITEM IS A KIND OF FOLDER
|
|
|
|
if (item instanceof FolderItem) {
|
|
|
|
isFolder = true;
|
|
|
|
FolderItem folderItem = (FolderItem) item; // ??
|
2018-10-16 15:18:59 +02:00
|
|
|
theItem = new WorkspaceFolder();
|
|
|
|
type = WorkspaceItemType.FOLDER;
|
2022-04-28 11:29:25 +02:00
|
|
|
if (item instanceof SharedFolder || item instanceof VreFolder) {
|
|
|
|
SharedFolder sharedfolder = (SharedFolder) item; // ??
|
|
|
|
theItem = new WorkspaceSharedFolder();
|
2018-10-16 15:18:59 +02:00
|
|
|
type = WorkspaceItemType.SHARED_FOLDER;
|
2022-04-28 11:29:25 +02:00
|
|
|
itemName = sharedfolder.getTitle(); // IN CASE OF SHARED FOLDER THE NAME IS AN UUID, I'M USING THE
|
|
|
|
// TITLE
|
|
|
|
|
|
|
|
if (sharedfolder.isVreFolder()) {
|
|
|
|
// logger.debug("Converting shared folder: "+theItem.getClass());
|
|
|
|
// VreFolder vreFolder = (VreFolder) item;
|
|
|
|
// theItem = new WorkspaceVREFolder(); //NEVER INSTANCE THE WorkspaceVREFolder
|
|
|
|
// because VreFolder is never used by HL/StorageHub
|
|
|
|
itemName = sharedfolder.getDisplayName(); // IN CASE OF VRE FOLDER I'M USING THE DISPLAYNAME
|
2018-10-16 15:18:59 +02:00
|
|
|
((WorkspaceSharedFolder) theItem).setVreFolder(true);
|
|
|
|
type = WorkspaceItemType.VRE_FOLDER;
|
|
|
|
}
|
2022-04-28 11:29:25 +02:00
|
|
|
}
|
2018-10-16 15:18:59 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
boolean isPublicItem = folderItem.isPublicItem();
|
|
|
|
// ((WorkspaceFolder) theItem).setPublicFolder(folderItem.isPublicItem());
|
|
|
|
// logger.debug("Wrapped as Folder");
|
2018-10-16 15:18:59 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
// TODO THIS MUST BE REMOVED. Checking the old property isPublic added as
|
|
|
|
// "<boolean>true</boolean>" by HL
|
|
|
|
if (!isPublicItem) {
|
|
|
|
try {
|
|
|
|
// Map<String, Object> map = item.getPropertyMap().getValues();
|
2018-11-22 12:49:47 +01:00
|
|
|
// logger.debug("Property Map size: "+map.size());
|
|
|
|
// for (String key : map.keySet()) {
|
|
|
|
// logger.debug("Key: "+key+ "value: "+map.get(key));
|
|
|
|
// }
|
2022-04-28 11:29:25 +02:00
|
|
|
String isPublic = (String) item.getMetadata().getMap().get("isPublic");
|
|
|
|
logger.debug("The item name: " + item.getName() + " has isPublic property like: " + isPublic);
|
|
|
|
isPublicItem = isPublic != null ? isPublic.toLowerCase().contains("true") : false;
|
|
|
|
} catch (Exception e) {
|
|
|
|
// silent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
((WorkspaceFolder) theItem).setPublicFolder(isPublicItem);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// THE ITEM IS A KIND OF FILE
|
|
|
|
if (item instanceof AbstractFileItem) {
|
|
|
|
theItem = new FileItem();
|
|
|
|
type = WorkspaceItemType.FILE_ITEM;
|
|
|
|
FileItemType fileItemType = null;
|
|
|
|
if (item instanceof ExternalURL) {
|
|
|
|
theItem = new URLFileItem();
|
|
|
|
fileItemType = FileItemType.URL_DOCUMENT;
|
|
|
|
} else if (item instanceof GenericFileItem) {
|
|
|
|
GenericFileItem gFI = (GenericFileItem) item; // ??
|
|
|
|
fileItemType = FileItemType.DOCUMENT;
|
|
|
|
} else if (item instanceof PDFFileItem) {
|
|
|
|
theItem = new PDFFile();
|
|
|
|
fileItemType = FileItemType.PDF_DOCUMENT;
|
|
|
|
if (withFileDetails) {
|
|
|
|
PDFFileItem pdfFI = (PDFFileItem) item;
|
|
|
|
PDFContent pdfContent = pdfFI.getContent();
|
|
|
|
PDFFile thePDFFileItem = (PDFFile) theItem;
|
|
|
|
thePDFFileItem.setNumberOfPages(pdfContent.getNumberOfPages());
|
|
|
|
thePDFFileItem.setProducer(pdfContent.getProducer());
|
|
|
|
thePDFFileItem.setVersion(pdfContent.getVersion());
|
|
|
|
thePDFFileItem.setTitle(pdfContent.getTitle());
|
|
|
|
thePDFFileItem.setAuthor(pdfContent.getAuthor());
|
|
|
|
}
|
|
|
|
} else if (item instanceof org.gcube.common.storagehub.model.items.ImageFile) {
|
|
|
|
theItem = new ImageFile();
|
|
|
|
fileItemType = FileItemType.IMAGE_DOCUMENT;
|
|
|
|
if (withFileDetails) {
|
|
|
|
org.gcube.common.storagehub.model.items.ImageFile imgFI = (org.gcube.common.storagehub.model.items.ImageFile) item; // ??
|
|
|
|
ImageFile theImageFileItem = (ImageFile) theItem;
|
|
|
|
ImageContent content = imgFI.getContent();
|
|
|
|
theImageFileItem.setHeight(content.getHeight());
|
|
|
|
theImageFileItem.setWidth(content.getWidth());
|
|
|
|
theImageFileItem.setThumbnailWidth(content.getThumbnailHeight());
|
|
|
|
theImageFileItem.setThumbnailHeight(content.getThumbnailHeight());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AbstractFileItem itemAb = (AbstractFileItem) item;
|
|
|
|
Content aC = itemAb.getContent();
|
|
|
|
FileItem theFileItem = (FileItem) theItem;
|
|
|
|
theFileItem.setFileItemType(fileItemType);
|
|
|
|
|
|
|
|
if (aC != null) {
|
|
|
|
logger.debug("The content is not null for item: " + itemAb.getId());
|
|
|
|
theFileItem.setMimeType(aC.getMimeType());
|
|
|
|
theFileItem.setSize(aC.getSize());
|
|
|
|
} else
|
|
|
|
logger.warn("The content is null for item: " + itemAb.getId());
|
|
|
|
|
|
|
|
// TODO ADD VERSION NAME
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// ADDING (GCUBE) PROPERTIES
|
|
|
|
PropertyMap pm = null;
|
|
|
|
if (withMapProperties || isFolder) {
|
|
|
|
// System.out.println("Setting map: "+item.getPropertyMap().getValues());
|
|
|
|
pm = toPropertyMap(item.getMetadata());
|
|
|
|
}
|
|
|
|
|
|
|
|
// CONVERTING EXTERNALLINK
|
|
|
|
if (item instanceof ExternalLink) {
|
|
|
|
logger.trace("FOUND an ExternalLink...");
|
|
|
|
type = WorkspaceItemType.URL_ITEM;
|
|
|
|
ExternalLink extLink = (ExternalLink) item;
|
|
|
|
theItem = new URLFile();
|
|
|
|
URLFile theURLFile = (URLFile) theItem;
|
|
|
|
theURLFile.setValue(extLink.getValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
// CONVERTING TRASH ITEM
|
|
|
|
if (item.isTrashed() && item instanceof TrashItem) {
|
2018-10-16 15:18:59 +02:00
|
|
|
type = WorkspaceItemType.TRASH_ITEM;
|
2020-05-19 16:27:33 +02:00
|
|
|
TrashItem trashItem = (TrashItem) item;
|
2022-04-28 11:29:25 +02:00
|
|
|
itemName = trashItem.getTitle(); // IN CASE OF TRASHED ITEM THE NAME IS THE ID, SO I'M USING THE TITLE
|
2018-10-16 15:18:59 +02:00
|
|
|
theItem = new org.gcube.common.storagehubwrapper.shared.tohl.impl.TrashItem();
|
|
|
|
org.gcube.common.storagehubwrapper.shared.tohl.impl.TrashItem theTrashItem = (org.gcube.common.storagehubwrapper.shared.tohl.impl.TrashItem) theItem;
|
|
|
|
theTrashItem.setDeletedBy(trashItem.getDeletedBy());
|
|
|
|
theTrashItem.setDeletedTime(trashItem.getDeletedTime());
|
|
|
|
theTrashItem.setOriginalParentId(trashItem.getOriginalParentId());
|
|
|
|
theTrashItem.setDeletedFrom(trashItem.getDeletedFrom());
|
|
|
|
theTrashItem.setLenght(trashItem.getLenght());
|
|
|
|
theTrashItem.setMimeType(trashItem.getMimeType());
|
2020-05-19 16:27:33 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
isFolder = trashItem.isFolder(); // DO NOT MOVE THIS SET
|
|
|
|
if (isFolder) // Avoiding null exception on
|
2018-10-16 15:18:59 +02:00
|
|
|
type = WorkspaceItemType.TRASH_FOLDER;
|
|
|
|
|
|
|
|
logger.debug("Wrapped as TrashItem");
|
|
|
|
}
|
2018-06-26 14:58:41 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
if (item instanceof GCubeItem) {
|
2018-10-16 15:18:59 +02:00
|
|
|
type = WorkspaceItemType.FILE_ITEM;
|
2022-04-28 11:29:25 +02:00
|
|
|
GCubeItem gcubeItem = (GCubeItem) item; // ??
|
2018-10-16 15:18:59 +02:00
|
|
|
theItem = new GcubeItem();
|
|
|
|
GcubeItem theGcubeItem = (GcubeItem) theItem;
|
|
|
|
theGcubeItem.setFileItemType(FileItemType.GCUBE_ITEM);
|
|
|
|
theGcubeItem.setScopes(gcubeItem.getScopes());
|
|
|
|
theGcubeItem.setCreator(gcubeItem.getCreator());
|
|
|
|
theGcubeItem.setItemType(gcubeItem.getItemType());
|
|
|
|
theGcubeItem.setShared(gcubeItem.isShared());
|
2022-04-28 11:29:25 +02:00
|
|
|
if (withMapProperties) {
|
2018-10-16 15:18:59 +02:00
|
|
|
PropertyMap property = toPropertyMap(gcubeItem.getProperty());
|
|
|
|
theGcubeItem.setProperty(property);
|
2018-06-26 14:58:41 +02:00
|
|
|
}
|
|
|
|
|
2018-10-16 15:18:59 +02:00
|
|
|
logger.debug("Wrapped as GcubeItem");
|
2018-09-24 18:18:11 +02:00
|
|
|
}
|
2018-10-04 11:34:37 +02:00
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
if (theItem == null) {
|
2018-11-19 16:41:17 +01:00
|
|
|
logger.info("Mapping unknown object as simple FileItem");
|
|
|
|
theItem = new FileItem();
|
2018-11-19 17:51:05 +01:00
|
|
|
type = WorkspaceItemType.FILE_ITEM;
|
2018-11-19 18:30:05 +01:00
|
|
|
FileItem theFileItem = (FileItem) theItem;
|
2022-04-28 11:29:25 +02:00
|
|
|
theFileItem.setFileItemType(FileItemType.DOCUMENT);
|
2018-11-19 16:41:17 +01:00
|
|
|
}
|
2018-11-19 18:30:05 +01:00
|
|
|
|
2018-10-16 15:18:59 +02:00
|
|
|
theItem.setId(item.getId());
|
|
|
|
theItem.setName(itemName);
|
|
|
|
theItem.setPath(item.getPath());
|
|
|
|
theItem.setParentId(item.getParentId());
|
|
|
|
theItem.setTrashed(item.isTrashed());
|
|
|
|
theItem.setShared(item.isShared());
|
|
|
|
theItem.setLocked(item.isLocked());
|
|
|
|
theItem.setTitle(item.getTitle());
|
|
|
|
theItem.setDescription(item.getDescription());
|
|
|
|
theItem.setLastModifiedBy(item.getLastModifiedBy());
|
|
|
|
theItem.setLastModificationTime(item.getLastModificationTime());
|
|
|
|
theItem.setCreationTime(item.getCreationTime());
|
|
|
|
theItem.setOwner(item.getOwner());
|
|
|
|
theItem.setHidden(item.isHidden());
|
|
|
|
theItem.setAccounting(accountingEntries);
|
|
|
|
theItem.setType(type);
|
|
|
|
theItem.setFolder(isFolder);
|
2022-04-28 11:29:25 +02:00
|
|
|
theItem.setRoot(isRoot); // THIS IS ALWAYS FALSE. SHUB DOES NOT RETURN THIS INFORMATION
|
2018-10-16 15:18:59 +02:00
|
|
|
theItem.setPropertyMap(pm);
|
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
logger.debug("Wrapped WsItem: " + theItem);
|
|
|
|
logger.debug("Wrapped WsItem has type: " + theItem.getClass().getName());
|
2018-10-16 15:18:59 +02:00
|
|
|
|
|
|
|
return (T) theItem;
|
|
|
|
|
2022-04-28 11:29:25 +02:00
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("Error on converting the item with id: " + item.getId(), e);
|
2018-10-16 15:18:59 +02:00
|
|
|
throw e;
|
2018-09-24 11:25:04 +02:00
|
|
|
}
|
2018-06-26 14:58:41 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|