Coverage report

  %line %branch
org.apache.turbine.services.schedule.BaseJobEntry
22% 
78% 

 1  
 package org.apache.turbine.services.schedule;
 2  
 
 3  
 
 4  
 import java.math.BigDecimal;
 5  
 import java.sql.Connection;
 6  
 import java.util.ArrayList;
 7  
 import java.util.Collections;
 8  
 import java.util.Date;
 9  
 import java.util.List;
 10  
 
 11  
 import org.apache.commons.lang.ObjectUtils;
 12  
 import org.apache.torque.TorqueException;
 13  
 import org.apache.torque.om.BaseObject;
 14  
 import org.apache.torque.om.ComboKey;
 15  
 import org.apache.torque.om.DateKey;
 16  
 import org.apache.torque.om.NumberKey;
 17  
 import org.apache.torque.om.ObjectKey;
 18  
 import org.apache.torque.om.SimpleKey;
 19  
 import org.apache.torque.om.StringKey;
 20  
 import org.apache.torque.om.Persistent;
 21  
 import org.apache.torque.util.Criteria;
 22  
 import org.apache.torque.util.Transaction;
 23  
 
 24  
 
 25  
 /**
 26  
  * This class was autogenerated by Torque on:
 27  
  *
 28  
  * [Mon Oct 03 14:24:57 CEST 2005]
 29  
  *
 30  
  * You should not use this class directly.  It should not even be
 31  
  * extended all references should be to JobEntry
 32  
  */
 33  15
 public abstract class BaseJobEntry extends BaseObject
 34  
 {
 35  
     /** The Peer class */
 36  6
     private static final JobEntryPeer peer =
 37  
         new JobEntryPeer();
 38  
 
 39  
         
 40  
     /** The value for the jobId field */
 41  
     private int jobId;
 42  
                                           
 43  
     /** The value for the second field */
 44  10
     private int second = -1;
 45  
                                           
 46  
     /** The value for the minute field */
 47  10
     private int minute = -1;
 48  
                                           
 49  
     /** The value for the hour field */
 50  10
     private int hour = -1;
 51  
                                           
 52  
     /** The value for the weekDay field */
 53  10
     private int weekDay = -1;
 54  
                                           
 55  
     /** The value for the dayOfMonth field */
 56  10
     private int dayOfMonth = -1;
 57  
       
 58  
     /** The value for the task field */
 59  
     private String task;
 60  
       
 61  
     /** The value for the email field */
 62  
     private String email;
 63  
       
 64  
     /** The value for the property field */
 65  
     private byte[] property;
 66  
   
 67  
     
 68  
     /**
 69  
      * Get the JobId
 70  
      *
 71  
      * @return int
 72  
      */
 73  
     public int getJobId()
 74  
     {
 75  44
         return jobId;
 76  
     }
 77  
 
 78  
                         
 79  
     /**
 80  
      * Set the value of JobId
 81  
      *
 82  
      * @param v new value
 83  
      */
 84  
     public void setJobId(int v) 
 85  
     {
 86  
     
 87  12
                   if (this.jobId != v)
 88  
               {
 89  12
             this.jobId = v;
 90  12
             setModified(true);
 91  
         }
 92  
     
 93  
           
 94  12
               }
 95  
   
 96  
     /**
 97  
      * Get the Second
 98  
      *
 99  
      * @return int
 100  
      */
 101  
     public int getSecond()
 102  
     {
 103  14
         return second;
 104  
     }
 105  
 
 106  
                         
 107  
     /**
 108  
      * Set the value of Second
 109  
      *
 110  
      * @param v new value
 111  
      */
 112  
     public void setSecond(int v) 
 113  
     {
 114  
     
 115  8
                   if (this.second != v)
 116  
               {
 117  8
             this.second = v;
 118  8
             setModified(true);
 119  
         }
 120  
     
 121  
           
 122  8
               }
 123  
   
 124  
     /**
 125  
      * Get the Minute
 126  
      *
 127  
      * @return int
 128  
      */
 129  
     public int getMinute()
 130  
     {
 131  16
         return minute;
 132  
     }
 133  
 
 134  
                         
 135  
     /**
 136  
      * Set the value of Minute
 137  
      *
 138  
      * @param v new value
 139  
      */
 140  
     public void setMinute(int v) 
 141  
     {
 142  
     
 143  8
                   if (this.minute != v)
 144  
               {
 145  6
             this.minute = v;
 146  6
             setModified(true);
 147  
         }
 148  
     
 149  
           
 150  8
               }
 151  
   
 152  
     /**
 153  
      * Get the Hour
 154  
      *
 155  
      * @return int
 156  
      */
 157  
     public int getHour()
 158  
     {
 159  8
         return hour;
 160  
     }
 161  
 
 162  
                         
 163  
     /**
 164  
      * Set the value of Hour
 165  
      *
 166  
      * @param v new value
 167  
      */
 168  
     public void setHour(int v) 
 169  
     {
 170  
     
 171  8
                   if (this.hour != v)
 172  
               {
 173  0
             this.hour = v;
 174  0
             setModified(true);
 175  
         }
 176  
     
 177  
           
 178  8
               }
 179  
   
 180  
     /**
 181  
      * Get the WeekDay
 182  
      *
 183  
      * @return int
 184  
      */
 185  
     public int getWeekDay()
 186  
     {
 187  8
         return weekDay;
 188  
     }
 189  
 
 190  
                         
 191  
     /**
 192  
      * Set the value of WeekDay
 193  
      *
 194  
      * @param v new value
 195  
      */
 196  
     public void setWeekDay(int v) 
 197  
     {
 198  
     
 199  8
                   if (this.weekDay != v)
 200  
               {
 201  0
             this.weekDay = v;
 202  0
             setModified(true);
 203  
         }
 204  
     
 205  
           
 206  8
               }
 207  
   
 208  
     /**
 209  
      * Get the DayOfMonth
 210  
      *
 211  
      * @return int
 212  
      */
 213  
     public int getDayOfMonth()
 214  
     {
 215  8
         return dayOfMonth;
 216  
     }
 217  
 
 218  
                         
 219  
     /**
 220  
      * Set the value of DayOfMonth
 221  
      *
 222  
      * @param v new value
 223  
      */
 224  
     public void setDayOfMonth(int v) 
 225  
     {
 226  
     
 227  8
                   if (this.dayOfMonth != v)
 228  
               {
 229  0
             this.dayOfMonth = v;
 230  0
             setModified(true);
 231  
         }
 232  
     
 233  
           
 234  8
               }
 235  
   
 236  
     /**
 237  
      * Get the Task
 238  
      *
 239  
      * @return String
 240  
      */
 241  
     public String getTask()
 242  
     {
 243  8
         return task;
 244  
     }
 245  
 
 246  
                         
 247  
     /**
 248  
      * Set the value of Task
 249  
      *
 250  
      * @param v new value
 251  
      */
 252  
     public void setTask(String v) 
 253  
     {
 254  
     
 255  8
                   if (!ObjectUtils.equals(this.task, v))
 256  
               {
 257  8
             this.task = v;
 258  8
             setModified(true);
 259  
         }
 260  
     
 261  
           
 262  8
               }
 263  
   
 264  
     /**
 265  
      * Get the Email
 266  
      *
 267  
      * @return String
 268  
      */
 269  
     public String getEmail()
 270  
     {
 271  0
         return email;
 272  
     }
 273  
 
 274  
                         
 275  
     /**
 276  
      * Set the value of Email
 277  
      *
 278  
      * @param v new value
 279  
      */
 280  
     public void setEmail(String v) 
 281  
     {
 282  
     
 283  0
                   if (!ObjectUtils.equals(this.email, v))
 284  
               {
 285  0
             this.email = v;
 286  0
             setModified(true);
 287  
         }
 288  
     
 289  
           
 290  0
               }
 291  
   
 292  
     /**
 293  
      * Get the Property
 294  
      *
 295  
      * @return byte[]
 296  
      */
 297  
     public byte[] getProperty()
 298  
     {
 299  0
         return property;
 300  
     }
 301  
 
 302  
                         
 303  
     /**
 304  
      * Set the value of Property
 305  
      *
 306  
      * @param v new value
 307  
      */
 308  
     public void setProperty(byte[] v) 
 309  
     {
 310  
     
 311  0
                   if (!ObjectUtils.equals(this.property, v))
 312  
               {
 313  0
             this.property = v;
 314  0
             setModified(true);
 315  
         }
 316  
     
 317  
           
 318  0
               }
 319  
   
 320  
          
 321  
                 
 322  4
     private static List fieldNames = null;
 323  
 
 324  
     /**
 325  
      * Generate a list of field names.
 326  
      *
 327  
      * @return a list of field names
 328  
      */
 329  
     public static synchronized List getFieldNames()
 330  
     {
 331  0
         if (fieldNames == null)
 332  
         {
 333  0
             fieldNames = new ArrayList();
 334  0
               fieldNames.add("JobId");
 335  0
               fieldNames.add("Second");
 336  0
               fieldNames.add("Minute");
 337  0
               fieldNames.add("Hour");
 338  0
               fieldNames.add("WeekDay");
 339  0
               fieldNames.add("DayOfMonth");
 340  0
               fieldNames.add("Task");
 341  0
               fieldNames.add("Email");
 342  0
               fieldNames.add("Property");
 343  0
               fieldNames = Collections.unmodifiableList(fieldNames);
 344  
         }
 345  0
         return fieldNames;
 346  
     }
 347  
 
 348  
     /**
 349  
      * Retrieves a field from the object by name passed in as a String.
 350  
      *
 351  
      * @param name field name
 352  
      * @return value
 353  
      */
 354  
     public Object getByName(String name)
 355  
     {
 356  0
           if (name.equals("JobId"))
 357  
         {
 358  0
                 return new Integer(getJobId());
 359  
             }
 360  0
           if (name.equals("Second"))
 361  
         {
 362  0
                 return new Integer(getSecond());
 363  
             }
 364  0
           if (name.equals("Minute"))
 365  
         {
 366  0
                 return new Integer(getMinute());
 367  
             }
 368  0
           if (name.equals("Hour"))
 369  
         {
 370  0
                 return new Integer(getHour());
 371  
             }
 372  0
           if (name.equals("WeekDay"))
 373  
         {
 374  0
                 return new Integer(getWeekDay());
 375  
             }
 376  0
           if (name.equals("DayOfMonth"))
 377  
         {
 378  0
                 return new Integer(getDayOfMonth());
 379  
             }
 380  0
           if (name.equals("Task"))
 381  
         {
 382  0
                 return getTask();
 383  
             }
 384  0
           if (name.equals("Email"))
 385  
         {
 386  0
                 return getEmail();
 387  
             }
 388  0
           if (name.equals("Property"))
 389  
         {
 390  0
                 return getProperty();
 391  
             }
 392  0
           return null;
 393  
     }
 394  
     
 395  
     /**
 396  
      * Retrieves a field from the object by name passed in
 397  
      * as a String.  The String must be one of the static
 398  
      * Strings defined in this Class' Peer.
 399  
      *
 400  
      * @param name peer name
 401  
      * @return value
 402  
      */
 403  
     public Object getByPeerName(String name)
 404  
     {
 405  0
           if (name.equals(JobEntryPeer.JOB_ID))
 406  
         {
 407  0
                 return new Integer(getJobId());
 408  
             }
 409  0
           if (name.equals(JobEntryPeer.SECOND))
 410  
         {
 411  0
                 return new Integer(getSecond());
 412  
             }
 413  0
           if (name.equals(JobEntryPeer.MINUTE))
 414  
         {
 415  0
                 return new Integer(getMinute());
 416  
             }
 417  0
           if (name.equals(JobEntryPeer.HOUR))
 418  
         {
 419  0
                 return new Integer(getHour());
 420  
             }
 421  0
           if (name.equals(JobEntryPeer.WEEK_DAY))
 422  
         {
 423  0
                 return new Integer(getWeekDay());
 424  
             }
 425  0
           if (name.equals(JobEntryPeer.DAY_OF_MONTH))
 426  
         {
 427  0
                 return new Integer(getDayOfMonth());
 428  
             }
 429  0
           if (name.equals(JobEntryPeer.TASK))
 430  
         {
 431  0
                 return getTask();
 432  
             }
 433  0
           if (name.equals(JobEntryPeer.EMAIL))
 434  
         {
 435  0
                 return getEmail();
 436  
             }
 437  0
           if (name.equals(JobEntryPeer.PROPERTY))
 438  
         {
 439  0
                 return getProperty();
 440  
             }
 441  0
           return null;
 442  
     }
 443  
 
 444  
     /**
 445  
      * Retrieves a field from the object by Position as specified
 446  
      * in the xml schema.  Zero-based.
 447  
      *
 448  
      * @param pos position in xml schema
 449  
      * @return value
 450  
      */
 451  
     public Object getByPosition(int pos)
 452  
     {
 453  0
             if (pos == 0)
 454  
         {
 455  0
                 return new Integer(getJobId());
 456  
             }
 457  0
               if (pos == 1)
 458  
         {
 459  0
                 return new Integer(getSecond());
 460  
             }
 461  0
               if (pos == 2)
 462  
         {
 463  0
                 return new Integer(getMinute());
 464  
             }
 465  0
               if (pos == 3)
 466  
         {
 467  0
                 return new Integer(getHour());
 468  
             }
 469  0
               if (pos == 4)
 470  
         {
 471  0
                 return new Integer(getWeekDay());
 472  
             }
 473  0
               if (pos == 5)
 474  
         {
 475  0
                 return new Integer(getDayOfMonth());
 476  
             }
 477  0
               if (pos == 6)
 478  
         {
 479  0
                 return getTask();
 480  
             }
 481  0
               if (pos == 7)
 482  
         {
 483  0
                 return getEmail();
 484  
             }
 485  0
               if (pos == 8)
 486  
         {
 487  0
                 return getProperty();
 488  
             }
 489  0
               return null;
 490  
     }
 491  
      
 492  
     /**
 493  
      * Stores the object in the database.  If the object is new,
 494  
      * it inserts it; otherwise an update is performed.
 495  
      *
 496  
      * @throws Exception
 497  
      */
 498  
     public void save() throws Exception
 499  
     {
 500  0
           save(JobEntryPeer.getMapBuilder()
 501  
                 .getDatabaseMap().getName());
 502  0
       }
 503  
 
 504  
     /**
 505  
      * Stores the object in the database.  If the object is new,
 506  
      * it inserts it; otherwise an update is performed.
 507  
        * Note: this code is here because the method body is
 508  
      * auto-generated conditionally and therefore needs to be
 509  
      * in this file instead of in the super class, BaseObject.
 510  
        *
 511  
      * @param dbName
 512  
      * @throws TorqueException
 513  
      */
 514  
     public void save(String dbName) throws TorqueException
 515  
     {
 516  0
         Connection con = null;
 517  
           try
 518  
         {
 519  0
             con = Transaction.begin(dbName);
 520  0
             save(con);
 521  0
             Transaction.commit(con);
 522  
         }
 523  0
         catch(TorqueException e)
 524  
         {
 525  0
             Transaction.safeRollback(con);
 526  0
             throw e;
 527  0
         }
 528  0
       }
 529  
 
 530  
       /** flag to prevent endless save loop, if this object is referenced
 531  
         by another object which falls in this transaction. */
 532  10
     private boolean alreadyInSave = false;
 533  
       /**
 534  
      * Stores the object in the database.  If the object is new,
 535  
      * it inserts it; otherwise an update is performed.  This method
 536  
      * is meant to be used as part of a transaction, otherwise use
 537  
      * the save() method and the connection details will be handled
 538  
      * internally
 539  
      *
 540  
      * @param con
 541  
      * @throws TorqueException
 542  
      */
 543  
     public void save(Connection con) throws TorqueException
 544  
     {
 545  0
           if (!alreadyInSave)
 546  
         {
 547  0
             alreadyInSave = true;
 548  
 
 549  
 
 550  
   
 551  
             // If this object has been modified, then save it to the database.
 552  0
             if (isModclass="keyword">ified())
 553  
             {
 554  0
                 if (isNew())
 555  
                 {
 556  0
                     JobEntryPeer.doInsert((JobEntry) this, con);
 557  0
                     setNew(false);
 558  
                 }
 559  
                 else
 560  
                 {
 561  0
                     JobEntryPeer.doUpdate((JobEntry) this, con);
 562  
                 }
 563  
             }
 564  
 
 565  0
                       alreadyInSave = false;
 566  
         }
 567  0
       }
 568  
 
 569  
                   
 570  
       /**
 571  
      * Set the PrimaryKey using ObjectKey.
 572  
      *
 573  
      * @param key jobId ObjectKey
 574  
      */
 575  
     public void setPrimaryKey(ObjectKey key)
 576  
         
 577  
     {
 578  0
             setJobId(((NumberKey) key).intValue());
 579  0
         }
 580  
 
 581  
     /**
 582  
      * Set the PrimaryKey using a String.
 583  
      *
 584  
      * @param key
 585  
      */
 586  
     public void setPrimaryKey(String key) 
 587  
     {
 588  0
             setJobId(Integer.parseInt(key));
 589  0
         }
 590  
 
 591  
   
 592  
     /**
 593  
      * returns an id that differentiates this object from others
 594  
      * of its class.
 595  
      */
 596  
     public ObjectKey getPrimaryKey()
 597  
     {
 598  40
           return SimpleKey.keyFor(getJobId());
 599  
       }
 600  
  
 601  
 
 602  
     /**
 603  
      * Makes a copy of this object.
 604  
      * It creates a new object filling in the simple attributes.
 605  
        * It then fills all the association collections and sets the
 606  
      * related objects to isNew=true.
 607  
        */
 608  
       public JobEntry copy() throws TorqueException
 609  
     {
 610  0
         return copyInto(new JobEntry());
 611  
     }
 612  
   
 613  
     protected JobEntry copyInto(JobEntry copyObj) throws TorqueException
 614  
     {
 615  0
           copyObj.setJobId(jobId);
 616  0
           copyObj.setSecond(second);
 617  0
           copyObj.setMinute(minute);
 618  0
           copyObj.setHour(hour);
 619  0
           copyObj.setWeekDay(weekDay);
 620  0
           copyObj.setDayOfMonth(dayOfMonth);
 621  0
           copyObj.setTask(task);
 622  0
           copyObj.setEmail(email);
 623  0
           copyObj.setProperty(property);
 624  
   
 625  0
                             copyObj.setJobId( 0);
 626  
                                                             
 627  0
                 return copyObj;
 628  
     }
 629  
 
 630  
     /**
 631  
      * returns a peer instance associated with this om.  Since Peer classes
 632  
      * are not to have any instance attributes, this method returns the
 633  
      * same instance for all member of this class. The method could therefore
 634  
      * be static, but this would prevent one from overriding the behavior.
 635  
      */
 636  
     public JobEntryPeer getPeer()
 637  
     {
 638  0
         return peer;
 639  
     }
 640  
 
 641  
     public String toString()
 642  
     {
 643  0
         StringBuffer str = new StringBuffer();
 644  0
         str.append("JobEntry:\n");
 645  0
         str.append("JobId = ")
 646  
                .append(getJobId())
 647  
              .append("\n");
 648  0
         str.append("Second = ")
 649  
                .append(getSecond())
 650  
              .append("\n");
 651  0
         str.append("Minute = ")
 652  
                .append(getMinute())
 653  
              .append("\n");
 654  0
         str.append("Hour = ")
 655  
                .append(getHour())
 656  
              .append("\n");
 657  0
         str.append("WeekDay = ")
 658  
                .append(getWeekDay())
 659  
              .append("\n");
 660  0
         str.append("DayOfMonth = ")
 661  
                .append(getDayOfMonth())
 662  
              .append("\n");
 663  0
         str.append("Task = ")
 664  
                .append(getTask())
 665  
              .append("\n");
 666  0
         str.append("Email = ")
 667  
                .append(getEmail())
 668  
              .append("\n");
 669  0
         str.append("Property = ")
 670  
                .append("<binary>")
 671  
              .append("\n");
 672  0
         return(str.toString());
 673  
     }
 674  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.