How to set value in Compound type

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set value in Compound type

Priyank Gupta
HI,
    i have two documents of one compound type and another Document type.

I have Bean file for Document type and Compound type.

Document type contain compound type.
I want  to update this single Document type and also contained compound type.

Can your please tell what logic will be use to put values  in this compound type from Document type bean file.

i was trying to use to do as---
javax.jcr.Node prdLinkNode;

            if (node.hasNode("mootlywcm:mootlywcm_tdsatsalary")) {
                prdLinkNode = node.getNode("mootlywcm:mootlywcm_tdsatsalary");
            } else {
                prdLinkNode = node.addNode("mootlywcm:TDSatSalary", "hippo:mirror");
            }

above one give me node of compund type.

but when i was trying to set values in this compound type as---

prdLinkNode.setProperty("mootlywcm:EmployeeTAN",si.getEmployerName());

my document structure is as in image and this will


thanks
   
Reply | Threaded
Open this post in threaded view
|

Re: How to set value in Compound type

Jeroen Hoffman


On 23-02-13 12:06, Priyank Gupta wrote:
>
> but when i was trying to set values in this compound type as---
>
> prdLinkNode.setProperty("mootlywcm:EmployeeTAN",si.getEmployerName());

May sound silly, but isn't this just property naming: EmployeeTAN versus
EmployerTAN?

You're doing this from the site, right? Then you need also a writable session.

Jeroen
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: How to set value in Compound type

Priyank Gupta
Thanks for your respose

I am able to write in Document type's fields but not able to write in compound type's fields like "EmployerTAN" which is a part of Document type.
Reply | Threaded
Open this post in threaded view
|

Re: How to set value in Compound type

Jeroen Hoffman
In reply to this post by Priyank Gupta
Hi,

I think in principle you're doing the correct thing.
But on code level, I can see some issues. Perhaps you should use a debugger to
see what actually happens.

See also my two comments inline

GL
Jeroen


On 23-02-13 12:06, Priyank Gupta wrote:

>
> i was trying to use to do as---
> javax.jcr.Node prdLinkNode;
>
>              if (node.hasNode("mootlywcm:mootlywcm_tdsatsalary")) {
>                  prdLinkNode =
> node.getNode("mootlywcm:mootlywcm_tdsatsalary");
>              } else {
>                  prdLinkNode = node.addNode("mootlywcm:TDSatSalary",
> "hippo:mirror");
>              }
>

Be careful here, "mootlywcm:mootlywcm_tdsatsalary" and "mootlywcm:TDSatSalary"
is not the same.

> above one give me node of compund type.
>
> but when i was trying to set values in this compound type as---
>
> prdLinkNode.setProperty("mootlywcm:EmployeeTAN",si.getEmployerName());

You created a "hippo:mirror" node, not you're own compound. A hippo mirror does
nothing with "mootlywcm:EmployeeTAN".

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: How to set value in Compound type

Priyank Gupta
thanks Joroen,
     There is no relation with Hippo:mirror(leave it).
I am able to find the compound node in  Document type node by  
 javax.jcr.Node prdLinkNode;
>
>              if (node.hasNode("mootlywcm:mootlywcm_tdsatsalary")) {
>                  prdLinkNode =
> node.getNode("mootlywcm:mootlywcm_tdsatsalary");
>              }

So this prdLinkNode have mootlywcm:EmployerTAN wheb i use this it show on cmd "have" msg

if(prdLinkNode.hasProperty("mootlywcm:EmployerTAN")){
            log.warn("have");
            prdLinkNode.setProperty("mootlywcm:EmployerTAN",si.getEmployerName());
            }

Now when this line is use to set value by this line "prdLinkNode.setProperty("mootlywcm:EmployerTAN",si.getEmployerName());"
then it is not able to set value in that Property.
On CMS my doc looks like this
See the highlighted portion .

Is there another way to do this? so guide!

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: How to set value in Compound type

Jeroen Hoffman

Hi,

Can you check wether the property is actually saved on the node using the console application? If so, you have a configuration error in the doc type. If not, please attach a debugger and inspect whats going on in your code.

Gl
Jeroen

Op 27 feb. 2013 07:35 schreef "Priyank Gupta" <[hidden email]> het volgende:
thanks Joroen,
     There is no relation with Hippo:mirror(leave it).
I am able to find the compound node in  Document type node by
 javax.jcr.Node prdLinkNode;
>
>              if (node.hasNode("*mootlywcm:mootlywcm_tdsatsalary*")) {
>                  prdLinkNode =
> node.getNode("*mootlywcm:mootlywcm_tdsatsalary*");
>              }

So this prdLinkNode have mootlywcm:EmployerTAN wheb i use this it show on
cmd "have" msg

if(prdLinkNode.hasProperty("mootlywcm:EmployerTAN")){
                log.warn("have");

prdLinkNode.setProperty("mootlywcm:EmployerTAN",si.getEmployerName());
            }

Now when this line is use to set value by this line
"prdLinkNode.setProperty("mootlywcm:EmployerTAN",si.getEmployerName());"
then it is not able to set value in that Property.
On CMS my doc looks like this
<http://hippo.2275632.n2.nabble.com/file/n7580511/compund_doc.png>
See the highlighted portion .

Is there another way to do this? so guide!

Thanks




--
View this message in context: http://hippo.2275632.n2.nabble.com/How-to-set-value-in-Compound-type-tp7580500p7580511.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html

_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html