<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello Xiaoshu,</p>
<p>I am still not sure I completely understand your use case, but
maybe the simplest thing your connector can do is to mirror
__UID__ to __NAME__ itself (if the name is not known). This is
actually what many connectors do.</p>
<p>See also <a moz-do-not-send="true"
href="https://docs.evolveum.com/connectors/connid/1.x/connector-development-guide/#__uid__-and-__name__-are-the-same"
class="moz-txt-link-freetext">https://docs.evolveum.com/connectors/connid/1.x/connector-development-guide/#__uid__-and-__name__-are-the-same</a>.</p>
<p>I am not sure why both of these are obligatory in ConnId
(originally ICF, then OpenICF).</p>
<p>The <font face="monospace">ShadowUtil.determineShadowName</font>
method is maybe not very consistent, I must admit. (I have looked
at it right now.) For example, it is called from a couple of
places in midPoint, and a caller usually catches SchemaException,
and continues with "no name" situation. I am not sure about your
specific situation, because I don't know exact midPoint version,
whole stack trace, and so on. But I think the best you can do is
simply to return both __UID__ and __NAME__ from your connector,
and (hopefully) midPoint will be happy with it.</p>
<p>Best regards,<br>
</p>
<pre class="moz-signature" cols="72">--
Pavol Mederly
Software developer
evolveum.com</pre>
<div class="moz-cite-prefix">On 06/07/2022 17:34, Wang, Xiaoshu via
midPoint wrote:<br>
</div>
<blockquote type="cite"
cite="mid:BL0PR03MB42437236D1A8DE492868B0689C809@BL0PR03MB4243.namprd03.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}@font-face
{font-family:"Times New Roman \(Body CS\)";
panose-1:2 11 6 4 2 2 2 2 2 4;}@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
font-size:10.0pt;
font-family:"Courier New";}span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Consolas",serif;}span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}</style>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:16.0pt">Pavol:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt">Conceptually,
I know “why” it throws the exception but I wonder if it can
be considered as a “bug” or “improvement” for the midpoint.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt">I have a
particular use case, where I have a resource that I only
need to do outbound mapping. The resource, however, does not
provide an API for me to do something like getAll()
operations. In other words, I cannot do an initial import
kind of task to force midpoint to create all the shadow
account.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt">Thus, when a
property change that triggers an outbound mapping, midpoint
noted that the resource does not exist, so it calls the
create() method on the connector. Unlike the executeQuery
method, which can construct a connectorObject and ask
midpoint to handle it. The create method can only return a
“Uid”. I understand the rational under this as the
connector.create() is meant to create a remote resource as
opposed to create the shadow account, (I guess is mirrored
by the connectorObject). Upon receiving the UID, the
midpoint then creates a matching shadow account with it (due
to the absence of it). However, as both __UID__ and __NAME__
are *<b>required</b>* attributes for a connectorObject
(i.e., shadow account), then a later verification step
failed the check and throws the exception.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt">The
exception appears non-preemptive, i.e., it does create the
shadow account, which name, I can later fill when the
updateDelta is called. The exception trace would be more of
a nuance than error. Yet, I think it would be nice that
midpoint can do some auto remedy for it. For example, during
the validation phase, copy the __uid__ to __name__ if the
latter is absent etc.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt">Or, if there
might be some other way to get around this particular use
case of mine, I would be glad to hear it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt">Xiaoshu<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">midPoint
<a class="moz-txt-link-rfc2396E" href="mailto:midpoint-bounces@lists.evolveum.com"><midpoint-bounces@lists.evolveum.com></a> on behalf of
Pavol Mederly via midPoint
<a class="moz-txt-link-rfc2396E" href="mailto:midpoint@lists.evolveum.com"><midpoint@lists.evolveum.com></a><br>
<b>Date: </b>Wednesday, July 6, 2022 at 5:10 AM<br>
<b>To: </b><a class="moz-txt-link-abbreviated" href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a>
<a class="moz-txt-link-rfc2396E" href="mailto:midpoint@lists.evolveum.com"><midpoint@lists.evolveum.com></a><br>
<b>Cc: </b>Pavol Mederly <a class="moz-txt-link-rfc2396E" href="mailto:mederly@evolveum.com"><mederly@evolveum.com></a><br>
<b>Subject: </b>Re: [midPoint] Couldn't determine shadow
name<o:p></o:p></span></p>
</div>
<p>Hi Xiaoshu,<o:p></o:p></p>
<p>I always recommend to have a look at the code that throws the
exception. In your case it's most probably this one:<o:p></o:p></p>
<p><a
href="https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FEvolveum%2Fmidpoint%2Fblob%2Fd317537626a99db32764c486507f1c1ac5a47fb6%2Finfra%2Fschema%2Fsrc%2Fmain%2Fjava%2Fcom%2Fevolveum%2Fmidpoint%2Fschema%2Futil%2FShadowUtil.java%23L688-L736&data=05%7C01%7C%7C6db71273b9e54c31b99b08da5f2f5dc8%7C58b3d54f16c942d3af081fcabd095666%7C1%7C0%7C637926954285726547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=hAMdFcxeO%2FQlRRUqGHNHQCoLi4sWNZzxRQummPvlDtE%3D&reserved=0"
moz-do-not-send="true">https://github.com/Evolveum/midpoint/blob/d317537626a99db32764c486507f1c1ac5a47fb6/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ShadowUtil.java#L688-L736</a><o:p></o:p></p>
<p>(lines are shifted probably because of midPoint version
mismatch)<o:p></o:p></p>
<p>It should give you a clue - e.g. does your object have a
primary identifier set? Etc...<o:p></o:p></p>
<p>Regards,<o:p></o:p></p>
<pre>-- <o:p></o:p></pre>
<pre>Pavol Mederly<o:p></o:p></pre>
<pre>Software developer<o:p></o:p></pre>
<pre>evolveum.com<o:p></o:p></pre>
<div>
<p class="MsoNormal">On 23/06/2022 15:27, Wang, Xiaoshu via
midPoint wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:16.0pt">Hi,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt">I am
developing a custom connector. When I assign the resource
connected with that connector, I got the following
exception.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt">com.evolveum.midpoint.util.exception.SchemaException:
Could not determine shadow name.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt">
at
com.evolveum.midpoint.schema.util.ShadowUtil.determineShadowStringName(ShadowUtil.java:695)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt">
at
com.evolveum.midpoint.schema.util.ShadowUtil.determineShadowName(ShadowUtil.java:667)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt">
….</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt">The
exception seems not do anything “harmful” as far as I can
tell because the new account would be listed under the
resource. But I want to know why. Hope someone can shed
some light on for me.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt">Xiaoshu</span><o:p></o:p></p>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>midPoint mailing list<o:p></o:p></pre>
<pre><a href="mailto:midPoint@lists.evolveum.com" moz-do-not-send="true" class="moz-txt-link-freetext">midPoint@lists.evolveum.com</a><o:p></o:p></pre>
<pre><a href="https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.evolveum.com%2Fmailman%2Flistinfo%2Fmidpoint&data=05%7C01%7C%7C6db71273b9e54c31b99b08da5f2f5dc8%7C58b3d54f16c942d3af081fcabd095666%7C1%7C0%7C637926954285726547%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=c%2FCeTzy7i7FA5tBl2pWQBA4Wnb1j%2FdOkMCDAltEdPAQ%3D&reserved=0" moz-do-not-send="true">https://lists.evolveum.com/mailman/listinfo/midpoint</a><o:p></o:p></pre>
</blockquote>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-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="https://lists.evolveum.com/mailman/listinfo/midpoint">https://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
</body>
</html>