za.org.coefficient.modules.fileUpload
Class FileUpload

java.lang.Object
  extended by za.org.coefficient.modules.BaseModule
      extended by za.org.coefficient.modules.BaseProjectModule
          extended by za.org.coefficient.modules.fileUpload.FileUpload
All Implemented Interfaces:
CoefficientEventPublisher, ModuleLocal

public class FileUpload
extends BaseProjectModule


Field Summary
private static int sizeKb
           
private static int sizeMb
           
 
Constructor Summary
FileUpload()
           
 
Method Summary
 void addEntity(CoefficientContext ctx, Project project)
           
 void browse(CoefficientContext ctx, Project project, boolean showScreen)
           
 java.lang.String canExecuteForRole(CoefficientContext ctx, java.lang.String methodName, Role usersHighestRole)
          This is a base implementation that will allow all methods to be invoked without regard to roles
 CoefficientContext createRootFolderItemIfNotExist(CoefficientContext ctx)
          This is a workflow utility method
 CoefficientContext deleteAllForProject(CoefficientContext ctx)
           
 void deleteEntity(CoefficientContext ctx, Project project)
           
 void deleteFile(CoefficientContext ctx, Project project)
           
private  void deleteProjectFolder(java.lang.Long ID)
           
private  void deleteProjectFolderItem(java.lang.Long ID)
           
 void editEntity(CoefficientContext ctx, Project project)
           
private  java.util.List filterRoles(CoefficientUser user, java.util.List roles, Project project)
           
 int getAllUploadsSize(CoefficientContext ctx)
           
private  java.lang.String getFullPathForFolder(ProjectFolder folder, java.lang.String path)
          method to recursively get the full pathname of a projectfolder
 java.lang.String getMainMethod()
          This method is used to determine which method should be invoked when the module is requested without an operation.
 java.lang.String getModuleDescription()
          This method is used to find the description of the module
 java.lang.String getModuleDisplayName()
          This method is used to find the display name of the module
 java.lang.Long getRootFolderId(CoefficientContext ctx)
          This is a workflow utility method
 java.lang.String getSizeString(int fileSize)
          To get a string describing the size of a file
 java.lang.String getSummaryForProject(CoefficientContext ctx)
           
 FileDownloadData getUpload(CoefficientContext ctx)
           
 java.lang.String getUploadVersionString(ProjectUpload upload)
           
 boolean hasCurrentUpload(CoefficientContext ctx)
          This is a workflow utility method
 CoefficientContext interpretAction(CoefficientContext ctx)
           
private  boolean isUserAllowed(CoefficientContext ctx, long maxAllowedRole)
           
 void setCurrent(CoefficientContext ctx, Project project)
           
protected  CoefficientContext showFileSelectScreen(CoefficientContext ctx)
           
 void showItem(CoefficientContext ctx, Project project)
           
 CoefficientContext showSummaryForProject(CoefficientContext ctx)
           
private  java.lang.String trimToOneDecimalPlace(java.lang.String floatString)
           
 CoefficientContext unsetCurrentUpload(CoefficientContext ctx)
          This is a workflow utility method
 void uploadFile(CoefficientContext ctx, Project project)
           
 
Methods inherited from class za.org.coefficient.modules.BaseModule
createRSSItem, displayUsersData, getCoefficientContext, getModuleName, isProjectRequired, publishEvent, setCoefficientContext, showHelp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sizeKb

private static final int sizeKb
See Also:
Constant Field Values

sizeMb

private static final int sizeMb
See Also:
Constant Field Values
Constructor Detail

FileUpload

public FileUpload()
Method Detail

getMainMethod

public java.lang.String getMainMethod()
Description copied from interface: ModuleLocal
This method is used to determine which method should be invoked when the module is requested without an operation.

Specified by:
getMainMethod in interface ModuleLocal
Specified by:
getMainMethod in class BaseModule
Returns:
name of the method that should be invoked

getModuleDescription

public java.lang.String getModuleDescription()
Description copied from interface: ModuleLocal
This method is used to find the description of the module

Specified by:
getModuleDescription in interface ModuleLocal
Specified by:
getModuleDescription in class BaseModule
Returns:
the description of the module

getModuleDisplayName

public java.lang.String getModuleDisplayName()
Description copied from interface: ModuleLocal
This method is used to find the display name of the module

Specified by:
getModuleDisplayName in interface ModuleLocal
Specified by:
getModuleDisplayName in class BaseModule
Returns:
the display name of the module

getSummaryForProject

public java.lang.String getSummaryForProject(CoefficientContext ctx)
                                      throws java.lang.Exception
Overrides:
getSummaryForProject in class BaseProjectModule
Throws:
java.lang.Exception

showSummaryForProject

public CoefficientContext showSummaryForProject(CoefficientContext ctx)
                                         throws java.lang.Exception
Overrides:
showSummaryForProject in class BaseProjectModule
Throws:
java.lang.Exception

getAllUploadsSize

public int getAllUploadsSize(CoefficientContext ctx)
                      throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

setCurrent

public void setCurrent(CoefficientContext ctx,
                       Project project)
                throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

getRootFolderId

public java.lang.Long getRootFolderId(CoefficientContext ctx)
                               throws net.sf.hibernate.HibernateException
This is a workflow utility method

Throws:
net.sf.hibernate.HibernateException

getSizeString

public java.lang.String getSizeString(int fileSize)
To get a string describing the size of a file


getUpload

public FileDownloadData getUpload(CoefficientContext ctx)

getUploadVersionString

public java.lang.String getUploadVersionString(ProjectUpload upload)

addEntity

public void addEntity(CoefficientContext ctx,
                      Project project)

browse

public void browse(CoefficientContext ctx,
                   Project project,
                   boolean showScreen)

canExecuteForRole

public java.lang.String canExecuteForRole(CoefficientContext ctx,
                                          java.lang.String methodName,
                                          Role usersHighestRole)
Description copied from class: BaseModule
This is a base implementation that will allow all methods to be invoked without regard to roles

Specified by:
canExecuteForRole in interface ModuleLocal
Overrides:
canExecuteForRole in class BaseModule
Returns:
null if we can execute the method an error message if not

createRootFolderItemIfNotExist

public CoefficientContext createRootFolderItemIfNotExist(CoefficientContext ctx)
                                                  throws net.sf.hibernate.HibernateException
This is a workflow utility method

Throws:
net.sf.hibernate.HibernateException

deleteAllForProject

public CoefficientContext deleteAllForProject(CoefficientContext ctx)
                                       throws java.io.IOException
Specified by:
deleteAllForProject in class BaseProjectModule
Throws:
java.io.IOException

deleteEntity

public void deleteEntity(CoefficientContext ctx,
                         Project project)
                  throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

deleteFile

public void deleteFile(CoefficientContext ctx,
                       Project project)

editEntity

public void editEntity(CoefficientContext ctx,
                       Project project)
                throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

hasCurrentUpload

public boolean hasCurrentUpload(CoefficientContext ctx)
                         throws net.sf.hibernate.HibernateException
This is a workflow utility method

Throws:
net.sf.hibernate.HibernateException

interpretAction

public CoefficientContext interpretAction(CoefficientContext ctx)
                                   throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

showItem

public void showItem(CoefficientContext ctx,
                     Project project)

unsetCurrentUpload

public CoefficientContext unsetCurrentUpload(CoefficientContext ctx)
                                      throws net.sf.hibernate.HibernateException
This is a workflow utility method

Throws:
net.sf.hibernate.HibernateException

uploadFile

public void uploadFile(CoefficientContext ctx,
                       Project project)

showFileSelectScreen

protected CoefficientContext showFileSelectScreen(CoefficientContext ctx)

getFullPathForFolder

private java.lang.String getFullPathForFolder(ProjectFolder folder,
                                              java.lang.String path)
method to recursively get the full pathname of a projectfolder


isUserAllowed

private boolean isUserAllowed(CoefficientContext ctx,
                              long maxAllowedRole)

deleteProjectFolder

private void deleteProjectFolder(java.lang.Long ID)
                          throws net.sf.hibernate.HibernateException,
                                 java.io.IOException
Throws:
net.sf.hibernate.HibernateException
java.io.IOException

deleteProjectFolderItem

private void deleteProjectFolderItem(java.lang.Long ID)
                              throws net.sf.hibernate.HibernateException,
                                     java.io.IOException
Throws:
net.sf.hibernate.HibernateException
java.io.IOException

filterRoles

private java.util.List filterRoles(CoefficientUser user,
                                   java.util.List roles,
                                   Project project)

trimToOneDecimalPlace

private java.lang.String trimToOneDecimalPlace(java.lang.String floatString)


Copyright CSIR. All Rights Reserved.