List of usage examples for javax.xml.namespace QName equals
public final boolean equals(Object objectToTest)
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 QName
s are considered equal if and only if both the Namespace URI and local part are equal.
From source file:com.example.soaplegacy.WsdlValidator.java
private List<AssertionError> convertErrors(List<XmlError> errors) { if (errors.size() > 0) { List<AssertionError> response = new ArrayList<AssertionError>(); for (Iterator<XmlError> i = errors.iterator(); i.hasNext();) { XmlError error = i.next();// w w w .jav a 2s .c om if (error instanceof XmlValidationError) { XmlValidationError e = ((XmlValidationError) error); QName offendingQName = e.getOffendingQName(); if (offendingQName != null) { if (offendingQName.equals( new QName(wsdlContext.getSoapVersion().getEnvelopeNamespace(), "encodingStyle"))) { log.debug("ignoring encodingStyle validation.."); continue; } else if (offendingQName.equals( new QName(wsdlContext.getSoapVersion().getEnvelopeNamespace(), "mustUnderstand"))) { log.debug("ignoring mustUnderstand validation.."); continue; } } } AssertionError assertionError = new AssertionError(error); if (!response.contains(assertionError)) response.add(assertionError); } return new ArrayList<AssertionError>(response); } return new ArrayList<AssertionError>(); }
From source file:com.evolveum.midpoint.prism.schema.PrismSchema.java
private <T extends PrismContainerDefinition> T findContainerDefinitionByType(QName typeName, Class<T> type) { if (typeName == null) { throw new IllegalArgumentException("typeName must be supplied"); }/*from w w w .java2 s.co m*/ // TODO: check for multiple definition with the same type for (Definition definition : definitions) { if (type.isAssignableFrom(definition.getClass()) && typeName.equals(definition.getTypeName())) { return (T) definition; } } return null; }
From source file:com.evolveum.midpoint.web.component.prism.ContainerValueWrapper.java
/** * This methods check if we want to show property in form (e.g. * failedLogins, fetchResult, lastFailedLoginTimestamp must be invisible) * * @return//w ww . j a v a2s . c o m * @deprecated will be implemented through annotations in schema */ @Deprecated private boolean skipProperty(PrismPropertyDefinition def) { 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); for (QName name : names) { if (name.equals(def.getName())) { return true; } } return false; }
From source file:com.evolveum.midpoint.model.impl.lens.Construction.java
public boolean containsAssociationMapping(QName assocName) { for (MappingImpl<?, ?> mapping : getAssociationMappings()) { if (assocName.equals(mapping.getItemName())) { return true; }/*from w w w .ja va2 s.c o m*/ } return false; }
From source file:com.evolveum.midpoint.model.impl.lens.Construction.java
public boolean containsAttributeMapping(QName attributeName) { for (MappingImpl<?, ?> mapping : getAttributeMappings()) { if (attributeName.equals(mapping.getItemName())) { return true; }//from w ww . j a v a 2s . co m } return false; }
From source file:com.evolveum.midpoint.web.component.prism.ContainerWrapper.java
public ItemWrapper findPropertyWrapper(QName name) { Validate.notNull(name, "QName must not be null."); for (ItemWrapper wrapper : getItems()) { if (name.equals(wrapper.getItem().getElementName())) { return wrapper; }//w w w.ja v a2s.c o m } return null; }
From source file:com.evolveum.midpoint.repo.sql.query2.restriction.ReferenceRestriction.java
@Override public Condition interpretInternal() throws QueryException { String hqlPath = getHqlDataInstance().getHqlPath(); LOGGER.trace("interpretInternal starting with hqlPath = {}", hqlPath); List<? extends PrismValue> values = filter.getValues(); if (values != null && values.size() > 1) { throw new QueryException("Ref filter '" + filter + "' contain more than one reference value (which is not supported for now)."); }/*from w w w. ja va2 s.com*/ PrismReferenceValue refValue = null; if (values != null && !values.isEmpty()) { refValue = (PrismReferenceValue) values.get(0); } InterpretationContext context = getContext(); RootHibernateQuery hibernateQuery = context.getHibernateQuery(); String refValueOid = null; QName refValueRelation = null; QName refValueTargetType = null; if (refValue != null) { refValueOid = refValue.getOid(); refValueRelation = refValue.getRelation(); refValueTargetType = refValue.getTargetType(); } AndCondition conjunction = hibernateQuery.createAnd(); conjunction.add(handleEqOrNull(hibernateQuery, hqlPath + "." + ObjectReference.F_TARGET_OID, refValueOid)); if (refValueOid != null) { if (refValueRelation == null) { // Return only references without relation conjunction.add( hibernateQuery.createEq(hqlPath + "." + ObjectReference.F_RELATION, RUtil.QNAME_DELIMITER)); } else if (refValueRelation.equals(PrismConstants.Q_ANY)) { // Return all relations => no restriction } else { // return references with specific relation conjunction.add(handleEqOrNull(hibernateQuery, hqlPath + "." + ObjectReference.F_RELATION, RUtil.qnameToString(refValueRelation))); } if (refValueTargetType != null) { conjunction.add(handleEqOrNull(hibernateQuery, hqlPath + "." + ObjectReference.F_TYPE, ClassMapper.getHQLTypeForQName(refValueTargetType))); } } // TODO what about isNotNull if necessary ? return conjunction; }
From source file:com.evolveum.midpoint.repo.sql.query.restriction.ReferenceRestriction.java
@Override public Criterion interpretInternal(RefFilter filter) throws QueryException { // let's check the value (null is not supported yet) List<? extends PrismValue> values = filter.getValues(); if (values != null && values.size() > 1) { throw new QueryException("Ref filter '" + filter + "' contain more than one reference value (which is not supported for now)."); }/* w w w .jav a2 s. c om*/ PrismReferenceValue refValue = null; if (values != null && !values.isEmpty()) { refValue = (PrismReferenceValue) values.get(0); } QueryContext context = getContext(); ItemPath fullPath = filter.getFullPath(); // actually, we cannot look for ReferenceDefinition here, because e.g. linkRef has a CollectionDefinition Definition def = findProperDefinition(fullPath, Definition.class); if (def == null) { throw new QueryException("Definition for " + fullPath + " couldn't be found."); } // ugly hacking, todo refactor! StringBuilder sb = new StringBuilder(); if (def instanceof ReferenceDefinition) { ItemPath parentPath = filter.getParentPath(); // hack: construction/resourceRef->resourceRef if (QNameUtil.match(ConstructionType.F_RESOURCE_REF, filter.getElementName()) && parentPath != null && parentPath.last() instanceof NameItemPathSegment && QNameUtil.match( AssignmentType.F_CONSTRUCTION, ((NameItemPathSegment) parentPath.last()).getName())) { parentPath = parentPath.allExceptLast(); } String alias = context.getAlias(parentPath); if (StringUtils.isNotEmpty(alias)) { sb.append(alias); sb.append('.'); } sb.append(createPropertyOrReferenceNamePrefix(filter.getPath())); // i'm not sure about this [mederly] String referenceName = def.getJpaName(); sb.append(referenceName); sb.append("."); } else { String alias = context.getAlias(filter.getPath()); if (StringUtils.isNotEmpty(alias)) { sb.append(alias); sb.append('.'); } sb.append(createPropertyOrReferenceNamePrefix(filter.getPath())); // i'm not sure about this [mederly] } String prefix = sb.toString(); String refValueOid = null; QName refValueRelation = null; QName refValueTargetType = null; if (refValue != null) { refValueOid = refValue.getOid(); refValueRelation = refValue.getRelation(); refValueTargetType = refValue.getTargetType(); } Conjunction conjunction = Restrictions.conjunction(); conjunction.add(handleEqOrNull(prefix + ObjectReference.F_TARGET_OID, refValueOid)); if (refValueOid != null) { if (refValueRelation == null) { // Return only references without relation conjunction.add(Restrictions.eq(prefix + ObjectReference.F_RELATION, RUtil.QNAME_DELIMITER)); } else if (refValueRelation.equals(PrismConstants.Q_ANY)) { // Return all relations => no restriction } else { // return references with specific relation conjunction.add( handleEqOrNull(prefix + ObjectReference.F_RELATION, RUtil.qnameToString(refValueRelation))); } if (refValueTargetType != null) { conjunction.add(handleEqOrNull(prefix + ObjectReference.F_TYPE, ClassMapper.getHQLTypeForQName(refValueTargetType))); } } // TODO what about isNotNull if necessary ? return conjunction; }
From source file:com.evolveum.midpoint.prism.schema.PrismSchema.java
private <T extends PrismContainerDefinition> T findContainerDefinitionByElementName(QName elementName, Class<T> type) {/*from w ww . j a va 2s . c o m*/ if (elementName == null) { throw new IllegalArgumentException("elementName must be supplied"); } // TODO: check for multiple definition with the same type for (Definition definition : definitions) { if (type.isAssignableFrom(definition.getClass()) && elementName.equals(((PrismContainerDefinition) definition).getName())) { return (T) definition; } } return null; }
From source file:com.evolveum.midpoint.prism.schema.PrismSchema.java
private <T extends PrismPropertyDefinition> T findPropertyDefinitionByElementName(QName elementName, Class<T> type) {// w w w. j a v a 2 s . co m if (elementName == null) { throw new IllegalArgumentException("elementName must be supplied"); } // TODO: check for multiple definition with the same type for (Definition definition : definitions) { if (type.isAssignableFrom(definition.getClass()) && elementName.equals(((PrismPropertyDefinition) definition).getName())) { return (T) definition; } } return null; }