Thank you for the suggestions but I have no problem coding the JahiaApplicationField class.
The problem is in the JahiaField.loadField(...) method, which is called when loading all fields in a container and this method calls theField.load() and then theField.getValue() in the following statement:
if (theField.getValue () != null && theField.getValue ().equals ("<empty>")) {
theField.setValue ("");
}
Can I exchange theField.getValue() with theField.getRawValue() but still use theField.setValue() here?
Benjamin Papez
System Architect
***************************************************
COMMARO mobile trading systems GmbH
Lakeside B04
A-9020 Klagenfurt - Austria/Europe
phone: +43 (463) 298505-38
fax: +43 (463) 298505-22
***************************************************
| Serge Huber <[EMAIL PROTECTED]>
01.06.2005 14:18
|
|
You should be able to replace for example the following line :
setObject(this.getValue())
by
setObject(this.getRawValue());
and if you are having chicken and egg problems, you might also want to
call the getValue() of the JahiaField explicitely, by doing :
super.getValue()
These are just ideas as I said. It's a change I've been looking at doing
but I never got the occasion. Let me know if some things were not clear.
Regards,
Serge...
[EMAIL PROTECTED] wrote:
>
> As for your suggestion I wrote in my posting from 30.05.2005 15:07
> that JahiaField.loadField(...) also calls theField.getValue() right
> after theField.load() so moving the dispatching from
> JahiaApplicationField.load() to JahiaApplicationField.getValue() would
> not bring us anything unless you remove the theField.getValue() calls
> from JahiaField.loadField(...)and replace them with getRawValue() but
> I wonder what side-effects you will get then.
>
> Greetings,
> Benjamin Papez
>
> System Architect
> ***************************************************
> COMMARO mobile trading systems GmbH
> Lakeside B04
> A-9020 Klagenfurt - Austria/Europe
>
> phone: +43 (463) 298505-38
> fax: +43 (463) 298505-22
> ***************************************************
>
>
> *Serge Huber <[EMAIL PROTECTED]>*
>
> 01.06.2005 11:55
> Please respond to
> <[email protected]>
>
>
>
> To
> [email protected]
> cc
>
> Subject
> Re: Fw: How to prevent triggering a request to application on
> application loadField
>
>
>
>
>
>
>
>
>
>
> Hi Benjamin,
>
> I'm sorry I didn't have time to answer this thread earlier.
>
> Jahia fields have to values, the "rawValue" and the "value". The
> rawValue is the value that comes from the database. My idea was move the
> code to the getValue() and in the load method not yet set the value, but
> do it *one time only* in the getValue call. This should be the least
> intrusive way of doing it.
>
> What I mean is that you should overload the getValue from JahiaField
> into JahiaApplicationField, and put the logic there. Something along the
> lines of
>
> public String getValue() {
> if (fieldValue == null) {
> /** app dispatching comes here *//
> fieldValue = ...
> }
> }
>
> As for your solution, I don't think it's that practical because I know
> of a lot of templates that will access the field value through
> JahiaField.getValue call.
>
> Regards,
> Serge Huber.
>
> [EMAIL PROTECTED] wrote:
>
> >
> > Hi again,
> >
> > I have solved this like that:
> >
> > I removed the following code from JahiaApplicationField.load(...)
> >
> > logger.debug("Loading application field...");
> > ContentApplicationField contentApplicationField =
> > (ContentApplicationField)ContentApplicationField
> > .getField(fieldBean.getId());
> > logger.debug("value=" + value);
> >
> > String val = contentApplicationField.getValue(jData.params());
> >
> > value = JahiaTools.replacePattern(FormDataManager.getInstance()
> > .htmlEncode(val), "@", "@");
> >
> > and moved it to ApplicationFieldTag.readValue(...). This way the
> > dispatching to the application works only with the
> > <content:application> tag if the display flag is set to true
> > [default]. For now I haven't encountered any problems, but I wonder if
> > this solution can be contributed as you have to care about migration
> > of existing applications and maybe somebody uses the integration of
> > applications without the <content:application> tag, but using the
> > JahiaApplicationField.getValue() directly.
> >
> > Greetings,
> > Benjamin
> >
> > ----- Forwarded by Benjamin Papez/COMMARO/AT on 01.06.2005 07:47 -----
> > *Benjamin Papez/COMMARO/AT*
> >
> > 30.05.2005 15:07
> >
> >
> > To
> > <[email protected]>
> > cc
> >
> > Subject
> > Re: How to prevent triggering a request to
> application on application
> > loadFieldLink
> >
> <Notes:///C1256DE5002ABE51/A4D87D90E1B19842852564FF006DED4E/EE7FDF0010570B00C125700D0035D85D>
>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Hello Serge,
> >
> > well, we could contribute, but moving the dispatching from load() to
> > getValue() is not helping as in JahiaField.loadField(...) you first call
> >
> > theField.load (loadFlag, jParams);
> >
> > and right afterwards you call
> >
> > if (theField.getValue () != null && theField.getValue ().equals
> > ("<empty>")) {
> > theField.setValue ("");
> > }
> >
> > So if we just move the dispatching to getValue() it will still be
> > dispatched everytime a JahiaField.loadField() is called. Can you give
> > us some more hints, how we could solve that and what we should care
> > about.
> >
> > Greetings,
> > Benjamin
> >
> >
> > *Serge Huber <[EMAIL PROTECTED]>*
> >
> > 26.05.2005 11:48
> > Please respond to
> > <[email protected]>
> >
> >
> > To
> > [email protected]
> > cc
> >
> > Subject
> > Re: How to prevent triggering a request to
> application on application
> > loadField
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Unfortunately not with the current implementation. This is one thing
> > that has been on my todo list for some time but I never found the time
> > to do it. My idea was to move the dispatching to the getValue call in
> > the application field. I don't know when I'll get around to do this, but
> > another way to speed it up is to contribute it :)
> >
> > cheers,
> > Serge...
> >
> > [EMAIL PROTECTED] wrote:
> >
> > >
> > > Similar to the site settings we have on the startpage a container with
> > > web application fields, which we set with specific webapps to allow
> > > absolute field addressing from several other pages. On the startpage
> > > there is only the container with the application field, but this web
> > > application itself is not displayed on the startpage. Nevertheless
> > > when accessing the startpage, loadField is called for the "hidden"
> > > webapp field and there a request is sent to the servlet of the
> > > application. Is it possible to prevent triggering this request if the
> > > field is not shown really?
> > >
> > > Benjamin Papez
> >
>
>
