<div dir="ltr">Hi Pavol<div><br></div><div>I think here you are deleting the inducement itself but my goal was not to delete the resource inducement but modify some attributes of induced resource. </div><div><br></div><div>Let me know if i am getting it incorrect.</div><div><br></div><div>Thanks!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 12, 2015 at 3:23 PM, Pavol Mederly <span dir="ltr"><<a href="mailto:mederly@evolveum.com" target="_blank">mederly@evolveum.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Yes, of course.<br>
<br>
I've just pushed a modified model-client-sample showing how to
swap an inducement (with a known ID) in the role definition.<br>
<br>
See this (red = removal code, green = addition code):<br>
<br>
<p><span> </span>//
removes
inducement with a given ID and replaces it with a new one<u></u><u></u></p>
<p><span> </span>private
static
void modifyRoleReplaceInducement(ModelPortType modelPort, String
roleOid, int
oldId, String newInducementOid) throws FaultMessage,
IOException, SAXException
{<u></u><u></u></p>
<p><u></u> <u></u></p>
<p><font color="#cc0000"><span>
</span>ItemDeltaType inducementDeleteDelta = new
ItemDeltaType();<u></u><u></u></font></p>
<font color="#cc0000">
</font>
<p><font color="#cc0000"><span> </span>inducementDeleteDelta.setModificationType(ModificationTypeType.DELETE);<u></u><u></u></font></p>
<font color="#cc0000">
</font>
<p><font color="#cc0000"><span>
</span>inducementDeleteDelta.setPath(ModelClientUtil.createItemPathType("inducement"));<u></u><u></u></font></p>
<font color="#cc0000">
</font>
<p><font color="#cc0000"><span>
</span>inducementDeleteDelta.getValue().add(ModelClientUtil.parseElement("<value><id>"+oldId+"</id></value>"));<u></u><u></u></font></p>
<font color="#cc0000">
</font>
<p><u></u> <u></u></p>
<p><span> <font color="#009900">
</font></span><font color="#009900">ItemDeltaType
inducementAddDelta = new ItemDeltaType();<u></u><u></u></font></p>
<font color="#009900">
</font>
<p><font color="#009900"><span>
</span>inducementAddDelta.setModificationType(ModificationTypeType.ADD);<u></u><u></u></font></p>
<font color="#009900">
</font>
<p><font color="#009900"><span>
</span>inducementAddDelta.setPath(ModelClientUtil.createItemPathType("inducement"));<u></u><u></u></font></p>
<font color="#009900">
</font>
<p><font color="#009900"><span> </span>inducementAddDelta.getValue().add(createRoleAssignment(newInducementOid));<u></u><u></u></font></p>
<p><u></u> <u></u></p>
<p><span>
</span>ObjectDeltaType deltaType = new ObjectDeltaType();<u></u><u></u></p>
<p><span>
</span>deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.class));<u></u><u></u></p>
<p><span>
</span>deltaType.setChangeType(ChangeTypeType.MODIFY);<u></u><u></u></p>
<p><span>
</span>deltaType.setOid(roleOid);<u></u><u></u></p>
<p><span>
</span>deltaType.getItemDelta().add(inducementDeleteDelta);<u></u><u></u></p>
<p><span>
</span>deltaType.getItemDelta().add(inducementAddDelta);<u></u><u></u></p>
<p><u></u> <u></u></p>
<p><span>
</span>ObjectDeltaListType deltaListType = new
ObjectDeltaListType();<u></u><u></u></p>
<p><span>
</span>deltaListType.getDelta().add(deltaType);<u></u><u></u></p>
<p><span>
</span>ObjectDeltaOperationListType objectDeltaOperationList =
modelPort.executeChanges(deltaListType, null);<u></u><u></u></p>
<span> </span>}<u></u><u></u>
<br>
<br>
The corresponding XML is like this (again, red = removal code,
green = addition code):<br>
<br>
<soap:Body><br>
<ns8:executeChanges
xmlns:ns10=<a href="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/model/scripting-3"</a>
xmlns:ns11=<a href="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3"</a>
xmlns:ns12=<a href="http://www.w3.org/2000/09/xmldsig#" target="_blank">"http://www.w3.org/2000/09/xmldsig#"</a>
xmlns:ns13=<a href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"</a>
xmlns:ns14=<a href="http://www.w3.org/2001/04/xmlenc#" target="_blank">"http://www.w3.org/2001/04/xmlenc#"</a>
xmlns:ns15=<a href="http://prism.evolveum.com/xml/ns/public/annotation-3" target="_blank">"http://prism.evolveum.com/xml/ns/public/annotation-3"</a>
xmlns:ns16=<a href="http://midpoint.evolveum.com/xml/ns/public/common/fault-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/common/fault-3"</a>
xmlns:ns2=<a href="http://prism.evolveum.com/xml/ns/public/types-3" target="_blank">"http://prism.evolveum.com/xml/ns/public/types-3"</a>
xmlns:ns3=<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>
xmlns:ns4=<a href="http://prism.evolveum.com/xml/ns/public/query-3" target="_blank">"http://prism.evolveum.com/xml/ns/public/query-3"</a>
xmlns:ns5=<a href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"</a>
xmlns:ns6=<a href="http://midpoint.evolveum.com/xml/ns/model/workflow/common-forms-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/model/workflow/common-forms-3"</a>
xmlns:ns7=<a href="http://midpoint.evolveum.com/xml/ns/model/workflow/process-instance-state-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/model/workflow/process-instance-state-3"</a>
xmlns:ns8=<a href="http://midpoint.evolveum.com/xml/ns/public/model/model-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/model/model-3"</a>
xmlns:ns9=<a href="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/common/api-types-3"</a>><br>
<ns8:deltaList><br>
<ns9:delta><br>
<ns2:changeType>modify</ns2:changeType><br>
<ns2:objectType>ns3:RoleType</ns2:objectType><br>
<ns2:oid>290acb64-f64c-4f01-8b5b-c5b745092f27</ns2:oid><br>
<font color="#cc0000"> <ns2:itemDelta><br>
<ns2:modificationType>delete</ns2:modificationType><br>
<ns2:path>declare default
namespace
'<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>';
inducement</ns2:path><br>
<ns2:value><br>
<id>2</id><br>
</ns2:value><br>
</ns2:itemDelta><br>
</font> <font color="#009900"><ns2:itemDelta><br>
<ns2:modificationType>add</ns2:modificationType><br>
<ns2:path>declare default
namespace
'<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>';
inducement</ns2:path><br>
<ns2:value
xmlns:xsi=<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">"http://www.w3.org/2001/XMLSchema-instance"</a>
xsi:type="ns3:AssignmentType"><br>
<ns3:targetRef
oid="12345678-d34d-b33f-f00d-987987cccccc"
type="ns3:RoleType"/><br>
</ns2:value><br>
</ns2:itemDelta></font><br>
</ns9:delta><br>
</ns8:deltaList><br>
</ns8:executeChanges><br>
</soap:Body><br>
<br>
Best regards,<br>
Pavol<br>
<br>
</div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">Hi
<div><br>
</div>
<div>I got this point that i can add and delete individual
attribute/value but i want to know how can i achieve with java
code or can you give me a sample xml doing this.</div>
<div><br>
</div>
<div>Regards</div>
<div>Dharmendra</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Feb 12, 2015 at 1:53 PM, Pavol
Mederly <span dir="ltr"><<a href="mailto:mederly@evolveum.com" target="_blank">mederly@evolveum.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hello Dharmendra,<span><br>
<br>
<blockquote type="cite">If the replace does not work
how can i individually add/delete attributes/values
?</blockquote>
<br>
</span> REPLACE replaces the whole inducement, i.e. all
of its values. <br>
<br>
If you want to replace just one value (e.g. you have a
values of A, B, C and you want to make it A, B, D), you
have to do the following:<br>
- delete C<br>
- add D<br>
<br>
You can (and perhaps, should) do this in one operation.<br>
<br>
Hope this helps.<span><font color="#888888"><br>
Pavol</font></span>
<div>
<div><br>
<br>
<br>
On 12. 2. 2015 9:01, Dharmendra Parakh wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">HI Pavol
<div><br>
</div>
<div>Quick Background: </div>
<div>My role had two inducements: </div>
<div>id=1: Role</div>
<div>id=2 Resource</div>
<div>I wanted to replace the resource inducement.</div>
<div><br>
</div>
<div>As per my understanding i was trying to
replace the inducement with id=2. and that does
not means to delete the other inducement (like
id=1).</div>
<div><br>
</div>
<div>If the replace does not work how can i
individually add/delete attributes/values ?</div>
<div><br>
</div>
<div>Thanks</div>
<div>Dharmendra</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Feb 12, 2015 at
1:22 PM, Pavol Mederly <span dir="ltr"><<a href="mailto:mederly@evolveum.com" target="_blank">mederly@evolveum.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hello Dharmendra,<br>
<br>
looking at your WS request: it is of
REPLACE type, see:<br>
<br>
<objectDelta ... ><br>
... <br>
<t:itemDelta><br>
<t:modificationType><b>replace</b></t:modificationType><br>
<t:path>c:<b>inducement</b></t:path><br>
<t:value id="2"><br>
...<br>
</t:value><br>
</t:itemDelta><br>
...<br>
<br>
So, basically you tell midPoint that you
want to REPLACE the values of <b>inducement</b><b>
</b>item with the ones you have provided.<br>
And you've provided one value with id=2
and content of account construction on
resource
d0811790-1d80-11e4-86b2-3c970e467874.<br>
So after the operation, the original
inducement with id=1 should be gone.<br>
<br>
Is this what you wanted to do? Perhaps no.<br>
<br>
If you want to replace only one value in
multi-valued item, you have to<br>
1) delete old value<br>
2) add new value<br>
<br>
And, I'm not quite sure about your first
mail (Manish Baid, received 01:14). Aren't
the contents of files "original.xml" and
"after_addRoleInducement.xml" swapped?
Because original.xml corresponds to the
state with only one inducement, while the
file "after_addRoleInducement.xml"
contains two inducements. Just opposite as
I would expect, given the messages you
wrote.<br>
<br>
Best regards,<br>
Pavol
<div>
<div><br>
<br>
<br>
On 12. 2. 2015 8:39, Dharmendra Parakh
wrote:<br>
</div>
</div>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">Hi Ivan
<div><br>
<div>Thanks for your reply. jira
you have pointed is might be
related to UI only and what i
observed is if i use model web
service to modify one inducement
it is deleting other
inducements.</div>
</div>
<div><br>
</div>
<div>We are using the master branch
so latest midpoint version.</div>
<div><br>
</div>
<div>Regards</div>
<div>Dharmendra</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Feb
12, 2015 at 1:01 PM, Ivan Noris <span dir="ltr"><<a href="mailto:ivan.noris@evolveum.com" target="_blank">ivan.noris@evolveum.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hi,<br>
<br>
I believe this is the issue: <a href="https://jira.evolveum.com/browse/MID-2113" target="_blank">https://jira.evolveum.com/browse/MID-2113</a>
and it should be fixed, but
please see the comment in
JIRA.<br>
<br>
Also, what version of midPoint
are you using?<br>
<br>
Thanks,<br>
regards<br>
Ivan
<div>
<div><br>
<br>
<div>On 02/12/2015 08:08
AM, Dharmendra Parakh
wrote:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div>
<div dir="ltr">Hi
Radovan
<div><br>
</div>
<div>Additional
Information:</div>
<div><br>
</div>
<div>We have a
requirement to
update the role
inducement from web
service client,
where we have to
add/delete some
resource attributes.</div>
<div><br>
</div>
<div>In our scenario
we have a role with
multiple inducements
(let say one role
and one resource
inducement). Now i
want to add some
additional
attribute-values in
resource inducement.
To do this we
calculate the
correct inducement
(AssignmentType)
object with all
current attributes
and try to replace
this inducement. </div>
<div>Earlier this was
working for us but
now when we do this
other inducement
information is lost
(induced role is no
longer available in
role).</div>
<div><br>
</div>
<div>I am attaching
the request xml with
the mail...</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Regards</div>
<div>Dharmendra</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On
Thu, Feb 12, 2015 at
12:03 PM, Manish
Baid <span dir="ltr"><<a href="mailto:baid_manish@yahoo.com" target="_blank">baid_manish@yahoo.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:14px">
<div>Hi
Radovan,</div>
<div dir="ltr">We
are showing a
demo to our
clients, looks
like with
recent 3.1
release,
inducement
update is
behaving
differently.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">If
you can work
with
Dharmendra to
work through
this (he is in
India
timezone, will
be available
in your
mornings), it
would be of
great help.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Thanks<br>
</div>
<div>
<div>
<div><span></span></div>
<br>
<div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:14px">
<div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px">
<div dir="ltr">
-----
Forwarded
Message -----<br>
<font face="Arial">
<b><span style="font-weight:bold">From:</span></b>
Manish Baid
<<a href="mailto:baid_manish@yahoo.com" target="_blank">baid_manish@yahoo.com</a>><br>
<b><span style="font-weight:bold">To:</span></b>
midPoint
General
Discussion
<<a href="mailto:midpoint@lists.evolveum.com" target="_blank">midpoint@lists.evolveum.com</a>>
<br>
<b><span style="font-weight:bold">Cc:</span></b>
Dharmendra
Parakh <<a href="mailto:dharmendra@confluxsys.com" target="_blank">dharmendra@confluxsys.com</a>>;
Indrajit
Chauhan <<a href="mailto:indrajit@confluxsys.com" target="_blank">indrajit@confluxsys.com</a>>
<br>
<b><span style="font-weight:bold">Sent:</span></b>
Wednesday,
February 11,
2015 4:14 PM<br>
<b><span style="font-weight:bold">Subject:</span></b>
URGENT ...
Role
inducements
lost on role
updates<br>
</font> </div>
<div><br>
<div>
<div>
<div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:14px">
<div dir="ltr">Hi,</div>
<div dir="ltr">With
3.1 release
code (and also
after
MID-2194),
when
inducement/s
is/are updated
in a role,
other related
indcuments are
removed.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Here
is an example:</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">*
Role had an
indcument:
"LDAP Account"
with 3 group
memberships</div>
<div dir="ltr">*
Role is
modified to
add a role
inducement
(role
hierarchy) </div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Observation:
3 group
memberships
that were part
of "Ldap
Account"
inducments are
removed. <br>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Please
see object
XMLs of before
and after.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Thanks<br>
</div>
<div><br>
</div>
</div>
</div>
</div>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
midPoint mailing list
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><span><font color="#888888">
</font></span></pre>
<span><font color="#888888">
</font></span></blockquote>
<span><font color="#888888"> <br>
<pre cols="72">--
Ing. Ivan Noris
Senior Identity Management Engineer
<a href="http://evolveum.com" target="_blank">evolveum.com</a> <a href="http://evolveum.com/blog/" target="_blank">evolveum.com/blog/</a>
_____________________________________________
"Semper Id(e)M Vix."
</pre>
</font></span></div>
<br>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
midPoint mailing list
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
midPoint mailing list
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
midPoint mailing list
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
</div></div></div>
<br>_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
<br></blockquote></div><br></div>