String namespaceRoot = WSConstants.NAMESPACE_CRIS;
Namespace echoNamespaceRoot = Namespace.getNamespace(WSConstants.NAMESPACE_PREFIX_CRIS,
namespaceRoot);
UtilsXML xml = new UtilsXML(writer, applicationService);
xml.createPagination(hit, start, docList.size());
xml.createType(type);
xml.setSeeHiddenValue(seeHiddenValue);
org.jdom.Document xmldoc = null;
try
{
xmldoc = xml.createRoot(responseRootName, echoNamespaceRoot.getPrefix(),
echoNamespaceRoot.getURI());
}
catch (IOException e)
{
log.error(e.getMessage(), e);
}
catch (ParserConfigurationException e)
{
log.error(e.getMessage(), e);
}
// build the response XML with JDOM
Namespace echoNamespace = Namespace.getNamespace(namespacePrefix,
namespace);
Element child = new Element("crisobjects", echoNamespace.getPrefix(),echoNamespace.getURI());
xmldoc.getRootElement().addContent(child);
if (docList != null)
{
List<IContainable> tmp_containables = new LinkedList<IContainable>();
List<IContainable> containables = new LinkedList<IContainable>();
try
{
tmp_containables = applicationService
.newFindAllContainables(tpClazz);
main: for (String projection : splitProjection)
{
slave: for (IContainable cc : tmp_containables)
{
if (cc.getShortName().equals(projection))
{
containables.add(cc);
break slave;
}
}
}
if (containables.isEmpty())
{
throw new RuntimeException(
"Incoherent properties definitions, you looking for a projection not stable, contact administrator (web services contract fault)");
}
}
catch (InstantiationException e)
{
log.error(e.getMessage(), e);
}
catch (IllegalAccessException e)
{
log.error(e.getMessage(), e);
}
for (T rp : docList)
{
try
{
xml.write(rp, containables, child);
}
catch (SecurityException e)
{
log.error(e.getMessage(), e);
}