 
					
				
		
09-15-2012 10:07 PM
09-17-2012 11:03 AM
 
					
				
		
09-17-2012 09:00 PM
09-18-2012 05:11 AM
@Put
  public ObjectNode executeTaskOperation(Representation entity) {
    if(authenticate() == false) return null;
    
    String taskId = (String) getRequest().getAttributes().get("taskId");
    String operation = (String) getRequest().getAttributes().get("operation");
    try {
      String startParams = entity.getText();
      JsonNode startJSON = new ObjectMapper().readTree(startParams);
      Iterator<String> itName = startJSON.getFieldNames();
      Map<String, Object> variables = new HashMap<String, Object>();
      while(itName.hasNext()) {
        String name = itName.next();
        JsonNode valueNode = startJSON.path(name);
        if (valueNode.isBoolean()) {
          variables.put(name, valueNode.getBooleanValue());
        } else if (valueNode.isLong()) {
          variables.put(name, valueNode.getLongValue());
        } else if (valueNode.isDouble()) {
          variables.put(name, valueNode.getDoubleValue());
        } else if (valueNode.isTextual()) {
          variables.put(name, valueNode.getTextValue());
        } else if("true".equals(valueNode.getTextValue()) || "false".equals(valueNode.getTextValue())) {
          variables.put(name, Boolean.valueOf(valueNode.getTextValue()));
        } else {
          variables.put(name, valueNode.getValueAsText());
        }
      }
      
      if ("claim".equals(operation)) {
        ActivitiUtil.getTaskService().claim(taskId, loggedInUser);
      } else if ("complete".equals(operation)) {
        variables.remove("taskId");
        [b]ActivitiUtil.getTaskService().complete(taskId, variables);[/b]
      } else {
        throw new ActivitiException("'" + operation + "' is not a valid operation");
      }
      
    } catch(Exception e) {
      throw new ActivitiException("Did not receive the operation parameters", e);
    }
    
    ObjectNode successNode = new ObjectMapper().createObjectNode();
    successNode.put("success", true);
    return successNode;
  }
}
    if (variables!=null) {
      task.setExecutionVariables(variables);
    }
    
    completeTask(task);
 
					
				
				
			
		
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.