Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Anonymous_User Absent Member.
Absent Member.
218 views

appending a new xml instance


Hi,

working with my new Exchange contacts I realized I probably need to
create a new Instance document since I will modify two diffrent objects
at the same time with diffrent objectGUID.

Almost got there, my only problem is that I add an association to the
first documet as well.
This is the code:

Code:
--------------------
<do-if>
<arg-conditions>
<or>
<if-op-attr name="Given Name" op="changing"/>
</or>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="varGivenName" scope="policy">
<arg-string>
<token-op-attr name="Given Name"/>
</arg-string>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-query class-name="pidStudent" datastore="src" scope="subordinates">
<arg-dn>
<token-src-dn/>
</arg-dn>
<arg-string>
<token-text xml:space="preserve">pidAdministration</token-text>
</arg-string>
<arg-string>
<token-text xml:space="preserve">pidLocation</token-text>
</arg-string>
</token-query>
<token-query class-name="pidEmployee" datastore="src" scope="subordinates">
<arg-dn>
<token-src-dn/>
</arg-dn>
<arg-string>
<token-text xml:space="preserve">pidAdministration</token-text>
</arg-string>
<arg-string>
<token-text xml:space="preserve">pidLocation</token-text>
</arg-string>
</token-query>
</arg-node-set>
<arg-actions>
<do-set-local-variable name="pidAdmin" scope="policy">
<arg-string>
<token-xpath expression="$current-node/attr[@attr-name='pidAdministration']/value"/>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="pidLoc" scope="policy">
<arg-string>
<token-xpath expression="$current-node/attr[@attr-name='pidLocation']/value"/>
</arg-string>
</do-set-local-variable>
<do-if>
<arg-conditions>
<or>
<if-local-variable mode="nocase" name="pidAdmin" op="equal">BOU</if-local-variable>
<if-local-variable mode="regex" name="pidLoc" op="equal">GY.*</if-local-variable>
</or>
</arg-conditions>
<arg-actions>
<do-if>
<arg-conditions>
<and>
<if-src-attr name="pidGoogleMail" op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="ADname" scope="policy">
<arg-string>
<token-attr name="pidUserID"/>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="varDestObj" scope="policy">
<arg-string>
<token-text xml:space="preserve">cn=</token-text>
<token-local-variable name="ADname"/>
<token-text xml:space="preserve">,</token-text>
<token-global-variable name="drv.mailcontact.container"/>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="varObjectGUID" scope="policy">
<arg-string>
<token-dest-attr name="objectGUID">
<arg-dn>
<token-local-variable name="varDestObj"/>
</arg-dn>
</token-dest-attr>
</arg-string>
</do-set-local-variable>
<do-append-xml-element expression=".." name="instance"/>
<do-set-xml-attr expression="../instance" name="class-name">
<arg-string>
<token-text xml:space="preserve">contact</token-text>
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="../instance" name="src-dn">
<arg-string>
<token-src-dn/>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../instance" name="association"/>
<do-append-xml-element expression="../instance/association[last()]" name="association"/>
<do-append-xml-text expression='../instance[@class-name="contact"]/association[last()]/association'>
<arg-string>
<token-local-variable name="varObjectGUID"/>
</arg-string>
</do-append-xml-text>
<do-append-xml-element expression="../instance" name="attr"/>
<do-set-xml-attr expression="../instance/attr[last()]" name="attr-name">
<arg-string>
<token-text xml:space="preserve">givenName</token-text>
</arg-string>
</do-set-xml-attr>
<do-append-xml-element expression="../instance/attr[@attr-name='givenName']" name="value"/>
<do-append-xml-text expression='../instance[@class-name="contact"]/attr[@attr-name="givenName"]/value'>
<arg-string>
<token-local-variable name="varGivenName"/>
</arg-string>
</do-append-xml-text>
</arg-actions>
<arg-actions/>
</do-if>
</arg-actions>
<arg-actions/>
</do-if>
</arg-actions>
</do-for-each>
</arg-actions>
<arg-actions/>
</do-if>
--------------------


This is the end of the designer trace:

Code:
--------------------


AD Tyreso Prod : Token Value: "1234567".
AD Tyreso Prod : Arg Value: "1234567".
AD Tyreso Prod : Action: do-append-xml-element("instance","..").
AD Tyreso Prod : Action: do-set-xml-attr("class-name","../instance","contact").
AD Tyreso Prod : arg-string("contact")
AD Tyreso Prod : token-text("contact")
AD Tyreso Prod : Arg Value: "contact".
AD Tyreso Prod : Action: do-set-xml-attr("src-dn","../instance",token-src-dn()).
AD Tyreso Prod : arg-string(token-src-dn())
AD Tyreso Prod : token-src-dn()
AD Tyreso Prod : Token Value: "\TK-IDVAULT2\TK\Meta\Identities\xyz".
AD Tyreso Prod : Arg Value: "\TK-IDVAULT2\TK\Meta\Identities\xyz".
AD Tyreso Prod : Action: do-append-xml-element("association","../instance").
AD Tyreso Prod : Action: do-append-xml-element("association","../instance/association[last()]").
AD Tyreso Prod : Action: do-append-xml-text("../instance[@class-name="contact"]/association[last()]/association",token-local-variable("varObjectGUID")).
AD Tyreso Prod : arg-string(token-local-variable("varObjectGUID"))
AD Tyreso Prod : token-local-variable("varObjectGUID")
AD Tyreso Prod : Token Value: "1234567".
AD Tyreso Prod : Arg Value: "1234567".
AD Tyreso Prod : Action: do-append-xml-element("attr","../instance").
AD Tyreso Prod : Action: do-set-xml-attr("attr-name","../instance/attr[last()]","givenName").
AD Tyreso Prod : arg-string("givenName")
AD Tyreso Prod : token-text("givenName")
AD Tyreso Prod : Arg Value: "givenName".
AD Tyreso Prod : Action: do-append-xml-element("value","../instance/attr[@attr-name='givenName']").
AD Tyreso Prod : Action: do-append-xml-text("../instance[@class-name="contact"]/attr[@attr-name="givenName"]/value",token-local-variable("varGivenName")).
AD Tyreso Prod : arg-string(token-local-variable("varGivenName"))
AD Tyreso Prod : token-local-variable("varGivenName")
AD Tyreso Prod : Token Value: "Susanna".
AD Tyreso Prod : Arg Value: "Susanna".
AD Tyreso Prod :Policy returned:
AD Tyreso Prod :
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product version="?.?.?.?">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<instance class-name="contact" qualified-src-dn="O=TK\OU=Meta\OU=Identities\CN=xyz" src-dn="\TK-IDVAULT2\TK\Meta\Identities\xyz" src-entry-id="48196">
<association>1qaz<2wsx3edc4rfv</association>
<attr attr-name="Full Name">
<value timestamp="1379509195#2" type="string">Susanna Loukaja</value>
</attr>
<attr attr-name="Given Name">
<value timestamp="1250252908#235" type="string">Susanna</value>
</attr>
<attr attr-name="OU">
<value timestamp="1379420195#82" type="string">BOU-TARNFSK</value>
</attr>
<attr attr-name="pidCategory">
<value timestamp="1283528750#154" type="string">Citizen</value>
<value timestamp="1379420194#47" type="string">Employee</value>
</attr>
<attr attr-name="pidGoogleMail">
<value timestamp="1379492766#2" type="string">susanna.loukaja@utb.tyreso.se</value>
</attr>
<attr attr-name="pidUserID">
<value timestamp="1236853377#20357" type="string">SuLo0904</value>
</attr>
<attr attr-name="Surname">
<value timestamp="1379422036#2" type="string">Loukaja</value>
</attr>
<association>
<association>1234567</association>
</association>
<attr attr-name="givenName">
<value>Susanna</value>
</attr>
</instance>
<instance class-name="contact" src-dn="\TK-IDVAULT2\TK\Meta\Identities\xyz">
<association>
<association>1234567</association>
</association>
<attr attr-name="givenName">
<value>Susanna</value>
</attr>
</instance>
</input>
</nds>

--------------------


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=48726

Labels (1)
0 Likes
2 Replies
Anonymous_User Absent Member.
Absent Member.

Re: appending a new xml instance

On Thu, 19 Sep 2013 12:47:53 +0000, joakim ganse wrote:

> working with my new Exchange contacts I realized I probably need to
> create a new Instance document since I will modify two diffrent objects
> at the same time with diffrent objectGUID.


Why <instance> here? I'd expect <modify>, since you're trying to modify
things (or maybe <add>, if you're adding one). An <instance> would
generally be the return result of a <query>.

I've sometimes used <instance> as a way to deal with applications that
don't understand <add> and <modify> events directly. Maybe that's what
you're doing here?


> Almost got there, my only problem is that I add an association to the
> first documet as well.

[-snip-]
> <do-append-xml-element expression="../instance"


Hm. Maybe this should be:

<do-append-xml-element expression="../instance[last()]"

so that it only applies to the one you're adding. Otherwise, it's going
to apply to all <instance> nodes in the document.


--
--------------------------------------------------------------------------
David Gersic dgersic_@_niu.edu
Knowledge Partner http://forums.netiq.com

Please post questions in the forums. No support provided via email.

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: appending a new xml instance


You are right in both cases.
If I just use modify it should work.

Thanks


--
joakim_ganse
------------------------------------------------------------------------
joakim_ganse's Profile: https://forums.netiq.com/member.php?userid=159
View this thread: https://forums.netiq.com/showthread.php?t=48726

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.