Save This Page
Home » jdo2-tck-2.3-ea-src » org.apache.jdo.tck.pc.companyAnnotatedJPA » [javadoc | source]
    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    * 
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    * 
   11    * Unless required by applicable law or agreed to in writing, software 
   12    * distributed under the License is distributed on an "AS IS" BASIS, 
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
   14    * See the License for the specific language governing permissions and 
   15    * limitations under the License.
   16    */
   17    
   18   package org.apache.jdo.tck.pc.companyAnnotatedJPA;
   19   
   20   import javax.persistence;
   21   
   22   import java.math.BigDecimal;
   23   
   24   import org.apache.jdo.tck.pc.company.IDentalInsurance;
   25   import org.apache.jdo.tck.pc.company.IEmployee;
   26   import org.apache.jdo.tck.util.EqualityHelper;
   27   
   28   /**
   29    * This class represents a dental insurance carrier selection for a
   30    * particular <code>Employee</code>.
   31    */
   32   @Entity
   33   public class JPAAppDentalInsurance extends JPAAppInsurance
   34       implements IDentalInsurance {
   35   
   36       @Column(name="LIFETIME_ORTHO_BENEFIT")
   37       private BigDecimal lifetimeOrthoBenefit;
   38   
   39       /** This is the JDO-required no-args constructor. The TCK relies on
   40        * this constructor for testing PersistenceManager.newInstance(PCClass).
   41        */
   42       public JPAAppDentalInsurance() {}
   43   
   44       /**
   45        * Construct a <code>DentalInsurance</code> instance.
   46        * @param insid The insurance instance identifier.
   47        * @param carrier The insurance carrier.
   48        * @param lifetimeOrthoBenefit The lifetimeOrthoBenefit.
   49        */
   50       public JPAAppDentalInsurance(long insid, String carrier, 
   51                              BigDecimal lifetimeOrthoBenefit) {
   52           super(insid, carrier);
   53           this.lifetimeOrthoBenefit = lifetimeOrthoBenefit;
   54       }
   55   
   56       /**
   57        * Construct a <code>JPAAppDentalInsurance</code> instance.
   58        * 
   59        * 
   60        * @param insid The insurance instance identifier.
   61        * @param carrier The insurance carrier.
   62        * @param employee The employee associated with this insurance.
   63        * @param lifetimeOrthoBenefit The lifetimeOrthoBenefit.
   64        */
   65       public JPAAppDentalInsurance(long insid, String carrier, IEmployee employee,
   66                              BigDecimal lifetimeOrthoBenefit) {
   67           super(insid, carrier, employee);
   68           this.lifetimeOrthoBenefit = lifetimeOrthoBenefit;
   69       }
   70   
   71       /**
   72        * Get the insurance lifetimeOrthoBenefit.
   73        * @return The insurance lifetimeOrthoBenefit.
   74        */
   75       public BigDecimal getLifetimeOrthoBenefit() {
   76           return lifetimeOrthoBenefit;
   77       }
   78   
   79       /**
   80        * Set the insurance lifetimeOrthoBenefit.
   81        * @param lifetimeOrthoBenefit The insurance lifetimeOrthoBenefit.
   82        */
   83       public void setLifetimeOrthoBenefit(BigDecimal lifetimeOrthoBenefit) {
   84           this.lifetimeOrthoBenefit = lifetimeOrthoBenefit;
   85       }
   86   
   87       /**
   88        * Returns a String representation of a <code>JPAAppDentalInsurance</code>
   89        * object.
   90        * 
   91        * 
   92        * @return a String representation of a <code>JPAAppDentalInsurance</code>
   93        * object.
   94        */
   95       public String toString() {
   96           return "JPAAppDentalInsurance(" + getFieldRepr()+ ")";
   97       }
   98   
   99       /**
  100        * Returns a String representation of the non-relationship fields.
  101        * @return a String representation of the non-relationship fields.
  102        */
  103       protected String getFieldRepr() {
  104           StringBuffer rc = new StringBuffer();
  105           rc.append(super.getFieldRepr());
  106           rc.append(", lifetimeOrthoBenefit ").append(lifetimeOrthoBenefit);
  107           return rc.toString();
  108       }
  109   
  110       /** 
  111        * Returns <code>true</code> if all the fields of this instance are
  112        * deep equal to the coresponding fields of the other Object.
  113        * @param other the object with which to compare.
  114        * @param helper EqualityHelper to keep track of instances that have
  115        * already been processed. 
  116        * @return <code>true</code> if all the fields are deep equal;
  117        * <code>false</code> otherwise.  
  118        * @throws ClassCastException if the specified instances' type prevents
  119        * it from being compared to this instance. 
  120        */
  121       public boolean deepCompareFields(Object other, 
  122                                        EqualityHelper helper) {
  123           JPAAppDentalInsurance otherIns = (JPAAppDentalInsurance)other;
  124           String where = "JPAAppDentalInsurance<" + getInsid() + ">";
  125           return super.deepCompareFields(otherIns, helper) &
  126               helper.equals(lifetimeOrthoBenefit, 
  127                             otherIns.getLifetimeOrthoBenefit(), where + ".lifetimeOrthoBenefit");
  128       }
  129   
  130   }
  131   

Save This Page
Home » jdo2-tck-2.3-ea-src » org.apache.jdo.tck.pc.companyAnnotatedJPA » [javadoc | source]