integrated with the method setDescription reported at #19652#note-1
This commit is contained in:
parent
bd5cfa29ea
commit
d203bf71e9
17
.classpath
17
.classpath
|
@ -24,23 +24,6 @@
|
||||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="ignore_optional_problems" value="true"/>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="m2e-apt" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="ignore_optional_problems" value="true"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="m2e-apt" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" path=".apt_generated">
|
<classpathentry kind="src" path=".apt_generated">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
|
|
|
@ -60,8 +60,8 @@ public class StorageHubClientService {
|
||||||
/** The authorization token. */
|
/** The authorization token. */
|
||||||
private String authorizationToken;
|
private String authorizationToken;
|
||||||
|
|
||||||
/** The shc client. */
|
|
||||||
private StorageHubClient shcClient;
|
private StorageHubClient shClient;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +76,7 @@ public class StorageHubClientService {
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
this.authorizationToken = authorizationToken;
|
this.authorizationToken = authorizationToken;
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
shcClient = new StorageHubClient();
|
shClient = new StorageHubClient();
|
||||||
logger.info("Instancied the "+StorageHubClientService.class.getSimpleName()+" as: "+this.toString());
|
logger.info("Instancied the "+StorageHubClientService.class.getSimpleName()+" as: "+this.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public FolderItem getRoot() throws Exception {
|
public FolderItem getRoot() throws Exception {
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
FolderContainer root = shcClient.getWSRoot();
|
FolderContainer root = shClient.getWSRoot();
|
||||||
return root.get();
|
return root.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ public class StorageHubClientService {
|
||||||
public List<? extends Item> getChildren(String id, boolean withAccounting, boolean withMapProperties) throws Exception{
|
public List<? extends Item> getChildren(String id, boolean withAccounting, boolean withMapProperties) throws Exception{
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
logger.trace("Requesting getChildren for id: "+id+" [withAccounting: "+withAccounting+", withMapProperties: "+withMapProperties+"]");
|
logger.trace("Requesting getChildren for id: "+id+" [withAccounting: "+withAccounting+", withMapProperties: "+withMapProperties+"]");
|
||||||
ListResolverTyped resolverTyped = shcClient.open(id).asFolder().list();
|
ListResolverTyped resolverTyped = shClient.open(id).asFolder().list();
|
||||||
ListResolver theResolver = resolverTyped.withContent();
|
ListResolver theResolver = resolverTyped.withContent();
|
||||||
|
|
||||||
if(withAccounting)
|
if(withAccounting)
|
||||||
|
@ -156,7 +156,7 @@ public class StorageHubClientService {
|
||||||
public List<? extends Item> getFilteredChildren(String id, Class<? extends Item> aType, boolean withAccounting, boolean withMapProperties) throws Exception{
|
public List<? extends Item> getFilteredChildren(String id, Class<? extends Item> aType, boolean withAccounting, boolean withMapProperties) throws Exception{
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
|
|
||||||
ListResolver resolverTyped = shcClient.open(id).asFolder().list().ofType(aType);
|
ListResolver resolverTyped = shClient.open(id).asFolder().list().ofType(aType);
|
||||||
ListResolver theResolver = resolverTyped.withContent();
|
ListResolver theResolver = resolverTyped.withContent();
|
||||||
|
|
||||||
if(withAccounting)
|
if(withAccounting)
|
||||||
|
@ -184,12 +184,12 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
//I'M GOING TO REMAIN THESE OPTIONS FOR POSSIBLE FUTURE SUPPORTING ON SHUB
|
//I'M GOING TO REMAIN THESE OPTIONS FOR POSSIBLE FUTURE SUPPORTING ON SHUB
|
||||||
if(withMetadata) {
|
if(withMetadata) {
|
||||||
itemCont = shcClient.open(itemId).asItem(); //TODO
|
itemCont = shClient.open(itemId).asItem(); //TODO
|
||||||
}else if(withAccounting){
|
}else if(withAccounting){
|
||||||
itemCont = shcClient.open(itemId).asItem(); //TODO
|
itemCont = shClient.open(itemId).asItem(); //TODO
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
itemCont = shcClient.open(itemId).asItem();
|
itemCont = shClient.open(itemId).asItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemCont.get();
|
return itemCont.get();
|
||||||
|
@ -218,7 +218,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public Item setMetadata(String itemId, Metadata metadata) throws Exception{
|
public Item setMetadata(String itemId, Metadata metadata) throws Exception{
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
ItemContainer<Item> itemCont = shcClient.open(itemId).asItem();
|
ItemContainer<Item> itemCont = shClient.open(itemId).asItem();
|
||||||
itemCont.setMetadata(metadata);
|
itemCont.setMetadata(metadata);
|
||||||
return itemCont.get();
|
return itemCont.get();
|
||||||
}
|
}
|
||||||
|
@ -234,8 +234,8 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> getMetadata(String itemId) throws Exception{
|
public Map<String, Object> getMetadata(String itemId) throws Exception{
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
ItemContainer<Item> itemCont = shcClient.open(itemId).asItem();
|
ItemContainer<Item> itemCont = shClient.open(itemId).asItem();
|
||||||
Metadata metadata = shcClient.open(itemId).asItem().get().getMetadata();
|
Metadata metadata = shClient.open(itemId).asItem().get().getMetadata();
|
||||||
if(metadata!=null)
|
if(metadata!=null)
|
||||||
return metadata.getMap();
|
return metadata.getMap();
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public FolderContainer getFolderContainer(String itemId) throws Exception{
|
public FolderContainer getFolderContainer(String itemId) throws Exception{
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return shcClient.open(itemId).asFolder();
|
return shClient.open(itemId).asFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public List<? extends Item> getParents(String itemId) throws Exception {
|
public List<? extends Item> getParents(String itemId) throws Exception {
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
ListResolver toReturn = shcClient.open(itemId).asItem().getAnchestors();
|
ListResolver toReturn = shClient.open(itemId).asItem().getAnchestors();
|
||||||
if(toReturn==null || toReturn.getItems()==null){
|
if(toReturn==null || toReturn.getItems()==null){
|
||||||
logger.warn("Parent List of item id "+itemId+" is null");
|
logger.warn("Parent List of item id "+itemId+" is null");
|
||||||
return null;
|
return null;
|
||||||
|
@ -298,7 +298,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public FolderItem getRootSharedFolder(String itemId) throws Exception {
|
public FolderItem getRootSharedFolder(String itemId) throws Exception {
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return getRootSharedFolder(shcClient.open(itemId).asItem());
|
return getRootSharedFolder(shClient.open(itemId).asItem());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public boolean isItemShared(String itemId) throws Exception {
|
public boolean isItemShared(String itemId) throws Exception {
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return shcClient.open(itemId).asItem().get().isShared();
|
return shClient.open(itemId).asItem().get().isShared();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public boolean canWrite(String folderContainerId) throws Exception {
|
public boolean canWrite(String folderContainerId) throws Exception {
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return shcClient.open(folderContainerId).asFolder().canWrite();
|
return shClient.open(folderContainerId).asFolder().canWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public Item createFolder(String parentId, String folderName, String folderDescription) throws Exception {
|
public Item createFolder(String parentId, String folderName, String folderDescription) throws Exception {
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
FolderContainer folderContainer = shcClient.open(parentId).asFolder().newFolder(folderName, folderDescription);
|
FolderContainer folderContainer = shClient.open(parentId).asFolder().newFolder(folderName, folderDescription);
|
||||||
return getItem(folderContainer.get().getId(), false, true);
|
return getItem(folderContainer.get().getId(), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ public class StorageHubClientService {
|
||||||
public Item uploadFile(String folderId, InputStream is, String fileName, String fileDescription) throws Exception{
|
public Item uploadFile(String folderId, InputStream is, String fileName, String fileDescription) throws Exception{
|
||||||
|
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
FileContainer fileCont = shcClient.open(folderId).asFolder().uploadFile(is, fileName, fileDescription);
|
FileContainer fileCont = shClient.open(folderId).asFolder().uploadFile(is, fileName, fileDescription);
|
||||||
return fileCont.get();
|
return fileCont.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,9 +479,9 @@ public class StorageHubClientService {
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
StreamDescriptor streamDesc;
|
StreamDescriptor streamDesc;
|
||||||
if(versionName!=null && !versionName.isEmpty()){
|
if(versionName!=null && !versionName.isEmpty()){
|
||||||
streamDesc = shcClient.open(itemId).asFile().downloadSpecificVersion(versionName);
|
streamDesc = shClient.open(itemId).asFile().downloadSpecificVersion(versionName);
|
||||||
}else{
|
}else{
|
||||||
streamDesc = shcClient.open(itemId).asFile().download(nodeIdsToExclude);
|
streamDesc = shClient.open(itemId).asFile().download(nodeIdsToExclude);
|
||||||
}
|
}
|
||||||
return new StreamDescriptor(streamDesc.getStream(), streamDesc.getFileName(), streamDesc.getContentType(), streamDesc.getContentLenght());
|
return new StreamDescriptor(streamDesc.getStream(), streamDesc.getFileName(), streamDesc.getContentType(), streamDesc.getContentLenght());
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ public class StorageHubClientService {
|
||||||
public StreamDescriptor downloadFolder(String folderId, String nodeIdsToExclude) throws Exception{
|
public StreamDescriptor downloadFolder(String folderId, String nodeIdsToExclude) throws Exception{
|
||||||
|
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
StreamDescriptor streamDesc = shcClient.open(folderId).asFolder().download(nodeIdsToExclude);
|
StreamDescriptor streamDesc = shClient.open(folderId).asFolder().download(nodeIdsToExclude);
|
||||||
return new StreamDescriptor(streamDesc.getStream(), streamDesc.getFileName(), streamDesc.getContentType(), streamDesc.getContentLenght());
|
return new StreamDescriptor(streamDesc.getStream(), streamDesc.getFileName(), streamDesc.getContentType(), streamDesc.getContentLenght());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ public class StorageHubClientService {
|
||||||
public Item uploadArchive(String folderId, InputStream is, String extractionFolderName) throws Exception{
|
public Item uploadArchive(String folderId, InputStream is, String extractionFolderName) throws Exception{
|
||||||
|
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
FolderContainer folderCont = shcClient.open(folderId).asFolder().uploadArchive(is, extractionFolderName);
|
FolderContainer folderCont = shClient.open(folderId).asFolder().uploadArchive(is, extractionFolderName);
|
||||||
return folderCont.get();
|
return folderCont.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ public class StorageHubClientService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(item instanceof FolderItem || item instanceof SharedFolder || item instanceof VreFolder){
|
if(item instanceof FolderItem || item instanceof SharedFolder || item instanceof VreFolder){
|
||||||
return shcClient.open(folderId).asFolder().findByName(name).withContent().getItems();
|
return shClient.open(folderId).asFolder().findByName(name).withContent().getItems();
|
||||||
}else
|
}else
|
||||||
throw new Exception("The input folder id is not a folder");
|
throw new Exception("The input folder id is not a folder");
|
||||||
}
|
}
|
||||||
|
@ -589,7 +589,7 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
if(item instanceof FolderItem || item instanceof SharedFolder || item instanceof VreFolder){
|
if(item instanceof FolderItem || item instanceof SharedFolder || item instanceof VreFolder){
|
||||||
//this does not return the trashed items
|
//this does not return the trashed items
|
||||||
return shcClient.open(folderId).asFolder().search(text,true).withContent().getItems();
|
return shClient.open(folderId).asFolder().search(text,true).withContent().getItems();
|
||||||
}else
|
}else
|
||||||
throw new Exception("The input folder id is not a folder");
|
throw new Exception("The input folder id is not a folder");
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
Validate.notNull(itemId, "Bad request to deleteItemById, the itemId is null");
|
Validate.notNull(itemId, "Bad request to deleteItemById, the itemId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
shcClient.open(itemId).asItem().delete();
|
shClient.open(itemId).asItem().delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ public class StorageHubClientService {
|
||||||
public Item openTrash() throws Exception{
|
public Item openTrash() throws Exception{
|
||||||
|
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return shcClient.openTrash().get();
|
return shClient.openTrash().get();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ public class StorageHubClientService {
|
||||||
public void emptyTrash() throws Exception{
|
public void emptyTrash() throws Exception{
|
||||||
|
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
shcClient.emptyTrash();
|
shClient.emptyTrash();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,9 +655,9 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
GenericItemContainer container = null;
|
GenericItemContainer container = null;
|
||||||
if(destinationFolderId==null)
|
if(destinationFolderId==null)
|
||||||
container = shcClient.restoreThrashItem(itemId);
|
container = shClient.restoreThrashItem(itemId);
|
||||||
else
|
else
|
||||||
container = shcClient.restoreThrashItem(itemId, destinationFolderId);
|
container = shClient.restoreThrashItem(itemId, destinationFolderId);
|
||||||
|
|
||||||
if(container!=null){
|
if(container!=null){
|
||||||
Item item = container.get();
|
Item item = container.get();
|
||||||
|
@ -684,8 +684,8 @@ public class StorageHubClientService {
|
||||||
Validate.notNull(itemId, "Bad request to moveItem, the itemId is null");
|
Validate.notNull(itemId, "Bad request to moveItem, the itemId is null");
|
||||||
Validate.notNull(destFolderContainer, "Bad request to moveItem, the itemId is null");
|
Validate.notNull(destFolderContainer, "Bad request to moveItem, the itemId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
shcClient.open(itemId).asItem().move(destFolderContainer);
|
shClient.open(itemId).asItem().move(destFolderContainer);
|
||||||
return shcClient.open(itemId).asItem().get();
|
return shClient.open(itemId).asItem().get();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ public class StorageHubClientService {
|
||||||
Validate.notNull(fileItemId, "Bad request to copyFileItem, the fileItemId is null");
|
Validate.notNull(fileItemId, "Bad request to copyFileItem, the fileItemId is null");
|
||||||
Validate.notNull(destFolderContainer, "Bad request to copyFileItem, the destFolderContainer is null");
|
Validate.notNull(destFolderContainer, "Bad request to copyFileItem, the destFolderContainer is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
FileContainer copyingItem = shcClient.open(fileItemId).asFile();
|
FileContainer copyingItem = shClient.open(fileItemId).asFile();
|
||||||
String newName = newFileName!=null && !newFileName.isEmpty()?newFileName:"Copy of "+copyingItem.get().getName();
|
String newName = newFileName!=null && !newFileName.isEmpty()?newFileName:"Copy of "+copyingItem.get().getName();
|
||||||
FileContainer newItem = copyingItem.copy(destFolderContainer, newName);
|
FileContainer newItem = copyingItem.copy(destFolderContainer, newName);
|
||||||
return newItem.get();
|
return newItem.get();
|
||||||
|
@ -723,8 +723,8 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
Validate.notNull(itemId, "Bad request to renameItem, the itemId is null");
|
Validate.notNull(itemId, "Bad request to renameItem, the itemId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
shcClient.open(itemId).asItem().rename(newName);
|
shClient.open(itemId).asItem().rename(newName);
|
||||||
return shcClient.open(itemId).asItem().get();
|
return shClient.open(itemId).asItem().get();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
Validate.notNull(fileItemId, "Bad request to getPublicLinkForFile, the fileItemId is null");
|
Validate.notNull(fileItemId, "Bad request to getPublicLinkForFile, the fileItemId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return shcClient.open(fileItemId).asFile().getPublicLink();
|
return shClient.open(fileItemId).asFile().getPublicLink();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ public class StorageHubClientService {
|
||||||
Validate.notNull(version, "Bad request to getPublicLinkForFileVersion, the version is null");
|
Validate.notNull(version, "Bad request to getPublicLinkForFileVersion, the version is null");
|
||||||
Validate.notEmpty(version, "Bad request to getPublicLinkForFileVersion, the version is empty");
|
Validate.notEmpty(version, "Bad request to getPublicLinkForFileVersion, the version is empty");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return shcClient.open(fileItemId).asFile().getPublicLink(version);
|
return shClient.open(fileItemId).asFile().getPublicLink(version);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,7 +775,7 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
Validate.notNull(fileItemId, "Bad request to getListVersions, the fileItemId is null");
|
Validate.notNull(fileItemId, "Bad request to getListVersions, the fileItemId is null");
|
||||||
|
|
||||||
return shcClient.open(fileItemId).asFile().getVersions();
|
return shClient.open(fileItemId).asFile().getVersions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,7 +790,7 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
Validate.notNull(itemId, "Bad request to getImageContent, the itemId is null");
|
Validate.notNull(itemId, "Bad request to getImageContent, the itemId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
ItemContainer<Item> itemCont = shcClient.open(itemId).asItem();
|
ItemContainer<Item> itemCont = shClient.open(itemId).asItem();
|
||||||
Item item = itemCont.get();
|
Item item = itemCont.get();
|
||||||
if(item instanceof org.gcube.common.storagehub.model.items.ImageFile){
|
if(item instanceof org.gcube.common.storagehub.model.items.ImageFile){
|
||||||
org.gcube.common.storagehub.model.items.ImageFile imgFI = (org.gcube.common.storagehub.model.items.ImageFile) item; //??
|
org.gcube.common.storagehub.model.items.ImageFile imgFI = (org.gcube.common.storagehub.model.items.ImageFile) item; //??
|
||||||
|
@ -809,7 +809,7 @@ public class StorageHubClientService {
|
||||||
public long getTotalItems() throws Exception{
|
public long getTotalItems() throws Exception{
|
||||||
|
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return shcClient.getTotalItemCount();
|
return shClient.getTotalItemCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -821,7 +821,7 @@ public class StorageHubClientService {
|
||||||
*/
|
*/
|
||||||
public long getDiskUsage() throws Exception{
|
public long getDiskUsage() throws Exception{
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
return shcClient.getTotalVolume();
|
return shClient.getTotalVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -835,7 +835,7 @@ public class StorageHubClientService {
|
||||||
|
|
||||||
Validate.notNull(itemId, "Bad request to getAccounting, the itemId is null");
|
Validate.notNull(itemId, "Bad request to getAccounting, the itemId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
ItemContainer<Item> itemCont = shcClient.open(itemId).asItem();
|
ItemContainer<Item> itemCont = shClient.open(itemId).asItem();
|
||||||
Item item = itemCont.get();
|
Item item = itemCont.get();
|
||||||
return item.getAccounting();
|
return item.getAccounting();
|
||||||
}
|
}
|
||||||
|
@ -851,7 +851,7 @@ public class StorageHubClientService {
|
||||||
public Metadata getGcubeItemProperties(String gcubeItemId) throws Exception {
|
public Metadata getGcubeItemProperties(String gcubeItemId) throws Exception {
|
||||||
Validate.notNull(gcubeItemId, "Bad request to loadGcubeItemProperties, the itemId is null");
|
Validate.notNull(gcubeItemId, "Bad request to loadGcubeItemProperties, the itemId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
ItemContainer<Item> itemCont = shcClient.open(gcubeItemId).asItem();
|
ItemContainer<Item> itemCont = shClient.open(gcubeItemId).asItem();
|
||||||
Item item = itemCont.get();
|
Item item = itemCont.get();
|
||||||
|
|
||||||
if(item instanceof GCubeItem) {
|
if(item instanceof GCubeItem) {
|
||||||
|
@ -876,7 +876,7 @@ public class StorageHubClientService {
|
||||||
//ItemContainer<Item> itemCont = shcClient.open(itemId).asItem();
|
//ItemContainer<Item> itemCont = shcClient.open(itemId).asItem();
|
||||||
//itemCont.get().setMetadata(new Metadata(mapProperties));
|
//itemCont.get().setMetadata(new Metadata(mapProperties));
|
||||||
//item.setMetadata(new Metadata(mapProperties));
|
//item.setMetadata(new Metadata(mapProperties));
|
||||||
shcClient.open(itemId).asItem().setMetadata(new Metadata(mapProperties));
|
shClient.open(itemId).asItem().setMetadata(new Metadata(mapProperties));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -894,7 +894,7 @@ public class StorageHubClientService {
|
||||||
public ExternalLink addURL(String folderId, URL URL, String name, String description) throws StorageHubException {
|
public ExternalLink addURL(String folderId, URL URL, String name, String description) throws StorageHubException {
|
||||||
Validate.notNull(folderId, "Bad request to createURL the folderId is null");
|
Validate.notNull(folderId, "Bad request to createURL the folderId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
FolderContainer folder = shcClient.open(folderId).asFolder();
|
FolderContainer folder = shClient.open(folderId).asFolder();
|
||||||
|
|
||||||
return folder.addUrl(URL, name, description).get();
|
return folder.addUrl(URL, name, description).get();
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ public class StorageHubClientService {
|
||||||
public boolean setFolderAsPublic(String folderId, boolean setPublic) throws Exception {
|
public boolean setFolderAsPublic(String folderId, boolean setPublic) throws Exception {
|
||||||
Validate.notNull(folderId, "Bad request to setFolderAsPublic the folderId is null");
|
Validate.notNull(folderId, "Bad request to setFolderAsPublic the folderId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
FolderContainer folderCont = shcClient.open(folderId).asFolder();
|
FolderContainer folderCont = shClient.open(folderId).asFolder();
|
||||||
|
|
||||||
if(setPublic) {
|
if(setPublic) {
|
||||||
folderCont.publish();
|
folderCont.publish();
|
||||||
|
@ -921,11 +921,10 @@ public class StorageHubClientService {
|
||||||
logger.debug("Unpublished the folder id: "+folderId);
|
logger.debug("Unpublished the folder id: "+folderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return shcClient.open(folderId).asFolder().get().isPublicItem();
|
return shClient.open(folderId).asFolder().get().isPublicItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update description for item.
|
* Update description for item.
|
||||||
*
|
*
|
||||||
|
@ -938,13 +937,12 @@ public class StorageHubClientService {
|
||||||
Validate.notNull(itemId, "Bad request the itemId is null");
|
Validate.notNull(itemId, "Bad request the itemId is null");
|
||||||
setContextProviders(scope, authorizationToken);
|
setContextProviders(scope, authorizationToken);
|
||||||
|
|
||||||
throw new Exception("Not implemented yet by SHUB");
|
shClient.open(itemId).asFile().setDescription(newDescription);
|
||||||
|
return shClient.open(itemId).asFile().get().getDescription();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To string.
|
* To string.
|
||||||
*
|
*
|
||||||
|
@ -962,7 +960,7 @@ public class StorageHubClientService {
|
||||||
builder.append(", authorizationToken=");
|
builder.append(", authorizationToken=");
|
||||||
builder.append(authorizationToken.substring(0, authorizationToken.length()-5)+"XXXXX");
|
builder.append(authorizationToken.substring(0, authorizationToken.length()-5)+"XXXXX");
|
||||||
builder.append(", itemManagerClient=");
|
builder.append(", itemManagerClient=");
|
||||||
builder.append(shcClient);
|
builder.append(shClient);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue