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 org.apache.jdo.tck.pc.company.IEmployee;
   23   import org.apache.jdo.tck.pc.company.IMedicalInsurance;
   24   import org.apache.jdo.tck.util.EqualityHelper;
   25   
   26   /**
   27    * This class represents a dental insurance carrier selection for a
   28    * particular <code>Employee</code>.
   29    */
   30   @Entity
   31   public class JPAAppMedicalInsurance extends JPAAppInsurance implements IMedicalInsurance {
   32   
   33       @Column(name="PLANTYPE")
   34       private String planType; // possible values: "PPO", "EPO", "NPO" 
   35   
   36       /** This is the JDO-required no-args constructor. The TCK relies on
   37        * this constructor for testing PersistenceManager.newInstance(PCClass).
   38        */
   39       public JPAAppMedicalInsurance() {}
   40   
   41       /**
   42        * Construct a <code>JPAAppMedicalInsurance</code> instance.
   43        * 
   44        * 
   45        * @param insid The insurance instance identifier.
   46        * @param carrier The insurance carrier.
   47        * @param planType The planType.
   48        */
   49       public JPAAppMedicalInsurance(long insid, String carrier, 
   50                               String planType)
   51       {
   52           super(insid, carrier);
   53           this.planType = planType;
   54       }
   55   
   56       /**
   57        * Construct a <code>JPAAppMedicalInsurance</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 planType The planType.
   64        */
   65       public JPAAppMedicalInsurance(long insid, String carrier, 
   66                               IEmployee employee, String planType)
   67       {
   68           super(insid, carrier, (JPAAppEmployee)employee);
   69           this.planType = planType;
   70       }
   71   
   72       /**
   73        * Get the insurance planType.
   74        * @return The insurance planType.
   75        */
   76       public String getPlanType() {
   77           return planType;
   78       }
   79   
   80       /**
   81        * Set the insurance planType.
   82        * @param planType The insurance planType.
   83        */
   84       public void setPlanType(String planType) {
   85           this.planType = planType;
   86       }
   87   
   88       /**
   89        * Returns a String representation of a <code>JPAAppMedicalInsurance</code>
   90        * object.
   91        * 
   92        * 
   93        * @return a String representation of a <code>JPAAppMedicalInsurance</code>
   94        * object.
   95        */
   96       public String toString() {
   97           return "JPAMedicalInsurance(" + getFieldRepr() + ")";
   98       }
   99   
  100       /**
  101        * Returns a String representation of the non-relationship fields.
  102        * @return a String representation of the non-relationship fields.
  103        */
  104       protected String getFieldRepr() {
  105           StringBuffer rc = new StringBuffer();
  106           rc.append(super.getFieldRepr());
  107           rc.append(", planType ").append(planType);
  108           return rc.toString();
  109       }
  110   
  111       /** 
  112        * Returns <code>true</code> if all the fields of this instance are
  113        * deep equal to the coresponding fields of the other Object.
  114        * @param other the object with which to compare.
  115        * @param helper EqualityHelper to keep track of instances that have
  116        * already been processed. 
  117        * @return <code>true</code> if all the fields are deep equal;
  118        * <code>false</code> otherwise.  
  119        * @throws ClassCastException if the specified instances' type prevents
  120        * it from being compared to this instance. 
  121        */
  122       public boolean deepCompareFields(Object other, 
  123                                        EqualityHelper helper) {
  124           JPAAppMedicalInsurance otherIns = (JPAAppMedicalInsurance)other;
  125           String where = "JPAAppMedicalInsurance<" + getInsid() + ">";
  126           return super.deepCompareFields(otherIns, helper) &
  127               helper.equals(planType, otherIns.getPlanType(), where + ".planType");
  128       }
  129   }
  130   

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