本文整理汇总了Java中org.apache.axiom.om.OMAttribute类的典型用法代码示例。如果您正苦于以下问题:Java OMAttribute类的具体用法?Java OMAttribute怎么用?Java OMAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OMAttribute类属于org.apache.axiom.om包,在下文中一共展示了OMAttribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPayload
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
private OMElement getPayload() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNsa = fac.createOMNamespace("testns1", "a");
OMNamespace omNsb = fac.createOMNamespace("testns2", "b");
OMNamespace omNsc = fac.createOMNamespace("testns3", "c");
OMElement payload = fac.createOMElement("test", omNsa);
OMElement p1 = fac.createOMElement("testb", omNsb);
OMAttribute a1 = fac.createOMAttribute("attrb1", omNsa, "a");
a1.setAttributeValue("v1");
p1.addAttribute(a1);
OMAttribute a2 = fac.createOMAttribute("attrb2", omNsb, "b");
a2.setAttributeValue("v2");
p1.addAttribute(a2);
OMElement p2 = fac.createOMElement("testc", omNsc);
p1.addChild(p2);
payload.addChild(p1);
return payload;
}
示例2: testFindDocuments_MultipleStatus
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
@Test
public void testFindDocuments_MultipleStatus() throws Exception {
//Generate StoredQuery request message
patientId = XdsTest.patientId;
String message = findDocumentsQuery(patientId);
OMElement request = OMUtil.xmlStringToOM(message);
System.out.println("Request:\n" +request);
//3. Send a StoredQuery
ServiceClient sender = getRegistryServiceClient();
OMElement response = sender.sendReceive( request );
assertNotNull(response);
//4. Verify the response is correct
OMAttribute status = response.getAttribute(new QName("status"));
assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue());
String result = response.toString();
System.out.println("Result:\n" +result);
}
示例3: verifyDocuments
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
public int verifyDocuments(String patientId) throws Exception {
String message = findDocumentsQuery(patientId + "^^^IHENA&1.3.6.1.4.1.21367.2010.1.2.300&ISO");
OMElement request = OMUtil.xmlStringToOM(message);
ServiceClient sender = getRegistryServiceClient();
OMElement response = sender.sendReceive( request );
assertNotNull(response);
// Verify the response is correct
OMAttribute status = response.getAttribute(new QName("status"));
assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue());
System.out.println("Response:\n" +response.toString());
OMElement robList = MetadataSupport.firstChildWithLocalName(response, "RegistryObjectList");
List objects = MetadataSupport.childrenWithLocalName(robList, "ObjectRef");
return objects.size();
}
示例4: toXml
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
public OMElement toXml() {
OMElement doc = MetadataSupport.om_factory.createOMElement("ValidateTestResponse", null);
OMAttribute status_att = MetadataSupport.om_factory.createOMAttribute("status", null, status);
doc.addAttribute(status_att);
if (errors != null) {
for ( String error_text : errors) {
OMElement error_ele = MetadataSupport.om_factory.createOMElement("Error", null);
error_ele.setText(error_text);
doc.addChild(error_ele);
}
}
if (warnings != null) {
for ( String warning_text : warnings) {
OMElement warning_ele = MetadataSupport.om_factory.createOMElement("Warning", null);
warning_ele.setText(warning_text);
doc.addChild(warning_ele);
}
}
return doc;
}
示例5: validate1
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
public void validate1(OMElement root) {
String localname = root.getLocalName();
if (isIdentifiable(localname)) {
OMAttribute home_att = root.getAttribute(MetadataSupport.home_qname);
if (home_att == null) {
errs += "\nElement of type " + localname + " does not contain a home attribute";
} else {
String home1 = home_att.getAttributeValue();
if (home1 == null) home1 = "";
if ( !home1.equals(home))
errs += "\nElement of type " + localname + " has home of [" + home1 + "] which does not match expected value of [" + home + "]";
}
}
for (OMNode child=root.getFirstElement(); child != null; child=child.getNextOMSibling()) {
OMElement child_e = (OMElement) child;
validate1(child_e);
}
}
示例6: getUniqueIdAttribute
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
public OMAttribute getUniqueIdAttribute(String id) throws MetadataException {
OMAttribute att;
att = id_index().getExternalIdentifierAttribute(id,
MetadataSupport.XDSDocumentEntry_uniqueid_uuid);
if (att != null && !att.equals(""))
return att;
att = id_index().getExternalIdentifierAttribute(id,
MetadataSupport.XDSSubmissionSet_uniqueid_uuid);
if (att != null && !att.equals(""))
return att;
att = id_index().getExternalIdentifierAttribute(id,
MetadataSupport.XDSFolder_uniqueid_uuid);
if (att != null && !att.equals(""))
return att;
return null;
}
示例7: dup_wrapper1
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
OMElement dup_wrapper1(OMElement e) {
OMElement e_dup = om_factory().createOMElement(e.getLocalName(),
e.getNamespace());
for (Iterator it = e.getAllAttributes(); it.hasNext();) {
OMAttribute a = (OMAttribute) it.next();
String name = a.getLocalName();
String value = a.getAttributeValue();
e_dup.addAttribute(name, value, null);
}
if (e.getLocalName().equals(wrapper.getLocalName())) {
wrapperDup = e_dup;
return e_dup;
}
for (Iterator it = e.getChildElements(); it.hasNext();) {
OMElement ele = (OMElement) it.next();
OMElement ele_dup = dup_wrapper1(ele);
e_dup.addChild(ele_dup);
}
return e_dup;
}
示例8: validate_internal_classifications
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
void validate_internal_classifications(OMElement e) throws MetadataValidationException, MetadataException {
String e_id = e.getAttributeValue(MetadataSupport.id_qname);
if (e_id == null || e_id.equals(""))
return;
for (Iterator it=e.getChildElements(); it.hasNext(); ) {
OMElement child = (OMElement) it.next();
OMAttribute classified_object_att = child.getAttribute(MetadataSupport.classified_object_qname);
if (classified_object_att != null) {
String value = classified_object_att.getAttributeValue();
if ( !e_id.equals(value)) {
throw new MetadataValidationException("Classification " + m.getIdentifyingString(child) +
"\n is nested inside " + m.getIdentifyingString(e) +
"\n but classifies object " + m.getIdentifyingString(value));
}
}
}
}
示例9: getExternalIdentifierAttribute
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
public OMAttribute getExternalIdentifierAttribute(String id, String identifier_scheme) {
HashMap<String,List<OMElement>> part_map = object_parts_by_id().get(id);
if (part_map == null)
return null;
try { // huh?
@SuppressWarnings("unused")
OMElement obj = m.getObjectById(id);
} catch (Exception e) {}
List<OMElement> external_identifiers = part_map.get("ExternalIdentifier");
for (int i=0; i<external_identifiers.size(); i++ ) {
OMElement ei = (OMElement) external_identifiers.get(i);
OMAttribute id_scheme_att = ei.getAttribute(MetadataSupport.identificationscheme_qname);
//String scheme = id_scheme_att.getAttributeValue();
if (id_scheme_att != null && id_scheme_att.getAttributeValue().equals(identifier_scheme)) {
OMAttribute value_att = ei.getAttribute(MetadataSupport.value_qname);
if (value_att != null)
return value_att;
}
}
return null;
}
示例10: processIdExpression
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
protected void processIdExpression(T tag, IParserContext context) {
IdAttribute a = ReflectUtils.getAnnotation(tag.getClass(), IdAttribute.class);
if (a != null) {
final String id = a.value();
if (IdAttribute.NO_ID_SUPPORT.equals(id)) {
return;
}
OMElement ele = context.getElement();
QName qn = new QName("", id);
OMAttribute at = ele.getAttribute(qn);
if (at != null) {
String attr = at.getAttributeValue();
if (StringUtils.isBlank(attr)) {
throw new PaxmlRuntimeException("Id attribute cannot be given as blank: " + qn);
}
tag.setIdExpression(new IdExpression(ExpressionFactory.create(attr), qn));
}
}
}
示例11: getDocumentType
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
/**
* Checks if an XMl tree is compliant with pnml root definition and returns
* the string of pnml net type.
*
* @param document
* the xml tree
* @return the pnml type
* @throws BadFileFormatException
* if the tree is not well formated
*/
private OMAttribute getDocumentType(OMElement document)
throws BadFileFormatException {
if (!(document.getLocalName().equals("pnml") && document
.getFirstElement().getLocalName().equals("net"))) {
log
.error("this file is not a well formated PNML file, <pnml> or <net> are missing");
throw new BadFileFormatException(
"this file is not a well formated PNML file");
}
final OMAttribute doctype = document.getFirstElement().getAttribute(
new QName("type"));
if (doctype == null) {
log.error("the type of this PNML file is not given");
throw new BadFileFormatException(
"the type of this PNML file is not given");
}
return doctype;
}
示例12: getSOAPBodyIdRef
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
/**
* Helper method to retrieve the value of the id of the SOAP <code>Body</code> element.
* <a>As described in the WS-Security spec valid id attributes are:<ul>
* <li>Local ID attributes on XML Signature elements</li>
* <li>Local ID attributes on XML Encryption elements</li>
* <li>Global wsu:Id attributes (described below) on elements</li>
* <li>Profile specific defined identifiers</li>
* <li>Global xml:id attributes on elements</li>
* </ul>
* So for the SOAP <code>Body</code> element the possible id attributes are <code>wsu:Id</code> and
* <code>xml:id</code>.
*
* @param mc The current message context
* @return The id reference for the SOAP Body element if it has an id attribute, or<br>
* <code>null</code> if no id attribute is found on the SOAP Body element
*/
private String getSOAPBodyIdRef(final MessageContext mc) {
String bodyId = null;
final SOAPBody body = mc.getEnvelope().getBody();
for(final Iterator<OMAttribute> attributes = body.getAllAttributes(); attributes.hasNext() && bodyId == null;) {
final OMAttribute attr = attributes.next();
if (SecurityConstants.QNAME_WSU_ID.equals(attr.getQName()))
bodyId = attr.getAttributeValue();
else if (EbMSConstants.QNAME_XMLID.equals(attr.getQName()))
bodyId = attr.getAttributeValue();
}
// As we need to return the reference the id must be prefixed with a '#'
return bodyId != null ? "#" + bodyId : null;
}
示例13: getElementAttributeValue
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
/**
* Get attribute value of the element when attribute name and element is given.
*
* @param elementName element name
* @param attributeName attribute name of the element.
* @param parentEle OMElement
* @return Value of the attribute as a String
*/
private static String getElementAttributeValue(String elementName, String attributeName,
OMElement parentEle) {
OMElement ele = parentEle.getFirstChildWithName(
new QName(BusinessProcessConstants.BPEL_PKG_ENDPOINT_CONFIG_NS, elementName));
if (ele != null) {
Iterator attributes = ele.getAllAttributes();
while (attributes.hasNext()) {
OMAttribute attribute = (OMAttribute) attributes.next();
if (attribute.getLocalName().equals(attributeName)) {
return attribute.getAttributeValue();
}
}
}
if (log.isDebugEnabled()) {
log.debug(Messages.msgElementAttributeValueNotFound(elementName, attributeName));
}
return null;
}
示例14: processAnalyticsServerProfileName
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
/**
* Reading Analytics Server profile name and Agent type and setting them to given analyticsServerProfile instance.
*
* @param analyticsServerConfig OMElement of analyticsServerConfig
* @param analyticsServerProfile AnalyticsServerProfile instance
*/
private void processAnalyticsServerProfileName(OMElement analyticsServerConfig,
AnalyticsServerProfile analyticsServerProfile) {
OMAttribute name = analyticsServerConfig.getAttribute(new QName(AnalyticsConstants.NAME));
if (name != null && name.getAttributeValue() != null &&
!AnalyticsConstants.EMPTY.equals(name.getAttributeValue().trim())) {
analyticsServerProfile.setName(name.getAttributeValue().trim());
} else {
String errMsg =
AnalyticsConstants.NAME + " attribute not found for Analytics server profile: " + profileLocation;
handleError(errMsg);
}
OMAttribute type = analyticsServerConfig.getAttribute(new QName(AnalyticsConstants.TYPE));
if (type != null && type.getAttributeValue() != null &&
!AnalyticsConstants.EMPTY.equals(type.getAttributeValue().trim())) {
analyticsServerProfile.setType(type.getAttributeValue().trim());
} else {
// This value can be null or empty. Then default agent will get selected.
analyticsServerProfile.setType(null);
}
}
示例15: ActivityImpl
import org.apache.axiom.om.OMAttribute; //导入依赖的package包/类
/**
* When processing for subActivities in a process, the process is iterated and each activity is taken into a temp
* omElement.
* If the name of the temp omElement matches the tag name of an activity , the constructor of that activity
* implementation is invoked.
* The constructor of the activity implementation invokes this method which is the constructor of the base class
* by passing
* the omElement as a @param
* Gets the name and the value of the omElement that is taken as the @param
* The attribute name and the attribute value is added to a list as a key-value pair
*
* @param omElement -an activity of the bpel process (obtained by iterating the omElement which contains the
* process definition)
*/
public ActivityImpl(OMElement omElement) {
Iterator tmpIterator = omElement.getAllAttributes();
//Iterates through the attributes of the omElement
while (tmpIterator.hasNext()) {
OMAttribute omAttribute = (OMAttribute) tmpIterator.next();
//Gets the type of the activity
String tmpAttribute = omAttribute.getLocalName();
//Gets the name of the activity
String tmpValue = omAttribute.getAttributeValue();
if (tmpAttribute != null && tmpValue != null) {
//type and the name of the attribute is added to a list
attributes.add(new BPELAttributeValuePair(tmpAttribute,
tmpValue));
if (tmpAttribute.equals("name")) {
//Set the name of the activity
setName(tmpValue);
setDisplayName(getName());
}
}
}
}