You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Giaccone, Anthony CTR DTIC-A" <AG...@DTIC.MIL> on 2007/05/01 00:35:57 UTC

Initialize a value in the state object.


Here's what I want to do..

I have a form that holds a variety of data, which the user will use to
generate a query.  The query data is persistent at the session. This
wayIf they wander down a path, eventually they'll return to the "main"
page, and the query data will be returned from the "session" and they'll
be ready to query based on the data that was last entered. 

This all works fine and dandy. 

What I want to do now, is set a value in this persistent object when the
object is created. To provide a default value for one (or more) of the
query parameters. 

Imagine for instance that you want to search a queue of beans for those
beans that are in state "Pending"  as the intial state of the query
page.

This seems like a perfect place to use Hivemind. The query data is
already constructed by Hivemind. 

Here's the XML for the query data in the hivemind.xml

<module id="mil.dtic.mipr" version="1.0.0">
	<contribution
configuration-id="tapestry.state.ApplicationObjects">		
		<state-object name="queryData" scope="session"> 
			<create-instance 
	
class="mil.dtic.j2ee.Hibernate.QueryForms.MiprQueryItem" />
		</state-object>
	</contribution>
</module>

So my question is.. How do I convince Hivemind to set the property
status on the object MiprQueryItem to the value of "Pending". 




RE: Initialize a value in the state object.

Posted by "Giaccone, Anthony CTR DTIC-A" <AG...@DTIC.MIL>.
Hugo, 

First let me say thank you for your effort. I follow the basic idea
here. I have to say I'm pretty ignorant of the HiveMind. But I'm trying
to figure this out..

Here's what I put in the hivemind.xml file:

	<contribution
configuration-id="tapestry.state.ApplicationObjects">
		<state-object name="queryData" scope="session">
			<invoke-factory>
            	<construct
class="mil.dtic.j2ee.Hibernate.QueryForms.MiprQueryItem">
					<set property="status"
value="P"/>
		 		</construct>
        	</invoke-factory>
		</state-object>
	</contribution>

Which causes the following error message:
 
Element state-object/invoke-factory (at
file:/Users/agiaccon/Source/MiprPhase1/MiprApp/WebRoot/WEB-INF/classes/M
ETA-INF/hivemodule.xml, line 10, column 20) contains errors: Attribute
'object' is required but no value was provided.

Now I looked at the message from: Shing Hing Man [matmsh@yahoo.com]

And he references a web page
(http://lombok.demon.co.uk/tapestry4Demo/Inject.html)  that has this on
it:

 <service-point id="myASOFactory" interface="man.aso.MyASOFactory">
  <invoke-factory>
    <construct class="man.aso.MyASOFactory">
		  <set-service property="messageHolder" 
                service-id="helloMessage"/>
	 </construct>
   </invoke-factory>  
 </service-point>
	
<contribution configuration-id="tapestry.state.ApplicationObjects">
    <state-object name="myASO" scope="session">
    <invoke-factory object="service:myASOFactory" />
</state-object>


In this second example there's two different <invoke factory>
references, the first doesn't have an object associated with it, the
second does. In the first case there's a <service-point> and in the
second a contribution surrounding the <invoke-factory>


What's up how do I do this?


Tony


-----Original Message-----
From: Hugo Palma [mailto:hugo.m.palma@gmail.com] 
Sent: Monday, April 30, 2007 7:40 PM
To: Tapestry users
Subject: Re: Initialize a value in the state object.

Try using the BuilderFactory service for creating the ASO. You can see 
more info about the service here 
http://hivemind.apache.org/hivemind1/hivemind/BuilderFactory.html.

In your example it would look like this:

<module id="mil.dtic.mipr" version="1.0.0">
	<contribution
configuration-id="tapestry.state.ApplicationObjects">		
		<state-object name="queryData" scope="session">
			<invoke-factory>
            			<construct
class="mil.dtic.j2ee.Hibernate.QueryForms.MiprQueryItem">
					<set property="status
value="Pending"/>
		 		</construct>
        		</invoke-factory>
		</state-object>
	</contribution>
</module>



Giaccone, Anthony CTR DTIC-A wrote:
> Here's what I want to do..
>
> I have a form that holds a variety of data, which the user will use to
> generate a query.  The query data is persistent at the session. This
> wayIf they wander down a path, eventually they'll return to the "main"
> page, and the query data will be returned from the "session" and
they'll
> be ready to query based on the data that was last entered. 
>
> This all works fine and dandy. 
>
> What I want to do now, is set a value in this persistent object when
the
> object is created. To provide a default value for one (or more) of the
> query parameters. 
>
> Imagine for instance that you want to search a queue of beans for
those
> beans that are in state "Pending"  as the intial state of the query
> page.
>
> This seems like a perfect place to use Hivemind. The query data is
> already constructed by Hivemind. 
>
> Here's the XML for the query data in the hivemind.xml
>
> <module id="mil.dtic.mipr" version="1.0.0">
> 	<contribution
> configuration-id="tapestry.state.ApplicationObjects">		
> 		<state-object name="queryData" scope="session"> 
> 			<create-instance 
> 	
> class="mil.dtic.j2ee.Hibernate.QueryForms.MiprQueryItem" />
> 		</state-object>
> 	</contribution>
> </module>
>
> So my question is.. How do I convince Hivemind to set the property
> status on the object MiprQueryItem to the value of "Pending". 
>
>
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Initialize a value in the state object.

Posted by Hugo Palma <hu...@gmail.com>.
Try using the BuilderFactory service for creating the ASO. You can see 
more info about the service here 
http://hivemind.apache.org/hivemind1/hivemind/BuilderFactory.html.

In your example it would look like this:

<module id="mil.dtic.mipr" version="1.0.0">
	<contribution configuration-id="tapestry.state.ApplicationObjects">		
		<state-object name="queryData" scope="session">
			<invoke-factory>
            			<construct class="mil.dtic.j2ee.Hibernate.QueryForms.MiprQueryItem">
					<set property="status value="Pending"/>
		 		</construct>
        		</invoke-factory>
		</state-object>
	</contribution>
</module>



Giaccone, Anthony CTR DTIC-A wrote:
> Here's what I want to do..
>
> I have a form that holds a variety of data, which the user will use to
> generate a query.  The query data is persistent at the session. This
> wayIf they wander down a path, eventually they'll return to the "main"
> page, and the query data will be returned from the "session" and they'll
> be ready to query based on the data that was last entered. 
>
> This all works fine and dandy. 
>
> What I want to do now, is set a value in this persistent object when the
> object is created. To provide a default value for one (or more) of the
> query parameters. 
>
> Imagine for instance that you want to search a queue of beans for those
> beans that are in state "Pending"  as the intial state of the query
> page.
>
> This seems like a perfect place to use Hivemind. The query data is
> already constructed by Hivemind. 
>
> Here's the XML for the query data in the hivemind.xml
>
> <module id="mil.dtic.mipr" version="1.0.0">
> 	<contribution
> configuration-id="tapestry.state.ApplicationObjects">		
> 		<state-object name="queryData" scope="session"> 
> 			<create-instance 
> 	
> class="mil.dtic.j2ee.Hibernate.QueryForms.MiprQueryItem" />
> 		</state-object>
> 	</contribution>
> </module>
>
> So my question is.. How do I convince Hivemind to set the property
> status on the object MiprQueryItem to the value of "Pending". 
>
>
>
>
>   

Re: Initialize a value in the state object.

Posted by Shing Hing Man <ma...@yahoo.com>.
There is an example on 
 how to inject a property into an Application State
Object at 

http://lombok.demon.co.uk/tapestry4Demo/Inject.html


Shing

--- "Giaccone, Anthony CTR DTIC-A"
<AG...@DTIC.MIL> wrote:

> 
> 
> Here's what I want to do..
> 
> I have a form that holds a variety of data, which
> the user will use to
> generate a query.  The query data is persistent at
> the session. This
> wayIf they wander down a path, eventually they'll
> return to the "main"
> page, and the query data will be returned from the
> "session" and they'll
> be ready to query based on the data that was last
> entered. 
> 
> This all works fine and dandy. 
> 
> What I want to do now, is set a value in this
> persistent object when the
> object is created. To provide a default value for
> one (or more) of the
> query parameters. 
> 
> Imagine for instance that you want to search a queue
> of beans for those
> beans that are in state "Pending"  as the intial
> state of the query
> page.
> 
> This seems like a perfect place to use Hivemind. The
> query data is
> already constructed by Hivemind. 
> 
> Here's the XML for the query data in the
> hivemind.xml
> 
> <module id="mil.dtic.mipr" version="1.0.0">
> 	<contribution
>
configuration-id="tapestry.state.ApplicationObjects">
> 	
> 		<state-object name="queryData" scope="session"> 
> 			<create-instance 
> 	
>
class="mil.dtic.j2ee.Hibernate.QueryForms.MiprQueryItem"
> />
> 		</state-object>
> 	</contribution>
> </module>
> 
> So my question is.. How do I convince Hivemind to
> set the property
> status on the object MiprQueryItem to the value of
> "Pending". 
> 
> 
> 
> 





      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org