use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class DataRepository method remapDataNames.
/** this renames data values in the global datafile. */
private void remapDataNames(String oldPrefix, String newPrefix) {
String name, newName;
DataElement element;
SaveableData value;
oldPrefix = oldPrefix + "/";
newPrefix = newPrefix + "/";
int oldPrefixLen = oldPrefix.length();
Iterator k = getInternalKeys();
while (k.hasNext()) {
name = (String) k.next();
if (!name.startsWith(oldPrefix))
continue;
element = (DataElement) data.get(name);
if (element == null || element.isDefaultName() || element.datafile == null || element.datafile.prefix == null || element.datafile.prefix.length() > 0)
// only remap data which lives in the global datafile.
continue;
value = element.getValue();
// move - but none of that stuff should be moving.
if (value instanceof SimpleData) {
newName = newPrefix + name.substring(oldPrefixLen);
newName = intern(newName, false);
//System.out.println("renaming " + name + " to " + newName);
putValue(newName, value.getSimpleValue(), IS_NOT_DEFAULT_VAL);
putValue(name, null, IS_NOT_DEFAULT_VAL);
}
}
}
use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class UserDataWriter method getInheritedWbsIdForPath.
private String getInheritedWbsIdForPath(String path) {
String result = getWbsOrClientIdForPath(path);
if (hasValue(result))
return result;
SaveableData sd = getDataRepository().getInheritableValue(path, TeamDataConstants.WBS_ID_DATA_NAME);
return (sd == null ? null : getStringData(sd.getSimpleValue()));
}
use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class SyncWorkerWhatIf method getSimpleValue.
public SimpleData getSimpleValue(String name) {
name = getOriginalPath(name);
SaveableData result = (SaveableData) localData.get(name);
if (result != null)
return result.getSimpleValue();
else
return data.getSimpleValue(name);
}
use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class SyncWorkerWhatIf method getValue.
public SaveableData getValue(String name) {
name = getOriginalPath(name);
SaveableData result = (SaveableData) localData.get(name);
if (result != null)
return result;
else
return data.getValue(name);
}
use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class RadarChart method maybeScaleDataAxes.
private void maybeScaleDataAxes() {
for (int i = 0; i < data.numCols(); i++) {
int n = i + 1;
String target = getParameter("t" + n);
if (!StringUtils.hasValue(target))
continue;
double targetVal = 0;
try {
targetVal = FormatUtil.parseNumber(target);
} catch (Exception e) {
SaveableData val = getDataRepository().getInheritableValue(getPrefix(), target);
if (val != null) {
SimpleData sVal = val.getSimpleValue();
if (sVal instanceof NumberData)
targetVal = ((NumberData) sVal).getDouble();
}
}
if (targetVal == 0)
continue;
boolean reverse = parameters.containsKey("r" + n);
SimpleData d = data.getData(1, n);
if (d instanceof NumberData) {
NumberData num = (NumberData) d;
double val = num.getDouble();
if (Double.isInfinite(val) || Double.isNaN(val))
val = 1.0;
else if (reverse)
val = 2.0 / (1.0 + (val / targetVal));
else
val = val / targetVal;
data.setData(1, n, new DoubleData(val));
}
}
}
Aggregations