use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class ObjectSetUtil method getQueryFromTaskObjectRef.
private static QueryType getQueryFromTaskObjectRef(ObjectReferenceType objectRef) {
if (objectRef == null) {
return null;
}
SearchFilterType filterType = objectRef.getFilter();
if (filterType == null || FilterUtil.isFilterEmpty(filterType)) {
return null;
}
QueryType queryType = new QueryType();
queryType.setFilter(filterType);
return queryType;
}
use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class TestQueryConverter method test930EqualsWithTypedValue.
/**
* MID-6658
*/
@Test
public void test930EqualsWithTypedValue() throws Exception {
SearchFilterType filterBean = PrismTestUtil.parseAtomicValue(FILTER_EQUALS_WITH_TYPED_VALUE, SearchFilterType.COMPLEX_TYPE);
ObjectQuery query;
try {
query = getQueryConverter().createObjectQuery(UserType.class, filterBean);
displayQuery(query);
assertNotNull(query);
ObjectFilter filter = query.getFilter();
PrismAsserts.assertEqualsFilter(query.getFilter(), EXT_LONG_TYPE, DOMUtil.XSD_LONG, EXT_LONG_TYPE_PATH);
PrismAsserts.assertEqualsFilterValue((EqualFilter) filter, 4L);
QueryType convertedQueryBean = toQueryType(query);
displayQueryType(convertedQueryBean);
} catch (Exception ex) {
logger.error("Error while converting query: {}", ex.getMessage(), ex);
throw ex;
}
}
use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class TestQueryConverter method testTypeFilterQuery.
@Test
public void testTypeFilterQuery() throws Exception {
SearchFilterType filterType = PrismTestUtil.parseAtomicValue(FILTER_BY_TYPE_FILE, SearchFilterType.COMPLEX_TYPE);
ObjectQuery query;
try {
query = getQueryConverter().createObjectQuery(ConnectorType.class, filterType);
displayQuery(query);
assertNotNull(query);
ObjectFilter filter = query.getFilter();
assertTrue("filter is not an instance of type filter", filter instanceof TypeFilter);
TypeFilter typeFilter = (TypeFilter) filter;
assertEquals(typeFilter.getType(), UserType.COMPLEX_TYPE);
assertNotNull("filter in type filter must not be null", typeFilter.getFilter());
ItemPath namePath = UserType.F_NAME;
PrismPropertyDefinition ppd = getUserDefinition().findPropertyDefinition(namePath);
PrismAsserts.assertEqualsFilter(typeFilter.getFilter(), ppd.getItemName(), ppd.getTypeName(), namePath);
PrismAsserts.assertEqualsFilterValue((EqualFilter) typeFilter.getFilter(), PrismTestUtil.createPolyString("some name identificator"));
QueryType convertedQueryType = toQueryType(query);
displayQueryType(convertedQueryType);
} catch (Exception ex) {
logger.error("Error while converting query: {}", ex.getMessage(), ex);
throw ex;
}
}
use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class TestQueryConverter method testAccountQueryAttributesAndResource.
@Test
public void testAccountQueryAttributesAndResource() throws Exception {
SearchFilterType filterType = unmarshalFilter(FILTER_ACCOUNT_ATTRIBUTES_RESOURCE_REF_FILE);
ObjectQuery query = toObjectQuery(ShadowType.class, filterType);
displayQuery(query);
assertNotNull(query);
ObjectFilter filter = query.getFilter();
PrismAsserts.assertAndFilter(filter, 2);
ObjectFilter first = getFilterCondition(filter, 0);
PrismAsserts.assertRefFilter(first, ShadowType.F_RESOURCE_REF, ObjectReferenceType.COMPLEX_TYPE, ShadowType.F_RESOURCE_REF);
assertRefFilterValue((RefFilter) first, "aae7be60-df56-11df-8608-0002a5d5c51b");
ObjectFilter second = getFilterCondition(filter, 1);
PrismAsserts.assertEqualsFilter(second, ICF_NAME, DOMUtil.XSD_STRING, ItemPath.create(ShadowType.F_ATTRIBUTES, ICF_NAME));
PrismAsserts.assertEqualsFilterValue((EqualFilter) second, "uid=jbond,ou=People,dc=example,dc=com");
QueryType convertedQueryType = toQueryType(query);
// logger.info(DOMUtil.serializeDOMToString(convertedQueryType.getFilter().getFilterClauseAsElement(getPrismContext())));
}
use of net.opengis.wfs.v_1_1_0.QueryType in project midpoint by Evolveum.
the class TestQueryConverter method test920QueryTypeEquals.
// Q{AND(IN OID: 8657eccf-c60d-4b5c-bbd4-4c73ecfd6436; ,REF: resourceRef,PRV(oid=aeff994e-381a-4fb3-af3b-f0f5dcdc9653, targetType=null),EQUAL: kind,PPV(ShadowKindType:ENTITLEMENT),EQUAL: intent,PPV(String:group)),null
@Test
public void test920QueryTypeEquals() throws Exception {
ObjectQuery query1 = getPrismContext().queryFor(ShadowType.class).id("8657eccf-c60d-4b5c-bbd4-4c73ecfd6436").and().item(ShadowType.F_RESOURCE_REF).ref("aeff994e-381a-4fb3-af3b-f0f5dcdc9653").and().item(ShadowType.F_KIND).eq(ShadowKindType.ENTITLEMENT).and().item(ShadowType.F_INTENT).eq("group").build();
ObjectQuery query2 = getPrismContext().queryFor(ShadowType.class).id("8657eccf-c60d-4b5c-bbd4-4c73ecfd6436").and().item(ShadowType.F_RESOURCE_REF).ref("aeff994e-381a-4fb3-af3b-f0f5dcdc9653").and().item(ShadowType.F_KIND).eq(ShadowKindType.ENTITLEMENT).and().item(ShadowType.F_INTENT).eq("group").build();
System.out.println(query1.equals(query2));
QueryType bean1 = getPrismContext().getQueryConverter().createQueryType(query1);
QueryType bean2 = getPrismContext().getQueryConverter().createQueryType(query2);
System.out.println(bean1.equals(bean2));
System.out.println(bean1.hashCode() == bean2.hashCode());
}
Aggregations