@Override public void setExpirationDate(long taskId, Date date) { SetTaskPropertyCommand cmd = new SetTaskPropertyCommand(); cmd.setExpirationDate(convertDateToXmlGregorianCalendar(date)); cmd.setProperty(BigInteger.valueOf(5l)); executeCommand(cmd); }
@Override public Date getAddedAt() { return convertXmlGregCalToDate(this.comment.getAddedAt()); }
@Override public ProcessInstance startProcess( String processId, Map<String, Object> parameters ) { StartProcessCommand cmd = new StartProcessCommand(); cmd.setProcessId(processId); JaxbStringObjectPairArray arrayMap = convertMapToJaxbStringObjectPairArray(parameters); cmd.setParameter(arrayMap); return (ProcessInstance) executeCommand(cmd); }
public Long addContent(long taskId, Map<String, Object> params) { AddContentCommand cmd = new AddContentCommand(); cmd.setTaskId(taskId); org.kie.remote.jaxb.gen.Content jaxbContent = new org.kie.remote.jaxb.gen.Content(); StringKeyObjectValueMap jaxbMap = convertMapToStringKeyObjectValueMap(params); jaxbContent.setContentMap(jaxbMap); cmd.setTaskId(taskId); return executeCommand(cmd); }
@Override public RemoteApiResponse nominate( long taskId, String... potentialOwnerUserIds ) { RemoteApiResponse<Void> response; if( potentialOwnerUserIds == null || potentialOwnerUserIds.length == 0 ) { return new RemoteApiResponse<Void>(RemoteOperationStatus.CLIENT_FAILURE, "Null or empty list of potential owner user ids received as argument"); } try { NominateTaskCommand cmd = new NominateTaskCommand(); cmd.setTaskId(taskId); cmd.setUserId(delegate.getConfig().getUserName()); List<org.kie.remote.jaxb.gen.OrganizationalEntity> genOrgEntList = convertStringListToGenOrgEntList(Arrays.asList(potentialOwnerUserIds)); if( genOrgEntList != null ) { cmd.getPotentialOwners().addAll(genOrgEntList); } delegate.executeCommand(cmd); response = new RemoteApiResponse<Void>(); } catch( RemoteClientException rce ) { response = createRemoteApiResponse(rce); } catch( Exception e ) { response = new RemoteApiResponse<Void>(RemoteOperationStatus.UNKNOWN_FAILURE, e); } return response; }
@Override public void completeWorkItem( long id, Map<String, Object> results ) { CompleteWorkItemCommand cmd = new CompleteWorkItemCommand(); cmd.setId(id); JaxbStringObjectPairArray arrayMap = convertMapToJaxbStringObjectPairArray(results); cmd.setResult(arrayMap); executeCommand(cmd); }
@Override public void fail( long taskId, String userId, Map<String, Object> faultData ) { FailTaskCommand cmd = new FailTaskCommand(); cmd.setTaskId(taskId); cmd.setUserId(userId); JaxbStringObjectPairArray values = convertMapToJaxbStringObjectPairArray(faultData); cmd.setData(values); executeCommand(cmd); }
private void setCommentFields(Comment comment) { this.addedAt = ConversionUtil.convertDateToXmlGregorianCalendar(comment.getAddedAt()); User addedByUser = comment.getAddedBy(); if( addedByUser != null ) { this.addedBy = addedByUser.getId(); } this.id = comment.getId(); this.text = comment.getText(); }
@Override public Date getActivationTime() { return convertXmlGregCalToDate(this.taskData.getActivationTime()); }
@Override public long addTask( Task task, Map<String, Object> params ) { AddTaskCommand cmd = new AddTaskCommand(); org.kie.remote.jaxb.gen.Task genTask = convertKieTaskToGenTask(task); cmd.setJaxbTask(genTask); JaxbStringObjectPairArray values = convertMapToJaxbStringObjectPairArray(params); cmd.setParameter(values); return (Long) executeCommand(cmd); }
@Override public Long addComment( long taskId, String addedByUserId, String commentText ) { AddCommentCommand cmd = new AddCommentCommand(); cmd.setTaskId(taskId); org.kie.remote.jaxb.gen.Comment jaxbComment = new org.kie.remote.jaxb.gen.Comment(); jaxbComment.setAddedBy(addedByUserId); jaxbComment.setAddedAt(convertDateToXmlGregorianCalendar(new Date())); jaxbComment.setText(commentText); cmd.setJaxbComment(jaxbComment); return executeCommand(cmd); }
@Override public Date getCreatedOn() { return convertXmlGregCalToDate(this.taskData.getCreatedOn()); }
@Override public void complete( long taskId, String userId, Map<String, Object> data ) { CompleteTaskCommand cmd = new CompleteTaskCommand(); cmd.setTaskId(taskId); cmd.setUserId(userId); cmd.setData(convertMapToJaxbStringObjectPairArray(data)); executeCommand(cmd); }
@Override public void setResult(List<org.kie.api.task.model.Comment> result) { List<Comment> newCommentList = null; if( result != null ) { newCommentList = new ArrayList<Comment>(result.size()); for( org.kie.api.task.model.Comment kieComment : result ) { Comment genComment = new Comment(); genComment.setAddedAt(ConversionUtil.convertDateToXmlGregorianCalendar(kieComment.getAddedAt())); User addedByUser = kieComment.getAddedBy(); if( addedByUser != null ) { genComment.setAddedBy(addedByUser.getId()); } genComment.setId(genComment.getId()); genComment.setText(genComment.getText()); newCommentList.add(genComment); } } this.commentList = newCommentList; }
@Override public Date getExpirationTime() { return convertXmlGregCalToDate(this.taskData.getExpirationTime()); }
@Override public ProcessInstance startProcess( String processId, CorrelationKey correlationKey, Map<String, Object> parameters ) { StartCorrelatedProcessCommand cmd = new StartCorrelatedProcessCommand(); cmd.setProcessId(processId); JaxbStringObjectPairArray arrayMap = convertMapToJaxbStringObjectPairArray(parameters); cmd.setParameter(arrayMap); String strCorrKey = convertCorrelationKeyToString(correlationKey); cmd.setCorrelationKey(strCorrKey); return executeCommand(cmd); }
@Override public Long addComment(long taskId, Comment comment) { // fill jaxbComment org.kie.remote.jaxb.gen.Comment jaxbComment = new org.kie.remote.jaxb.gen.Comment(); Date addedAt = comment.getAddedAt(); if( addedAt != null ) { XMLGregorianCalendar jaxbAddedAt = convertDateToXmlGregorianCalendar(addedAt); jaxbComment.setAddedAt(jaxbAddedAt); } User addedBy = comment.getAddedBy(); if( addedBy != null ) { jaxbComment.setAddedBy(addedBy.getId()); } jaxbComment.setText(comment.getText()); jaxbComment.setId(comment.getId()); // create command AddCommentCommand cmd = new AddCommentCommand(); cmd.setTaskId(taskId); cmd.setJaxbComment(jaxbComment); return executeCommand(cmd); }
@Override public Date getAttachedAt() { return convertXmlGregCalToDate(this.attachment.getAttachedAt()); }
@Test public void serializingPrimitiveArraysTest() throws Exception { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("url", "http://soaptest.parasoft.com/calculator.wsdl"); parameters.put("namespace", "http://www.parasoft.com/wsdl/calculator/"); parameters.put("interface", "Calculator"); parameters.put("operation", "add"); Float [] arrayParam = new Float[] { 9.0f, 12.0f }; parameters.put("parameters", arrayParam); addClassesToSerializationProvider(arrayParam.getClass()); org.kie.remote.jaxb.gen.StartProcessCommand cmd = new org.kie.remote.jaxb.gen.StartProcessCommand(); cmd.setProcessId("proc.with.array.params"); cmd.setParameter(ConversionUtil.convertMapToJaxbStringObjectPairArray(parameters)); org.kie.remote.client.jaxb.JaxbCommandsRequest clientReq = new org.kie.remote.client.jaxb.JaxbCommandsRequest("test", cmd); JaxbCommandsRequest serviceReq = (JaxbCommandsRequest) clientServicesRoundTrip(clientReq); StartProcessCommand newCmd = (StartProcessCommand) serviceReq.getCommands().get(0); assertNotNull(newCmd); Float [] arrayParamCopy = (Float[]) newCmd.getParameters().get("parameters"); assertArrayEquals(arrayParam, arrayParamCopy); }
genTaskData.setActualOwner(convertKieUserToStringId(user)); genTaskData.setCreatedBy(convertKieUserToStringId(kieTaskData.getCreatedBy())); genTaskData.setCreatedOn(convertDateToXmlGregorianCalendar(kieTaskData.getCreatedOn())); Date date = kieTaskData.getActivationTime(); genTaskData.setActivationTime(convertDateToXmlGregorianCalendar(date)); date = kieTaskData.getExpirationTime(); genTaskData.setExpirationTime(convertDateToXmlGregorianCalendar(date)); genTaskData.setSkipable(kieTaskData.isSkipable()); genTaskData.setWorkItemId(kieTaskData.getWorkItemId()); genAttach.setName(attach.getName()); genAttach.setContentType(attach.getContentType()); genAttach.setAttachedAt(convertDateToXmlGregorianCalendar(attach.getAttachedAt())); genAttach.setAttachedBy(attach.getAttachedBy().getId()); genAttach.setSize(attach.getSize()); genComment.setId(comment.getId()); genComment.setText(comment.getText()); genComment.setAddedAt(convertDateToXmlGregorianCalendar(comment.getAddedAt()));