use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class NavajoMap method processPropertyDirections.
private final void processPropertyDirections(Message m) {
Iterator<Property> allProps = m.getAllProperties().iterator();
while (allProps.hasNext()) {
Property p = allProps.next();
if (isPropertyInList(p, this.outputProperties, m.getType().equals(Message.MSG_TYPE_ARRAY_ELEMENT))) {
p.setDirection(Property.DIR_OUT);
} else if (isPropertyInList(p, this.inputProperties, m.getType().equals(Message.MSG_TYPE_ARRAY_ELEMENT))) {
p.setDirection(Property.DIR_IN);
}
}
Iterator<Message> subMessages = m.getAllMessages().iterator();
while (subMessages.hasNext()) {
processPropertyDirections(subMessages.next());
}
}
use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class RESTAdapter method setDoSend.
@Override
public void setDoSend(String method) throws UserException, ConditionErrorException, SystemException {
if (messagesPerRequest < 1 || useCurrentMessages == null) {
setDoSend(method, prepareOutDoc());
serviceCalled = true;
} else {
String[] messages = useCurrentMessages.split(",");
Navajo copy = outDoc.copy();
Navajo indoc = null;
if (inDoc == null) {
indoc = NavajoFactory.getInstance().createNavajo();
} else {
indoc = inDoc.copy();
}
for (String msgName : messages) {
Message msg = access.getOutputDoc().getMessage(msgName);
if (msg != null && msg.isArrayMessage()) {
Message outMsg = NavajoFactory.getInstance().createMessage(outDoc, msgName);
outMsg.setType("array");
int counter = 0;
int totalCounter = 0;
for (Message element : msg.getElements()) {
outMsg.addElement(element);
counter++;
totalCounter++;
if (counter >= messagesPerRequest || totalCounter >= msg.getArraySize()) {
outDoc.addMessage(outMsg);
setDoSend(method, outDoc);
indoc.merge(inDoc);
// Going to clear data
outDoc = copy.copy();
outMsg = NavajoFactory.getInstance().createMessage(outDoc, msgName);
outMsg.setType("array");
counter = 0;
}
}
inDoc = indoc.copy();
} else {
throw new UserException(2, "Message " + msgName + "not found or not array message!");
}
}
serviceCalled = true;
}
}
use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class AccessMap method getMessage.
private Message getMessage(Message parent, String name) {
Message m = null;
m = NavajoFactory.getInstance().createMessage(callingAccess.getOutputDoc(), name);
if (parent != null) {
parent.addMessage(m);
} else {
callingAccess.getOutputDoc().addMessage(m);
}
return m;
}
use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class AccessMap method getOutMessageStack.
private String getOutMessageStack() {
StringBuilder stackBuffer = new StringBuilder();
Stack<Message> s = myAccess.getCompiledScript().getOutMsgStack();
Iterator<Message> iter = s.iterator();
while (iter.hasNext()) {
Message o = iter.next();
if (o != null) {
stackBuffer.append(o + "\n");
}
}
return stackBuffer.toString();
}
use of com.dexels.navajo.document.Message 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());
}
}
Aggregations