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
 Model convertGWTModelToJavaModel(SerializableModel model)
          converts a GWT Serializable into a Java Serializable
 SerializableModel convertJavaModelToGWTModel(Model model)
          converts a Java Serializable into a GWT Serializable
 void copyFile(File from, File to, String folder)
          just copies files using buffered input stream
 SerializableTimeSeries getGWTTS(RTimeSeries rts)
          return a GWT Serializable timeseries
 RTimeSeries getJavaTS(SerializableTimeSeries sts)
          return a JAVA Serializable timeseries
 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)
           
 Model readRawModel(String pathToModel)
           
 boolean writeModel(SerializableModel gwtModel, 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:
.

convertJavaModelToGWTModel

public SerializableModel convertJavaModelToGWTModel(Model model)
converts a Java Serializable into a GWT Serializable

Parameters:
model - the JAVA Model to be "converted"
Returns:
.

convertGWTModelToJavaModel

public Model convertGWTModelToJavaModel(SerializableModel model)
converts a GWT Serializable into a Java Serializable

Parameters:
model - the GWT Model to be "converted"
Returns:
.

writeModel

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

readRawModel

public Model 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 - .

getJavaTS

public RTimeSeries getJavaTS(SerializableTimeSeries sts)
return a JAVA Serializable timeseries

Parameters:
sts - .
Returns:
.

getGWTTS

public SerializableTimeSeries getGWTTS(RTimeSeries rts)
return a GWT Serializable timeseries

Parameters:
rts - .
Returns:
.


Copyright © 2013. All Rights Reserved.