in connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java [2340:3226]
public void outputSpecificationBody(IHTTPOutput out, Locale locale, Specification ds,
int connectionSequenceNumber, int actualSequenceNumber, String tabName)
throws ManifoldCFException, IOException
{
String seqPrefix = "s"+connectionSequenceNumber+"_";
int k;
// Paths tab
if (tabName.equals(Messages.getString(locale,"DCTM.Paths")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
);
// Now, loop through paths
k = 0;
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(CONFIG_PARAM_LOCATION))
{
String pathDescription = "_" + Integer.toString(k);
String pathName = seqPrefix + "specpath" + pathDescription;
String pathOpName = seqPrefix + "pathop" + pathDescription;
out.print(
" <tr>\n"+
" <td class=\"description\">\n"+
" <input type=\"hidden\" name=\""+pathName+"\" value=\""+sn.getAttributeValue("path")+"\"/>\n"+
" <input type=\"hidden\" name=\""+pathOpName+"\" value=\"\"/>\n"+
" <a name=\""+seqPrefix+"path_"+Integer.toString(k)+"\">\n"+
" <input type=\"button\" value=\"Delete\" onClick='Javascript:"+seqPrefix+"SpecOp(\""+pathOpName+"\",\"Delete\",\""+seqPrefix+"path_"+Integer.toString(k)+"\")' alt=\"" + Messages.getAttributeString(locale,"DCTM.DeletePath")+Integer.toString(k)+"\"/>\n"+
" </a> \n"+
" </td>\n"+
" <td class=\"value\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(sn.getAttributeValue("path"))+"\n"+
" </td>\n"+
" </tr>\n"
);
k++;
}
}
if (k == 0)
{
out.print(
" <tr>\n"+
" <td class=\"message\" colspan=\"2\">" + Messages.getBodyString(locale,"DCTM.NoSpecificCabinetFolderPathsGiven") + "</td>\n"+
" </tr>\n"
);
}
out.print(
" <tr>\n"+
" <td class=\"description\">\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"pathcount\" value=\""+Integer.toString(k)+"\"/>\n"
);
String pathSoFar = (String)currentContext.get(seqPrefix+"specpath");
if (pathSoFar == null)
pathSoFar = "/";
// Grab next folder/project list
try
{
String[] childList = getChildFolderNames(pathSoFar);
if (childList == null)
{
// Illegal path - set it back
pathSoFar = "/";
childList = getChildFolderNames(pathSoFar);
if (childList == null)
throw new ManifoldCFException("Can't find any children for root folder");
}
out.print(
" <a name=\""+seqPrefix+"path_"+Integer.toString(k)+"\">\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"specpath\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(pathSoFar)+"\"/>\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"pathop\" value=\"\"/>\n"+
" <input type=\"button\" value=\"Add\" alt=\"" + Messages.getAttributeString(locale,"DCTM.AddPath") + "\" onClick='Javascript:"+seqPrefix+"SpecOp(\""+seqPrefix+"pathop\",\"Add\",\""+seqPrefix+"path_"+Integer.toString(k+1)+"\")'/> \n"+
" </a>\n"+
" </td>\n"+
" <td class=\"value\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(pathSoFar)+"\n"
);
if (pathSoFar.length() > 1)
{
out.print(
" <input type=\"button\" value=\"-\" alt=\"" + Messages.getAttributeString(locale,"DCTM.RemoveFromPath") + "\" onClick='Javascript:"+seqPrefix+"SpecOp(\""+seqPrefix+"pathop\",\"Up\",\""+seqPrefix+"path_"+Integer.toString(k)+"\")'/>\n"
);
}
if (childList.length > 0)
{
out.print(
" <input type=\"button\" value=\"+\" alt=\"" + Messages.getAttributeString(locale,"DCTM.AddToPath") + "\" onClick='Javascript:"+seqPrefix+"SpecAddToPath(\""+seqPrefix+"path_"+Integer.toString(k)+"\")'/> \n"+
" <select multiple=\"false\" name=\""+seqPrefix+"pathaddon\" size=\"2\">\n"+
" <option value=\"\" selected=\"selected\">" + Messages.getBodyString(locale,"DCTM.PickAFolder") + "</option>\n"
);
int j = 0;
while (j < childList.length)
{
out.print(
" <option value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(childList[j])+"\">"+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(childList[j])+"</option>\n"
);
j++;
}
out.print(
" </select>\n"
);
}
}
catch (ManifoldCFException e)
{
out.println(org.apache.manifoldcf.ui.util.Encoder.bodyEscape(e.getMessage()));
}
catch (ServiceInterruption e)
{
out.println("Service interruption or invalid credentials - check your repository connection: "+e.getMessage());
}
out.print(
" </td>\n"+
" </tr>\n"+
"</table>\n"
);
}
else
{
// Now, loop through paths
k = 0;
for (int i =0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(CONFIG_PARAM_LOCATION))
{
String pathDescription = "_" + Integer.toString(k);
String pathName = seqPrefix + "specpath" + pathDescription;
out.print(
"<input type=\"hidden\" name=\""+pathName+"\" value=\""+sn.getAttributeValue("path")+"\"/>\n"
);
k++;
}
}
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"pathcount\" value=\""+Integer.toString(k)+"\"/>\n"
);
}
// Security tab
// Find whether security is on or off
boolean securityOn = true;
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals("security"))
{
String securityValue = sn.getAttributeValue("value");
if (securityValue.equals("off"))
securityOn = false;
else if (securityValue.equals("on"))
securityOn = true;
}
}
if (tabName.equals(Messages.getString(locale,"DCTM.Security")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
" <tr>\n"+
" <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"DCTM.Security2") + "</nobr></td>\n"+
" <td class=\"value\" colspan=\"1\">\n"+
" <input type=\"radio\" name=\""+seqPrefix+"specsecurity\" value=\"on\" "+((securityOn)?"checked=\"true\"":"")+" />Enabled \n"+
" <input type=\"radio\" name=\""+seqPrefix+"specsecurity\" value=\"off\" "+((securityOn==false)?"checked=\"true\"":"")+" />Disabled\n"+
" </td>\n"+
" </tr>\n"+
" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
);
// Finally, go through forced ACL
k = 0;
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals("access"))
{
String accessDescription = "_"+Integer.toString(k);
String accessOpName = seqPrefix+"accessop"+accessDescription;
String accessTokenName = seqPrefix+"spectoken"+accessDescription;
String token = sn.getAttributeValue("token");
out.print(
" <tr>\n"+
" <td class=\"description\">\n"+
" <input type=\"hidden\" name=\""+accessOpName+"\" value=\"\"/>\n"+
" <input type=\"hidden\" name=\""+accessTokenName+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(token)+"\"/>\n"+
" <a name=\""+seqPrefix+"token_"+Integer.toString(k)+"\">\n"+
" <input type=\"button\" value=\"Delete\" alt=\""+Messages.getAttributeString(locale,"DCTM.DeleteAccessToken")+Integer.toString(k)+"\" onClick='Javascript:"+seqPrefix+"SpecOp(\""+accessOpName+"\",\"Delete\",\""+seqPrefix+"token_"+Integer.toString(k)+"\")'/>\n"+
" </a>\n"+
" </td>\n"+
" <td class=\"value\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(token)+"\n"+
" </td>\n"+
" </tr>\n"
);
k++;
}
}
if (k == 0)
{
out.print(
" <tr>\n"+
" <td class=\"message\" colspan=\"2\">" + Messages.getBodyString(locale,"DCTM.NoAccessTokensPresent") + "</td>\n"+
" </tr>\n"
);
}
out.print(
" <tr><td class=\"lightseparator\" colspan=\"2\"><hr/></td></tr>\n"+
" <tr>\n"+
" <td class=\"description\">\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"tokencount\" value=\""+Integer.toString(k)+"\"/>\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"accessop\" value=\"\"/>\n"+
" <a name=\""+seqPrefix+"token_"+Integer.toString(k)+"\">\n"+
" <input type=\"button\" value=\"Add\" alt=\"" + Messages.getAttributeString(locale,"DCTM.AddAccessToken") + "\" onClick='Javascript:"+seqPrefix+"SpecAddToken(\""+seqPrefix+"token_"+Integer.toString(k+1)+"\")'/>\n"+
" </a>\n"+
" </td>\n"+
" <td class=\"value\">\n"+
" <input type=\"text\" size=\"30\" name=\""+seqPrefix+"spectoken\" value=\"\"/>\n"+
" </td>\n"+
" </tr>\n"+
"</table>\n"
);
}
else
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specsecurity\" value=\""+(securityOn?"on":"off")+"\"/>\n"
);
// Finally, go through forced ACL
k = 0;
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals("access"))
{
String accessDescription = "_"+Integer.toString(k);
String token = sn.getAttributeValue("token");
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"spectoken"+accessDescription+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(token)+"\"/>\n"
);
k++;
}
}
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"tokencount\" value=\""+Integer.toString(k)+"\"/>\n"
);
}
// Document Types tab
// First, build a hash map containing all the currently selected document types
Map<String,Object> dtMetadata = new HashMap<String,Object>();
Map<String,Map<String,Map<String,Set<String>>>> dtFilters = new HashMap<String,Map<String,Map<String,Set<String>>>>();
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(CONFIG_PARAM_OBJECTTYPE))
{
String token = sn.getAttributeValue("token");
if (token != null && token.length() > 0)
{
String isAllString = sn.getAttributeValue("all");
if (isAllString != null && isAllString.equals("true"))
dtMetadata.put(token,new Boolean(true));
else
{
Set<String> attrMap = new HashSet<String>();
// Go through the children and look for attribute records
for (int kk = 0; kk < sn.getChildCount(); kk++)
{
SpecificationNode dsn = sn.getChild(kk);
if (dsn.getType().equals(CONFIG_PARAM_ATTRIBUTENAME))
{
String attr = dsn.getAttributeValue("attrname");
attrMap.add(attr);
}
}
dtMetadata.put(token,attrMap);
}
Map<String,Map<String,Set<String>>> filterInfo = new HashMap<String,Map<String,Set<String>>>();
for (int kk = 0; kk < sn.getChildCount(); kk++)
{
SpecificationNode dsn = sn.getChild(kk);
if (dsn.getType().equals(CONFIG_PARAM_FILTER))
{
String name = dsn.getAttributeValue("name");
String op = dsn.getAttributeValue("op");
String value = dsn.getAttributeValue("value");
Map<String,Set<String>> filters = filterInfo.get(name);
if (filters == null)
{
filters = new HashMap<String,Set<String>>();
filterInfo.put(name,filters);
}
Set<String> filterValues = filters.get(op);
if (filterValues == null)
{
filterValues = new HashSet<String>();
filters.put(op,filterValues);
}
filterValues.add(value);
}
}
dtFilters.put(token,filterInfo);
}
}
}
if (tabName.equals(Messages.getString(locale,"DCTM.DocumentTypes")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
);
// Need to catch potential license exception here
try
{
out.print(
" <tr>\n"+
" <td class=\"boxcell\" colspan=\"2\">\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"filter_op\" value=\"Continue\"/>\n"+
" <table class=\"formtable\">\n"+
" <tr class=\"formheaderrow\">\n"+
" <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale,"DCTM.DocumentType") + "</nobr></td>\n"+
" <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale,"DCTM.Filters") + "</nobr></td>\n"+
" <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale,"DCTM.AllMetadataQ") + "</nobr></td>\n"+
" <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale,"DCTM.SpecificMetadata") + "</nobr></td>\n"+
" </tr>\n"
);
k = 0;
String[] strarrObjTypes = getObjectTypes();
for (String strObjectType : strarrObjTypes)
{
if (strObjectType != null && strObjectType.length() > 0)
{
// Get the attributes for this data type
String[] values = getIngestableAttributes(strObjectType);
out.print(
" <tr class=\""+(((k % 2)==0)?"evenformrow":"oddformrow")+"\">\n"+
" <td class=\"formcolumncell\">\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"datatype_"+k+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strObjectType)+"\"/>\n"
);
Object o = dtMetadata.get(strObjectType);
if (o == null)
{
out.print(
" <input type=\"checkbox\" name=\""+seqPrefix+"specfiletype\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strObjectType)+"\">"+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(strObjectType)+"</input>\n"
);
}
else
{
out.print(
" <input type=\"checkbox\" name=\""+seqPrefix+"specfiletype\" checked=\"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strObjectType)+"\">"+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(strObjectType)+"</input>\n"
);
}
out.print(
" </td>\n"+
" <td class=\"boxcell\">\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_op\" value=\"Continue\"/>\n"+
" <table class=\"formtable\">\n"+
" <tr class=\"formheaderrow\">\n"+
" <td class=\"formcolumnheader\"></td>\n"+
" <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale,"DCTM.AttributeName") + "</nobr></td>\n"+
" <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale,"DCTM.Operation") + "</nobr></td>\n"+
" <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale,"DCTM.Value") + "</nobr></td>\n"+
" </tr>\n"
);
// Now, do filters. This will be a table-with-a-table, with an "Add" button at the bottom.
Map<String,Map<String,Set<String>>> currentFilters = dtFilters.get(strObjectType);
int l = 0;
if (currentFilters != null)
{
String[] filterAttributes = currentFilters.keySet().toArray(new String[0]);
java.util.Arrays.sort(filterAttributes);
for (String filterAttribute : filterAttributes)
{
Map<String,Set<String>> filters = currentFilters.get(filterAttribute);
String[] sortedOperations = filters.keySet().toArray(new String[0]);
java.util.Arrays.sort(sortedOperations);
for (String filterOperation : sortedOperations)
{
Set<String> filterValues = filters.get(filterOperation);
String[] sortedValues = filterValues.toArray(new String[0]);
java.util.Arrays.sort(sortedValues);
for (String filterValue : sortedValues)
{
out.print(
" <tr class=\""+(((l % 2)==0)?"evenformrow":"oddformrow")+"\">\n"+
" <td class=\"formcolumncell\">\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_"+l+"_op\" value=\"Continue\"/>\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_"+l+"_name\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(filterAttribute)+"\"/>\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_"+l+"_operation\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(filterOperation)+"\"/>\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_"+l+"_value\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(filterValue)+"\"/>\n"+
" <a name=\""+seqPrefix+"filter_"+k+"_"+l+"\">\n"+
" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"DCTM.Delete") + "\" alt=\""+Messages.getAttributeString(locale,"DCTM.DeleteFilter")+"\" onclick='javascript:"+seqPrefix+"DeleteFilter("+k+","+l+");'/>\n"+
" </a>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(filterAttribute)+"\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(filterOperation)+"\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(filterValue)+"\n"+
" </td>\n"+
" </tr>\n"
);
l++;
}
}
}
}
if (l == 0)
{
out.print(
" <tr class=\"formrow\"><td colspan=\"4\" class=\"formcolumnmessage\"><nobr>" + Messages.getBodyString(locale,"DCTM.NoAttributeFiltersSpecified") + "</nobr></td></tr>\n"
);
}
out.print(
" <tr class=\"formrow\"><td colspan=\"4\" class=\"formseparator\"><hr/></td></tr>\n"+
" <tr class=\"formrow\">\n"+
" <td class=\"formcolumncell\">\n"+
" <a name=\""+seqPrefix+"filter_"+k+"_"+l+"\">\n"+
" <input type=\"button\" value=\"" + Messages.getAttributeString(locale,"DCTM.Add") + "\" alt=\"" + Messages.getAttributeString(locale,"DCTM.AddFilter") + "\" onclick='javascript:"+seqPrefix+"AddFilter("+k+","+l+");'/>\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_count\" value=\""+l+"\"/>\n"+
" </a>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
" <select multiple=\"false\" name=\""+seqPrefix+"filter_"+k+"_name\" size=\"3\">\n"+
" <option value=\"\" selected=\"selected\">" + Messages.getBodyString(locale,"DCTM.PickAnAttribute") + "</option>\n"
);
for (String attributeName : values)
{
out.print(
" <option value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(attributeName)+"\">" + org.apache.manifoldcf.ui.util.Encoder.bodyEscape(attributeName) + "</option>\n"
);
}
out.print(
" </select>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
" <select multiple=\"false\" name=\""+seqPrefix+"filter_"+k+"_operation\" size=\"3\">\n"+
" <option value=\"\" selected=\"selected\">" + Messages.getBodyString(locale,"DCTM.PickAnOperation") + "</option>\n"+
" <option value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape("=")+"\">" + Messages.getBodyString(locale,"DCTM.Equals") + "</option>\n"+
" <option value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape("<>")+"\">" + Messages.getBodyString(locale,"DCTM.NotEquals") + "</option>\n"+
" </select>\n"+
" </td>\n"+
" <td class=\"formcolumncell\"><input type=\"text\" name=\""+seqPrefix+"filter_"+k+"_value\" size=\"30\" value=\"\"/></td>\n"+
" </tr>\n"+
" </table>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"
);
boolean isAll = false;
Set<String> attrMap = null;
if (o instanceof Boolean)
{
isAll = ((Boolean)o).booleanValue();
attrMap = new HashSet<String>();
}
else
{
isAll = false;
attrMap = (Set<String>)o;
}
out.print(
" <input type=\"checkbox\" name=\""+seqPrefix+"specfileallattrs_"+k+"\" value=\"true\" "+(isAll?"checked=\"\"":"")+"/>\n"+
" </td>\n"+
" <td class=\"formcolumncell\">\n"+
" <select multiple=\"true\" name=\""+seqPrefix+"specfileattrs_"+k+"\" size=\"3\">\n"
);
for (String option : values)
{
if (attrMap != null && attrMap.contains(option))
{
// Selected
out.print(
" <option selected=\"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(option)+"\">"+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(option)+"</option>\n"
);
}
else
{
// Unselected
out.print(
" <option value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(option)+"\">"+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(option)+"</option>\n"
);
}
}
out.print(
" </select>\n"+
" </td>\n"
);
out.print(
" </tr>\n"
);
k++;
}
}
out.print(
" </table>\n"+
" <input type=\"hidden\" name=\""+seqPrefix+"datatype_count\" value=\""+k+"\"/>\n"+
" </td>\n"+
" </tr>\n"
);
}
catch (ManifoldCFException e)
{
out.print(
" <tr>\n"+
" <td class=\"message\" colspan=\"2\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(e.getMessage())+"\n"+
" </td>\n"+
" </tr>\n"
);
}
catch (ServiceInterruption e)
{
out.print(
" <tr>\n"+
" <td class=\"message\" colspan=\"2\">\n"+
" " + Messages.getBodyString(locale,"DCTM.ServiceInterruptionOrInvalidCredentials")+
" </td>\n"+
" </tr>\n"
);
}
out.print(
"</table>\n"
);
}
else
{
k = 0;
for (String strObjectType : dtMetadata.keySet())
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"datatype_"+k+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strObjectType)+"\"/>\n"
);
Map<String,Map<String,Set<String>>> currentFilters = dtFilters.get(strObjectType);
int l = 0;
for (String filterAttribute : currentFilters.keySet())
{
Map<String,Set<String>> filters = currentFilters.get(filterAttribute);
for (String filterOperation : filters.keySet())
{
Set<String> filterValues = filters.get(filterOperation);
for (String filterValue : filterValues)
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_"+l+"_name\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(filterAttribute)+"\"/>\n"+
"<input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_"+l+"_operation\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(filterOperation)+"\"/>\n"+
"<input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_"+l+"_value\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(filterValue)+"\"/>\n"
);
l++;
}
}
}
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"filter_"+k+"_count\" value=\""+l+"\"/>\n"
);
Object o = dtMetadata.get(strObjectType);
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specfiletype\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strObjectType)+"\"/>\n"
);
if (o instanceof Boolean)
{
Boolean b = (Boolean)o;
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specfileallattrs_"+k+"\" value=\""+(b.booleanValue()?"true":"false")+"\"/>\n"
);
}
else
{
Set<String> map = (Set<String>)o;
for (String attrName : map)
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specfileattrs_"+k+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(attrName)+"\"/>\n"
);
}
}
k++;
}
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"datatype_count\" value=\""+k+"\"/>\n"
);
}
// Content types tab
// First, build a hash map containing all the currently selected document types
Set<String> ctMap = null;
boolean seenAll = false;
boolean doAll = false;
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(CONFIG_PARAM_FORMAT))
{
seenAll = true;
String token = sn.getAttributeValue("value");
if (token != null && token.length() > 0)
{
if (ctMap == null)
ctMap = new HashSet<String>();
ctMap.add(token);
}
}
else if (sn.getType().equals(CONFIG_PARAM_FORMAT_ALL))
{
seenAll = true;
String value = sn.getAttributeValue("value");
if (value.equals("true")) {
doAll = true;
}
}
}
// Hidden variable so we know that the form was posted
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specmimetype_posted\" value=\"true\"/>\n"
);
if (tabName.equals(Messages.getString(locale,"DCTM.ContentTypes")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
" <tr>\n"+
" <td class=\"description\">\n"
);
// If _ALL record not even seen, do default thing
if (seenAll == false || doAll)
{
out.print(
" <input type=\"checkbox\" name=\""+seqPrefix+"specmimetypeall\" checked=\"\" value=\"true\"></input>\n"
);
}
else
{
out.print(
" <input type=\"checkbox\" name=\""+seqPrefix+"specmimetypeall\" value=\"true\"></input>\n"
);
}
out.print(
" </td>\n"+
" <td class=\"value\">\n"+
" "+Messages.getBodyString(locale,"DCTM.AllContentTypes")+"\n"+
" </td>\n"+
" </tr>\n"+
" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
);
// Need to catch potential license exception here
try
{
String[] strarrMimeTypes = getContentTypes();
for (String strMimeType : strarrMimeTypes)
{
if (strMimeType != null && strMimeType.length() > 0)
{
out.print(
" <tr>\n"+
" <td class=\"description\">\n"
);
if (ctMap != null && ctMap.contains(strMimeType))
{
out.print(
" <input type=\"checkbox\" name=\""+seqPrefix+"specmimetype\" checked=\"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strMimeType)+"\"></input>\n"
);
}
else
{
out.print(
" <input type=\"checkbox\" name=\""+seqPrefix+"specmimetype\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strMimeType)+"\"></input>\n"
);
}
out.print(
" </td>\n"+
" <td class=\"value\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(strMimeType)+"\n"+
" </td>\n"+
" </tr>\n"
);
}
}
}
catch (ManifoldCFException e)
{
out.print(
" <tr>\n"+
" <td class=\"message\" colspan=\"2\">\n"+
" "+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(e.getMessage())+"\n"+
" </td>\n"+
" </tr>\n"
);
}
catch (ServiceInterruption e)
{
out.print(
" <tr>\n"+
" <td class=\"message\" colspan=\"2\">\n"+
" " + Messages.getBodyString(locale,"DCTM.ServiceInterruptionOrInvalidCredentials") +
" </td>\n"+
" </tr>\n"
);
}
out.print(
"</table>\n"
);
}
else
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specmimetypeall\" value=\""+((seenAll == false || doAll)?"true":"false")+"\"/>\n"
);
if (ctMap != null)
{
for (String strMimeType : ctMap)
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specmimetype\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(strMimeType)+"\"/>\n"
);
}
}
}
// The Content Length tab
// Search for max document size
String maxDocLength = "";
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(CONFIG_PARAM_MAXLENGTH))
{
maxDocLength = sn.getAttributeValue("value");
}
}
if (tabName.equals(Messages.getString(locale,"DCTM.ContentLength")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<table class=\"displaytable\">\n"+
" <tr>\n"+
" <td class=\"separator\" colspan=\"2\"><hr/></td>\n"+
" </tr>\n"+
" <tr>\n"+
" <td class=\"description\"><nobr>" + Messages.getBodyString(locale,"DCTM.ContentLength") + "</nobr></td>\n"+
" <td class=\"value\">\n"+
" <input name=\""+seqPrefix+"specmaxdoclength\" type=\"text\" size=\"10\" value=\""+maxDocLength+"\"/>\n"+
" </td>\n"+
" </tr>\n"+
"</table>\n"
);
}
else
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specmaxdoclength\" value=\""+maxDocLength+"\"/>\n"
);
}
// Path metadata tab
// Find the path-value metadata attribute name
String pathNameAttribute = "";
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(CONFIG_PARAM_PATHNAMEATTRIBUTE))
{
pathNameAttribute = sn.getAttributeValue("value");
}
}
// Find the path-value mapping data
org.apache.manifoldcf.crawler.connectors.DCTM.MatchMap matchMap = new org.apache.manifoldcf.crawler.connectors.DCTM.MatchMap();
for (int i = 0; i < ds.getChildCount(); i++)
{
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(CONFIG_PARAM_PATHMAP))
{
String pathMatch = sn.getAttributeValue("match");
String pathReplace = sn.getAttributeValue("replace");
matchMap.appendMatchPair(pathMatch,pathReplace);
}
}
if (tabName.equals(Messages.getString(locale,"DCTM.PathMetadata")) && connectionSequenceNumber == actualSequenceNumber)
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specmappingcount\" value=\""+Integer.toString(matchMap.getMatchCount())+"\"/>\n"+
"<input type=\"hidden\" name=\""+seqPrefix+"specmappingop\" value=\"\"/>\n"+
"\n"+
"<table class=\"displaytable\">\n"+
" <tr><td class=\"separator\" colspan=\"4\"><hr/></td></tr>\n"+
" <tr>\n"+
" <td class=\"description\" colspan=\"1\"><nobr>" + Messages.getBodyString(locale,"DCTM.PathAttributeName") + "</nobr></td>\n"+
" <td class=\"value\" colspan=\"3\">\n"+
" <input type=\"text\" name=\""+seqPrefix+"specpathnameattribute\" size=\"20\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(pathNameAttribute)+"\"/>\n"+
" </td>\n"+
" </tr>\n"+
" <tr><td class=\"separator\" colspan=\"4\"><hr/></td></tr>\n"
);
for (int i = 0; i < matchMap.getMatchCount(); i++)
{
String matchString = matchMap.getMatchString(i);
String replaceString = matchMap.getReplaceString(i);
out.print(
" <tr>\n"+
" <td class=\"description\"><input type=\"hidden\" name=\""+seqPrefix+"specmappingop_"+Integer.toString(i)+"\" value=\"\"/>\n"+
" <a name=\""+seqPrefix+"mapping_"+Integer.toString(i)+"\">\n"+
" <input type=\"button\" onClick='Javascript:"+seqPrefix+"SpecOp(\""+seqPrefix+"specmappingop_"+Integer.toString(i)+"\",\"" + Messages.getAttributeJavascriptString(locale,"DCTM.Delete") + "\",\""+seqPrefix+"mapping_"+Integer.toString(i)+"\")' alt=\"" + Messages.getAttributeString(locale,"DCTM.DeleteMapping") + Integer.toString(i)+"\" value=\"Delete\"/>\n"+
" </a>\n"+
" </td>\n"+
" <td class=\"value\"><input type=\"hidden\" name=\""+seqPrefix+"specmatch_"+Integer.toString(i)+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(matchString)+"\"/>"+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(matchString)+"</td>\n"+
" <td class=\"value\">==></td>\n"+
" <td class=\"value\"><input type=\"hidden\" name=\""+seqPrefix+"specreplace_"+Integer.toString(i)+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(replaceString)+"\"/>"+org.apache.manifoldcf.ui.util.Encoder.bodyEscape(replaceString)+"</td>\n"+
" </tr>\n"
);
}
if (matchMap.getMatchCount() == 0)
{
out.print(
" <tr><td colspan=\"4\" class=\"message\">" + Messages.getBodyString(locale,"DCTM.NoMappingsSpecified") + "</td></tr>\n"
);
}
out.print(
" <tr><td class=\"lightseparator\" colspan=\"4\"><hr/></td></tr>\n"+
"\n"+
" <tr>\n"+
" <td class=\"description\">\n"+
" <a name=\""+seqPrefix+"mapping_"+Integer.toString(matchMap.getMatchCount())+"\">\n"+
" <input type=\"button\" onClick='Javascript:"+seqPrefix+"SpecAddMapping(\""+seqPrefix+"mapping_"+Integer.toString(matchMap.getMatchCount()+1)+"\")' alt=\"" + Messages.getAttributeString(locale,"DCTM.AddToMappings") + "\" value=\"" + Messages.getAttributeString(locale,"DCTM.Add") + "\"/>\n"+
" </a>\n"+
" </td>\n"+
" <td class=\"value\">" + Messages.getBodyString(locale,"DCTM.MatchRegexp") + " <input type=\"text\" name=\""+seqPrefix+"specmatch\" size=\"32\" value=\"\"/></td>\n"+
" <td class=\"value\">==></td>\n"+
" <td class=\"value\">" + Messages.getBodyString(locale,"DCTM.ReplaceString") + " <input type=\"text\" name=\""+seqPrefix+"specreplace\" size=\"32\" value=\"\"/></td>\n"+
" </tr>\n"+
"</table>\n"
);
}
else
{
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specmappingcount\" value=\""+Integer.toString(matchMap.getMatchCount())+"\"/>\n"+
"<input type=\"hidden\" name=\""+seqPrefix+"specpathnameattribute\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(pathNameAttribute)+"\"/>\n"
);
for (int i = 0; i < matchMap.getMatchCount(); i++)
{
String matchString = matchMap.getMatchString(i);
String replaceString = matchMap.getReplaceString(i);
out.print(
"<input type=\"hidden\" name=\""+seqPrefix+"specmatch_"+Integer.toString(i)+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(matchString)+"\"/>\n"+
"<input type=\"hidden\" name=\""+seqPrefix+"specreplace_"+Integer.toString(i)+"\" value=\""+org.apache.manifoldcf.ui.util.Encoder.attributeEscape(replaceString)+"\"/>\n"
);
}
}
}