File: JobentryPeer.java

package info (click to toggle)
turbine 20010419-1
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 17,460 kB
  • ctags: 7,501
  • sloc: java: 41,929; xml: 12,430; sql: 637; sh: 90; makefile: 50
file content (132 lines) | stat: -rw-r--r-- 4,862 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package test.peer;



import com.workingdogs.village.*;
import org.apache.turbine.om.peer.*;
import org.apache.turbine.util.*;
import org.apache.turbine.util.db.*;
import org.apache.turbine.util.db.map.*;
import java.util.*;
import test.map.*;
import test.*;

/** This class was autogenerated by XMLSchemaToObjectModel on: Sun Aug 27 15:53:55 EDT 2000 */
public class JobentryPeer extends BasePeer
{
    /** the mapbuilder for this class */
    private static final JobentryMapBuilder mapBuilder = (JobentryMapBuilder)getMapBuilder(JobentryMapBuilder.CLASS_NAME);

    /** the table name for this class */
    public static final String TABLE_NAME = mapBuilder.getTable();

    /** the column name for the TASK id field */
    public static final String TASK = mapBuilder.getJobentry_Task();
    /** the column name for the HOUR id field */
    public static final String HOUR = mapBuilder.getJobentry_Hour();
    /** the column name for the MINUTE id field */
    public static final String MINUTE = mapBuilder.getJobentry_Minute();
    /** the column name for the DAY_OF_MONTH id field */
    public static final String DAY_OF_MONTH = mapBuilder.getJobentry_DayOfMonth();
    /** the column name for the WEEKDAY id field */
    public static final String WEEKDAY = mapBuilder.getJobentry_Weekday();
    /** the column name for the EMAIL id field */
    public static final String EMAIL = mapBuilder.getJobentry_Email();
    /** the column name for the JOBID id field */
    public static final String JOBID = mapBuilder.getJobentry_Jobid();

    /** Method to do inserts */ 
    public static Object doInsert( Criteria criteria ) throws Exception
    {
        return BasePeer.doInsert( criteria );
    }

    /** Method to do selects */ 
    public static Vector doSelect( Criteria criteria ) throws Exception
    {
        criteria.addSelectColumn( TASK );
        criteria.addSelectColumn( HOUR );
        criteria.addSelectColumn( MINUTE );
        criteria.addSelectColumn( DAY_OF_MONTH );
        criteria.addSelectColumn( WEEKDAY );
        criteria.addSelectColumn( EMAIL );
        criteria.addSelectColumn( JOBID );

        // BasePeer returns a Vector of Value (Village) arrays.  The array
        // order follows the order columns were placed in the Select clause.
        Vector rows = BasePeer.doSelect(criteria);
        Vector results = new Vector();

        // populate the object(s)
        for ( int i=0; i<rows.size(); i++ )
        {
           Jobentry obj = new Jobentry();
            Record row = (Record)rows.elementAt(i);
            obj.setTask( row.getValue(1).asString() );
            obj.setHour( row.getValue(2).asInt() );
            obj.setMinute( row.getValue(3).asInt() );
            obj.setDayOfMonth( row.getValue(4).asInt() );
            obj.setWeekday( row.getValue(5).asInt() );
            obj.setEmail( row.getValue(6).asString() );
            obj.setJobid( row.getValue(7).asInt() );
            results.addElement( obj );
         }
         return results;
    }

    /**
     * @param Criteria object containing data that is used to create the UPDATE statement.
     */
     public static void doUpdate(Criteria criteria) throws Exception
     {
         Criteria selectCriteria = new Criteria(2);
         selectCriteria.put( JOBID, criteria.remove(JOBID) );
         BasePeer.doUpdate( selectCriteria, criteria );
     }

    /**
     * @param Criteria object containing data that is used DELETE from database.
     */
     public static void doDelete(Criteria criteria) throws Exception
     {
         BasePeer.doDelete ( criteria );
     }

    /** Method to do inserts */
    public static Object doInsert( Jobentry obj ) throws Exception
    {
        return JobentryPeer.doInsert(buildCriteria(obj));
    }

    /** Build a Criteria object from the data object for this peer */
    public static Criteria buildCriteria( Jobentry obj )
    {
        Criteria criteria = new Criteria();
        criteria.add( JobentryPeer.TASK, obj.getTask() );
        criteria.add( JobentryPeer.HOUR, obj.getHour() );
        criteria.add( JobentryPeer.MINUTE, obj.getMinute() );
        criteria.add( JobentryPeer.DAY_OF_MONTH, obj.getDayOfMonth() );
        criteria.add( JobentryPeer.WEEKDAY, obj.getWeekday() );
        criteria.add( JobentryPeer.EMAIL, obj.getEmail() );
        if( obj.getJobid() > 0 )
            criteria.add( JobentryPeer.JOBID, obj.getJobid() );
        return criteria;
    }


    /**
     * @param obj the data object to update in the database.
     */
    public static void doUpdate(Jobentry obj) throws Exception
    {
        JobentryPeer.doUpdate(buildCriteria(obj));
    }
    /**
     * @param obj the data object to delete in the database.
     */
    public static void doDelete(Jobentry obj) throws Exception
    {
        JobentryPeer.doDelete(buildCriteria(obj));
    }

}