Code Search for Developers
 
 
  

TestDomainEntity.java from Texai at Krugle


Show TestDomainEntity.java syntax highlighted

/*
 * TestDomainEntity.java
 *
 * Created on October 30, 2006, 6:00 PM
 *
 * Description: Contains annotations to test Semantic Object Relational Mapping for
 * a prototype domain class.
 *
 * Copyright (C) 2006 Stephen L. Reed.
 *
 * This program is free software; you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

package org.texai.kb.persistence.test;

import java.util.List;
import java.util.Set;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OrderBy;
import javax.persistence.Transient;
import org.texai.kb.ejb.entity.AtomicTerm;
import org.texai.kb.persistence.DomainEntity;
import org.texai.kb.persistence.DomainProperty;

/**
 *
 * @author reed
 */
@DomainEntity(typeOf={"TransportationDeviceType", "SpatiallyDisjointObjectType"}, subClassOf={"Scooter", "Device-UserPowered"})
public class TestDomainEntity {
  
  // required annotation and field type
  /** the domain entity id injected by the container */
  @Id
  private Long domainEntityId;
  
  /** the name of this instance */
  @DomainProperty(name="prettyString-Canonical")
  private String name;
  
  /** the number of crew members needed to operate this vehicle*/
  @DomainProperty
  private int numberOfCrew;
  
  /** the number of crew members needed to operate this vehicle*/
  @DomainProperty(subPropertyOf="conceptuallyRelated", range="Scooter", domain="PositiveInteger", functional=true)
  private Integer maxNbrOfScooterRiders;
  
  /** the list of peers, ordered by primary key */
  @DomainProperty(
          name="testDomainEntityPeer", 
          subPropertyOf="conceptuallyRelated",
          range="org.texai.kb.persistence.test.TestDomainEntity",
          domain="org.texai.kb.persistence.test.TestDomainEntity",
          strengthField="myPeersStrengths",
          fetch=FetchType.EAGER)
  @OrderBy
  private List<TestDomainEntity> myPeers;
  
  /** the strengths associated with myPeers */
  private List<Double> myPeersStrengths;
  
  /** a field that should not be persisted */
  @Transient
  private String dontCareField;
  
  /** a functional association */
  @DomainProperty(
          subPropertyOf="conceptuallyRelated",
          range="org.texai.kb.persistence.test.TestDomainEntity",
          domain="org.texai.kb.persistence.test.TestDomainEntity",
          fetch=FetchType.EAGER)
  private TestDomainEntity favoriteTestDomainEntityPeer;
  
  /** an inverse property */
  @DomainProperty(
  subPropertyOf="conceptuallyRelated",
          range="CharacterString",
          domain="Scooter", inverse=true,
          strengthField="myInversePropertyStrength")
  private String myInverseProperty;
  
  /** the strength associated with myInverseProperty */
  private Double myInversePropertyStrength;
  
  /** an array type */
  @DomainProperty
  private String[] comment;
  
  /** a Set type that is lazily loaded */
  @DomainProperty
  private Set<String> cyclistNotes;
  
  /** a List type that is lazily loaded */
  @DomainProperty(name="myListTestString")
  private List<String> myListTestStrings;
  
  /** the indicator whether this object is Test1 */
  @DomainProperty(trueClass="TestDomainEntity_TrueTest1", falseClass="TestDomainEntity_FalseTest1")
  private boolean isTest1;
  
  /** the indicator whether this object is Test2 */
  @DomainProperty(trueClass="TestDomainEntity_TrueTest2", falseClass="TestDomainEntity_FalseTest2")
  private boolean isTest2;
  
  /** the domain entity field that is lazily loaded */
  @DomainProperty
  private TestDomainEntity myLazilyLoadedTestDomainEntity;
  
  /** the atomic term field that is lazily loaded */
  @DomainProperty
  private AtomicTerm myLazilyLoadedAtomicTerm;
  
  
  /**
   * Creates a new instance of TestDomainEntity
   */
  public TestDomainEntity() {
    super();
  }
  
  public Long getDomainEntityId() {
    return domainEntityId;
  }
  
  public void setDomainEntityId(Long domainEntityId) {
    this.domainEntityId = domainEntityId;
  }
  
  public String getName() {
    return name;
  }
  
  public void setName(String name) {
    this.name = name;
  }
  
  public int getNumberOfCrew() {
    return numberOfCrew;
  }
  
  public void setNumberOfCrew(int numberOfCrew) {
    this.numberOfCrew = numberOfCrew;
  }
  
  public int getMaxNbrOfScooterRiders() {
    return maxNbrOfScooterRiders;
  }
  
  public void setMaxNbrOfScooterRiders(int maxNbrOfScooterRiders) {
    this.maxNbrOfScooterRiders = maxNbrOfScooterRiders;
  }
  
  public List<TestDomainEntity> getMyPeers() {
    return myPeers;
  }
  
  public void setMyPeers(List<TestDomainEntity> myPeers) {
    this.myPeers = myPeers;
  }
  
  public String getDontCareField() {
    return dontCareField;
  }
  
  public void setDontCareField(String dontCareField) {
    this.dontCareField = dontCareField;
  }
  
  public TestDomainEntity getFavoriteTestDomainEntityPeer() {
    return favoriteTestDomainEntityPeer;
  }
  
  public void setFavoriteTestDomainEntityPeer(TestDomainEntity favoriteTestDomainEntityPeer) {
    this.favoriteTestDomainEntityPeer = favoriteTestDomainEntityPeer;
  }
  
  public boolean isTest1() {
    return isTest1;
  }
  
  public void setIsTest1(boolean isTest1) {
    this.isTest1 = isTest1;
  }
  
  public boolean isTest2() {
    return isTest2;
  }
  
  public void setIsTest2(boolean isTest2) {
    this.isTest2 = isTest2;
  }
  
  public String[] getComment() {
    return comment;
  }
  
  public void setComment(String[] comment) {
    this.comment = comment;
  }
  
  public Set<String> getCyclistNotes() {
    return cyclistNotes;
  }
  
  public void setCyclistNotes(Set<String> cyclistNote) {
    this.cyclistNotes = cyclistNote;
  }

  public String getMyInverseProperty() {
    return myInverseProperty;
  }

  public void setMyInverseProperty(String myInverseProperty) {
    this.myInverseProperty = myInverseProperty;
  }

  public Double getMyInversePropertyStrength() {
    return myInversePropertyStrength;
  }

  public void setMyInversePropertyStrength(Double myInversePropertyStrength) {
    this.myInversePropertyStrength = myInversePropertyStrength;
  }

  public List<Double> getMyPeersStrengths() {
    return myPeersStrengths;
  }

  public void setMyPeersStrengths(List<Double> myPeersStrengths) {
    this.myPeersStrengths = myPeersStrengths;
  }
  
  /**
   * Determines whether another object is equal to this AtomicTerm.
   * @param object the reference object with which to compare
   * @return <code>true</code> if this object is the same as the argument;
   * <code>false</code> otherwise.
   */
  @Override
  public boolean equals(final Object object) {
    if (!(object instanceof TestDomainEntity)) {
      return false;
    }
    final TestDomainEntity that = (TestDomainEntity) object;
    return this.name.equals(that.name);
  }
  
  /** Returns a string representation of this object.
   *
   * @return a string representation of this object
   */
  @Override
  public String toString() {
    if (name instanceof String && domainEntityId instanceof Long) {
      return "[TestDomainEntity: " + name + ", id: " + domainEntityId + "]";
    } else {
      return super.toString();
    }
  }

  public List<String> getMyListTestStrings() {
    return myListTestStrings;
  }

  public void setMyListTestStrings(List<String> myListTestStrings) {
    this.myListTestStrings = myListTestStrings;
  }

  public TestDomainEntity getMyLazilyLoadedTestDomainEntity() {
    return myLazilyLoadedTestDomainEntity;
  }

  public void setMyLazilyLoadedTestDomainEntity(TestDomainEntity myLazilyLoadedTestDomainEntity) {
    this.myLazilyLoadedTestDomainEntity = myLazilyLoadedTestDomainEntity;
  }

  public AtomicTerm getMyLazilyLoadedAtomicTerm() {
    return myLazilyLoadedAtomicTerm;
  }

  public void setMyLazilyLoadedAtomicTerm(AtomicTerm myLazilyLoadedAtomicTerm) {
    this.myLazilyLoadedAtomicTerm = myLazilyLoadedAtomicTerm;
  }
  
}




See more files for this project here

Texai

Texai is an chatbot that intelligently seeks to acquire knowledge and friendly behaviors.

Project homepage: http://sourceforge.net/projects/texai
Programming language(s): Java,Shell Script,XML
License: other

  TestDomainEntity.java
  package-info.java