Search in sources :

Example 86 with Property

use of com.dexels.navajo.document.Property in project navajo by Dexels.

the class TmlToXmlMap method appendMessages.

private final void appendMessages(Message m, TagMap parent) throws UserException {
    if (!m.getMode().equals(Message.MSG_MODE_IGNORE)) {
        // Check for array messages. Only append array children
        TagMap child;
        if (!m.getType().equals(Message.MSG_TYPE_ARRAY)) {
            child = new TagMap();
            child.setCompact(true);
            child.setName(m.getName());
            parent.setChild(child);
        } else {
            child = parent;
        }
        List<Property> allProperties = m.getAllProperties();
        for (int i = 0; i < allProperties.size(); i++) {
            appendProperty(allProperties.get(i), child);
        }
        List<Message> allMessages = m.getAllMessages();
        for (int i = 0; i < allMessages.size(); i++) {
            appendMessages(allMessages.get(i), child);
        }
    }
}
Also used : Message(com.dexels.navajo.document.Message) Property(com.dexels.navajo.document.Property) TagMap(com.dexels.navajo.adapter.xmlmap.TagMap)

Example 87 with Property

use of com.dexels.navajo.document.Property in project navajo by Dexels.

the class TmlToXmlMap method setProcessSoapData.

/**
 * @param b
 */
public void setProcessSoapData(boolean b) throws UserException {
    Message settings = this.document.getMessage("_SoapSettings");
    Message headers = this.document.getMessage("_SoapHeaders");
    settings.setMode(Message.MSG_MODE_IGNORE);
    headers.setMode(Message.MSG_MODE_IGNORE);
    setTargetNamespace(settings.getProperty("TargetNamespace").getValue());
    logger.debug("Using namespace: {}", settings.getProperty("TargetNamespace").getValue());
    Property parts = settings.getProperty("Parts");
    String partList = parts.getValue();
    String[] partArray = partList.split(",");
    for (String pt : partArray) {
        logger.debug("Part: {}", pt);
        Message rootParent = this.document.getMessage(pt);
        // should have only one child, if I'm not mistaken.
        for (Message child : rootParent.getAllMessages()) {
            setRootPath(child.getFullMessageName());
            setBuildContent(true);
        }
    }
}
Also used : Message(com.dexels.navajo.document.Message) Property(com.dexels.navajo.document.Property)

Example 88 with Property

use of com.dexels.navajo.document.Property in project navajo by Dexels.

the class ResultMessage method processSuppressedProperties.

public final void processSuppressedProperties(Message m) {
    if (m.isArrayMessage() && m.getDefinitionMessage() != null) {
        processSuppressedProperties(m.getDefinitionMessage());
    }
    Iterator<Property> allProps = new ArrayList<Property>(m.getAllProperties()).iterator();
    while (allProps.hasNext()) {
        Property p = allProps.next();
        if (isPropertyInList(p, this.suppressProperties)) {
            m.removeProperty(p);
        }
    }
    Iterator<Message> subMessages = m.getAllMessages().iterator();
    while (subMessages.hasNext()) {
        processSuppressedProperties(subMessages.next());
    }
}
Also used : Message(com.dexels.navajo.document.Message) Property(com.dexels.navajo.document.Property)

Example 89 with Property

use of com.dexels.navajo.document.Property in project navajo by Dexels.

the class NQLContext method set.

public void set(String path, String value) {
    if (current == null) {
        current = NavajoFactory.getInstance().createNavajo();
    }
    Property p = current.getProperty(path);
    if (p == null) {
        return;
    }
    p.setValue(value);
}
Also used : Property(com.dexels.navajo.document.Property)

Example 90 with Property

use of com.dexels.navajo.document.Property in project navajo by Dexels.

the class NavajoContext method getProperty.

public Property getProperty(String service, String path) {
    Navajo n = getNavajo(service);
    Property p = n.getProperty(path);
    if (p == null) {
        throw new IllegalStateException("Unknown property: " + path + " in service " + service);
    }
    return p;
}
Also used : Navajo(com.dexels.navajo.document.Navajo) Property(com.dexels.navajo.document.Property)

Aggregations

Property (com.dexels.navajo.document.Property)253 Message (com.dexels.navajo.document.Message)148 Test (org.junit.Test)88 Navajo (com.dexels.navajo.document.Navajo)84 Selection (com.dexels.navajo.document.Selection)36 NavajoException (com.dexels.navajo.document.NavajoException)30 TMLExpressionException (com.dexels.navajo.expression.api.TMLExpressionException)17 ArrayList (java.util.ArrayList)17 ImmutableMessage (com.dexels.immutable.api.ImmutableMessage)16 Binary (com.dexels.navajo.document.types.Binary)16 UserException (com.dexels.navajo.script.api.UserException)16 Access (com.dexels.navajo.script.api.Access)15 StringWriter (java.io.StringWriter)13 List (java.util.List)11 Operand (com.dexels.navajo.document.Operand)10 MappableException (com.dexels.navajo.script.api.MappableException)9 IOException (java.io.IOException)9 Writer (java.io.Writer)9 StringTokenizer (java.util.StringTokenizer)9 JSONTML (com.dexels.navajo.document.json.JSONTML)8