Example usage for javax.xml.namespace QName equals

List of usage examples for javax.xml.namespace QName equals

Introduction

In this page you can find the example usage for javax.xml.namespace QName equals.

Prototype

public final boolean equals(Object objectToTest) 

Source Link

Document

Test this QName for equality with another Object.

If the Object to be tested is not a QName or is null, then this method returns false.

Two QNames are considered equal if and only if both the Namespace URI and local part are equal.

Usage

From source file:com.evolveum.midpoint.web.component.prism.ObjectWrapperFactory.java

private boolean isIgnoreContainer(QName containerDefinitionName) {
    for (QName container : CONTAINERS_TO_IGNORE) {
        if (container.equals(containerDefinitionName)) {
            return true;
        }//w  ww  .j a  va 2s. c om
    }

    return false;
}

From source file:com.evolveum.midpoint.util.DOMUtil.java

public static boolean isElementName(Element element, QName name) {
    return name.equals(getQNameWithoutPrefix(element));
}

From source file:com.evolveum.midpoint.util.DOMUtil.java

public static Element findElementRecursive(Element element, QName elementQName) {
    if (elementQName.equals(getQName(element))) {
        return element;
    }/*from   w ww  .jav  a2  s  .  c o m*/
    for (Element subElement : listChildElements(element)) {
        Element foundElement = findElementRecursive(subElement, elementQName);
        if (foundElement != null) {
            return foundElement;
        }
    }
    return null;
}

From source file:com.evolveum.midpoint.test.IntegrationTestTools.java

public static void assertAssociation(PrismObject<ShadowType> shadow, QName associationName,
        String entitlementOid) {//from  w  ww .  j  a  v  a  2s .c  o m
    ShadowType accountType = shadow.asObjectable();
    List<ShadowAssociationType> associations = accountType.getAssociation();
    assertNotNull("Null associations in " + shadow, associations);
    assertFalse("Empty associations in " + shadow, associations.isEmpty());
    for (ShadowAssociationType association : associations) {
        if (associationName.equals(association.getName())
                && entitlementOid.equals(association.getShadowRef().getOid())) {
            return;
        }
    }
    AssertJUnit.fail("No association for entitlement " + entitlementOid + " in " + shadow);
}

From source file:com.evolveum.midpoint.util.DOMUtil.java

public static Element getChildElement(Element element, QName qname) {
    for (Element subelement : listChildElements(element)) {
        if (qname.equals(getQName(subelement))) {
            return subelement;
        }//w ww.j  a  va 2  s. co m
    }
    return null;
}

From source file:com.evolveum.midpoint.util.DOMUtil.java

private static Attr findAttributeByQName(NamedNodeMap attrs, QName qname) {
    for (int i = 0; i < attrs.getLength(); i++) {
        Node aItem = attrs.item(i);
        Attr aAttr = (Attr) aItem;
        if (aAttr.getLocalName() == null) {
            continue;
        }//from  www  .  j  a va 2  s  .com
        QName aQname = new QName(aAttr.getNamespaceURI(), aAttr.getLocalName());
        if (aQname.equals(qname)) {
            return aAttr;
        }
    }
    return null;
}

From source file:gov.nih.nci.cagrid.introduce.servicetools.ReflectionResource.java

/**
 * Override this callback method to specialize the implementation of the
 * resource property value accessors on a per resource property basis. For
 * instance, in the overriden version, do special processing if the QName of
 * the property matches a special QName, or just call this base
 * implementation otherwise.//w  ww. j av a 2 s  .c o m
 * <p>
 * The default behavior is to create a new
 * {@link ReflectionResourceProperty ReflectionResourceProperty} constructed
 * with the QName of the resource property and the resource implementation
 * Bean used to construct this ReflectionResource object.
 * <p>
 * This function handles a few special cases:
 * <ul>
 * <li>If rpQName equals WSRFConstants.CURRENT_TIME, the resource property
 * MUST use a dynamic implementation of getCurrentTime(), since time never
 * stops changing. Therefore the resource bean callback used is not the
 * initial resource Bean but the ReflectionResource object, which bears such
 * an implementation of that function.</li>
 * <li>If rpQName equals WSRFConstants.TERMINATION_TIME, the resource
 * property created is set be nillable.</li>
 * </ul>
 * 
 * @param metaData
 *            Meta data associated with the resource property object
 * @param resourceBean
 *            same as passed to constructor or initialize
 */
protected ResourceProperty createNewResourceProperty(ResourcePropertyMetaData metaData, Object resourceBean)
        throws Exception {
    Object resourceBeanCallback = resourceBean; // default

    QName rpQName = metaData.getName();

    ReflectionResourceProperty prop = null;

    if (rpQName.equals(WSRFConstants.TERMINATION_TIME)) {
        prop = new ReflectionResourceProperty(SimpleResourcePropertyMetaData.TERMINATION_TIME,
                resourceBeanCallback);

        this.setTerminationTimeMethod = methodCache.getMethod(resourceBeanCallback.getClass(),
                "setTerminationTime", SET_TERM_TIME_PARAM);

        this.getTerminationTimeMethod = methodCache.getMethod(resourceBeanCallback.getClass(),
                "getTerminationTime", null);

    } else if (rpQName.equals(WSRFConstants.CURRENT_TIME)) {
        prop = new ReflectionResourceProperty(SimpleResourcePropertyMetaData.CURRENT_TIME, this);
    } else {
        prop = new ReflectionResourceProperty(metaData, resourceBeanCallback);
    }

    return prop;
}

From source file:edu.jhuapl.tinkerpop.AccumuloGraphConfigurationTest.java

@Test
public void testPropertyValues() throws Exception {
    AccumuloGraph graph = new AccumuloGraph(AccumuloGraphTestUtils.generateGraphConfig("propertyValues"));
    // Tests for serialization/deserialization of properties.
    QName qname = new QName("ns", "prop");
    Vertex v = graph.addVertex(null);/* ww  w  .  jav  a2s . co  m*/
    v.setProperty("qname", qname);
    assertTrue(v.getProperty("qname") instanceof QName);
    assertTrue(qname.equals(v.getProperty("qname")));
}

From source file:com.evolveum.midpoint.gui.api.component.autocomplete.AutoCompleteQNamePanel.java

private void initLayout(final IModel<QName> model) {
    setOutputMarkupId(true);// w  w w  .j  a v a 2  s .  c o  m

    AutoCompleteSettings autoCompleteSettings = createAutoCompleteSettings();
    final IModel<String> stringModel = new Model<String>() {

        @Override
        public void setObject(String object) {
            super.setObject(object);
            model.setObject(convertToQname(object));
        }

    };

    // The inner autocomplete field is always String. Non-string auto-complete fields are problematic
    final AutoCompleteTextField<String> input = new AutoCompleteTextField<String>(ID_INPUT, stringModel,
            String.class, autoCompleteSettings) {
        private static final long serialVersionUID = 1L;

        @Override
        protected Iterator<String> getChoices(String input) {
            return getIterator(input);
        }

    };
    input.add(new OnChangeAjaxBehavior() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            String inputString = stringModel.getObject();
            if (StringUtils.isBlank(inputString)) {
                QName modelObject = model.getObject();
                if (modelObject != null) {
                    model.setObject(null);
                    AutoCompleteQNamePanel.this.onChange(target);
                }
            } else {
                QName inputQName = convertToQname(stringModel.getObject());
                if (inputQName == null) {
                    // We have some input, but it does not match any QName. Just do nothing.
                } else {
                    QName modelObject = model.getObject();
                    if (inputQName.equals(modelObject)) {
                        model.setObject(inputQName);
                        AutoCompleteQNamePanel.this.onChange(target);
                    }
                }
            }
        }
    });
    add(input);
}

From source file:com.evolveum.midpoint.gui.api.util.FocusTabVisibleBehavior.java

private List<ObjectFormType> findObjectForm(AdminGuiConfigurationType config, QName type) {
    List<ObjectFormType> result = new ArrayList<>();

    if (config == null || config.getObjectForms() == null) {
        return result;
    }//w ww.  j ava  2  s  .  c  om

    ObjectFormsType forms = config.getObjectForms();
    List<ObjectFormType> list = forms.getObjectForm();
    if (list.isEmpty()) {
        return result;
    }

    for (ObjectFormType form : list) {
        if (type.equals(form.getType())) {
            result.add(form);
        }
    }

    return result;
}