ch.tatool.app.service.impl
Class DataServiceImpl

java.lang.Object
  extended by ch.tatool.app.service.impl.DataServiceImpl
All Implemented Interfaces:
DataService

public class DataServiceImpl
extends Object
implements DataService

DataService implementation.

Author:
Michael Ruflin

Constructor Summary
DataServiceImpl()
           
 
Method Summary
 ModuleSession createSession(Module module)
          Creates a new module session.
 List<Object[]> findDistinctSessionPropertyNames(Module module)
          Get all distinct session property names contained in a module
 List<Object[]> findDistinctTrialPropertyNames(Module module)
          Get all distinct trial property names contained in a module
 void finishSession(ModuleSession moduleSession)
          Finishes a module session.
 ModuleSession getLastSession(Module module)
          Get the last session of a module.
 Messages getMessages()
           
 long getSessionCount(Module module, boolean includeUnfinished)
          Get the number of sessions in a module
 List<ModuleSession> getSessions(Module module)
          Load all session in a given module.
 List<Trial> getTrials(Module module, ModuleSession session, Node node, int maxResults)
          Returns a list of trial instances for a given element or session.
 List<Trial> getTrials(Module module, ModuleSession session, String elementNameLike, String propertyNameLike, int offset, int maxResults)
          Find the last x trials with given property of a given element
 List<Trial> getTrials(ModuleSession session)
           
 void insertTrial(ModuleSession session, Trial trial)
          Inserts a trial object into the session.
 List<Trial> loadAllTrials(Module module)
          Load all trials of a given module and session.
 void saveModule(Module module)
          Save the module instance.
 void saveSession(ModuleSession moduleSession)
          Save a session without finishing it.
 void setMessages(Messages messages)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataServiceImpl

public DataServiceImpl()
Method Detail

saveModule

public void saveModule(Module module)
Save the module instance. This will save all changed module properties

Specified by:
saveModule in interface DataService

createSession

public ModuleSession createSession(Module module)
Creates a new module session. The module start date is set immediately

Specified by:
createSession in interface DataService

saveSession

public void saveSession(ModuleSession moduleSession)
Save a session without finishing it.

Specified by:
saveSession in interface DataService

finishSession

public void finishSession(ModuleSession moduleSession)
Finishes a module session.

Specified by:
finishSession in interface DataService

getSessions

public List<ModuleSession> getSessions(Module module)
Load all session in a given module.

Specified by:
getSessions in interface DataService

insertTrial

public void insertTrial(ModuleSession session,
                        Trial trial)
Inserts a trial object into the session.

Specified by:
insertTrial in interface DataService

getTrials

public List<Trial> getTrials(ModuleSession session)
Specified by:
getTrials in interface DataService

loadAllTrials

public List<Trial> loadAllTrials(Module module)
Load all trials of a given module and session.


getTrials

public List<Trial> getTrials(Module module,
                             ModuleSession session,
                             Node node,
                             int maxResults)
Returns a list of trial instances for a given element or session.

Specified by:
getTrials in interface DataService
Returns:
list of trials

getLastSession

public ModuleSession getLastSession(Module module)
Get the last session of a module.

Specified by:
getLastSession in interface DataService
Parameters:
module -
Returns:
the last created session

getSessionCount

public long getSessionCount(Module module,
                            boolean includeUnfinished)
Get the number of sessions in a module

Specified by:
getSessionCount in interface DataService
Parameters:
module - the module to check
includeUnfinished - whether to include unfinished module (modules without end time)
Returns:

getTrials

public List<Trial> getTrials(Module module,
                             ModuleSession session,
                             String elementNameLike,
                             String propertyNameLike,
                             int offset,
                             int maxResults)
Find the last x trials with given property of a given element

Specified by:
getTrials in interface DataService

findDistinctTrialPropertyNames

public List<Object[]> findDistinctTrialPropertyNames(Module module)
Get all distinct trial property names contained in a module

Specified by:
findDistinctTrialPropertyNames in interface DataService
Returns:
a List of object arrays containing [0] the item name and [1] the property name

findDistinctSessionPropertyNames

public List<Object[]> findDistinctSessionPropertyNames(Module module)
Get all distinct session property names contained in a module

Specified by:
findDistinctSessionPropertyNames in interface DataService
Returns:
a List of object arrays containing [0] the item name and [1] the property name

setMessages

public void setMessages(Messages messages)
Specified by:
setMessages in interface DataService

getMessages

public Messages getMessages()
Specified by:
getMessages in interface DataService


Copyright © 2012. All Rights Reserved.