-
1. Re: Outjecting in conversation
kragoth Feb 10, 2010 2:04 AM (in response to spetkov)How are you creating the new instance.
Please show your code.
Thanks.
-
2. Re: Outjecting in conversation
spetkov Feb 10, 2010 2:23 AM (in response to spetkov)In the class where I create the instance I have the following:
...
@Name("consultTpProcessSelectorHome")
public class TpProcessSelectorHome
extends EntityHome<TpProcessSelector>
{
@In(value="defaultErrorProcess", required=false, scope=ScopeType.CONVERSATION)
@Out(value="defaultErrorProcess", required=false, scope=ScopeType.CONVERSATION)
private TpProcessSelector defaultErrorProcess;
....
@Override
protected TpProcessSelector createInstance()
{
if (defaultErrorProcess == null)
defaultErrorProcess = new TpProcessSelector();
return defaultErrorProcess;
}
....
}
The class that controls the conversation is as follows:
@Name("inDocConfigBean")
@Scope(ScopeType.CONVERSATION)
public class InDocConfigBean
{
....
@In(value="#{inDocConfigControl}")
private InDocConfigControl inDocConfigControl;
@Out(value="defaultErrorProcess", required=false)
private TpProcessSelector defaultErrorProcess;
If the defaultErrorProcess is initialized here with a value from the database or is null.
...
}
It has @Begin and @End methods.
The context variable is accessed in the second screen as follows:
<s:decorate
id="errorProcessVersion"
template="/layout/display.xhtml"
rendered="#{!inDocConfigControl.addDefErrProc()}">
<ui:define name="label">Error Process Version</ui:define>
<h:outputText value="#{inDocConfigBean.inDocConfigControl.defaultErrorBusinessProcess.bpProcessDefinitions.id.processVersion}"/>
</s:decorate
For the InDocConfigControl I have
@Name("inDocConfigControl")
public class InDocConfigControl
extends EntityQuery<TpSearchMethodXref>
{
...
@In(value="defaultErrorProcess", create=false, required=false)
@Out(value="defaultErrorProcess", required=false, scope=ScopeType.CONVERSATION)
private TpProcessSelector defaultErrorProcess;
...
public TpProcessSelector getDefaultErrorBusinessProcess()
{
return defaultErrorProcess;
}
...
}
Sorry if the snippets are not full, but the code is in several Java files and JSF pages. -
3. Re: Outjecting in conversation
kragoth Feb 10, 2010 2:30 AM (in response to spetkov)
Stoyan Petkov wrote on Feb 10, 2010 02:23:@Override protected TpProcessSelector createInstance() { if (defaultErrorProcess == null) defaultErrorProcess = new TpProcessSelector(); return defaultErrorProcess; }
You can't use the new operator to construct a new instance of Seam beans.
Instead use Component.getInstance(TpProcessSelector.class, true)Hope that helps.
-
4. Re: Outjecting in conversation
spetkov Feb 10, 2010 2:55 AM (in response to spetkov)In fact every thing is fine if in the case of a new instance in the InDocConfigBean I create an empty defaultErrorProcess. It gets populated with data on its on screen and it is in the conversation. The problem is when the value is null. I understand that in this case nothing gets put in the conversation, but I would expect that when the object gets created later in the conversation the value to be outjected to the conversation. I would be interested to know if I am doing something not right or that how the behavior is designed to work. I can supply more code snippets if needed.
-
5. Re: Outjecting in conversation
spetkov Feb 10, 2010 2:56 AM (in response to spetkov)OK. Let me try it...
-
6. Re: Outjecting in conversation
kragoth Feb 10, 2010 2:58 AM (in response to spetkov)Did you try what I said or not?
-
7. Re: Outjecting in conversation
kragoth Feb 10, 2010 2:58 AM (in response to spetkov)Nevermind.... didn't get your reply till just then :S
-
8. Re: Outjecting in conversation
spetkov Feb 10, 2010 3:15 AM (in response to spetkov)Thanks for the suggestion. TpProcessSelector is not a Seam component. In order to test my scenario I use new TpProcessSelector in the case when I do not have data in the database. I have the object created in inDocConfigBean. In this case I can see the variable outjected to the conversation.
I have noticed that inDocConfigBean has @Scope conversation, but TpProcessSelectorHome does not. Is it posible this to have an effect on the outjection process.
-
9. Re: Outjecting in conversation
amitev Feb 10, 2010 7:35 AM (in response to spetkov)If you don't specify outjection scope explicitly, the scope of the component owning the reference is used.
-
10. Re: Outjecting in conversation
spetkov Feb 10, 2010 7:45 AM (in response to spetkov)So you are saying that in the case of creating the defaultErrorProcess instance in the InDocConfigBean it gets outjected in the conversation because of the @Scope annotation?
-
11. Re: Outjecting in conversation
spetkov Feb 10, 2010 8:05 AM (in response to spetkov)I have solved the problem by creating a non initialized defaultErrorProcess instance in the InDocConfigBean and outjecting it in the conversation. Then I inject it when I want to add or change the information.
My original idea for the case when the data is not present in the database to create the instance when the user enters the information, but I could not get the instance outjected to the conversation.
Still can not understand why?
Thanks for all the help.