use of com.dexels.navajo.script.api.Mappable in project navajo by Dexels.
the class AccessMap method showMapDetails.
private void showMapDetails(Message parent, MappableTreeNode m) throws MappingException, UserException {
Mappable myMap = (Mappable) m.myObject;
addProperty(parent, "Map", m.getMapName(), Property.STRING_PROPERTY, 50);
addProperty(parent, "Totaltime", Integer.valueOf(m.getTotaltime()), Property.STRING_PROPERTY, 50);
Class<?> ccc = null;
try {
ccc = Class.forName("com.dexels.navajo.adapter.SPMap");
} catch (ClassNotFoundException e) {
logger.debug("SPMap missing?", e);
}
if (myMap instanceof com.dexels.navajo.adapter.SQLMap || (ccc != null && (ccc.isInstance(myMap)))) {
SQLMap mySQL = (SQLMap) myMap;
Message parameters = getMessage(parent, "MapParameters");
addProperty(parameters, "Datasource", mySQL.getDatasource(), Property.STRING_PROPERTY, 50);
addProperty(parameters, "DatabaseProductName", mySQL.getDatabaseProductName(), Property.STRING_PROPERTY, 100);
addProperty(parameters, "DatabaseVersion", mySQL.getDatabaseVersion(), Property.STRING_PROPERTY, 100);
addProperty(parameters, "SessionId", mySQL.getDatabaseSessionId(), Property.STRING_PROPERTY, -1);
addProperty(parameters, "Query", mySQL.getQuery(), Property.STRING_PROPERTY, -1);
}
// Show parents.
if (m.getParent() != null) {
Message parentMap = getMessage(parent, "ParentMap");
showMapDetails(parentMap, m.getParent());
}
}
use of com.dexels.navajo.script.api.Mappable in project navajo by Dexels.
the class CSVMap method main.
public static void main(String[] args) throws Exception {
Mappable csv = new CSVMap();
((CSVMap) csv).setSeparator(";");
((CSVMap) csv).setIncludeEmpty(true);
((CSVMap) csv).setSkipFirstRow(false);
Binary b = new Binary(new File("C:/Temp/LedenLIJST-vertrouwelijktest.csv"));
((CSVMap) csv).setFileContent(b);
Mappable[] all = ((CSVMap) csv).getEntries();
for (int i = 0; i < all.length; i++) {
CSVEntryMap entryMap = ((CSVEntryMap) all[i]);
logger.info("a = >" + entryMap.getEntry(Integer.valueOf(0)) + "< - >" + entryMap.getEntry(Integer.valueOf(1)) + "< - >" + entryMap.getEntry(Integer.valueOf(2)) + "< - >" + entryMap.getEntry(Integer.valueOf(3)) + "< - >" + entryMap.getEntry(Integer.valueOf(4)) + "< - >" + entryMap.getEntry(Integer.valueOf(5)) + "< - >" + entryMap.getEntry(Integer.valueOf(6)) + "< - >" + entryMap.getEntry(Integer.valueOf(7)) + "< - >" + entryMap.getEntry(Integer.valueOf(8)) + "< - >" + entryMap.getEntry(Integer.valueOf(9)) + "< - >" + entryMap.getEntry(Integer.valueOf(10)) + "< - >" + entryMap.getEntry(Integer.valueOf(11)) + "<");
}
}
use of com.dexels.navajo.script.api.Mappable in project navajo by Dexels.
the class MappingUtils method isObjectMappable.
public static final boolean isObjectMappable(String className) throws UserException {
try {
DispatcherInterface instance = DispatcherFactory.getInstance();
Class c = null;
if (instance == null) {
c = Class.forName(className);
} else {
c = Class.forName(className, true, instance.getNavajoConfig().getClassloader());
}
return (Mappable.class.isAssignableFrom(c));
} catch (Exception e) {
throw new UserException(-1, "Could not handle class as either mappable or POJO bean: " + className + ", cause: " + e.getMessage(), e);
}
}
Aggregations