|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.bundle.Controller
org.torweg.pulse.component.statistics.view.AbstractStatisticsController<T,V>
org.torweg.pulse.component.statistics.view.AbstractStatisticsViewController<T,U,V>
T - the actual implementation of:
AbstractStatisticsViewControllerConfigurationU - the actual implementation of:
AbstractStatisticsViewControllerResultDataV - the actual implementation of:
AbstractStatisticsViewControllerResult as used for the
initialisation of the viewpublic abstract class AbstractStatisticsViewController<T extends AbstractStatisticsViewControllerConfiguration,U extends AbstractStatisticsViewControllerResultData,V extends AbstractStatisticsViewControllerResult<U>>
Abstract base-class to derive a "view" for statistical data from.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.torweg.pulse.bundle.Controller |
|---|
Controller.AlwaysRun |
| Field Summary | |
|---|---|
protected static int |
DEFAULT_CHART_HEIGHT
The default chart height - 400 - being used if none is specified. |
protected static int |
DEFAULT_CHART_WIDTH
The default chart width - 600 - being used if none is specified. |
protected static long |
NO_SERVERID
The default server id - 0L - being used if none is specified. |
| Fields inherited from class org.torweg.pulse.component.statistics.view.AbstractStatisticsController |
|---|
LOGGER |
| Constructor Summary | |
|---|---|
AbstractStatisticsViewController()
|
|
| Method Summary | |
|---|---|
protected abstract U |
buildViewResultData(Duration duration, Period dataResolution, StatisticsServer server,
org.hibernate.Session s)
Builds the result data for the given StatisticsServer and the
given Duration using the given Period as
"data resolution". |
protected int |
chartHeightFromCommand(Command command)
Retrieves the "height" as integer from the given Command. |
protected int |
chartWidthFromCommand(Command command)
Retrieves the "width" as integer from the given Command. |
protected java.lang.Class<? extends org.jfree.data.time.RegularTimePeriod> |
determineJFreeChartTimePeriod(Period dataResolution)
Returns the corresponding RegularTimePeriod for the given
Period. |
protected Duration |
durationFromCommand(Command command)
Builds a Duration from the given Command if the given
command.getParameter("duration") ! |
protected U |
fetchResultDataFromSession(ServiceSession session,
long statisticsServerId)
Retrieves the AbstractStatisticsViewControllerResultData from the
current ServiceSession for the given id of a
StatisticsServer. |
protected java.lang.String |
fileNameForReport(StatisticsServer server,
java.lang.String suffix)
Creates a string to name the actual report with. |
protected V |
initView(ServiceRequest request,
boolean keepDataInSession)
Builds the <V<U>> initialising the view. |
protected java.lang.Integer |
integerFromCommand(Command command,
java.lang.String parameterName)
Retrieves an integer by parameterName from the given Command. |
protected java.util.List<? extends AbstractAggregation> |
loadAggregations(java.lang.Class<? extends AbstractAggregation> clazz, StatisticsServer statisticsServer, Duration duration,
org.hibernate.Session s)
Loads the AbstractAggregations of the given type clazz
for the given StatisticsServer and the given Duration. |
protected StatisticsServer |
loadStatisticsServer(long serverId,
org.hibernate.Session s)
Loads and returns a StatisticsServer by given request-
Parameter "serverId". |
protected abstract V |
newResult(T configuration, U data)
Factory method to retrieve an actual new result. |
protected V |
outputReportPDF(V result,
java.util.Map<java.lang.String,java.io.File> fileMap, ServiceRequest request)
Performs the creation of the PDF-file and adds the required PDFOutputEvent to the EventManager. |
protected void |
putResultDataInSession(U resultData, ServiceSession session)
Adds the given AbstractStatisticsViewControllerResultData to the
current request-session and stores it under the following key:
"fqn.of.the.current. |
protected void |
removeResultDataFromSession(ServiceSession session,
long statisticsServerId)
Retrieves the AbstractStatisticsViewControllerResultData from the
current ServiceSession for the given id of a
StatisticsServer. |
protected Period |
resolutionFromCommand(Command command)
Builds a Duration from the given Command if the given
command.getParameter("resolution") ! |
protected long |
serverIdFromCommand(Command command)
Retrieves the "serverId" as long from the given Command. |
protected V |
userIsNotAllowedEvent(ServiceRequest request)
Adds a ForbiddenEvent to the EventManager of the current
ServiceRequest with the following message "You do not have the
required roles to view the data for the requested server.". |
| Methods inherited from class org.torweg.pulse.component.statistics.view.AbstractStatisticsController |
|---|
getConfiguration, hasRoleForServer, initialize, initView |
| Methods inherited from class org.torweg.pulse.bundle.Controller |
|---|
getAlwaysRun, isAlwaysRun, setAlwaysRun |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int DEFAULT_CHART_WIDTH
protected static final int DEFAULT_CHART_HEIGHT
protected static final long NO_SERVERID
| Constructor Detail |
|---|
public AbstractStatisticsViewController()
| Method Detail |
|---|
protected abstract U buildViewResultData(Duration duration, Period dataResolution, StatisticsServer server,
org.hibernate.Session s)
StatisticsServer and the
given Duration using the given Period as
"data resolution".
duration - DurationdataResolution - Period to be used as "data resolution"server - StatisticsServers - Session
<U>protected abstract V newResult(T configuration, U data)
configuration - <T>data - <U>
<V>
protected final V initView(ServiceRequest request,
boolean keepDataInSession)
<V<U>> initialising the view.
request - ServiceRequestkeepDataInSession - true to keep the data in the session, false
otherwise
<V>protected final V userIsNotAllowedEvent(ServiceRequest request)
ForbiddenEvent to the EventManager of the current
ServiceRequest with the following message "You do not have the
required roles to view the data for the requested server.".
request - the current ServiceRequest
null
protected final java.util.List<? extends AbstractAggregation> loadAggregations(java.lang.Class<? extends AbstractAggregation> clazz, StatisticsServer statisticsServer, Duration duration,
org.hibernate.Session s)
AbstractAggregations of the given type clazz
for the given StatisticsServer and the given Duration.
clazz - the Class<? extends AbstractAggregation> to be
loadedstatisticsServer - the StatisticsServerduration - the Durations - the HibernateTM-Session to be used for
loading
List<? extends AbstractAggregation>
protected final StatisticsServer loadStatisticsServer(long serverId,
org.hibernate.Session s)
StatisticsServer by given request-
Parameter "serverId".
serverId - the request-Parameters - a HibernateTM-Session to be used for
loading
StatisticsServer if one could be loaded, null
otherwiseprotected final Duration durationFromCommand(Command command)
Duration from the given Command if the given
command.getParameter("duration") != null.
If no duration can be build from request, the default Duration as
in set in <T> based on the current time-stamp will be
returned.
command - the Command to build the Duration from
Duration
PulseException - if a request-parameter for the "duration" is given, but
cannot be converted to a valid Durationprotected final Period resolutionFromCommand(Command command)
Duration from the given Command if the given
command.getParameter("resolution") != null.
If no Period can be build from request, the default
Period as in set in <T> will be returned.
NOTE: <T> does not necessarily have to
have a default "data resolution" Period to be set.
command - the Command to build the Period from
Period, or null if none could be retrieved or
build from given command
PulseException - if a request-parameter for the "resolution" is given, but
cannot be converted to a valid Periodprotected final int chartHeightFromCommand(Command command)
Command.
command - the Command
AbstractStatisticsViewController.DEFAULT_CHART_HEIGHT
otherwise and on internal NumberFormatExceptionprotected final int chartWidthFromCommand(Command command)
Command.
command - the Command
AbstractStatisticsViewController.DEFAULT_CHART_WIDTH
otherwise and on internal NumberFormatExceptionprotected final long serverIdFromCommand(Command command)
Command.
command - the Command
AbstractStatisticsViewController.NO_SERVERID otherwise
and on internal NumberFormatException
protected final java.lang.Integer integerFromCommand(Command command,
java.lang.String parameterName)
Command.
command - the CommandparameterName - the name of the Parameter to look for
AbstractStatisticsViewController.DEFAULT_CHART_HEIGHT
otherwise and on internal NumberFormatExceptionprotected final void putResultDataInSession(U resultData, ServiceSession session)
AbstractStatisticsViewControllerResultData to the
current request-session and stores it under the following key:
"fqn.of.the.current.AbstractStatisticsViewController#resultData.StatisticsServer.id"
resultData - the AbstractStatisticsViewControllerResultDatasession - the current ServiceSession
protected final U fetchResultDataFromSession(ServiceSession session,
long statisticsServerId)
AbstractStatisticsViewControllerResultData from the
current ServiceSession for the given id of a
StatisticsServer.
session - the current ServiceSessionstatisticsServerId - the id of the StatisticsServer
AbstractStatisticsViewControllerResultData, or
null if no
AbstractStatisticsViewControllerResultData
protected final void removeResultDataFromSession(ServiceSession session,
long statisticsServerId)
AbstractStatisticsViewControllerResultData from the
current ServiceSession for the given id of a
StatisticsServer.
session - the current ServiceSessionstatisticsServerId - the id of the StatisticsServerprotected final java.lang.Class<? extends org.jfree.data.time.RegularTimePeriod> determineJFreeChartTimePeriod(Period dataResolution)
RegularTimePeriod for the given
Period.
dataResolution - the Period
RegularTimePeriod, null if no
RegularTimePeriod could be mapped to the given
Period
protected final V outputReportPDF(V result,
java.util.Map<java.lang.String,java.io.File> fileMap, ServiceRequest request)
PDFOutputEvent to the EventManager.
result - the actual implementation of:
AbstractStatisticsViewControllerResultfileMap - a map of files for the creation of the report PDFrequest - the current ServiceRequest
AbstractStatisticsViewControllerResult as
used for the creation of the PDF
protected final java.lang.String fileNameForReport(StatisticsServer server,
java.lang.String suffix)
server - the StatisticsServersuffix - the file name suffix
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||