Search in sources :

Example 6 with Method

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

the class VersionedNavajoMap method setDoSend.

@Override
public void setDoSend(String method) throws UserException, ConditionErrorException, SystemException {
    super.setDoSend(method);
    logger.debug("in VersionedNavajoMap store()");
    if (!this.isEqual) {
        logger.debug("ABOUT TO CONSTRUCT MESSAGES!");
        try {
            Navajo currentOutDoc = super.access.getOutputDoc();
            Message confirm = NavajoFactory.getInstance().createMessage(currentOutDoc, "DataHasChanged");
            currentOutDoc.addMessage(confirm);
            Property b = NavajoFactory.getInstance().createProperty(currentOutDoc, "Overwrite", Property.BOOLEAN_PROPERTY, "false", 1, "", Property.DIR_IN);
            confirm.addProperty(b);
            List<Method> allMethods = inMessage.getAllMethods();
            for (int i = 0; i < allMethods.size(); i++) {
                Method m = allMethods.get(i);
                logger.debug("Adding method: {}", m.getName());
                Method a = NavajoFactory.getInstance().createMethod(currentOutDoc, m.getName(), "");
                List<String> required = m.getRequiredMessages();
                for (int j = 0; j < required.size(); j++) {
                    String name = required.get(j);
                    logger.debug("Adding required message: {}", name);
                    a.addRequired(name);
                }
                currentOutDoc.addMethod(a);
            }
            List<Message> allMessages = inMessage.getAllMessages();
            for (int i = 0; i < allMessages.size(); i++) {
                Message m = allMessages.get(i);
                logger.debug("Adding message: " + m.getName());
                Message a = inMessage.copyMessage(m, currentOutDoc);
                currentOutDoc.addMessage(a);
            }
        } catch (NavajoException ne) {
            throw new UserException(-1, ne.getMessage(), ne);
        }
    }
}
Also used : Message(com.dexels.navajo.document.Message) NavajoException(com.dexels.navajo.document.NavajoException) Navajo(com.dexels.navajo.document.Navajo) Method(com.dexels.navajo.document.Method) UserException(com.dexels.navajo.script.api.UserException) Property(com.dexels.navajo.document.Property)

Aggregations

Method (com.dexels.navajo.document.Method)6 Navajo (com.dexels.navajo.document.Navajo)4 Message (com.dexels.navajo.document.Message)3 Operation (com.dexels.navajo.document.Operation)2 Test (org.junit.Test)2 NavajoException (com.dexels.navajo.document.NavajoException)1 NavajoFactory (com.dexels.navajo.document.NavajoFactory)1 Property (com.dexels.navajo.document.Property)1 UserException (com.dexels.navajo.script.api.UserException)1 ArrayList (java.util.ArrayList)1