use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class BaseNavajoImpl method merge.
@Override
public Navajo merge(Navajo with, boolean preferThisNavajo) {
// Find duplicate messages.
List<Message> superMessages = this.getAllMessages();
List<Message> subMessages = with.getAllMessages();
for (int i = 0; i < superMessages.size(); i++) {
Message superMsg = superMessages.get(i);
for (int j = 0; j < subMessages.size(); j++) {
Message subMsg = subMessages.get(j);
if (superMsg.getName().equals(subMsg.getName())) {
// Found duplicate!
Message newMsg = subMsg.copy(this);
this.mergeMessage(newMsg, preferThisNavajo);
}
}
}
// Find new messages.
for (int i = 0; i < subMessages.size(); i++) {
Message subMsg = subMessages.get(i);
boolean newMsg = true;
for (int j = 0; j < superMessages.size(); j++) {
Message superMsg = superMessages.get(j);
if (superMsg.getName().equals(subMsg.getName())) {
newMsg = false;
j = superMessages.size() + 1;
}
}
if (newMsg) {
this.addMessage(subMsg.copy(this));
}
}
return this;
}
use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class BaseNavajoImpl method appendDocBuffer.
/**
* @deprecated
*/
@Override
@Deprecated
public void appendDocBuffer(Object d) {
Navajo n = (Navajo) d;
List<Message> msgs = n.getAllMessages();
for (int i = 0; i < msgs.size(); i++) {
Message m = msgs.get(i);
addMessage(m.copy(this));
}
}
use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class BirtUtils method locateArrayMessage.
private String locateArrayMessage(Navajo n) {
List<Message> mm = n.getAllMessages();
for (Iterator<Message> iter = mm.iterator(); iter.hasNext(); ) {
Message m = iter.next();
if (Message.MSG_TYPE_ARRAY.equals(m.getType())) {
return m.getFullMessageName();
}
}
// two loops, for pre order:
for (Iterator<Message> iter = mm.iterator(); iter.hasNext(); ) {
Message m = iter.next();
String res = locateArrayMessage(m);
if (res != null) {
return res;
}
}
return null;
}
use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class BirtUtils method createResultSet.
private void createResultSet(Document d, Element odaDataSetTag, Message sourceObject, String service) {
Message first = null;
if (sourceObject == null) {
return;
}
if (sourceObject.getType().equals(Message.MSG_TYPE_ARRAY)) {
first = sourceObject.getMessage(0);
if (first == null) {
return;
}
} else {
first = sourceObject;
}
List<Property> props = first.getAllProperties();
Element listprop = addProperty(d, odaDataSetTag, "list-property", "resultSet", null);
for (int i = 0; i < props.size(); i++) {
Property current = props.get(i);
Element s = d.createElement("structure");
listprop.appendChild(s);
addProperty(d, s, "property", "position", "" + (i + 1));
addProperty(d, s, "property", "name", current.getName());
addProperty(d, s, "property", "nativeName", current.getName());
addProperty(d, s, "property", "dataType", getPropertyType(current, false));
if (Property.BINARY_PROPERTY.equals(current.getType())) {
Element n = (Element) XMLutils.findNode(odaDataSetTag, "computedColumns");
if (n == null) {
n = addProperty(d, odaDataSetTag, "list-property", "computedColumns", null);
}
Element struc = addProperty(d, n, "structure", null, null);
addProperty(d, struc, "property", "name", current.getName() + "_Data");
addProperty(d, struc, "expression", "expression", "importPackage(Packages.org.dexels.utils); Base64.decode(dataSetRow[\"" + current.getName() + "\"])");
addProperty(d, struc, "property", "dataType", "any");
}
}
addProperty(d, odaDataSetTag, "property", "queryText", createArrayMessageQueryText(props, service, sourceObject));
}
use of com.dexels.navajo.document.Message in project navajo by Dexels.
the class BirtUtils method locateArrayMessage.
private String locateArrayMessage(Message in) {
List<Message> mm = in.getAllMessages();
for (Iterator<Message> iter = mm.iterator(); iter.hasNext(); ) {
Message m = iter.next();
if (Message.MSG_TYPE_ARRAY.equals(m.getType())) {
return m.getFullMessageName();
}
}
// two loops, for breath first order:
for (Iterator<Message> iter = mm.iterator(); iter.hasNext(); ) {
Message m = iter.next();
String res = locateArrayMessage(m);
if (res != null) {
return res;
}
}
return null;
}
Aggregations