DerivedDataFunction dynamic value of document field

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

DerivedDataFunction dynamic value of document field

rmtl
Hello ,

in a folder , there is one document A and several documents B. To avoid user typo error , I  need that documents B has a field value of a document A field.

My questions are :

 I m trying to query JCR to retrieve the document A., using https://wiki.onehippo.com/display/CMS7/1+HstQuery+bootstrapping

especially the snippet
ComponentManager compMngr = HstServices.getComponentManager();
  if (compMngr != null) {
     hstQueryManagerFactory = (HstQueryManagerFactory)compMngr.getComponent(HstQueryManagerFactory.class.getName());
ObjectConverterUtils.createObjectConverter(l);ObjectConverter objectConverter = ObjectConverterUtils.createObjectConverter(DocumentA.class);
 HstQueryManager createQueryManager = hstQueryManagerFactory.createQueryManager(objectConverter);

   }

I m kind of stuck at this points since the manager need a HippoBean scope.

Is there anyway to retrieve this HippoBean  via his path ?

  23) Or its exists another way to dynamically compute a field ?

Thanks
 
Reply | Threaded
Open this post in threaded view
|

Re: DerivedDataFunction dynamic value of document field

Wouter Danes-2
Are you working on the CMS or Site side?
IIRC the ObjectConverter is only available on the site.
Can you tell us a bit more about your use case? What are you trying to accomplish?

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of rmtl
Sent: vrijdag 15 juni 2012 16:42
To: [hidden email]
Subject: [Hippo-cms7-user] DerivedDataFunction dynamic value of document field

Hello ,

in a folder , there is one document A and several documents B. To avoid user typo error , I  need that documents B has a field value of a document A field.

My questions are :

 I m trying to query JCR to retrieve the document A., using https://wiki.onehippo.com/display/CMS7/1+HstQuery+bootstrapping

especially the snippet
ComponentManager compMngr = HstServices.getComponentManager();
  if (compMngr != null) {
     hstQueryManagerFactory =
(HstQueryManagerFactory)compMngr.getComponent(HstQueryManagerFactory.class.getName());
ObjectConverterUtils.createObjectConverter(l);ObjectConverter
objectConverter =
ObjectConverterUtils.createObjectConverter(DocumentA.class);
 HstQueryManager createQueryManager =
hstQueryManagerFactory.createQueryManager(objectConverter);

   }

I m kind of stuck at this points since the manager need a HippoBean scope.

Is there anyway to retrieve this HippoBean  via his path ?

  23) Or its exists another way to dynamically compute a field ?

Thanks
 

--
View this message in context: http://hippo.2275632.n2.nabble.com/DerivedDataFunction-dynamic-value-of-document-field-tp7578491.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
Reply | Threaded
Open this post in threaded view
|

RE: DerivedDataFunction dynamic value of document field

rmtl

I should be on the CMS side I think .

 

Found some doc (http://www.onehippo.org/cms7/documentation/development/content+repository/jcr/jcr.html and http://www.onehippo.org/cms7/documentation/development/content+repository/jcr/reference/derived_data.html ) .

 

For I m trying to do :

 

In a folder , I have document A1 with  a field levelfield for example , and several documents B : B0,B1,B2 .

I want  to add a computed field levelfield to documents B0,B1,B2 , and this field levelfield should have the value of the levelfield  field of the document A1 .

There is no direct link between document A and documents B, except the fact that there exists in the same folder.

 

My question is if it’s possible to do that with DerivedDataFunction or I should use the workflow. Problem with workflow is that if the user didn’t created a Document A, then document b cant have the value.

 

Romuald

 

 

 

From: Wouter Danes-2 [via Hippo] [mailto:[hidden email]]
Sent: June-15-12 2:54 PM
To: Romuald Guyonnet Duluc
Subject: Re: DerivedDataFunction dynamic value of document field

 

Are you working on the CMS or Site side?
IIRC the ObjectConverter is only available on the site.
Can you tell us a bit more about your use case? What are you trying to accomplish?

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of rmtl
Sent: vrijdag 15 juni 2012 16:42
To: [hidden email]
Subject: [Hippo-cms7-user] DerivedDataFunction dynamic value of document field

Hello ,

in a folder , there is one document A and several documents B. To avoid user typo error , I  need that documents B has a field value of a document A field.

My questions are :

 I m trying to query JCR to retrieve the document A., using https://wiki.onehippo.com/display/CMS7/1+HstQuery+bootstrapping

especially the snippet
ComponentManager compMngr = HstServices.getComponentManager();
  if (compMngr != null) {
     hstQueryManagerFactory =
(HstQueryManagerFactory)compMngr.getComponent(HstQueryManagerFactory.class.getName());
ObjectConverterUtils.createObjectConverter(l);ObjectConverter
objectConverter =
ObjectConverterUtils.createObjectConverter(DocumentA.class);
 HstQueryManager createQueryManager =
hstQueryManagerFactory.createQueryManager(objectConverter);

   }

I m kind of stuck at this points since the manager need a HippoBean scope.

Is there anyway to retrieve this HippoBean  via his path ?

  23) Or its exists another way to dynamically compute a field ?

Thanks
 

--
View this message in context: http://hippo.2275632.n2.nabble.com/DerivedDataFunction-dynamic-value-of-document-field-tp7578491.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


If you reply to this email, your message will be added to the discussion below:

http://hippo.2275632.n2.nabble.com/DerivedDataFunction-dynamic-value-of-document-field-tp7578491p7578493.html

To unsubscribe from DerivedDataFunction dynamic value of document field, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

RE: DerivedDataFunction dynamic value of document field

rmtl
I should be on the CMS side I think .

Found some doc (http://www.onehippo.org/cms7/documentation/development/content+repository/jcr/jcr.html and http://www.onehippo.org/cms7/documentation/development/content+repository/jcr/reference/derived_data.html ) .

For I m trying to do :

In a folder , I have document A1 with  a field levelfield for example , and several documents B : B0,B1,B2 .
I want  to add a computed field levelfield to documents B0,B1,B2 , and this field levelfield should have the value of the levelfield  field of the document A1 .
There is no direct link between document A and documents B, except the fact that there exists in the same folder.

My question is if it’s possible to do that with DerivedDataFunction or I should use the workflow. Problem with workflow is that if the user didn’t created a Document A, then document b cant have the value.

Romuald
Reply | Threaded
Open this post in threaded view
|

Re: DerivedDataFunction dynamic value of document field

Frank van Lankvelt
On Fri, Jun 15, 2012 at 9:26 PM, rmtl <[hidden email]> wrote:

> I should be on the CMS side I think .
>
> Found some doc
> (http://www.onehippo.org/cms7/documentation/development/content+repository/jcr/jcr.html
> and
> http://www.onehippo.org/cms7/documentation/development/content+repository/jcr/reference/derived_data.html
> ) .
>
> For I m trying to do :
>
> In a folder , I have document A1 with  a field levelfield for example , and
> several documents B : B0,B1,B2 .
> I want  to add a computed field levelfield to documents B0,B1,B2 , and this
> field levelfield should have the value of the levelfield  field of the
> document A1 .
> There is no direct link between document A and documents B, except the fact
> that there exists in the same folder.
>
this sounds like the easiest solution, though.  Link to A from B, then
in your beans you can retrieve the required value.

Is the problem that this field (on B) is used for authorization or
needs to be indexed?

cheers, Frank

> My question is if it’s possible to do that with DerivedDataFunction or I
> should use the workflow. Problem with workflow is that if the user didn’t
> created a Document A, then document b cant have the value.
>
> Romuald
>
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/DerivedDataFunction-dynamic-value-of-document-field-tp7578491p7578496.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



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: DerivedDataFunction dynamic value of document field

Jerome Mirc
In reply to this post by rmtl
Hi,

But, what is the best way to get the current JCS Session within a deriveddatafunction class?

Thanks

Jérôme
Reply | Threaded
Open this post in threaded view
|

Re: DerivedDataFunction dynamic value of document field

Frank van Lankvelt
On Mon, Jun 18, 2012 at 12:43 PM, jmirc <[hidden email]> wrote:
> Hi,
>
> But, what is the best way to get the current JCS Session within a
> deriveddatafunction class?
>
that's not possible; the derived data engine manages the value lookup
and persistence for the derived data functions.
The lookup path is quite flexible, though it's not well documented.
(see the HierarchyResolverImpl class in the repository for the
implementation)

cheers, Frank

> Thanks
>
> Jérôme
>
> --
> View this message in context: http://hippo.2275632.n2.nabble.com/DerivedDataFunction-dynamic-value-of-document-field-tp7578491p7578516.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



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: DerivedDataFunction dynamic value of document field

Jeroen Reijn
Administrator
Is document A always the same document for documents of type B? If so
then why not mimic how the selections plugin does it?
That way you can perhaps create a valuelistprovider that gives you the
options from the other document.

On Mon, Jun 18, 2012 at 1:19 PM, Frank van Lankvelt
<[hidden email]> wrote:

> On Mon, Jun 18, 2012 at 12:43 PM, jmirc <[hidden email]> wrote:
>> Hi,
>>
>> But, what is the best way to get the current JCS Session within a
>> deriveddatafunction class?
>>
> that's not possible; the derived data engine manages the value lookup
> and persistence for the derived data functions.
> The lookup path is quite flexible, though it's not well documented.
> (see the HierarchyResolverImpl class in the repository for the
> implementation)
>
> cheers, Frank
>
>> Thanks
>>
>> Jérôme
>>
>> --
>> View this message in context: http://hippo.2275632.n2.nabble.com/DerivedDataFunction-dynamic-value-of-document-field-tp7578491p7578516.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
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Jeroen Reijn
Solution Architect
Hippo

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

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

Re: DerivedDataFunction dynamic value of document field

rmtl
in a folder , there is one document A and several document B.  but if there is 2 folders , there is will be document A1 in folder F1 and document A2  infolder F2.

What I need , is that multiple document B  has the a field computed  from a document A  field in the same folder.

for the moment, I have to make a link to Document A  in each  document B , which could lead
to user errors.

thanks for the replies.
Reply | Threaded
Open this post in threaded view
|

Re: DerivedDataFunction dynamic value of document field

Niels van Kampenhout-2
On Tue, Jun 19, 2012 at 2:52 PM, rmtl <[hidden email]> wrote:
> in a folder , there is one document A and several document B.  but if there
> is 2 folders , there is will be document A1 in folder F1 and document A2
> infolder F2.
>
> What I need , is that multiple document B  has the a field computed  from a
> document A  field in the same folder.

Do you actually need to store the value from A in all the Bs as well,
or do you only need to display the value from A in the editing
template for the Bs?
In the latter case, you can create a custom field plugin. You will
have access to the document node (through its JcrNodeModel) so you can
use the JCR API to look up node A. I've done this in a project a few
years ago.

Hope this helps.

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

Re: DerivedDataFunction dynamic value of document field

rmtl
Thanks for your answer .

Unfortunately, I need to store the value , because I use the Bs Documents in a facet .For the moment , I use a link to document A in Documents B but that could be boring for cms users  and error prone.
 
Romuald

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Niels van Kampenhout
Sent: June-20-12 4:47 PM
To: Hippo CMS 7 development public mailinglist
Subject: Re: [Hippo-cms7-user] DerivedDataFunction dynamic value of document field

On Tue, Jun 19, 2012 at 2:52 PM, rmtl <[hidden email]> wrote:
> in a folder , there is one document A and several document B.  but if
> there is 2 folders , there is will be document A1 in folder F1 and
> document A2 infolder F2.
>
> What I need , is that multiple document B  has the a field computed  
> from a document A  field in the same folder.

Do you actually need to store the value from A in all the Bs as well, or do you only need to display the value from A in the editing template for the Bs?
In the latter case, you can create a custom field plugin. You will have access to the document node (through its JcrNodeModel) so you can use the JCR API to look up node A. I've done this in a project a few years ago.

Hope this helps.

Regards,
Niels
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: DerivedDataFunction dynamic value of document field

Frank van Lankvelt
On Wed, Jun 20, 2012 at 10:52 PM, Romuald Guyonnet Duluc
<[hidden email]> wrote:
> Thanks for your answer .
>
> Unfortunately, I need to store the value , because I use the Bs Documents in a facet .For the moment , I use a link to document A in Documents B but that could be boring for cms users  and error prone.
>
if the value in document A never changes, and the property path for
the derived data function didn't work out, you could also try workflow
events:
  http://www.onehippo.org/cms7/documentation/development/content+repository/workflow/workflow-events.html
If you then register a callback workflow for new document creation
(folderworkflow#add), you can then use the jcr session from the
workflow context to set the property to its required value.  This will
not update the value when it changes in A, though.

cheers, Frank

> Romuald
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Niels van Kampenhout
> Sent: June-20-12 4:47 PM
> To: Hippo CMS 7 development public mailinglist
> Subject: Re: [Hippo-cms7-user] DerivedDataFunction dynamic value of document field
>
> On Tue, Jun 19, 2012 at 2:52 PM, rmtl <[hidden email]> wrote:
>> in a folder , there is one document A and several document B.  but if
>> there is 2 folders , there is will be document A1 in folder F1 and
>> document A2 infolder F2.
>>
>> What I need , is that multiple document B  has the a field computed
>> from a document A  field in the same folder.
>
> Do you actually need to store the value from A in all the Bs as well, or do you only need to display the value from A in the editing template for the Bs?
> In the latter case, you can create a custom field plugin. You will have access to the document node (through its JcrNodeModel) so you can use the JCR API to look up node A. I've done this in a project a few years ago.
>
> Hope this helps.
>
> Regards,
> Niels
> _______________________________________________
> 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



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html