Search in sources :

Example 1 with EnabledFor

use of net.sourceforge.processdash.tool.redact.EnabledFor in project processdash by dtuma.

the class FilterDataContainingTaskNames method hashRollupTaskListSpec.

@EnabledFor("/Task Lists$")
public String hashRollupTaskListSpec(String value) throws MalformedValueException {
    List<String> taskLists = StringData.create(value).asList().asList();
    ListData newVal = new ListData();
    for (String elem : taskLists) {
        elem = taskListMapper.hashTaskListName(elem);
        newVal.add(elem);
    }
    return newVal.saveString().substring(1);
}
Also used : ListData(net.sourceforge.processdash.data.ListData) EnabledFor(net.sourceforge.processdash.tool.redact.EnabledFor)

Example 2 with EnabledFor

use of net.sourceforge.processdash.tool.redact.EnabledFor in project processdash by dtuma.

the class FilterTaskListMetadata method filterMetadata.

@EnabledFor("/Task_List_Metadata$")
public String filterMetadata(String metadata) {
    Properties p = new Properties();
    try {
        String val = StringData.unescapeString(metadata);
        p.load(new ByteArrayInputStream(val.getBytes("ISO-8859-1")));
    } catch (Exception e) {
        return null;
    }
    boolean madeChange = false;
    if (stripComments && p.remove("Schedule_Notes") != null)
        madeChange = true;
    if (stripTaskLists && p.remove("Forecast.Range.Historical_Data") != null)
        madeChange = true;
    if (madeChange == false)
        return metadata;
    if (p.isEmpty())
        return null;
    try {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        p.store(out, "task list metadata");
        return StringData.escapeString(out.toString("ISO-8859-1"));
    } catch (IOException e) {
        return null;
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) Properties(java.util.Properties) IOException(java.io.IOException) EnabledFor(net.sourceforge.processdash.tool.redact.EnabledFor)

Example 3 with EnabledFor

use of net.sourceforge.processdash.tool.redact.EnabledFor in project processdash by dtuma.

the class FilterDataContainingNotes method fixBaselineDescription.

@EnabledFor("Task-Schedule/.*/Snapshot/")
public String fixBaselineDescription(String data) {
    int tagEnd = data.indexOf('>') + 1;
    String tag = data.substring(0, tagEnd);
    try {
        String date = RedactFilterUtils.getXmlAttr(tag, "when");
        Date ts = new Date(Long.parseLong(date.substring(1)));
        String newName = "Baseline saved " + ts;
        tag = RedactFilterUtils.replaceXmlAttr(tag, "name", newName);
    } catch (Exception e) {
    }
    tag = RedactFilterUtils.discardXmlAttr(tag, "comment");
    return tag + data.substring(tagEnd);
}
Also used : Date(java.util.Date) EnabledFor(net.sourceforge.processdash.tool.redact.EnabledFor)

Example 4 with EnabledFor

use of net.sourceforge.processdash.tool.redact.EnabledFor in project processdash by dtuma.

the class FilterDataContainingTaskNames method scrambleProbeList.

@EnabledFor({ "PROBE_LIST", "Subproject_Path_List" })
public String scrambleProbeList(String value) {
    if (value == null || value.length() == 0)
        return value;
    List<String> list = StringData.create(value).asList().asList();
    ListData newVal = new ListData();
    for (String elem : list) newVal.add(pathNameMapper.getString(elem));
    return newVal.saveString().substring(1);
}
Also used : ListData(net.sourceforge.processdash.data.ListData) EnabledFor(net.sourceforge.processdash.tool.redact.EnabledFor)

Aggregations

EnabledFor (net.sourceforge.processdash.tool.redact.EnabledFor)4 ListData (net.sourceforge.processdash.data.ListData)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 Date (java.util.Date)1 Properties (java.util.Properties)1