Package org.jbpm.jsf.core.impl

Examples of org.jbpm.jsf.core.impl.UpdatesHashMap$EntrySet


            final ELContext elContext = facesContext.getELContext();
            final Object value = valueExpression.getValue(elContext);
            final Map<String,Object> updatesMap;
            if (value instanceof ProcessInstance) {
                final ProcessInstance processInstance = (ProcessInstance) value;
                updatesMap = new UpdatesHashMap(processInstance.getContextInstance().getVariables());
            } else if (value instanceof Token) {
                final Token token = (Token) value;
                updatesMap = new UpdatesHashMap(token.getProcessInstance().getContextInstance().getVariables(token));
            } else if (value instanceof TaskInstance) {
                final TaskInstance task = (TaskInstance) value;
                updatesMap = new UpdatesHashMap(task.getVariables());
            } else if (value == null) {
                context.setError("Error getting variable map", "The value was given as null");
                return;
            } else {
                context.setError("Error getting variable map", "The value is not a recognized type");
View Full Code Here


    public void handleAction(JbpmJsfContext context, ActionEvent event) {
        try {
            final FacesContext facesContext = FacesContext.getCurrentInstance();
            final ELContext elContext = facesContext.getELContext();
            final UpdatesHashMap updatesHashMap = (UpdatesHashMap) variableMapExpression.getValue(elContext);
            final Set<String> deletes = updatesHashMap.deletesSet();
            final Set<String> updates = updatesHashMap.updatesSet();
            boolean updated = false;

            final Object targetValue = targetExpression.getValue(elContext);
            if (targetValue instanceof ProcessInstance) {
                final ProcessInstance processInstance = (ProcessInstance) targetValue;
                final ContextInstance contextInstance = processInstance.getContextInstance();
                for (String name : deletes) {
                    contextInstance.deleteVariable(name);
                    updated = true;
                }
                for (String name : updates) {
                    contextInstance.setVariable(name, updatesHashMap.get(name));
                    updated = true;
                }
            } else if (targetValue instanceof Token) {
                final Token token = (Token) targetValue;
                final ProcessInstance processInstance = token.getProcessInstance();
                final ContextInstance contextInstance = processInstance.getContextInstance();
                for (String name : deletes) {
                    contextInstance.deleteVariable(name, token);
                    updated = true;
                }
                for (String name : updates) {
                    contextInstance.setVariable(name, updatesHashMap.get(name), token);
                    updated = true;
                }
            } else if (targetValue instanceof TaskInstance) {
                final TaskInstance task = (TaskInstance) targetValue;
                for (String name : deletes) {
                    task.deleteVariable(name);
                    updated = true;
                }
                for (String name : updates) {
                    task.setVariable(name, updatesHashMap.get(name));
                    updated = true;
                }
            } else if (targetValue == null) {
                context.setError("Error updating variable map", "The target value was given as null");
                return;
View Full Code Here

TOP

Related Classes of org.jbpm.jsf.core.impl.UpdatesHashMap$EntrySet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.