public Request<ListActivityTypesRequest> marshall( ListActivityTypesRequest listActivityTypesRequest) { if (listActivityTypesRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListActivityTypesRequest> request = new DefaultRequest<ListActivityTypesRequest>( listActivityTypesRequest, "AmazonSimpleWorkflow"); String target = "SimpleWorkflowService.ListActivityTypes"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.0"); request.setHttpMethod(POST); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (listActivityTypesRequest.getDomain() != null) { jsonWriter.key("domain").value(listActivityTypesRequest.getDomain()); } if (listActivityTypesRequest.getName() != null) { jsonWriter.key("name").value(listActivityTypesRequest.getName()); } if (listActivityTypesRequest.getRegistrationStatus() != null) { jsonWriter .key("registrationStatus") .value(listActivityTypesRequest.getRegistrationStatus()); } if (listActivityTypesRequest.getNextPageToken() != null) { jsonWriter.key("nextPageToken").value(listActivityTypesRequest.getNextPageToken()); } if (listActivityTypesRequest.getMaximumPageSize() != null) { jsonWriter.key("maximumPageSize").value(listActivityTypesRequest.getMaximumPageSize()); } if (listActivityTypesRequest.isReverseOrder() != null) { jsonWriter.key("reverseOrder").value(listActivityTypesRequest.isReverseOrder()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes("UTF-8"); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); return request; } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<ListClosedWorkflowExecutionsRequest> marshall( ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest) { if (listClosedWorkflowExecutionsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListClosedWorkflowExecutionsRequest> request = new DefaultRequest<ListClosedWorkflowExecutionsRequest>( listClosedWorkflowExecutionsRequest, "AmazonSimpleWorkflow"); String target = "SimpleWorkflowService.ListClosedWorkflowExecutions"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.0"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = ""; uriResourcePath = uriResourcePath.replaceAll("//", "/"); if (uriResourcePath.contains("?")) { String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1); uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?")); for (String s : queryString.split("[;&]")) { String[] nameValuePair = s.split("="); if (nameValuePair.length == 2) { request.addParameter(nameValuePair[0], nameValuePair[1]); } else { request.addParameter(s, null); } } } request.setResourcePath(uriResourcePath); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (listClosedWorkflowExecutionsRequest.getDomain() != null) { jsonWriter.key("domain").value(listClosedWorkflowExecutionsRequest.getDomain()); } ExecutionTimeFilter startTimeFilter = listClosedWorkflowExecutionsRequest.getStartTimeFilter(); if (startTimeFilter != null) { jsonWriter.key("startTimeFilter"); jsonWriter.object(); if (startTimeFilter.getOldestDate() != null) { jsonWriter.key("oldestDate").value(startTimeFilter.getOldestDate()); } if (startTimeFilter.getLatestDate() != null) { jsonWriter.key("latestDate").value(startTimeFilter.getLatestDate()); } jsonWriter.endObject(); } ExecutionTimeFilter closeTimeFilter = listClosedWorkflowExecutionsRequest.getCloseTimeFilter(); if (closeTimeFilter != null) { jsonWriter.key("closeTimeFilter"); jsonWriter.object(); if (closeTimeFilter.getOldestDate() != null) { jsonWriter.key("oldestDate").value(closeTimeFilter.getOldestDate()); } if (closeTimeFilter.getLatestDate() != null) { jsonWriter.key("latestDate").value(closeTimeFilter.getLatestDate()); } jsonWriter.endObject(); } WorkflowExecutionFilter executionFilter = listClosedWorkflowExecutionsRequest.getExecutionFilter(); if (executionFilter != null) { jsonWriter.key("executionFilter"); jsonWriter.object(); if (executionFilter.getWorkflowId() != null) { jsonWriter.key("workflowId").value(executionFilter.getWorkflowId()); } jsonWriter.endObject(); } CloseStatusFilter closeStatusFilter = listClosedWorkflowExecutionsRequest.getCloseStatusFilter(); if (closeStatusFilter != null) { jsonWriter.key("closeStatusFilter"); jsonWriter.object(); if (closeStatusFilter.getStatus() != null) { jsonWriter.key("status").value(closeStatusFilter.getStatus()); } jsonWriter.endObject(); } WorkflowTypeFilter typeFilter = listClosedWorkflowExecutionsRequest.getTypeFilter(); if (typeFilter != null) { jsonWriter.key("typeFilter"); jsonWriter.object(); if (typeFilter.getName() != null) { jsonWriter.key("name").value(typeFilter.getName()); } if (typeFilter.getVersion() != null) { jsonWriter.key("version").value(typeFilter.getVersion()); } jsonWriter.endObject(); } TagFilter tagFilter = listClosedWorkflowExecutionsRequest.getTagFilter(); if (tagFilter != null) { jsonWriter.key("tagFilter"); jsonWriter.object(); if (tagFilter.getTag() != null) { jsonWriter.key("tag").value(tagFilter.getTag()); } jsonWriter.endObject(); } if (listClosedWorkflowExecutionsRequest.getNextPageToken() != null) { jsonWriter .key("nextPageToken") .value(listClosedWorkflowExecutionsRequest.getNextPageToken()); } if (listClosedWorkflowExecutionsRequest.getMaximumPageSize() != null) { jsonWriter .key("maximumPageSize") .value(listClosedWorkflowExecutionsRequest.getMaximumPageSize()); } if (listClosedWorkflowExecutionsRequest.isReverseOrder() != null) { jsonWriter.key("reverseOrder").value(listClosedWorkflowExecutionsRequest.isReverseOrder()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes("UTF-8"); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<StartWorkflowExecutionRequest> marshall( StartWorkflowExecutionRequest startWorkflowExecutionRequest) { if (startWorkflowExecutionRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<StartWorkflowExecutionRequest> request = new DefaultRequest<StartWorkflowExecutionRequest>( startWorkflowExecutionRequest, "AmazonSimpleWorkflow"); String target = "SimpleWorkflowService.StartWorkflowExecution"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (startWorkflowExecutionRequest.getDomain() != null) { jsonWriter.key("domain").value(startWorkflowExecutionRequest.getDomain()); } if (startWorkflowExecutionRequest.getWorkflowId() != null) { jsonWriter.key("workflowId").value(startWorkflowExecutionRequest.getWorkflowId()); } WorkflowType workflowType = startWorkflowExecutionRequest.getWorkflowType(); if (workflowType != null) { jsonWriter.key("workflowType"); jsonWriter.object(); if (workflowType.getName() != null) { jsonWriter.key("name").value(workflowType.getName()); } if (workflowType.getVersion() != null) { jsonWriter.key("version").value(workflowType.getVersion()); } jsonWriter.endObject(); } TaskList taskList = startWorkflowExecutionRequest.getTaskList(); if (taskList != null) { jsonWriter.key("taskList"); jsonWriter.object(); if (taskList.getName() != null) { jsonWriter.key("name").value(taskList.getName()); } jsonWriter.endObject(); } if (startWorkflowExecutionRequest.getInput() != null) { jsonWriter.key("input").value(startWorkflowExecutionRequest.getInput()); } if (startWorkflowExecutionRequest.getExecutionStartToCloseTimeout() != null) { jsonWriter .key("executionStartToCloseTimeout") .value(startWorkflowExecutionRequest.getExecutionStartToCloseTimeout()); } com.amazonaws.internal.ListWithAutoConstructFlag<String> tagListList = (com.amazonaws.internal.ListWithAutoConstructFlag<String>) (startWorkflowExecutionRequest.getTagList()); if (tagListList != null && !(tagListList.isAutoConstruct() && tagListList.isEmpty())) { jsonWriter.key("tagList"); jsonWriter.array(); for (String tagListListValue : tagListList) { if (tagListListValue != null) { jsonWriter.value(tagListListValue); } } jsonWriter.endArray(); } if (startWorkflowExecutionRequest.getTaskStartToCloseTimeout() != null) { jsonWriter .key("taskStartToCloseTimeout") .value(startWorkflowExecutionRequest.getTaskStartToCloseTimeout()); } if (startWorkflowExecutionRequest.getChildPolicy() != null) { jsonWriter.key("childPolicy").value(startWorkflowExecutionRequest.getChildPolicy()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes(UTF8); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", "application/x-amz-json-1.0"); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<RegisterWorkflowTypeRequest> marshall( RegisterWorkflowTypeRequest registerWorkflowTypeRequest) { if (registerWorkflowTypeRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<RegisterWorkflowTypeRequest> request = new DefaultRequest<RegisterWorkflowTypeRequest>( registerWorkflowTypeRequest, "AmazonSimpleWorkflow"); String target = "SimpleWorkflowService.RegisterWorkflowType"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.0"); request.setHttpMethod(POST); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (registerWorkflowTypeRequest.getDomain() != null) { jsonWriter.key("domain").value(registerWorkflowTypeRequest.getDomain()); } if (registerWorkflowTypeRequest.getName() != null) { jsonWriter.key("name").value(registerWorkflowTypeRequest.getName()); } if (registerWorkflowTypeRequest.getVersion() != null) { jsonWriter.key("version").value(registerWorkflowTypeRequest.getVersion()); } if (registerWorkflowTypeRequest.getDescription() != null) { jsonWriter.key("description").value(registerWorkflowTypeRequest.getDescription()); } if (registerWorkflowTypeRequest.getDefaultTaskStartToCloseTimeout() != null) { jsonWriter .key("defaultTaskStartToCloseTimeout") .value(registerWorkflowTypeRequest.getDefaultTaskStartToCloseTimeout()); } if (registerWorkflowTypeRequest.getDefaultExecutionStartToCloseTimeout() != null) { jsonWriter .key("defaultExecutionStartToCloseTimeout") .value(registerWorkflowTypeRequest.getDefaultExecutionStartToCloseTimeout()); } if (registerWorkflowTypeRequest != null) { TaskList taskListDefaultTaskList = registerWorkflowTypeRequest.getDefaultTaskList(); if (taskListDefaultTaskList != null) { jsonWriter.key("defaultTaskList").object(); if (taskListDefaultTaskList.getName() != null) { jsonWriter.key("name").value(taskListDefaultTaskList.getName()); } jsonWriter.endObject(); } } if (registerWorkflowTypeRequest.getDefaultChildPolicy() != null) { jsonWriter .key("defaultChildPolicy") .value(registerWorkflowTypeRequest.getDefaultChildPolicy()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes("UTF-8"); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); return request; } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<StartWorkflowExecutionRequest> marshall( StartWorkflowExecutionRequest startWorkflowExecutionRequest) { if (startWorkflowExecutionRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<StartWorkflowExecutionRequest> request = new DefaultRequest<StartWorkflowExecutionRequest>( startWorkflowExecutionRequest, "AmazonSimpleWorkflow"); String target = "SimpleWorkflowService.StartWorkflowExecution"; request.addHeader("X-Amz-Target", target); request.addHeader("Content-Type", "application/x-amz-json-1.0"); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = ""; uriResourcePath = uriResourcePath.replaceAll("//", "/"); if (uriResourcePath.contains("?")) { String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1); uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?")); for (String s : queryString.split("[;&]")) { String[] nameValuePair = s.split("="); if (nameValuePair.length == 2) { request.addParameter(nameValuePair[0], nameValuePair[1]); } else { request.addParameter(s, null); } } } request.setResourcePath(uriResourcePath); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (startWorkflowExecutionRequest.getDomain() != null) { jsonWriter.key("domain").value(startWorkflowExecutionRequest.getDomain()); } if (startWorkflowExecutionRequest.getWorkflowId() != null) { jsonWriter.key("workflowId").value(startWorkflowExecutionRequest.getWorkflowId()); } WorkflowType workflowType = startWorkflowExecutionRequest.getWorkflowType(); if (workflowType != null) { jsonWriter.key("workflowType"); jsonWriter.object(); if (workflowType.getName() != null) { jsonWriter.key("name").value(workflowType.getName()); } if (workflowType.getVersion() != null) { jsonWriter.key("version").value(workflowType.getVersion()); } jsonWriter.endObject(); } TaskList taskList = startWorkflowExecutionRequest.getTaskList(); if (taskList != null) { jsonWriter.key("taskList"); jsonWriter.object(); if (taskList.getName() != null) { jsonWriter.key("name").value(taskList.getName()); } jsonWriter.endObject(); } if (startWorkflowExecutionRequest.getInput() != null) { jsonWriter.key("input").value(startWorkflowExecutionRequest.getInput()); } if (startWorkflowExecutionRequest.getExecutionStartToCloseTimeout() != null) { jsonWriter .key("executionStartToCloseTimeout") .value(startWorkflowExecutionRequest.getExecutionStartToCloseTimeout()); } java.util.List<String> tagListList = startWorkflowExecutionRequest.getTagList(); if (tagListList != null && tagListList.size() > 0) { jsonWriter.key("tagList"); jsonWriter.array(); for (String tagListListValue : tagListList) { if (tagListListValue != null) { jsonWriter.value(tagListListValue); } } jsonWriter.endArray(); } if (startWorkflowExecutionRequest.getTaskStartToCloseTimeout() != null) { jsonWriter .key("taskStartToCloseTimeout") .value(startWorkflowExecutionRequest.getTaskStartToCloseTimeout()); } if (startWorkflowExecutionRequest.getChildPolicy() != null) { jsonWriter.key("childPolicy").value(startWorkflowExecutionRequest.getChildPolicy()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes("UTF-8"); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }