org.hackystat.projectbrowser.page.projectportfolio.detailspanel
Class ProjectPortfolioDataModel

java.lang.Object
  extended by org.hackystat.projectbrowser.page.projectportfolio.detailspanel.ProjectPortfolioDataModel
All Implemented Interfaces:
java.io.Serializable, Processable

public class ProjectPortfolioDataModel
extends java.lang.Object
implements java.io.Serializable, Processable

Data model to hold state of Project Portfolio.

Author:
Shaoxuan Zhang
See Also:
Serialized Form

Field Summary
static java.util.List<java.lang.String> availableClassifiers
          List of available stream classifiers.
 
Constructor Summary
ProjectPortfolioDataModel(java.lang.String telemetryHost, java.lang.String userEmail, java.lang.String password)
          Constructor that initialize the measures.
 
Method Summary
 void cancelDataUpdate()
          Cancel the data loading process.
 java.lang.String getAverageColor()
           
 java.lang.String getBackgroundColor()
           
protected static StreamClassifier getClassifier(Measures.Measure measure)
          Get a StreamClassifier according to the given Measure.
 java.util.List<PortfolioMeasureConfiguration> getEnabledMeasures()
           
 java.util.List<java.lang.String> getEnabledMeasuresName()
          Return the names of enabled measures.
 java.lang.String getFontColor()
           
 java.lang.String getGoodColor()
           
static java.util.logging.Logger getLogger()
           
 java.util.List<PortfolioMeasureConfiguration> getMeasures()
           
 java.util.Map<org.hackystat.sensorbase.resource.projects.jaxb.Project,java.util.List<MiniBarChart>> getMeasuresCharts()
           
 java.lang.String getNAColor()
           
 java.lang.String getPoorColor()
           
 java.lang.String getProcessingMessage()
           
protected  Measures.Measure getSavedMeasure(PortfolioMeasureConfiguration measure)
          Get the Measures.Measure instance associated with the given PortfolioMeasureConfiguration from UriCache.
 java.util.List<org.hackystat.sensorbase.resource.projects.jaxb.Project> getSelectedProjects()
           
 boolean isComplete()
           
 boolean isEmpty()
          Returns true if this model does not contain any data.
 boolean isInProcess()
           
 void loadData()
          Load data from Hackystat service.
 void resetUserConfiguration()
          Reset user's configuration cache.
 java.lang.String saveUserConfiguration()
          Save user's configuration to system's cache.
 void setModel(long startDate, long endDate, java.util.List<org.hackystat.sensorbase.resource.projects.jaxb.Project> selectedProjects, java.lang.String granularity)
           
 void sortProjectNames()
          Sort the table by the project's name.
 void sortTable(int i)
          Sort the table according to the given measure index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

availableClassifiers

public static final java.util.List<java.lang.String> availableClassifiers
List of available stream classifiers.

Constructor Detail

ProjectPortfolioDataModel

public ProjectPortfolioDataModel(java.lang.String telemetryHost,
                                 java.lang.String userEmail,
                                 java.lang.String password)
Constructor that initialize the measures.

Parameters:
telemetryHost - the telemetry host
userEmail - the user's email
password - the user's passowrd
Method Detail

setModel

public void setModel(long startDate,
                     long endDate,
                     java.util.List<org.hackystat.sensorbase.resource.projects.jaxb.Project> selectedProjects,
                     java.lang.String granularity)
Parameters:
startDate - the start date.
endDate - the end date.
selectedProjects - the selected projects.
granularity - the granularity this data model focus.

getClassifier

protected static StreamClassifier getClassifier(Measures.Measure measure)
Get a StreamClassifier according to the given Measure.

Parameters:
measure - a given Measures.Measure object.
Returns:
a StreamClassifier instance, null if no supported classifier defined in the Measure object.

saveUserConfiguration

public java.lang.String saveUserConfiguration()
Save user's configuration to system's cache.

Returns:
change maked in this saving.

getSavedMeasure

protected final Measures.Measure getSavedMeasure(PortfolioMeasureConfiguration measure)
Get the Measures.Measure instance associated with the given PortfolioMeasureConfiguration from UriCache.

Parameters:
measure - the given PortfolioMeasureConfiguration
Returns:
the Measures.Measure instance, null if not matched found in cache.

resetUserConfiguration

public void resetUserConfiguration()
Reset user's configuration cache.


loadData

public void loadData()
Load data from Hackystat service.


cancelDataUpdate

public void cancelDataUpdate()
Cancel the data loading process.


isInProcess

public boolean isInProcess()
Specified by:
isInProcess in interface Processable
Returns:
the inProcess

isComplete

public boolean isComplete()
Specified by:
isComplete in interface Processable
Returns:
the complete

getProcessingMessage

public java.lang.String getProcessingMessage()
Specified by:
getProcessingMessage in interface Processable
Returns:
the processingMessage

getMeasuresCharts

public java.util.Map<org.hackystat.sensorbase.resource.projects.jaxb.Project,java.util.List<MiniBarChart>> getMeasuresCharts()
Returns:
the analysesCharts

getSelectedProjects

public java.util.List<org.hackystat.sensorbase.resource.projects.jaxb.Project> getSelectedProjects()
Returns:
the selectedProjects

isEmpty

public boolean isEmpty()
Returns true if this model does not contain any data.

Returns:
True if no data.

getMeasures

public java.util.List<PortfolioMeasureConfiguration> getMeasures()
Returns:
the measures

getEnabledMeasures

public final java.util.List<PortfolioMeasureConfiguration> getEnabledMeasures()
Returns:
the enabled measures

getEnabledMeasuresName

public java.util.List<java.lang.String> getEnabledMeasuresName()
Return the names of enabled measures. If alias available for the measure, alias will be returned. Otherwise, name in measure's definition will be returned.

Returns:
the names of the enabled measures.

getBackgroundColor

public java.lang.String getBackgroundColor()
Returns:
the backgroundColor

getGoodColor

public java.lang.String getGoodColor()
Returns:
the goodColor

getAverageColor

public java.lang.String getAverageColor()
Returns:
the sosoColor

getPoorColor

public java.lang.String getPoorColor()
Returns:
the badColor

getFontColor

public java.lang.String getFontColor()
Returns:
the fontColor

getNAColor

public java.lang.String getNAColor()
Returns:
the naColor

getLogger

public static java.util.logging.Logger getLogger()
Returns:
the logger that associated to this web application.

sortTable

public void sortTable(int i)
Sort the table according to the given measure index.

Parameters:
i - the index of the measure in enabled measures.

sortProjectNames

public void sortProjectNames()
Sort the table by the project's name.