use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class EVTaskDependency method getTaskIDs.
public static List getTaskIDs(DataContext data, String taskPath) {
String dataName = DataRepository.createDataName(taskPath, TASK_ID_DATA_NAME);
SimpleData currentValue = data.getSimpleValue(dataName);
ListData list = null;
if (currentValue == null || currentValue.test() == false)
return null;
if (currentValue instanceof ListData)
list = (ListData) currentValue;
else if (currentValue instanceof StringData)
list = ((StringData) currentValue).asList();
else
return null;
List result = new LinkedList();
for (int i = 0; i < list.size(); i++) result.add(list.get(i));
if (!result.isEmpty())
return result;
else
return null;
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class EVTaskDependency method addTaskIDs.
public static void addTaskIDs(DataContext data, String taskPath, String id) {
if (id == null || id.length() == 0)
return;
String dataName = DataRepository.createDataName(taskPath, TASK_ID_DATA_NAME);
SimpleData currentValue = data.getSimpleValue(dataName);
ListData newValue;
if (currentValue instanceof ListData)
newValue = (ListData) currentValue;
else if (currentValue instanceof StringData)
newValue = ((StringData) currentValue).asList();
else
newValue = new ListData();
boolean valueChanged = false;
String[] idList = id.split(",");
for (int i = 0; i < idList.length; i++) {
if (newValue.setAdd(idList[i]))
valueChanged = true;
}
if (valueChanged)
data.putValue(dataName, newValue);
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class EVTask method saveDataElement.
private void saveDataElement(String oldTaskListName, String newTaskListName, String dataNamePrefix, int savedValue, int newValue, int defaultValue) {
if (fullName == null || fullName.length() == 0)
return;
String oldDataName = null;
if (savedValue != defaultValue)
oldDataName = dataNamePrefix + oldTaskListName;
if (newTaskListName != null && newValue != defaultValue) {
String newDataName = dataNamePrefix + newTaskListName;
if (newDataName.equals(oldDataName))
oldDataName = null;
if (newValue != savedValue || oldDataName != null) {
SimpleData d = new DoubleData(newValue, false);
String dataName = DataRepository.createDataName(fullName, newDataName);
data.putValue(dataName, d);
}
}
if (oldDataName != null) {
String dataName = DataRepository.createDataName(fullName, oldDataName);
data.putValue(dataName, null);
}
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class AnalysisPage method setSizeUnits.
private static boolean setSizeUnits(ChartData chartData, DataRepository data, String dataName) {
SimpleData sd = data.getSimpleValue("/Workflow_Prefs/" + dataName);
if (sd == null || !sd.test())
return false;
chartData.setPrimarySizeUnits(sd.format());
return true;
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class EVTaskList method getSnapshotFromData.
/**
* Retrieve a single snapshot of this task list.
*
* @param data the DataRepository
* @param snapshotId the ID of the snapshot to retrieve
* @return the {@link EVSnapshot} of this schedule with the given ID, or
* null if no such snapshot exists.
*/
protected EVSnapshot getSnapshotFromData(DataRepository data, String snapshotId) {
String globalPrefix = MAIN_DATA_PREFIX + taskListName;
String dataName = globalPrefix + "/" + SNAPSHOT_DATA_PREFIX + "/" + snapshotId;
SimpleData d = data.getSimpleValue(dataName);
if (d != null && d.test()) {
try {
return new EVSnapshot(snapshotId, d.format());
} catch (Exception e) {
logger.warning("Couldn't open snapshot '" + snapshotId + "' for task list '" + taskListName + "' - aborting");
}
}
return null;
}
Aggregations