<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello Samu,<br>
      <br>
      because midPoint uses multiple formats for data serialization
      (XML, JSON, YAML - although the support for latter two is not
      fully finished yet), we don't rely on JAXB any more. We treat some
      data structures (mainly in the prism module) in quite a custom
      way. This causes some slight issues when trying to cooperate with
      JAXB serialization, namely, when interfacing via Web Services.<br>
      <br>
      So, to answer your questions: The weird setFilterClause method and
      its "Element" parameter is one of these issues. <br>
      <br>
      One of the methods how to create queries can be seen in the
      model-client-sample:<br>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <pre style="background-color:#ffffff;color:#000000;font-family:'Courier New';font-size:9,0pt;"><small><small><span style="color:#808080;font-style:italic;">// WARNING: in a real case make sure that the username is properly escaped before putting it in XML
</span>SearchFilterType filter = ModelClientUtil.<span style="font-style:italic;">parseSearchFilterType</span>(
        <span style="color:#008000;font-weight:bold;">"<equal xmlns='<a class="moz-txt-link-freetext" href="http://prism.evolveum.com/xml/ns/public/query-3">http://prism.evolveum.com/xml/ns/public/query-3</a>' xmlns:c='<a class="moz-txt-link-freetext" href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>' >" </span>+
                <span style="color:#008000;font-weight:bold;">"<path>c:name</path>" </span>+
                <span style="color:#008000;font-weight:bold;">"<value>" </span>+ username + <span style="color:#008000;font-weight:bold;">"</value>" </span>+
                <span style="color:#008000;font-weight:bold;">"</equal>"
</span>);
QueryType query = <span style="color:#000080;font-weight:bold;">new </span>QueryType();
query.setFilter(filter);
</small></small>
</pre>
      I tried to take your sample and make it working - it can be done
      in the following way:<br>
      <pre style="background-color:#ffffff;color:#000000;font-family:'Courier New';font-size:9,0pt;"><small>QueryType query = <span style="color:#000080;font-weight:bold;">new </span>QueryType();

SearchFilterType filter = <span style="color:#000080;font-weight:bold;">new </span>SearchFilterType();

PropertyComplexValueFilterClauseType fc = <span style="color:#000080;font-weight:bold;">new </span>PropertyComplexValueFilterClauseType();
ItemPathType path = <span style="color:#000080;font-weight:bold;">new </span>ItemPathType();
path.setValue(<span style="color:#008000;font-weight:bold;">"declare namespace c=</span><span style="color:#000080;font-weight:bold;">\"</span><span style="color:#008000;font-weight:bold;"><a class="moz-txt-link-freetext" href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a></span><span style="color:#000080;font-weight:bold;">\"</span><span style="color:#008000;font-weight:bold;">; c:name"</span>);
fc.setPath(path);
fc.setValue(username);

ObjectFactory factory = <span style="color:#000080;font-weight:bold;">new </span>ObjectFactory();
JAXBElement<PropertyComplexValueFilterClauseType> equal = factory.createEqual(fc);

JAXBContext jaxbContext = JAXBContext.<span style="font-style:italic;">newInstance</span>(<span style="color:#008000;font-weight:bold;">"com.evolveum.midpoint.xml.ns._public.common.api_types_3:" </span>+
        <span style="color:#008000;font-weight:bold;">"com.evolveum.midpoint.xml.ns._public.common.common_3:" </span>+
        <span style="color:#008000;font-weight:bold;">"com.evolveum.prism.xml.ns._public.annotation_3:" </span>+
        <span style="color:#008000;font-weight:bold;">"com.evolveum.prism.xml.ns._public.query_3:" </span>+
        <span style="color:#008000;font-weight:bold;">"com.evolveum.prism.xml.ns._public.types_3:"</span>);
Marshaller marshaller = jaxbContext.createMarshaller();
DOMResult result = <span style="color:#000080;font-weight:bold;">new </span>DOMResult();
marshaller.marshal(equal, result);
filter.setFilterClause(((Document) result.getNode()).getDocumentElement());

query.setFilter(filter);
</small>
</pre>
      (Of course, you can pre-create and cache jaxbContext or marshaller
      in order to avoid creating them each time.)<br>
      <br>
      Best regards,<br>
      Pavol<br>
      <br>
      On 3. 11. 2015 16:12, Samu Viitanen wrote:<br>
    </div>
    <blockquote cite="mid:DUB117-W17862CC6B6C2A185EDC1A5D12B0@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
      <div dir="ltr">Afternoon,<br>
        <br>
        I am having issues with the following code<br>
        <br>
                    QueryType query = new QueryType();<br>
                    <br>
                    ObjectFactory factory = new ObjectFactory();<br>
        <br>
                    SearchFilterType filter =
        factory.createSearchFilterType();<br>
                    PropertyComplexValueFilterClauseType fc =
        factory.createPropertyComplexValueFilterClauseType();<br>
                    ItemPathType path = new ItemPathType();<br>
                    path.setValue("c:name");<br>
                    fc.setPath(path);<br>
                    fc.setValue("queryvalue");<br>
                    filter.setFilterClause(??????);<br>
                    <br>
                    query.setFilter(filter);<br>
        <br>
        I noticed that SearchFilterType.setFilterClause only accepts
        org.w3c.dom.Element as a parameter. Is this intentional? If so,
        are there tools to create these dom elements? I was just
        wondering since there are plenty of ways to create the filter
        clauses, but I just dont seem to get my head around how I could
        actually set the filter clause.<br>
        <br>
        Sorry for the stupid question.<br>
        <br>
        BR<br>
        <br>
        Samu Viitanen<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>