use of org.mifos.framework.exceptions.TableTagTypeParserException in project head by mifos.
the class TableTag method doStartTag.
/**
* Function to render the tag
*/
@Override
public int doStartTag() throws JspException {
// call the helper method to display the result.
try {
// Value of the list which we are getting from the Cache
List list = getList();
if (list == null) {
return super.doStartTag();
}
if (list.size() == 0) {
JspWriter out = pageContext.getOut();
XmlBuilder result;
result = noResults((String) SessionUtils.getAttribute(Constants.OFFICE_NAME, (HttpServletRequest) pageContext.getRequest()), (String) SessionUtils.getAttribute(Constants.BRANCH_ID, (HttpServletRequest) pageContext.getRequest()), (String) SessionUtils.getAttribute(Constants.SEARCH_STRING, (HttpServletRequest) pageContext.getRequest()));
out.write(result.getOutput());
return super.doStartTag();
}
getTableData(list);
} catch (TableTagException tte) {
throw new JspException(tte);
} catch (TableTagParseException ttpe) {
throw new JspException(ttpe);
} catch (TableTagTypeParserException tttpe) {
throw new JspException(tttpe);
} catch (IOException ioe) {
throw new JspException(ioe);
} catch (HibernateSearchException hse) {
throw new JspException(hse);
} catch (PageExpiredException e) {
throw new JspException(e);
}
return super.doStartTag();
}
use of org.mifos.framework.exceptions.TableTagTypeParserException in project head by mifos.
the class TypeParser method parser.
public Files parser(String filename) throws TableTagTypeParserException {
Files file = null;
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
// Specify our own schema - this overrides the schemaLocation in the
// xml file
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", "type.xsd");
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(null);
Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsStream(filename));
Node fileNode = document.getFirstChild();
file = new Files();
file.setFileName(createFileName(fileNode));
} catch (ParserConfigurationException pce) {
throw new TableTagTypeParserException(pce);
} catch (IOException ioe) {
throw new TableTagTypeParserException(ioe);
} catch (SAXParseException saxpe) {
throw new TableTagTypeParserException(saxpe);
} catch (SAXException saxe) {
throw new TableTagTypeParserException(saxe);
} catch (MifosRuntimeException saxe) {
throw new TableTagTypeParserException(saxe);
}
return file;
}
use of org.mifos.framework.exceptions.TableTagTypeParserException in project head by mifos.
the class TypeParser method createFileName.
private FileName[] createFileName(Node file) throws TableTagTypeParserException {
NodeList fileNameNodeList = ((Element) file).getElementsByTagName(TableTagConstants.FILENAME);
if (fileNameNodeList.getLength() == 0) {
throw new TableTagTypeParserException(fileNameNodeList.toString());
}
FileName[] fileName = new FileName[fileNameNodeList.getLength()];
for (int i = 0; i < fileNameNodeList.getLength(); i++) {
fileName[i] = new FileName();
fileName[i].setName((fileNameNodeList.item(i).getAttributes().getNamedItem(TableTagConstants.NAME).getNodeValue()));
fileName[i].setPath((fileNameNodeList.item(i).getAttributes().getNamedItem(TableTagConstants.PATH).getNodeValue()));
}
return fileName;
}
Aggregations