org.gcube.portlets.user.homelibrary.util
Class WorkspaceUtil

java.lang.Object
  extended by org.gcube.portlets.user.homelibrary.util.WorkspaceUtil

public class WorkspaceUtil
extends Object

Author:
Federico De Faveri defaveri@isti.cnr.it

Constructor Summary
WorkspaceUtil()
           
 
Method Summary
static String cleanName(String name)
          Clean the given name from invalid chars.
static FolderItem createExternalFile(WorkspaceFolder destinationFolder, String name, String description, String mimeType, InputStream is)
          Create a external file in the specified folder.
static String getUniqueName(String initialName, WorkspaceFolder folder)
          Retrieve an unique name for the specified folder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkspaceUtil

public WorkspaceUtil()
Method Detail

getUniqueName

public static String getUniqueName(String initialName,
                                   WorkspaceFolder folder)
                            throws InternalErrorException
Retrieve an unique name for the specified folder.

Parameters:
initialName - the initial name.
folder - the item folder.
Returns:
the unique name.
Throws:
InternalErrorException - if an error occurs.

cleanName

public static String cleanName(String name)
                        throws InternalErrorException
Clean the given name from invalid chars.

Parameters:
name - the name to clean.
Returns:
the cleaned name.
Throws:
InternalErrorException - if an error occurs.

createExternalFile

public static FolderItem createExternalFile(WorkspaceFolder destinationFolder,
                                            String name,
                                            String description,
                                            String mimeType,
                                            InputStream is)
                                     throws InsufficientPrivilegesException,
                                            InternalErrorException,
                                            ItemAlreadyExistException
Create a external file in the specified folder.

Parameters:
destinationFolder - the destination folder.
name - the external file name.
description - the external file description.
mimeType - the external file mimetype.
is - the external file data.
Returns:
the created external file.
Throws:
InsufficientPrivilegesException - if an error occurs.
InternalErrorException - if an error occurs.
ItemAlreadyExistException - if an error occurs.


Copyright © 2013. All Rights Reserved.