Search in sources :

Example 1 with Mappable

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());
    }
}
Also used : Mappable(com.dexels.navajo.script.api.Mappable) Message(com.dexels.navajo.document.Message)

Example 2 with Mappable

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)) + "<");
    }
}
Also used : Mappable(com.dexels.navajo.script.api.Mappable) CSVEntryMap(com.dexels.navajo.adapter.csvmap.CSVEntryMap) Binary(com.dexels.navajo.document.types.Binary) File(java.io.File)

Example 3 with Mappable

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);
    }
}
Also used : Mappable(com.dexels.navajo.script.api.Mappable) DispatcherInterface(com.dexels.navajo.server.DispatcherInterface) UserException(com.dexels.navajo.script.api.UserException) MappingException(com.dexels.navajo.script.api.MappingException) NavajoException(com.dexels.navajo.document.NavajoException) UserException(com.dexels.navajo.script.api.UserException) MappableException(com.dexels.navajo.script.api.MappableException) InvocationTargetException(java.lang.reflect.InvocationTargetException) SystemException(com.dexels.navajo.script.api.SystemException)

Aggregations

Mappable (com.dexels.navajo.script.api.Mappable)3 CSVEntryMap (com.dexels.navajo.adapter.csvmap.CSVEntryMap)1 Message (com.dexels.navajo.document.Message)1 NavajoException (com.dexels.navajo.document.NavajoException)1 Binary (com.dexels.navajo.document.types.Binary)1 MappableException (com.dexels.navajo.script.api.MappableException)1 MappingException (com.dexels.navajo.script.api.MappingException)1 SystemException (com.dexels.navajo.script.api.SystemException)1 UserException (com.dexels.navajo.script.api.UserException)1 DispatcherInterface (com.dexels.navajo.server.DispatcherInterface)1 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1