org.gcube.portlets.d4sreporting.common.server
Class ServiceUtil

java.lang.Object
  extended by org.gcube.portlets.d4sreporting.common.server.ServiceUtil

public class ServiceUtil
extends Object

ServiceUtil contains utility methods for the servlet SERVICES

Version:
July 2011 (3.0)
Author:
Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it

Constructor Summary
ServiceUtil(org.gcube.application.framework.core.session.ASLSession session)
           
 
Method Summary
 void copyFile(File from, File to, String folder)
          just copies files using buffered input stream
 org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder getReportsFolder(org.gcube.application.framework.core.session.ASLSession session)
           
 String getReportsPath(String templateName, String currentDL, String currentUser)
          Return the server path of the templatename passed
 String getTemplateFolder(String currentDL, String currentUser)
          return the user template folder
 String getTemplatePath(String templateName, String currentDL, String currentUser)
          Return the server path of the templatename passed
protected  org.gcube.portlets.user.homelibrary.home.workspace.Workspace getWorkspaceArea(org.gcube.application.framework.core.session.ASLSession session)
           
 SerializableModel readRawModel(String pathToModel)
           
 boolean writeModel(SerializableModel model, String templateName, String currentDL, String currentUser)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceUtil

public ServiceUtil(org.gcube.application.framework.core.session.ASLSession session)
Method Detail

getReportsFolder

public org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder getReportsFolder(org.gcube.application.framework.core.session.ASLSession session)
                                                                                    throws org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException,
                                                                                           org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException,
                                                                                           org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException
Parameters:
session - the ASL session
Returns:
the reports workspace folder
Throws:
org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException - .
org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException - .
org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException - .

getWorkspaceArea

protected org.gcube.portlets.user.homelibrary.home.workspace.Workspace getWorkspaceArea(org.gcube.application.framework.core.session.ASLSession session)
                                                                                 throws org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException,
                                                                                        org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException,
                                                                                        org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException
Returns:
an instance of the user WorkspaceArea
Throws:
org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException
org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException
org.gcube.portlets.user.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException
WorkspaceNotFoundException
org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException
org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException

getTemplatePath

public String getTemplatePath(String templateName,
                              String currentDL,
                              String currentUser)
Return the server path of the templatename passed

Parameters:
templateName - .
currentDL - .
currentUser - .
Returns:
.

getReportsPath

public String getReportsPath(String templateName,
                             String currentDL,
                             String currentUser)
Return the server path of the templatename passed

Parameters:
templateName - .
currentDL - .
currentUser - .
Returns:
.

getTemplateFolder

public String getTemplateFolder(String currentDL,
                                String currentUser)
return the user template folder

Parameters:
templateName -
currentDL - .
currentUser - .
Returns:
.

writeModel

public boolean writeModel(SerializableModel model,
                          String templateName,
                          String currentDL,
                          String currentUser)
Parameters:
gwtModel - .
templateName - .
currentDL - .
currentUser - .
Returns:
true if everything's fine

readRawModel

public SerializableModel readRawModel(String pathToModel)
Parameters:
pathToModel - e.g. /home/massi/templates/massimiliano.assante/PROVA1/PROVA1.d4st
Returns:
the Model Instance

copyFile

public void copyFile(File from,
                     File to,
                     String folder)
              throws Exception
just copies files using buffered input stream

Parameters:
from - .
to - .
folder - the folder in which the image has to be copied, (it creates it if not exist)
Throws:
Exception - .


Copyright © 2013. All Rights Reserved.