Java源码示例:org.apache.axis2.databinding.types.NCName
示例1
public StaticOutputElement(DataService dataService, String name,
String param, String originalParam, String paramType,
String elementType, String namespace, QName xsdType,
Set<String> requiredRoles, int dataCategory, int resultType,
String export, int exportType,
String arrayName) throws DataServiceFault {
super(name, namespace, requiredRoles, param, paramType, arrayName);
this.originalParam = originalParam;
this.elementType = elementType;
this.xsdType = xsdType;
this.dataCategory = dataCategory;
this.resultType = resultType;
this.export = export;
this.exportType = exportType;
this.hasConstantValue = DBSFields.VALUE.equals(paramType);
this.udtInfo = processParamForUserDefinedObjects(this.getParam());
if (this.getArrayName() != null || this.getUDTInfo() != null) {
this.isUserDefinedObj = true;
}
/* validate element/attribute name */
if (!NCName.isValid(this.getName())) {
throw new DataServiceFault("Invalid output " + this.elementType + " name: '" +
this.getName() + "', must be an NCName.");
}
}
示例2
@Test(groups = {"wso2.bps.task.operate"}, description = "Get Task input test", priority = 9, singleThreaded = true)
public void testTaskGetInput() throws Exception {
Assert.assertNotNull(taskId, "The task ID has to be set by now!");
String input = (String) clerk1HumanTaskClientApiClient.getInput(taskId, null);
Assert.assertNotNull(input, "The input message cannot be null");
Assert.assertTrue(input.contains("<ClaimApprovalData xmlns=\"http://www.example.com/claims/schema\" " +
"xmlns:p=\"http://www.example.com/claims/schema\" " +
"xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"),
"The retrieved input message should contain message data");
NCName ncName = new NCName();
ncName.setValue("ClaimApprovalRequest");
String inputMessageWithPartName = (String) clerk1HumanTaskClientApiClient.getInput(taskId, ncName);
Assert.assertNotNull(input, "The input message cannot be null");
Assert.assertTrue(input.contains("<ClaimApprovalData xmlns=\"http://www.example.com/claims/schema\" " +
"xmlns:p=\"http://www.example.com/claims/schema\" " +
"xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"),
"The retrieved input message should contain message data");
Assert.assertEquals(input, inputMessageWithPartName, "2 returned values are different");
}
示例3
private void validateWithParam() throws DataServiceFault {
/* validate name, should be an NCName */
if (DBSFields.QUERY_PARAM.equals(this.getParamType()) &&
!NCName.isValid(this.getParam())) {
throw new DataServiceFault("Invalid query param name: '" + this.getParam() +
"', must be an NCName.");
}
}
示例4
private void validateElementName(String elementName) throws DataServiceFault {
if (this.resultType != DBConstants.ResultTypes.RDF) {
/* validate element name */
if (this.elementName != null && this.elementName.trim().length() > 0
&& !NCName.isValid(this.elementName)) {
throw new DataServiceFault("Invalid wrapper element name: '"
+ this.elementName + "', must be an NCName.");
}
}
}
示例5
private void validateRowName(String rowName) throws DataServiceFault {
if (this.resultType != DBConstants.ResultTypes.RDF) {
/* validate row name */
if (this.rowName != null && this.rowName.length() != 0 &&
!NCName.isValid(this.rowName)) {
throw new DataServiceFault("Invalid row name: '" + this.rowName
+ "', must be an NCName.");
}
}
}
示例6
public void setOutput(final URI taskIdURI, final NCName ncName, final Object o) throws Exception {
try {
humanTaskClientAPIAdminStub.setOutput(taskIdURI, ncName, o);
} catch (Exception e) {
String error_String = "Unable to setOutput for task " + taskIdURI;
log.error(error_String, e);
throw e;
}
}
示例7
public Object getInput(final URI taskIdURI, final NCName inputIdentifier) throws Exception {
try {
return humanTaskClientAPIAdminStub.getInput(taskIdURI, inputIdentifier);
} catch (Exception e) {
String error_String = "Unable to get Input for task " + taskIdURI;
log.error(error_String, e);
throw e;
}
}
示例8
public Object getOutput(final URI taskIdURI, final NCName partNCName) throws Exception {
try {
return humanTaskClientAPIAdminStub.getOutput(taskIdURI, partNCName);
} catch (Exception e) {
String error_String = "Unable to getOutput for Task " + taskIdURI;
log.error(error_String, e);
throw e;
}
}
示例9
/**
* 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;
}
}