<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hi Sebastien<br></div><div><br data-mce-bogus="1"></div><div>Sorry about the missing SchemaConstant constants. Object type constant for a particular type is best to be found directly in the class of that type as the field <!--StartFragment--><strong>COMPLEX_TYPE,</strong><!--EndFragment--> e.g.:<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>com.evolveum.midpoint.xml.ns._public.common.common_3.<strong>OrgType.COMPLEX_TYPE</strong><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Most if not all object types are in the same package, so you can import it for convenience.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>As a side note, strings are immutable so you don't need to write <strong>new String("...")</strong>, just use that <strong>"..."</strong> directly as it's immutable.</div><div>Instead of:<br data-mce-bogus="1"></div><div> <!--StartFragment--><span lang="EN-US">String orgType = new String("{http://midpoint.evolveum.com/xml/ns/public/common/common-3}OrgType");</span> </div><div><span lang="EN-US"><br data-mce-bogus="1"></span></div><div><span lang="EN-US">...you can simply write:<br> <!--StartFragment--> String orgType = "{http://midpoint.evolveum.com/xml/ns/public/common/common-3}OrgType";</span></div><div><span lang="EN-US"><br data-mce-bogus="1"></span></div><div><span lang="EN-US">But your<!--EndFragment--> original code should work with this line now (assuming the proper import is added):<br data-mce-bogus="1"></span></div><div><span lang="EN-US"> <!--StartFragment-->input?.targetRef.type <span style="background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;" data-mce-style="background-position: 0% 0%; background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto; background-origin: padding-box; background-clip: border-box;">== </span> <!--StartFragment--><strong>OrgType.COMPLEX_TYPE</strong><!--EndFragment-->) {<!--EndFragment--> </span></div><div><span lang="EN-US"><br data-mce-bogus="1"></span></div><div><span lang="EN-US">This issue is not related to removal of various obsolete <strong>*Type</strong> fileds, it's just a name coincidence.</span><span lang="EN-US"></span></div><div><span lang="EN-US"><br data-mce-bogus="1"></span></div><div><span lang="EN-US">Cheers<br data-mce-bogus="1"></span></div><div><span lang="EN-US"><br data-mce-bogus="1"></span></div><div><span lang="EN-US">Richard<br data-mce-bogus="1"></span></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>From: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>To: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>Cc: </b>"Sébastien MARBRIER" <smarbrier@positivethinking.tech><br><b>Sent: </b>Wednesday, December 22, 2021 12:17:27 PM<br><b>Subject: </b>[midPoint] Missing C_ORG_TYPE after migrating to midpoint 4.4<br></div><div><br><style>/*<![CDATA[*/p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin: 0.0cm;
font-size: 11.0pt;
font-family: Calibri , sans-serif;
}
a:link, span.MsoHyperlink {
color: rgb(5,99,193);
text-decoration: underline;
}
a:visited, span.MsoHyperlinkFollowed {
color: rgb(149,79,114);
text-decoration: underline;
}
span.EmailStyle17 {
font-family: Calibri , sans-serif;
color: windowtext;
}
*.MsoChpDefault {
font-family: Calibri , sans-serif;
}
div.WordSection1 {
page: WordSection1;
}
/*]]>*/</style></div><div data-marker="__QUOTED_TEXT__">
<div class="WordSection1">
<p class="MsoNormal">Hello,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-US">In several places, there some code similar to this one below with a check on the target type as Organization type.</span></p>
<p class="MsoNormal"><span lang="EN-US">However since midpoint 4.4 the C_ORG_TYPE constant has been removed from the SchemaConstant.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><inbound></p>
<p class="MsoNormal"> <description>[snip]</description></p>
<p class="MsoNormal"> <span lang="EN-US"><expression></span></p>
<p class="MsoNormal"><span lang="EN-US"> <assignmentTargetSearch></span></p>
<p class="MsoNormal"><span lang="EN-US"> <targetType>c:OrgType</targetType></span></p>
<p class="MsoNormal"><span lang="EN-US"> <filter></span></p>
<p class="MsoNormal"><span lang="EN-US"> <q:equal></span></p>
<p class="MsoNormal"><span lang="EN-US"> <q:path>c:name</q:path></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span>
<expression></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-indent:35.4pt">[snip]</p>
<p class="MsoNormal"> </expression></p>
<p class="MsoNormal"> </q:equal></p>
<p class="MsoNormal"> <span lang="EN-US"></filter></span></p>
<p class="MsoNormal"><span lang="EN-US"> </assignmentTargetSearch></span></p>
<p class="MsoNormal"><span lang="EN-US"> </expression></span></p>
<p class="MsoNormal"> <target></p>
<p class="MsoNormal"> <set></p>
<p class="MsoNormal"> <condition></p>
<p class="MsoNormal"> <script></p>
<p class="MsoNormal"> <code></p>
<p class="MsoNormal"> import com.evolveum.midpoint.schema.constants.SchemaConstants;</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-US"> if (input?.targetRef != null &&</span></p>
<p class="MsoNormal"><span lang="EN-US"> input?.targetRef.type
<span style="background:yellow">== SchemaConstants.C_ORG_TYPE</span>) {<!-- --></span></p>
<p class="MsoNormal"><span lang="EN-US"> orgFonctionnelle = midpoint.getOrgByOid(input.targetRef.oid);</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span>
return orgFonctionnelle?.subtype?.contains('fonctionnel');</p>
<p class="MsoNormal"> }</p>
<p class="MsoNormal"> return false;</p>
<p class="MsoNormal"><span lang="EN-US"> </code></span></p>
<p class="MsoNormal"><span lang="EN-US"> </script></span></p>
<p class="MsoNormal"><span lang="EN-US"> </condition></span></p>
<p class="MsoNormal"><span lang="EN-US"> </set></span></p>
<p class="MsoNormal"><span lang="EN-US"> <c:path>$focus/assignment</c:path></span></p>
<p class="MsoNormal"><span lang="EN-US"> </target></span></p>
<p class="MsoNormal"><span lang="EN-US"> </inbound></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I would understand, it is related the removal of the objectType, employeeType, roleType, orgType and serviceType in midpoint 4.4 schema but the C_OBJECT_TYPE is still present and neither C_EMPLOYEE_TYPE nor C_ROLE_TYPE
existed in 4.0.1 version of SchemaConstant.</span></p>
<p class="MsoNormal"><span lang="EN-US"><a href="https://evolveum.com/downloads/midpoint/4.0.1/midpoint-api-4.0.1-javadoc/com/evolveum/midpoint/schema/constants/SchemaConstants.html" target="_blank" rel="nofollow noopener noreferrer">https://evolveum.com/downloads/midpoint/4.0.1/midpoint-api-4.0.1-javadoc/com/evolveum/midpoint/schema/constants/SchemaConstants.html</a>
I beleive my issue is not related.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">As a workaround I replaced the C_ORG_TYPE by the following piece of code</span></p>
<p class="MsoNormal"><span lang="EN-US">String orgType = new String("{http://midpoint.evolveum.com/xml/ns/public/common/common-3}OrgType");</span></p>
<p class="MsoNormal"><span lang="EN-US">if (input?.targetRef != null &&</span></p>
<p class="MsoNormal"><span lang="EN-US">input?.targetRef.type.toString().equals(orgType))
</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Indeed it is ugly but for now I do not see any other solution. Would anybody can tell be if it is a bug in midpoint 4.4 or if there is a better way ?</span></p>
<p class="MsoNormal"><span lang="EN-US">Currently the owner of the midpoint installation is not ready to use the archetypes for this part.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards,</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"> </p>
<table class="MsoNormalTable" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="width:141pt;border:none;border-right:solid #ff1738 2.25pt;padding:0cm 7.5pt 0cm 0cm" width="188">
<p class="MsoNormal" style="text-align:right" align="right">
<a href="https://www.positivethinking.tech/" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:1.7708in;height:0.8229in" id="_x0000_i1031" src="cid:image001.png@01D7F72D.BD7242D0" alt="logo" width="170" height="79" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</td><td style="width:7.5pt;padding:0cm 0cm 0cm 0cm" width="10">
<p class="MsoNormal"><span style="font-size:12pt;font-family:'times new roman' , serif"> </span></p>
</td><td style="width:372.75pt;padding:0cm 0cm 0cm 0cm" width="497" valign="top">
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:'tahoma' , sans-serif;color:#ff0044" lang="EN-US">Sébastien Marbrier</span></b><span style="font-size:10pt;font-family:'tahoma' , sans-serif;color:#ff0044" lang="EN-US">
</span><span style="font-size:10pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US"> | Senior IT Consultant<br>
</span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777"><a href="mailto:smarbrier@positivethinking.tech" target="_blank" rel="nofollow noopener noreferrer"><span style="color:#ff0044" lang="EN-US">smarbrier@positivethinking.tech</span></a></span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777">
</span><span style="font-size:5pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US"><br>
</span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US"><br>
Tel. </span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777"><span style="color:#777777;text-decoration:none">+41 21 601 81 00</span>
</span><span style="font-size:5pt;font-family:'tahoma' , sans-serif;color:#777777"><br>
</span><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777"></span></p>
<table class="MsoNormalTable" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><a href="https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1030" src="cid:image002.png@01D7F72D.BD7242D0" alt="Teams chat" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</td><td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:12pt;font-family:'times new roman' , serif"><a href="https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777;text-decoration:none"> </span></a>
</span></p>
</td><td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:12pt;font-family:'times new roman' , serif"><a href="https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US">Chat
with me on Teams</span></a></span><span style="font-size:12pt;font-family:'times new roman' , serif">
<span lang="EN-US"></span></span></p>
</td></tr></tbody></table>
<p class="MsoNormal"><span style="font-size:1pt;font-family:'tahoma' , sans-serif;color:#777777" lang="EN-US"><br>
</span><span style="font-size:12pt;font-family:'times new roman' , serif" lang="EN-US"></span></p>
</td></tr><tr><td style="border:none;border-right:solid #ff1738 2.25pt;padding:0cm 7.5pt 0cm 0cm">
<p class="MsoNormal" style="text-align:right" align="right">
<span style="font-size:12pt;font-family:'times new roman' , serif" lang="EN-US"><br>
</span><a href="https://www.linkedin.com/company/the-positive-thinking-company/" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1029" src="cid:image003.png@01D7F72D.BD7242D0" alt="LinkedIn" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif">
</span><a href="https://www.instagram.com/positivethinkingcompany/" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1028" src="cid:image004.png@01D7F72D.BD7242D0" alt="Instagram" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif">
</span><a href="https://twitter.com/PTC_Tech" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1027" src="cid:image005.png@01D7F72D.BD7242D0" alt="Vimeo" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif">
</span><a href="https://youtube.com/channel/UCfaImWa6r0IoZoUYLhbiF7w" target="_blank" rel="nofollow noopener noreferrer"><span style="font-size:12pt;font-family:'times new roman' , serif;color:blue;text-decoration:none"><img style="width:0.2083in;height:0.2083in" id="_x0000_i1026" src="cid:image006.png@01D7F72D.BD7242D0" alt="Vimeo" width="20" height="20" border="0"></span></a><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</td><td style="padding:0cm 0cm 0cm 0cm" valign="bottom"></td><td style="padding:0cm 0cm 0cm 0cm" valign="bottom">
<p class="MsoNormal"><span style="font-size:9pt;font-family:'tahoma' , sans-serif;color:#777777">Avenue de cour, 135 – 1007 Lausanne<br>
<a href="https://www.positivethinking.tech/" target="_blank" rel="nofollow noopener noreferrer"><span style="color:#ff0044">www.positivethinking.tech</span></a>
<br>
</span><span style="font-size:3.5pt;font-family:'tahoma' , sans-serif;color:#777777"> </span><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</td></tr></tbody></table>
<div class="MsoNormal" style="text-align:center" align="center"><span style="font-size:12pt;font-family:'times new roman' , serif">
<hr width="100%" size="2" align="center">
</span></div>
<p class="MsoNormal"><b><span style="font-size:8pt;font-family:'roboto';color:#ff0044" lang="EN-US">Help save paper, do you really need to print this email?</span></b><span style="font-size:8pt;font-family:'roboto';color:#ff0044" lang="EN-US">
</span><span style="font-size:12pt;font-family:'times new roman' , serif" lang="EN-US"><br>
</span><i><span style="font-size:8pt;font-family:'roboto';color:#777777" lang="EN-US">The content of this email and any attachments are confidential and are intended solely for the person and/or company to whom they are addressed.
The information may also be legally privileged. No employee or agent is authorized to conclude any binding agreement on behalf of Positive Thinking Company with another party by email without express written confirmation. If you have received this email in
error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by return E-mail and delete this message, its attachments and all copies from your system.
Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions.
</span></i><i><span style="font-size:8pt;font-family:'roboto';color:#777777">Thank you for your cooperation.
<br>
</span></i></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
</div>
<p></p>
<hr>
<span style="font-size:8px"><em><span style="font-family:'roboto' , 'arial'"><span style="color:#777777">Positive Thinking Company puts security at a high priority in its conduct of business. Therefore, we have put our best efforts into ensuring that this email and
its attached documents are error and virus-free. Nonetheless, full security of emails/documents cannot be ensured. Therefore, the recipient is responsible for checking the email/documents for threats with its own security measures, prior to opening it. Positive
Thinking Company does not accept liability for any damage inflicted by using the content of this email/documents. If you are not the intended recipient, please notify the sender and delete this email/document.</span></span></em></span>
<p></p>
<br>_______________________________________________<br>midPoint mailing list<br>midPoint@lists.evolveum.com<br>https://lists.evolveum.com/mailman/listinfo/midpoint<br></div></div></body></html>