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.prism.xnode.MapXNode.java

public void qualifyKey(QName key, String newNamespace) {
    for (Entry entry : subnodes) {
        if (key.equals(entry.getKey())) {
            entry.qualifyKey(newNamespace);
        }// w w  w. ja v a  2 s.c  o m
    }
}

From source file:com.evolveum.midpoint.provisioning.impl.ShadowCaretaker.java

/**
 * Reapplies definition to the shadow if needed. The definition needs to be
 * reapplied e.g. if the shadow has auxiliary object classes, it if subclass
 * of the object class that was originally requested, etc.
 *//* w w  w .  j av  a  2  s  .c om*/
public ProvisioningContext reapplyDefinitions(ProvisioningContext ctx,
        PrismObject<ShadowType> rawResourceShadow) throws SchemaException, ConfigurationException,
        ObjectNotFoundException, CommunicationException, ExpressionEvaluationException {
    ShadowType rawResourceShadowType = rawResourceShadow.asObjectable();
    QName objectClassQName = rawResourceShadowType.getObjectClass();
    List<QName> auxiliaryObjectClassQNames = rawResourceShadowType.getAuxiliaryObjectClass();
    if (auxiliaryObjectClassQNames.isEmpty()
            && objectClassQName.equals(ctx.getObjectClassDefinition().getTypeName())) {
        // shortcut, no need to reapply anything
        return ctx;
    }
    ProvisioningContext shadowCtx = ctx.spawn(rawResourceShadow);
    shadowCtx.assertDefinition();
    RefinedObjectClassDefinition shadowDef = shadowCtx.getObjectClassDefinition();
    ResourceAttributeContainer attributesContainer = ShadowUtil.getAttributesContainer(rawResourceShadow);
    attributesContainer.applyDefinition(shadowDef.toResourceAttributeContainerDefinition());
    return shadowCtx;
}

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

/**
 * This methods check if we want to show property in form (e.g.
 * failedLogins, fetchResult, lastFailedLoginTimestamp must be invisible)
 *
 * @return//from w w w . j  a v a  2 s .com
 * @deprecated will be implemented through annotations in schema
 */
@Deprecated
private boolean skipProperty(ItemDefinition<? extends Item> def) {
    if (def == null) {
        return true;
    }
    final List<QName> names = new ArrayList<>();
    names.add(PasswordType.F_FAILED_LOGINS);
    names.add(PasswordType.F_LAST_FAILED_LOGIN);
    names.add(PasswordType.F_LAST_SUCCESSFUL_LOGIN);
    names.add(PasswordType.F_PREVIOUS_SUCCESSFUL_LOGIN);
    names.add(ObjectType.F_FETCH_RESULT);
    // activation
    names.add(ActivationType.F_EFFECTIVE_STATUS);
    names.add(ActivationType.F_VALIDITY_STATUS);
    // user
    names.add(UserType.F_RESULT);
    // org and roles
    names.add(OrgType.F_APPROVAL_PROCESS);
    names.add(OrgType.F_APPROVER_EXPRESSION);
    names.add(OrgType.F_AUTOMATICALLY_APPROVED);
    names.add(OrgType.F_CONDITION);
    // focus
    names.add(FocusType.F_LINK);
    names.add(FocusType.F_LINK_REF);
    names.add(FocusType.F_PERSONA_REF);

    for (QName name : names) {
        if (name.equals(def.getName())) {
            return true;
        }
    }

    return false;
}

From source file:org.bedework.notifier.cnctrs.bedework.BedeworkConnectorInstance.java

@Override
public boolean completeItem(final NotifyDb db, final Note note) throws NoteException {
    /* Because we do a sync-report on teh collection - we won't see the
     * notification unless it changes.//from w  ww  .  ja  v  a2  s .  c  om
     *
     * Sharing invites will be removed when processed.
     *
     * Sharing responses could be removed.
     *
     * Change notifications we might want to remove.
     *
     */
    final NotificationType notification = note.getNotification();
    final QName noteType = notification.getNotification().getElementName();

    if (noteType.equals(AppleServerTags.resourceChange)) {
        deleteItem(note);
    } else {
        replaceItem(note);
    }

    return true;
}

From source file:com.espertech.esper.event.xml.XPathPropertyGetter.java

/**
 * Ctor./*  ww  w .  ja  v  a  2s  .  c o  m*/
 * @param propertyName is the name of the event property for which this getter gets values
 * @param expressionText is the property expression itself
 * @param xPathExpression is a compile XPath expression
 * @param resultType is the resulting type
 * @param optionalCastToType if non-null then the return value of the xpath expression is cast to this value
 * @param fragmentFactory for creating fragments, or null in none to be created
 */
public XPathPropertyGetter(String propertyName, String expressionText, XPathExpression xPathExpression,
        QName resultType, Class optionalCastToType, FragmentFactory fragmentFactory) {
    this.expression = xPathExpression;
    this.expressionText = expressionText;
    this.property = propertyName;
    this.resultType = resultType;
    this.fragmentFactory = fragmentFactory;

    if ((optionalCastToType != null) && (optionalCastToType.isArray())) {
        isCastToArray = true;
        if (!resultType.equals(XPathConstants.NODESET)) {
            throw new IllegalArgumentException(
                    "Array cast-to types require XPathConstants.NODESET as the XPath result type");
        }
        optionalCastToType = optionalCastToType.getComponentType();
    } else {
        isCastToArray = false;
    }

    if (optionalCastToType != null) {
        simpleTypeParser = SimpleTypeParserFactory.getParser(optionalCastToType);
    } else {
        simpleTypeParser = null;
    }
    if (optionalCastToType == Node.class) {
        this.optionalCastToType = null;
    } else {
        this.optionalCastToType = optionalCastToType;
    }
}

From source file:com.evolveum.midpoint.prism.marshaller.PrismMarshaller.java

private <C extends Containerable> QName getSpecificTypeName(PrismContainerValue<C> cval) {
    if (cval.getParent() == null) {
        return null;
    }/* w w  w  . ja  v  a 2s. co m*/
    ComplexTypeDefinition ctdValue = cval.getComplexTypeDefinition();
    ComplexTypeDefinition ctdParent = cval.getParent().getComplexTypeDefinition();
    QName typeValue = ctdValue != null ? ctdValue.getTypeName() : null;
    QName typeParent = ctdParent != null ? ctdParent.getTypeName() : null;

    if (typeValue == null || typeValue.equals(typeParent)) {
        return null;
    }
    if (ctdValue.getCompileTimeClass() == null) {
        // TODO.................
        return null;
    }
    return typeValue;
}

From source file:com.evolveum.midpoint.prism.parser.DomParser.java

private MapXNode parseSubElemets(Element element) throws SchemaException {
    MapXNode xmap = new MapXNode();
    extractCommonMetadata(element, xmap);

    // Attributes
    for (Attr attr : DOMUtil.listApplicationAttributes(element)) {
        QName attrQName = DOMUtil.getQName(attr);
        XNode subnode = parseAttributeValue(attr);
        xmap.put(attrQName, subnode);//from  w  ww .  ja  v  a 2s .  co m
    }

    // Subelements
    QName lastElementQName = null;
    List<Element> lastElements = null;
    for (Element childElement : DOMUtil.listChildElements(element)) {
        QName childQName = DOMUtil.getQName(childElement);
        if (childQName == null) {
            throw new IllegalArgumentException(
                    "Null qname in element " + childElement + ", subelement of " + element);
        }
        if (childQName.equals(lastElementQName)) {
            lastElements.add(childElement);
        } else {
            parseElementGroup(xmap, lastElementQName, lastElements);
            lastElementQName = childQName;
            lastElements = new ArrayList<Element>();
            lastElements.add(childElement);
        }
    }
    parseElementGroup(xmap, lastElementQName, lastElements);

    return xmap;
}

From source file:com.evolveum.midpoint.prism.parser.DomParser.java

private void parseElementGroup(MapXNode xmap, QName elementQName, List<Element> elements)
        throws SchemaException {
    if (elements == null || elements.isEmpty()) {
        return;//from  w ww. j  a  va  2 s  .  c o  m
    }
    XNode xsub;
    // We really want to have equals here, not match
    // we want to be very explicit about namespace here
    if (elementQName.equals(SCHEMA_ELEMENT_QNAME)) {
        if (elements.size() == 1) {
            xsub = parseSchemaElement(elements.iterator().next());
        } else {
            throw new SchemaException("Too many schema elements");
        }
    } else if (elements.size() == 1) {
        xsub = parseElementContent(elements.get(0));
    } else {
        xsub = parseElementList(elements);
    }
    xmap.merge(elementQName, xsub);
}

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

/**
 * This methods check if we want to show property in form (e.g.
 * failedLogins, fetchResult, lastFailedLoginTimestamp must be invisible)
 * //from w w  w  . j a  v a2 s  . c om
 * @return
 * @deprecated will be implemented through annotations in schema
 */
@Deprecated
private boolean skipProperty(PrismPropertyDefinition def) {
    final List<QName> names = new ArrayList<QName>();
    names.add(PasswordType.F_FAILED_LOGINS);
    names.add(PasswordType.F_LAST_FAILED_LOGIN);
    names.add(PasswordType.F_LAST_SUCCESSFUL_LOGIN);
    names.add(PasswordType.F_PREVIOUS_SUCCESSFUL_LOGIN);
    names.add(ObjectType.F_FETCH_RESULT);
    // activation
    names.add(ActivationType.F_EFFECTIVE_STATUS);
    names.add(ActivationType.F_VALIDITY_STATUS);
    // user
    names.add(UserType.F_RESULT);
    // org and roles
    names.add(OrgType.F_APPROVAL_PROCESS);
    names.add(OrgType.F_APPROVER_EXPRESSION);
    names.add(OrgType.F_AUTOMATICALLY_APPROVED);
    names.add(OrgType.F_CONDITION);

    for (QName name : names) {
        if (name.equals(def.getName())) {
            return true;
        }
    }

    return false;
}

From source file:com.evolveum.midpoint.prism.schema.PrismSchema.java

/**
* Finds complex type definition by type name.
*//*from   w w  w . ja  v  a  2s  .c o  m*/
public ComplexTypeDefinition findComplexTypeDefinition(QName typeName) {
    if (typeName == null) {
        throw new IllegalArgumentException("typeName must be supplied");
    }
    // TODO: check for multiple definition with the same type
    for (Definition definition : definitions) {
        if (definition instanceof ComplexTypeDefinition && typeName.equals(definition.getTypeName())) {
            return (ComplexTypeDefinition) definition;
        }
    }
    return null;
}