001package org.apache.turbine.services.schedule;
002
003import java.io.Serializable;
004import java.sql.Connection;
005import java.util.Objects;
006
007import org.apache.torque.TorqueException;
008import org.apache.torque.map.TableMap;
009import org.apache.torque.om.NumberKey;
010import org.apache.torque.om.ObjectKey;
011import org.apache.torque.om.SimpleKey;
012import org.apache.torque.om.Persistent;
013import org.apache.torque.util.TorqueConnection;
014import org.apache.torque.util.Transaction;
015
016/**
017 * This class was autogenerated by Torque on:
018 *
019 * [Tue Dec 14 09:51:09 CET 2021]
020 *
021 * You should not use this class directly.  It should not even be
022 * extended; all references should be to JobEntryTorque
023 */
024@SuppressWarnings("unused")
025public abstract class BaseJobEntryTorque extends org.apache.turbine.services.schedule.AbstractJobEntry
026    implements Persistent, Serializable
027{
028    /** Serial version */
029    private static final long serialVersionUID = 1639471869696L;
030
031
032
033    /** Defines the jobId field. */
034    private int jobId = 0;
035
036    /** Defines the second field. */
037    private int second = -1;
038
039    /** Defines the minute field. */
040    private int minute = -1;
041
042    /** Defines the hour field. */
043    private int hour = -1;
044
045    /** Defines the weekDay field. */
046    private int weekDay = -1;
047
048    /** Defines the dayOfMonth field. */
049    private int dayOfMonth = -1;
050
051    /** Defines the task field. */
052    private String task = null;
053
054    /** Defines the email field. */
055    private String email = null;
056
057    /** Defines the property field. */
058    private byte[] property = null;
059
060    /** Whether this object was modified after loading or after last save. */
061    private boolean modified = true;
062
063    /** 
064     * Whether this object was loaded from the database or already saved 
065     * (false) or whether it is not yet in the database(true).
066     */
067    private boolean isNew = true;
068
069    /** Flag which indicates whether this object is currently saving. */
070    private boolean saving = false;
071
072    /** 
073     * Flag which indicates whether this object is currently loaded
074     * from the database. 
075     */
076    private boolean loading = false;
077
078    /** 
079     * Flag which indicates whether this object was deleted from the database.
080     * Note that this flags does not always display the current database state,
081     * there is no magical connection between this flag and the database.
082     */
083    private boolean deleted = false;
084
085
086
087
088
089    /**
090     * Get the value of jobId.
091     *
092     * @return the value of jobId as int
093     */
094    public int getJobId() 
095    {
096        
097        return jobId;
098    }
099
100    /**
101     * Set the value of jobId.
102     *
103     * @param v new value of jobId
104     */
105    public void setJobId(int v)
106    {
107        if (this.jobId != v)
108        {
109            setModified(true);
110        }
111
112        this.jobId = v;
113
114
115    }
116    
117    /**
118     * Get the value of second.
119     *
120     * @return the value of second as int
121     */
122    public int getSecond() 
123    {
124        
125        return second;
126    }
127
128    /**
129     * Set the value of second.
130     *
131     * @param v new value of second
132     */
133    public void setSecond(int v)
134    {
135        if (this.second != v)
136        {
137            setModified(true);
138        }
139
140        this.second = v;
141
142
143    }
144    
145    /**
146     * Get the value of minute.
147     *
148     * @return the value of minute as int
149     */
150    public int getMinute() 
151    {
152        
153        return minute;
154    }
155
156    /**
157     * Set the value of minute.
158     *
159     * @param v new value of minute
160     */
161    public void setMinute(int v)
162    {
163        if (this.minute != v)
164        {
165            setModified(true);
166        }
167
168        this.minute = v;
169
170
171    }
172    
173    /**
174     * Get the value of hour.
175     *
176     * @return the value of hour as int
177     */
178    public int getHour() 
179    {
180        
181        return hour;
182    }
183
184    /**
185     * Set the value of hour.
186     *
187     * @param v new value of hour
188     */
189    public void setHour(int v)
190    {
191        if (this.hour != v)
192        {
193            setModified(true);
194        }
195
196        this.hour = v;
197
198
199    }
200    
201    /**
202     * Get the value of weekDay.
203     *
204     * @return the value of weekDay as int
205     */
206    public int getWeekDay() 
207    {
208        
209        return weekDay;
210    }
211
212    /**
213     * Set the value of weekDay.
214     *
215     * @param v new value of weekDay
216     */
217    public void setWeekDay(int v)
218    {
219        if (this.weekDay != v)
220        {
221            setModified(true);
222        }
223
224        this.weekDay = v;
225
226
227    }
228    
229    /**
230     * Get the value of dayOfMonth.
231     *
232     * @return the value of dayOfMonth as int
233     */
234    public int getDayOfMonth() 
235    {
236        
237        return dayOfMonth;
238    }
239
240    /**
241     * Set the value of dayOfMonth.
242     *
243     * @param v new value of dayOfMonth
244     */
245    public void setDayOfMonth(int v)
246    {
247        if (this.dayOfMonth != v)
248        {
249            setModified(true);
250        }
251
252        this.dayOfMonth = v;
253
254
255    }
256    
257    /**
258     * Get the value of task.
259     *
260     * @return the value of task as String
261     */
262    public String getTask() 
263    {
264        
265        return task;
266    }
267
268    /**
269     * Set the value of task.
270     *
271     * @param v new value of task
272     */
273    public void setTask(String v)
274    {
275        if (!Objects.equals(this.task, v))
276        {
277            setModified(true);
278        }
279
280        this.task = v;
281
282
283    }
284    
285    /**
286     * Get the value of email.
287     *
288     * @return the value of email as String
289     */
290    public String getEmail() 
291    {
292        
293        return email;
294    }
295
296    /**
297     * Set the value of email.
298     *
299     * @param v new value of email
300     */
301    public void setEmail(String v)
302    {
303        if (!Objects.equals(this.email, v))
304        {
305            setModified(true);
306        }
307
308        this.email = v;
309
310
311    }
312    
313    /**
314     * Get the value of property.
315     *
316     * @return the value of property as byte[]
317     */
318    public byte[] getProperty() 
319    {
320        
321        return property;
322    }
323
324    /**
325     * Set the value of property.
326     *
327     * @param v new value of property
328     */
329    public void setProperty(byte[] v)
330    {
331        if (!Objects.equals(this.property, v))
332        {
333            setModified(true);
334        }
335
336        this.property = v;
337
338
339    }
340    
341
342    /**
343     * Returns whether the object has ever been saved.  This will
344     * be false, if the object was retrieved from storage or was created
345     * and then saved.
346     *
347     * @return true, if the object has never been persisted.
348     */
349    public boolean isNew()
350    {
351        return isNew;
352    }
353
354    /**
355     * Sets whether the object has ever been saved.
356     *
357     * @param isNew true if the object has never been saved, false otherwise.
358     */
359    public void setNew(boolean isNew)
360    {
361        this.isNew = isNew;
362    }
363
364    /**
365     * Returns whether the object has been modified.
366     *
367     * @return True if the object has been modified.
368     */
369    public boolean isModified()
370    {
371        return modified;
372    }
373
374    /**
375     * Sets whether the object has been modified.
376     *
377     * @param modified true if the object has been modified, false otherwise.
378     */
379    public void setModified(boolean modified)
380    {
381        this.modified = modified;
382    }
383
384    /**
385     * Sets the modified state for the object to be false.
386     */
387    public void resetModified()
388    {
389        modified = false;
390    }
391
392
393    /**
394     * Returns whether this object is currently saving.
395     *
396     * @return true if this object is currently saving, false otherwise.
397     */
398    public boolean isSaving()
399    {
400        return saving;
401    }
402
403    /**
404     * Sets whether this object is currently saving.
405     *
406     * @param saving true if this object is currently saving, false otherwise.
407     */
408    public void setSaving(boolean saving)
409    {
410        this.saving = saving;
411    }
412
413
414    /**
415     * Returns whether this object is currently being loaded from the database.
416     *
417     * @return true if this object is currently loading, false otherwise.
418     */
419    public boolean isLoading()
420    {
421        return loading;
422    }
423
424    /**
425     * Sets whether this object is currently being loaded from the database.
426     *
427     * @param loading true if this object is currently loading, false otherwise.
428     */
429    public void setLoading(boolean loading)
430    {
431        this.loading = loading;
432    }
433
434
435    /**
436     * Returns whether this object was deleted from the database.
437     * Note that this getter does not automatically reflect database state,
438     * it will be set to true by Torque if doDelete() was called with this 
439     * object. Bulk deletes and deletes via primary key do not change
440     * this flag. Also, if doDelete() was called on an object which does
441     * not exist in the database, the deleted flag is set to true even if
442     * it was not deleted.
443     *
444     * @return true if this object was deleted, false otherwise.
445     */
446    public boolean isDeleted()
447    {
448        return deleted;
449    }
450
451    /**
452     * Sets whether this object was deleted from the database.
453     *
454     * @param deleted true if this object was deleted, false otherwise.
455     */
456    public void setDeleted(boolean deleted)
457    {
458        this.deleted = deleted;
459    }
460
461
462
463
464
465
466
467
468    /**
469     * Stores an object in the database.  If the object is new,
470     * it is inserted; otherwise an update is performed.
471     *
472     * @throws TorqueException if an error occurs during saving.
473     */
474    public void save() throws TorqueException
475    {
476        save(JobEntryTorquePeer.DATABASE_NAME);
477    }
478
479    /**
480     * Stores an object in the database.  If the object is new,
481     * it is inserted; otherwise an update is performed.
482     *
483     * @param dbName the name of the database to which the object
484     *        should be saved.
485     *
486     * @throws TorqueException if an error occurs during saving.
487     */
488    public void save(String dbName) 
489            throws TorqueException
490    {
491        try (TorqueConnection con = Transaction.begin(dbName))
492        {
493            save(con);
494            Transaction.commit(con);
495        }
496    }
497
498    /**
499     * Stores an object in the database.  If the object is new,
500     * it is inserted; otherwise an update is performed.  This method
501     * is meant to be used as part of a transaction, otherwise use
502     * the save() method and the connection details will be handled
503     * internally.
504     *
505     * @param con the connection to use for saving the object, not null.
506     *
507     * @throws TorqueException if an error occurs during saving.
508     */
509    public void save(Connection con) 
510            throws TorqueException
511    {
512        if (isSaving())
513        {
514            return;
515        }
516        try
517        {
518            setSaving(true);
519            // If this object has been modified, then save it to the database.
520            if (isModified())
521            {
522                if (isNew())
523                {
524                    JobEntryTorquePeer.doInsert((JobEntryTorque) this, con);
525                    setNew(false);
526                }
527                else
528                {
529                    JobEntryTorquePeer.doUpdate((JobEntryTorque) this, con);
530                }
531            }
532
533        }
534        finally
535        {
536            setSaving(false);
537        }
538    }
539
540
541
542
543    /**
544     * Set the PrimaryKey using ObjectKey.
545     *
546     * @param key jobId ObjectKey
547     */
548    public void setPrimaryKey(ObjectKey<?> key)
549        
550    {
551        setJobId(((NumberKey) key).intValue());
552    }
553
554    /**
555     * Set the PrimaryKey using a String.
556     *
557     * @param key the primary key to set.
558     */
559    public void setPrimaryKey(String key) 
560    {
561        setJobId(Integer.parseInt(key));
562    }
563
564
565    /**
566     * returns an id that differentiates this object from others
567     * of its class.
568     */
569    public ObjectKey<?> getPrimaryKey()
570    {
571        return SimpleKey.keyFor(getJobId());
572    }
573
574
575
576    /**
577     * Makes a copy of this object.
578     * It creates a new object filling in the simple attributes.
579     * It then fills all the association collections and sets the
580     * related objects to isNew=true.
581     * @throws TorqueException if retrieval of the associated objects fails  
582     */
583    public JobEntryTorque copy() throws TorqueException
584    {
585        return copy(true);
586    }
587
588    /**
589     * Makes a copy of this object using a connection.
590     * It creates a new object filling in the simple attributes.
591     * It then fills all the association collections and sets the
592     * related objects to isNew=true.
593     *
594     * @param con the database connection to read associated objects.
595     * @throws TorqueException if retrieval of the associated objects fails     
596     */
597    public JobEntryTorque copy(Connection con) throws TorqueException
598    {
599        return copy(true, con);
600    }
601
602    /**
603     * Makes a copy of this object.
604     * It creates a new object filling in the simple attributes.
605     * If the parameter deepcopy is true, it then fills all the
606     * association collections and sets the related objects to
607     * isNew=true.
608     *
609     * @param deepcopy whether to copy the associated objects.
610     * @throws TorqueException if retrieval of the associated objects fails
611     */
612    public JobEntryTorque copy(boolean deepcopy) throws TorqueException
613    {
614        JobEntryTorque jobEntryTorque = new JobEntryTorque();
615
616        return copyInto(jobEntryTorque, deepcopy);
617    }
618
619    /**
620     * Makes a copy of this object using connection.
621     * It creates a new object filling in the simple attributes.
622     * If the parameter deepcopy is true, it then fills all the
623     * association collections and sets the related objects to
624     * isNew=true.
625     *
626     * @param deepcopy whether to copy the associated objects.
627     * @param con the database connection to read associated objects.
628     * @throws TorqueException if retrieval of the associated objects fails
629     */
630    public JobEntryTorque copy(boolean deepcopy, Connection con) throws TorqueException
631    {
632        JobEntryTorque jobEntryTorque = new JobEntryTorque();
633
634        return copyInto(jobEntryTorque, deepcopy, con);
635    }
636  
637    /**
638     * Fills the copyObj with the contents of this object.
639     * The associated objects are also copied and treated as new objects.
640     *
641     * @param copyObj the object to fill.
642     * @throws TorqueException if retrieval of the associated objects fails
643     */
644    public JobEntryTorque copyInto(JobEntryTorque copyObj) throws TorqueException
645    {
646        return copyInto(copyObj, true);
647    }
648
649    /**
650     * Fills the copyObj with the contents of this object using connection.
651     * The associated objects are also copied and treated as new objects.
652     *
653     * @param copyObj the object to fill.
654     * @param con the database connection to read associated objects.
655     * @throws TorqueException if retrieval of the associated objects fails
656     */
657    public JobEntryTorque copyInto(JobEntryTorque copyObj, Connection con) throws TorqueException
658    {
659        return copyInto(copyObj, true, con);
660    }
661  
662    /**
663     * Fills the copyObj with the contents of this object.
664     * If deepcopy is true, The associated objects are also copied
665     * and treated as new objects.
666     *
667     * @param copyObj the object to fill.
668     * @param deepcopy whether the associated objects should be copied.
669     * @throws TorqueException if retrieval of the associated objects fails
670     */
671    protected JobEntryTorque copyInto(JobEntryTorque copyObj, boolean deepcopy) throws TorqueException
672    {
673        copyObj.setJobId(0);
674        copyObj.setSecond(second);
675        copyObj.setMinute(minute);
676        copyObj.setHour(hour);
677        copyObj.setWeekDay(weekDay);
678        copyObj.setDayOfMonth(dayOfMonth);
679        copyObj.setTask(task);
680        copyObj.setEmail(email);
681        copyObj.setProperty(property);
682
683        if (deepcopy)
684        {
685        }
686        return copyObj;
687    }
688        
689    
690    /**
691     * Fills the copyObj with the contents of this object using connection.
692     * If deepcopy is true, The associated objects are also copied
693     * and treated as new objects.
694     *
695     * @param copyObj the object to fill.
696     * @param deepcopy whether the associated objects should be copied.
697     * @param con the database connection to read associated objects.
698     * @throws TorqueException if retrieval of the associated objects fails
699     */
700    public JobEntryTorque copyInto(JobEntryTorque copyObj, boolean deepcopy, Connection con) throws TorqueException
701    {
702        copyObj.setJobId(0);
703        copyObj.setSecond(second);
704        copyObj.setMinute(minute);
705        copyObj.setHour(hour);
706        copyObj.setWeekDay(weekDay);
707        copyObj.setDayOfMonth(dayOfMonth);
708        copyObj.setTask(task);
709        copyObj.setEmail(email);
710        copyObj.setProperty(property);
711
712        if (deepcopy)
713        {
714        }
715        return copyObj;
716    }
717
718    /** The Peer class */
719    private static final org.apache.turbine.services.schedule.JobEntryTorquePeer peer
720            = new org.apache.turbine.services.schedule.JobEntryTorquePeer();
721
722    /**
723     * returns a peer instance associated with this om.  Since Peer classes
724     * are not to have any instance attributes, this method returns the
725     * same instance for all member of this class. The method could therefore
726     * be static, but this would prevent one from overriding the behavior.
727     */
728    public org.apache.turbine.services.schedule.JobEntryTorquePeer getPeer()
729    {
730        return peer;
731    }
732
733    /**
734     * Retrieves the TableMap object related to this Table data without
735     * compiler warnings of using getPeer().getTableMap().
736     *
737     * @return The associated TableMap object.
738     * @throws TorqueException if associated objects are not found
739     */
740    public TableMap getTableMap() throws TorqueException
741    {
742        return org.apache.turbine.services.schedule.JobEntryTorquePeer.getTableMap();
743    }
744
745
746
747    public String toString()
748    {
749        StringBuffer str = new StringBuffer();
750        str.append("JobEntryTorque:\n");
751        str.append("jobId = ")
752           .append(getJobId())
753           .append("\n");
754        str.append("second = ")
755           .append(getSecond())
756           .append("\n");
757        str.append("minute = ")
758           .append(getMinute())
759           .append("\n");
760        str.append("hour = ")
761           .append(getHour())
762           .append("\n");
763        str.append("weekDay = ")
764           .append(getWeekDay())
765           .append("\n");
766        str.append("dayOfMonth = ")
767           .append(getDayOfMonth())
768           .append("\n");
769        str.append("task = ")
770           .append(getTask())
771           .append("\n");
772        str.append("email = ")
773           .append(getEmail())
774           .append("\n");
775        str.append("property = ")
776           .append("<binary>")
777           .append("\n");
778        return(str.toString());
779    }
780
781    /**
782     * Compares the primary key of this instance with the key of another.
783     *
784     * @param toCompare The object to compare to.
785     * @return Whether the primary keys are equal and the object have the
786     *         same class.
787     */
788    public boolean equals(Object toCompare)
789    {
790        if (toCompare == null)
791        {
792            return false;
793        }
794        if (this == toCompare)
795        {
796            return true;
797        }
798        if (!getClass().equals(toCompare.getClass()))
799        {
800            return false;
801        }
802        JobEntryTorque other = (JobEntryTorque) toCompare;
803        if (getPrimaryKey() == null || other.getPrimaryKey() == null)
804        {
805            return false;
806        }
807        return getPrimaryKey().equals(other.getPrimaryKey());
808    }
809
810    /**
811     * If the primary key is not <code>null</code>, return the hashcode of the
812     * primary key.  Otherwise calls <code>Object.hashCode()</code>.
813     *
814     * @return an <code>int</code> value
815     */
816    public int hashCode()
817    {
818        ObjectKey<?> ok = getPrimaryKey();
819        if (ok == null)
820        {
821            return super.hashCode();
822        }
823
824        return ok.hashCode();
825    }
826
827
828
829    /**
830     * Compares the content of this object to another object
831     *
832     * @param toCompare The object to compare to.
833     * @return true if all of the columns in the other object have 
834     *         the same value as the objects in this class.
835     */
836    public boolean valueEquals(JobEntryTorque toCompare)
837    {
838        if (toCompare == null)
839        {
840            return false;
841        }
842        if (this == toCompare)
843        {
844            return true;
845        }
846        if (this.jobId != toCompare.getJobId())
847        {
848            return false;
849        }
850        if (this.second != toCompare.getSecond())
851        {
852            return false;
853        }
854        if (this.minute != toCompare.getMinute())
855        {
856            return false;
857        }
858        if (this.hour != toCompare.getHour())
859        {
860            return false;
861        }
862        if (this.weekDay != toCompare.getWeekDay())
863        {
864            return false;
865        }
866        if (this.dayOfMonth != toCompare.getDayOfMonth())
867        {
868            return false;
869        }
870        if (!Objects.equals(this.task, toCompare.getTask()))
871        {
872            return false;
873        }
874        if (!Objects.equals(this.email, toCompare.getEmail()))
875        {
876            return false;
877        }
878        if (!Objects.equals(this.property, toCompare.getProperty()))
879        {
880            return false;
881        }
882        return true;
883    }
884
885
886
887}