Set grpSet = new HashSet();
for ( int i = 0; groups != null && i < groups.length; i++ )
grpSet.add(groups[i]);
String d = new Variant(date).getString();
StringBuffer sb = new StringBuffer(64);
sb.append("/" + Constants.CONTENT + "[" + Constants.MODIFIED + " > '" + d + "'");
if ( groups != null ) {
sb.append(" and " + Constants.GROUPS + "/" + Constants.GROUP + "[");
for ( int i = 0; i < groups.length; i++ ) {
if ( i > 0 )
sb.append(" or ");
sb.append(".='" + groups[i] + "'");
}
sb.append("]");
}
sb.append("]");
XMLSerializableAdapter col = getContentCollection();
ResultSet rs = col.queryCollection(tx, XPathQueryResolver.STYLE_XPATH, sb.toString(), null);
Map grpMap = new HashMap(); // of String to List of Element
while ( rs.next() ) {
try {
DocumentTable dt = rs.getResult();
Element elem = (Element)DTSMHelper.tableToNode(dt);
NodeList nl = elem.getElementsByTagName(Constants.GROUP);
for ( int i = 0; i < nl.getLength(); i++ ) {
Element e = (Element)nl.item(i);
String grpName = DOMUtils.getText(e);
if ( groups != null && !grpSet.contains(grpName) )
continue;
List l = (List)grpMap.get(grpName);
if ( l == null ) {
l = new ArrayList();
grpMap.put(grpName, l);
}
l.add(elem);
}
}
catch ( DTSMException e ) {
throw new DBException(FaultCodes.GEN_GENERAL_ERROR, "Can't convert DocumentTable", e);
}
}
Document doc = DOMHelper.newDocument();
Element rootElem = doc.createElement(Constants.MANIFEST);
rootElem.setAttribute(Constants.DATE, new Variant(start).getString());
doc.appendChild(rootElem);
Iterator iter = grpMap.keySet().iterator();
while ( iter.hasNext() ) {
String key = (String)iter.next();