this.responses.add(new JaxbProcessInstanceResponse((ProcessInstance) result, i, cmd));
} else if (result instanceof JaxbTask) {
this.responses.add(new JaxbTaskResponse((JaxbTask) result, i, cmd));
} else if (result instanceof JaxbContent) {
if (((JaxbContent) result).getId() == -1) {
this.responses.add(new JaxbTaskContentResponse(((JaxbContent) result).getContentMap(), i, cmd));
} else {
this.responses.add(new JaxbContentResponse((JaxbContent) result, i, cmd));
}
} else if (List.class.isInstance(result)) {
// Neccessary to determine return type of empty lists
Class listType = getListType(cmd);
if( listType == null ) {
unknownResultType = true;
} else if( listType.equals(TaskSummary.class) ) {
this.responses.add(new JaxbTaskSummaryListResponse((List<TaskSummary>) result, i, cmd));
} else if( listType.equals(Long.class) ) {
this.responses.add(new JaxbLongListResponse((List<Long>)result, i, cmd));
} else if( listType.equals(String.class) ) {
this.responses.add(new JaxbStringListResponse((List<String>)result, i, cmd));
} else if( listType.equals(ProcessInstance.class) ) {
this.responses.add(new JaxbProcessInstanceListResponse((List<ProcessInstance>) result, i, cmd));
} else if( listType.equals(ProcessInstanceLog.class)
|| listType.equals(NodeInstanceLog.class)
|| listType.equals(VariableInstanceLog.class) ) {
this.responses.add(new JaxbHistoryLogList((List<AuditEvent>) result));
} else {
throw new IllegalStateException(listType.getSimpleName() + " should be handled but is not in " + this.getClass().getSimpleName() + "!" );
}
} else if (result.getClass().isPrimitive()
|| Boolean.class.getName().equals(className)
|| Byte.class.getName().equals(className)
|| Short.class.getName().equals(className)
|| Integer.class.getName().equals(className)
|| Character.class.getName().equals(className)
|| Long.class.getName().equals(className)
|| Float.class.getName().equals(className)
|| Double.class.getName().equals(className) ) {
this.responses.add(new JaxbPrimitiveResponse(result, i, cmd));
} else if( result instanceof WorkItem ) {
this.responses.add(new JaxbWorkItemResponse((WorkItem) result, i, cmd));
} else if( result instanceof ProcessInstanceLog ) {
this.responses.add(new JaxbProcessInstanceLog((ProcessInstanceLog) result));
} else if( result instanceof NodeInstanceLog ) {
this.responses.add(new JaxbNodeInstanceLog((NodeInstanceLog) result));
} else if( result instanceof VariableInstanceLog ) {
this.responses.add(new JaxbVariableInstanceLog((VariableInstanceLog) result));
} else if( result instanceof DefaultFactHandle ) {
this.responses.add(new JaxbOtherResponse(result, i, cmd));
} else if( cmd instanceof GetTaskContentCommand ) {
this.responses.add(new JaxbTaskContentResponse((Map<String, Object>) result, i, cmd));
}
// Other
else if( result instanceof JaxbExceptionResponse ) {
this.responses.add((JaxbExceptionResponse) result);
} else {