On Mon, Aug 20, 2012 at 1:13 PM, Thiago H de Paula Figueiredo [via
Tapestry] <ml-node+s1045711n571561...@n5.nabble.com> wrote:

> On Mon, 20 Aug 2012 12:36:34 -0300, George Christman
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5715615&i=0>>
> wrote:
>
> > public static SomeService someServiceBuilder(Service1 service1, Service2
> > service2) {
> >   return new SomeService(service1, service2);
> > }
>
> This can be replaced by binder.bind().
>
> > and returns a new Class(service1, service2). I wasn't aware you could
> > pass in non service objs into the method.
>
> Which method? The builder method parameters can only handle services and a
>
> couple other objects (distributed configuration and other objects that
> aren't services but have injection provided for them. Inside the method,
> you can do anything you want.
>
> Okay, this is what that is what I thought based on what I've read.


> > In my case I have an entity called
> > ImportTask.class. I'm populating the ImportTask from a hibernate
> criteria
> > query.
> >
> > @Inject
> > private AutoMateParser autoMateParser;
> >
> > ImportTask importTasks = (ImportTask) session.get(ImportTask.class,
> > DatabaseConstant.AUTOMATE_PARSER);
> >
> > for(ImporTask importTask : importTasks) {
> >    //non service
> >    AutoMateParser autoMateParser = new AutoMateParser(importTask);
> >
> >    //With Service
> >    autoMateParser.set(importTasks);
> > }
> >
> > I tried something like this below,
> >
> > public static AutoMateParser autoMateParserBuilder(ImportTask
> > importTask) {
> >     return new AutoMateParser(importTask);
> > }
> >
> > but couldn't figure out how to actually pass my import obj into the
> > builder method so it ends up .
>
> Declare ImportTask as a service and it'll work.
>

Okay Few more minor questions on this and I think I'll be good to go.

1. If I declared ImportTask as a service, could I use it as a list as well?

Example

@Inject
private List<ImportTask> importTask;

2. When using services, should the service always be used with an
interface? In the case above, it's being shown with a Hibernate entity
class.

3. lastly when I populate my Service Obj, is that data available to me in
another service, or would some sort of  @SessionState be required? I just
always thought service's were used to handle business logic and not to be
used like a bean.

Once again Thiago, thanks for all your help.


> The only way I know of getting that non service obj
> into my Service is with a set. Could you explain an alternate way to
> passing in that obj so it ends up in the service constructor?

public static SomeService someServiceBuilder(Service1 service1, Service2
> service2) {
>      SomeService service = new SomeService(service1, service2);
>      SomethingElse else = ...; // do anything you want here
>      service.setSomethingElse(else);
>      return service;
> }
>
> --
> Thiago H. de Paula Figueiredo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=5715615&i=1>
> For additional commands, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=5715615&i=2>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://tapestry.1045711.n5.nabble.com/Question-tapestry-service-tp5715573p5715615.html
>  To unsubscribe from Question tapestry service, click 
> here<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5715573&code=Z2NocmlzdG1hbkBjYXJkYWRkeS5jb218NTcxNTU3M3wxNjMyOTYxMjA3>
> .
> NAML<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Question-tapestry-service-tp5715573p5715616.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Reply via email to