Search in sources :

Example 1 with PatternList

use of net.sourceforge.processdash.util.PatternList in project processdash by dtuma.

the class WBSModelMergeConflictNotificationFactory method findColumnForAttribute.

public static ConflictCapableDataColumn findColumnForAttribute(DataTableModel model, String attrName) {
    if (model == null)
        return null;
    for (int i = model.getColumnCount(); i-- > 0; ) {
        DataColumn column = model.getColumn(i);
        if (column instanceof ConflictCapableDataColumn) {
            ConflictCapableDataColumn ccdc = (ConflictCapableDataColumn) column;
            PatternList pattern = ccdc.getConflictAttributeNamePattern();
            if (pattern != null && pattern.matches(attrName))
                return ccdc;
        }
    }
    return null;
}
Also used : PatternList(net.sourceforge.processdash.util.PatternList)

Example 2 with PatternList

use of net.sourceforge.processdash.util.PatternList in project processdash by dtuma.

the class RedactFilterData method getEntries.

public List<ZipEntry> getEntries(String... patterns) {
    PatternList p = new PatternList(patterns);
    List<ZipEntry> result = new ArrayList<ZipEntry>();
    Enumeration<? extends ZipEntry> entries = srcZip.entries();
    while (entries.hasMoreElements()) {
        ZipEntry e = entries.nextElement();
        if (p.matches(e.getName()))
            result.add(e);
    }
    return result;
}
Also used : ZipEntry(java.util.zip.ZipEntry) PatternList(net.sourceforge.processdash.util.PatternList) ArrayList(java.util.ArrayList)

Example 3 with PatternList

use of net.sourceforge.processdash.util.PatternList in project processdash by dtuma.

the class FilterCensoredData method afterPropertiesSet.

public void afterPropertiesSet() {
    censoredDataElements = new PatternList();
    List<Element> cfgXml = ExtensionManager.getXmlConfigurationElements("redact-filter-censored-data");
    for (Element xml : cfgXml) if (isEnabled(xml))
        parseConfig(xml);
}
Also used : Element(org.w3c.dom.Element) PatternList(net.sourceforge.processdash.util.PatternList)

Example 4 with PatternList

use of net.sourceforge.processdash.util.PatternList in project processdash by dtuma.

the class DefaultDataExportFilter method setupPatterns.

private PatternList setupPatterns(List regexps) {
    if (regexps == null || regexps.isEmpty())
        return null;
    else {
        PatternList result = new PatternList();
        for (Iterator iter = regexps.iterator(); iter.hasNext(); ) {
            String re = (String) iter.next();
            int bracePos = re.indexOf('}');
            if (bracePos != -1 && re.startsWith("{"))
                re = re.substring(bracePos + 1);
            try {
                result.addRegexp(re);
            } catch (Exception e) {
                logger.log(Level.WARNING, "Bad regular expression ''{0}''", re);
            }
        }
        return result;
    }
}
Also used : PatternList(net.sourceforge.processdash.util.PatternList) Iterator(java.util.Iterator)

Example 5 with PatternList

use of net.sourceforge.processdash.util.PatternList in project processdash by dtuma.

the class AbstractLibraryEditor method openLibrary.

private void openLibrary(Component parent, boolean export) throws UserCancelledException {
    WBSLibrary result = null;
    while (true) {
        File file = selectFile(parent, export);
        if (file == null)
            throw new UserCancelledException();
        result = openLibrary(parent, export, file);
        if (result != null)
            break;
    }
    libraryFile = result;
    library = result.getWbs();
    library.getRoot().setName(resources.getString("Library_Root_Name"));
    if (export == false)
        library.removeAttributes(new PatternList("^exportSourceID$", "^relaunchSourceID$"));
}
Also used : PatternList(net.sourceforge.processdash.util.PatternList) File(java.io.File)

Aggregations

PatternList (net.sourceforge.processdash.util.PatternList)7 Iterator (java.util.Iterator)2 Element (org.w3c.dom.Element)2 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ZipEntry (java.util.zip.ZipEntry)1 ListData (net.sourceforge.processdash.data.ListData)1 SimplePrefixLocalDataNameFilter (net.sourceforge.processdash.data.repository.SimplePrefixLocalDataNameFilter)1 SAXException (org.xml.sax.SAXException)1