use of alma.cdbErrType.wrappers.AcsJCDBRecordDoesNotExistEx in project ACS by ACS-Community.
the class HibernateWDALImpl method get_DAO.
/* (non-Javadoc)
* @see com.cosylab.CDB.DALOperations#get_DAO(java.lang.String)
*/
public String get_DAO(String curl) throws CDBXMLErrorEx, CDBRecordDoesNotExistEx {
checkAccess();
// remove trailing slashes, to have unique curl (used for key)
if (curl.length() > 0 && curl.charAt(0) == '/')
curl = curl.substring(1);
m_logger.log(AcsLogLevel.INFO, "Returning XML record for: " + curl);
Object node = curl.length() == 0 ? rootNode : DOMJavaClassIntrospector.getNode(curl, rootNode);
if (node == null || DOMJavaClassIntrospector.isPrimitive(node.getClass())) {
AcsJCDBRecordDoesNotExistEx ex = new AcsJCDBRecordDoesNotExistEx();
ex.setCurl(curl);
String detailMsg = (node == null ? "node is null." : "node is primitive (" + node.getClass().getName() + ").");
m_logger.log(AcsLogLevel.NOTICE, detailMsg, ex);
throw ex.toCDBRecordDoesNotExistEx();
} else if (node instanceof DAOImpl) {
String ret = ((DAOImpl) node).getRootNode().toString(false);
m_logger.finest("get_DAO(" + curl + ") returning " + ret);
return ret;
}
// remove last slash
if (curl.length() > 0 && curl.charAt(curl.length() - 1) == '/')
curl = curl.substring(0, curl.length() - 1);
// get node name only
String name;
int pos = curl.lastIndexOf('/');
if (pos == -1)
name = curl;
else
name = curl.substring(pos + 1, curl.length());
// root
if (name.length() == 0)
name = "root";
try {
String ret = "<?xml version='1.0' encoding='ISO-8859-1'?>" + DOMJavaClassIntrospector.toXML(DOMJavaClassIntrospector.getRootNodeXMLName(name, node), node, curl, m_logger);
m_logger.finest("get_DAO(" + curl + ") returning " + ret);
return ret;
} catch (Throwable t) {
t.printStackTrace();
String info = "DAL::get_DAO " + t;
AcsJCDBXMLErrorEx xmlErr = new AcsJCDBXMLErrorEx(t);
xmlErr.setErrorString(info);
m_logger.log(AcsLogLevel.NOTICE, info);
throw xmlErr.toCDBXMLErrorEx();
}
}
Aggregations