Hi Declan,

I'm doing something very similar in my applications, but I don't rely on
isSet() anywhere.  Why do you need to use this? Maybe isSet only returns
true if the field is set to a value, not a non-blank default?

For validation, all I use is isValid() and isAllValid() and that works for
me.  Then I can rely on my intake.xml file to validate everything and my
form can be more 'dumb'. 

Let us know if you need more info,

David

-----Original Message-----
From: Declan Shanaghy [mailto:[EMAIL PROTECTED] 
Sent: October 19, 2006 10:47 AM
To: 'Turbine Users List'
Subject: Intake service using businedd model beans


Hello,
Im relatively new to turbine and have been getting to know it quite well
however I have come across a situation involving the intake service which is
causing grief.

Let me explain how im doing this, and why it doesn't work.
I then would like to know is this such an odd way to perform this task?
How is it normally done?


1 My velocity template, instantiates a new form bean with all the data setup
accordingly (see code below)
2 I then map that form to the intake service in the standard way.
3 Everything is working hunky dory, I can use Field.getValue() from the
intake service no problem, however upon checking the Field.isSet() method
the return is always false.
4 From the source of Field.java I noticed that setFlag = true only occurs
During Field.init which im probably not using because these valus are not
coming from the runData object.

This causes a problem because I usually use velociMacros to generate the
HTML forms which depend on isSet() working correctly.

Can anyone provide any pointers as to how to make this work, or some well
known design patterns within the turbine communit for doing this

Thanks,
Declan


============== FILE EditScheduledJob.vm =================================
$params.init($data.Request)
#set( $jobId = $params.getInt("jobid", 0) )
#set( $schJobForm = $forms.getScheduledJobForm($jobId, $scheduler) )
#set( $schJobGroup = $intake.ScheduledJob.mapTo($schJobForm) )

#set ($fld = $schJobGroup.get("Task"))
$fld.Value<br/> <!-- always contains the correct value -->
$fld.isSet()<br/> <!-- always prints false -->

============== FILE FormTool.java =================================

public class FormTool implements ApplicationTool
{
    private Log log = LogFactory.getLog(this.getClass());
    private Configuration config;

    public ScheduledJobForm getScheduledJobForm( int jobId, SchedulerTool
scheduler ) throws Exception
    {
        ScheduledJobForm form = new ScheduledJobForm();
        if ( jobId > 0 )
        {
            JobEntry job = scheduler.getJob(String.valueOf(jobId));
            ScheduledJobConfiguration config = new
SystemTool().getJobConfiguration(job);

            form.setJobId(jobId);
            form.setEnabled(config.isEnabled());
            form.setDisplayName(config.getDisplayName());
            form.setTask(job.getTask());
            form.setEmail(job.getEmail());
            form.setSecond(job.getSecond());
            form.setMinute(job.getMinute());
            form.setHour(job.getHour());
            form.setDayOfMonth(job.getDayOfMonth());
            form.setWeekDay(job.getWeekDay());
            form.setHosts(config.getHosts());
        }

        return form;
    }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to