Java源码示例:org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalAccessFault
示例1
public WorkItem[] getWorkItems()
throws IllegalStateFault, IllegalAccessFault, RemoteException, IllegalArgumentFault {
TSimpleQueryInput queryInput = new TSimpleQueryInput();
queryInput.setPageNumber(0);
queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);
TTaskSimpleQueryResultSet resultSet = htStub.simpleQuery(queryInput);
if (resultSet == null || resultSet.getRow() == null || resultSet.getRow().length == 0) {
return new WorkItem[0];
}
List<WorkItem> workItems = new LinkedList<>();
for (TTaskSimpleQueryResultRow row : resultSet.getRow()) {
URI id = row.getId();
String taskUser = "";
//Ready state notification doesn't have taskUser
if (htStub.loadTask(id) != null && htStub.loadTask(id).getActualOwner() != null) {
taskUser = htStub.loadTask(id).getActualOwner().getTUser();
}
workItems.add(new WorkItem(id, row.getPresentationSubject(),
row.getPresentationName(), row.getPriority(), row.getStatus(),
row.getCreatedTime(), taskUser));
}
return workItems.toArray(new WorkItem[workItems.size()]);
}
示例2
/**
* get management console subscriptions
*
* @param type type of the element
* @return true if the required notification is generated, false otherwise
* @throws java.rmi.RemoteException
* @throws IllegalStateFault
* @throws IllegalAccessFault
* @throws IllegalArgumentFault
* @throws InterruptedException
*/
private boolean getNotification(String type) throws RemoteException, IllegalStateFault,
IllegalAccessFault,
IllegalArgumentFault,
InterruptedException {
boolean success = false;
Thread.sleep(3000);//force delay otherwise getWorkItems return null
// get all the management console notifications
WorkItem[] workItems = WorkItemClient.getWorkItems(humanTaskAdminClient);
for (WorkItem workItem : workItems) {
// search for the correct notification
if (workItem.getPresentationSubject().toString().contains(type)) {
success = true;
break;
}
}
return success;
}
示例3
/**
* get management console subscriptions
*
* @param path
* @return true if the required notification is generated, false otherwise
* @throws java.rmi.RemoteException
* @throws IllegalStateFault
* @throws IllegalAccessFault
* @throws IllegalArgumentFault
* @throws InterruptedException
*/
private static boolean getNotification(String path) throws RemoteException, IllegalStateFault,
IllegalAccessFault,
IllegalArgumentFault,
InterruptedException {
boolean success = false;
HumanTaskAdminClient humanTaskAdminClient =
new HumanTaskAdminClient(backEndUrl, sessionCookie);
Thread.sleep(5000);//force delay otherwise get work items return error
// get all the notifications
WorkItem[] workItems = WorkItemClient.getWorkItems(humanTaskAdminClient);
for (WorkItem workItem : workItems) {
if (workItem.getPresentationSubject().toString().contains(path + " was updated.")) {
success = true;
break;
}
}
return success;
}
示例4
/**
* get the existing management console notifications
*
* @param humanTaskAdminClient
* @return
* @throws java.rmi.RemoteException
* @throws IllegalStateFault
* @throws IllegalAccessFault
* @throws IllegalArgumentFault
* @throws InterruptedException
*/
public static WorkItem[] getWorkItems(HumanTaskAdminClient humanTaskAdminClient)
throws RemoteException, IllegalStateFault, IllegalAccessFault, IllegalArgumentFault,
InterruptedException {
long startTime = new Date().getTime();
long endTime = startTime + 2 * 60 * 1000;
WorkItem[] workItems = null;
// try for a minute to get all the notifications
while ((new Date().getTime()) < endTime) {
workItems = humanTaskAdminClient.getWorkItems();
if (workItems.length > 0) {
break;
}
Thread.sleep(5000);
}
return workItems;
}
示例5
public TTaskSimpleQueryResultSet taskListQuery(TSimpleQueryInput queryInput)
throws RemoteException, IllegalArgumentFault, IllegalStateFault, IllegalOperationFault, IllegalAccessFault {
String errMsg = "Error occurred while performing taskListQuery operation";
try {
return stub.simpleQuery(queryInput);
} catch (Exception ex) {
handleException(errMsg, ex);
}
return null;
}
示例6
/**
*
* Load task data for the give task id.
*
* @param taskId :
* @return :
* @throws java.rmi.RemoteException :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalAccessFault :
*/
public TTaskAbstract loadTask(URI taskId)
throws RemoteException, IllegalAccessFault, IllegalOperationFault, IllegalArgumentFault, IllegalStateFault {
String errMsg = "Error occurred while performing loadTask operation";
try {
return stub.loadTask(taskId);
} catch (Exception ex) {
handleException(errMsg, ex);
}
return null;
}
示例7
/**
* Loads the task input.
*
* @param taskId : The id of the task/.
* @return : The task input OMElement.
* @throws java.rmi.RemoteException :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalStateFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalOperationFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalAccessFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalArgumentFault :
* @throws javax.xml.stream.XMLStreamException :
*/
public OMElement loadTaskInput(URI taskId)
throws RemoteException, IllegalStateFault, IllegalOperationFault, IllegalAccessFault, IllegalArgumentFault,
XMLStreamException {
String errMsg = "Error occurred while performing loadTaskInput operation";
try {
String input = (String) stub.getInput(taskId, null);
return AXIOMUtil.stringToOM(input);
} catch (Exception ex) {
handleException(errMsg, ex);
}
return null;
}
示例8
/**
* Loads the task output.
*
* @param taskId : The id of the task/.
* @return : The task input OMElement.
* @throws java.rmi.RemoteException :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalStateFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalOperationFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalAccessFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalArgumentFault :
* @throws javax.xml.stream.XMLStreamException :
*/
public OMElement loadTaskOutput(URI taskId)
throws RemoteException, IllegalStateFault, IllegalOperationFault, IllegalAccessFault, IllegalArgumentFault,
XMLStreamException {
String errMsg = "Error occurred while performing loadTaskOutput operation";
try {
String output = (String) stub.getOutput(taskId, null);
return AXIOMUtil.stringToOM(output);
} catch (Exception ex) {
handleException(errMsg, ex);
}
return null;
}
示例9
public void start(URI taskId)
throws RemoteException, IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
String errMsg = "Error occurred while performing start operation";
try {
stub.start(taskId);
} catch (Exception ex) {
handleException(errMsg, ex);
}
}
示例10
/**
* Task remove operation. Note: applicable for notifications only.
*
* @param taskId : The id of the task to be removed.
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalArgumentFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalOperationFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalAccessFault :
* @throws java.rmi.RemoteException :
*/
public void remove(URI taskId)
throws IllegalArgumentFault, IllegalOperationFault, IllegalAccessFault, RemoteException, IllegalStateFault {
String errMsg = "Error occurred while performing resume operation";
try {
stub.remove(taskId);
} catch (Exception ex) {
handleException(errMsg, ex);
}
}
示例11
private void handleException(String errMsg, Exception ex)
throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault,
IllegalAccessFault {
if (ex instanceof IllegalAccessFault) {
throw new IllegalAccessFault(errMsg, ex);
} else if (ex instanceof IllegalArgumentFault) {
throw new IllegalArgumentFault(errMsg, ex);
} else if (ex instanceof IllegalOperationFault) {
throw new IllegalOperationFault(errMsg, ex);
} else if (ex instanceof IllegalStateFault) {
throw new IllegalStateFault(errMsg, ex);
} else {
throw new IllegalStateFault(errMsg, ex);
}
}
示例12
private void checkMatchingTaskAndDelete(String requestId, HumanTaskClientAPIAdminClient client,
TTaskSimpleQueryResultRow[] resultsList, int resultIndex, OMElementImpl
taskElement) throws RemoteException, IllegalStateFault,
IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
if (taskElement.getLocalName().equals(WFImplConstant.HT_PARAMETER_LIST_ELEMENT)) {
Iterator<OMElementImpl> parameters = taskElement.getChildElements();
while (parameters.hasNext()) {
OMElementImpl parameter = parameters.next();
Iterator<OMAttribute> attributes = parameter.getAllAttributes();
while (attributes.hasNext()) {
OMAttribute currentAttribute = attributes.next();
if (currentAttribute.getLocalName().equals(WFImplConstant.HT_ITEM_NAME_ATTRIBUTE) &&
currentAttribute
.getAttributeValue().equals(WFImplConstant.HT_REQUEST_ID_ATTRIBUTE_VALUE)) {
Iterator<OMElementImpl> itemValues = parameter.getChildElements();
if (itemValues.hasNext()) {
String taskRequestId = itemValues.next().getText();
if (taskRequestId.contains(",")) {
taskRequestId = taskRequestId.replaceAll(",", "");
}
if (taskRequestId.equals(requestId)) {
client.skip(resultsList[resultIndex].getId());
}
}
}
}
}
}
}
示例13
/**
* The skip operation.
* @param taskId : The task id.
* @throws IllegalArgumentFault :
* @throws IllegalOperationFault :
* @throws IllegalAccessFault :
* @throws IllegalStateFault :
* @throws RemoteException :
*/
public void skip(URI taskId)
throws IllegalArgumentFault, IllegalOperationFault, IllegalAccessFault,
IllegalStateFault, RemoteException {
String errMsg = "Error occurred while performing skip operation";
try {
stub.skip(taskId);
} catch (RemoteException | IllegalStateFault | IllegalOperationFault | IllegalArgumentFault | IllegalAccessFault e) {
log.error(errMsg, e);
throw e;
}
}
示例14
/**
* Task complete operation.
*
* @param taskId : The task id to be completed.
* @param payLoad : The payload.
* @throws java.rmi.RemoteException :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalAccessFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalArgumentFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalStateFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalOperationFault :
* @throws javax.xml.stream.XMLStreamException :
*/
public void complete(URI taskId, String payLoad)
throws RemoteException, IllegalAccessFault, IllegalArgumentFault, IllegalStateFault, IllegalOperationFault,
XMLStreamException {
String errMsg = "Error occurred while performing complete operation";
try {
String decodedPayload = decodeHTML(payLoad);
stub.complete(taskId, decodedPayload);
} catch (Exception ex) {
handleException(errMsg, ex);
}
}
示例15
/**
* Claim task operation.
*
* @param taskId : The ID of the task to be claimed.
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalArgumentFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalAccessFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalStateFault :
* @throws java.rmi.RemoteException :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalOperationFault :
*/
public void claim(URI taskId)
throws IllegalArgumentFault, IllegalAccessFault, IllegalStateFault, RemoteException, IllegalOperationFault {
String errMsg = "Error occurred while performing claim operation";
try {
stub.claim(taskId);
} catch (Exception ex) {
handleException(errMsg, ex);
}
}
示例16
/**
* Stop task.
*
* @param taskId : The task Id.
* @throws java.rmi.RemoteException :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalStateFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalOperationFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalArgumentFault :
* @throws org.wso2.carbon.humantask.stub.ui.task.client.api.IllegalAccessFault :
*/
public void stop(URI taskId)
throws RemoteException, IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
String errMsg = "Error occurred while performing stop operation";
try {
stub.stop(taskId);
} catch (Exception ex) {
handleException(errMsg, ex);
}
}
示例17
/**
* Loads the task input.
*
* @param taskId : The id of the task/.
* @return : The task input OMElement.
* @throws RemoteException :
* @throws IllegalStateFault :
* @throws IllegalOperationFault:
* @throws IllegalAccessFault:
* @throws IllegalArgumentFault:
* @throws javax.xml.stream.XMLStreamException
*
*/
public OMElement getInput(URI taskId)
throws RemoteException, IllegalStateFault, IllegalOperationFault, IllegalAccessFault,
IllegalArgumentFault, XMLStreamException {
try {
String input = (String) stub.getInput(taskId, new NCName(""));
return AXIOMUtil.stringToOM(input);
} catch (RemoteException | IllegalStateFault | IllegalOperationFault | IllegalArgumentFault | IllegalAccessFault | XMLStreamException e) {
log.error("Error occurred while performing loadTaskInput operation", e);
throw e;
}
}
示例18
/**
* change the workItem status to Complete. it will hide from the management console
*
* @param id
* @throws RemoteException
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void completeTask(URI id) throws RemoteException, IllegalStateFault,
IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
htStub.start(id);
htStub.complete(id, "<WorkResponse>true</WorkResponse>");
}