@org.hibernate.search.annotations.Field - java examples

Here are the examples of the java api @org.hibernate.search.annotations.Field taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

68 Examples 7

19 View Complete Implementation : PatientIdentifier.java
Copyright Apache License 2.0
Author : isstac
/**
 * A <code>Patient</code> can have zero to n identifying PatientIdentifier(s). PatientIdentifiers
 * are anything from medical record numbers, to social security numbers, to driver's licenses. The
 * type of identifier is defined by the PatientIdentifierType. A PatientIdentifier also contains a
 * Location.
 *
 * @see org.openmrs.PatientIdentifierType
 */
@Indexed
public clreplaced PatientIdentifier extends BaseChangeableOpenmrsData implements java.io.Serializable, Comparable<PatientIdentifier> {

    public static final long serialVersionUID = 1123121L;

    private static final Logger log = LoggerFactory.getLogger(PatientIdentifier.clreplaced);

    // Fields
    /**
     * @since 1.5
     */
    @DoreplacedentId
    private Integer patientIdentifierId;

    @IndexedEmbedded(includeEmbeddedObjectId = true)
    private Patient patient;

    @Fields({ @Field(name = "identifierPhrase", replacedyzer = @replacedyzer(definition = Lucenereplacedyzers.PHRASE_replacedYZER), boost = @Boost(8f)), @Field(name = "identifierExact", replacedyzer = @replacedyzer(definition = Lucenereplacedyzers.EXACT_replacedYZER), boost = @Boost(4f)), @Field(name = "identifierStart", replacedyzer = @replacedyzer(definition = Lucenereplacedyzers.START_replacedYZER), boost = @Boost(2f)), @Field(name = "identifierAnywhere", replacedyzer = @replacedyzer(definition = Lucenereplacedyzers.ANYWHERE_replacedYZER)) })
    private String identifier;

    @IndexedEmbedded(includeEmbeddedObjectId = true)
    private PatientIdentifierType identifierType;

    private Location location;

    @Field
    private Boolean preferred = false;

    /**
     * default constructor
     */
    public PatientIdentifier() {
    }

    /**
     * Convenience constructor for creating a basic identifier
     *
     * @param identifier String identifier
     * @param type PatientIdentifierType
     * @param location Location of the identifier
     */
    public PatientIdentifier(String identifier, PatientIdentifierType type, Location location) {
        this.identifier = identifier;
        this.identifierType = type;
        this.location = location;
    }

    /**
     * Compares this PatientIdentifier object to the given otherIdentifier. This method differs from
     * {@link #equals(Object)} in that this method compares the inner fields of each identifier for
     * equality. Note: Null/empty fields on <code>otherIdentifier</code> /will not/ cause a false
     * value to be returned
     *
     * @param otherIdentifier PatientiIdentifier with which to compare
     * @return boolean true/false whether or not they are the same names
     */
    public boolean equalsContent(PatientIdentifier otherIdentifier) {
        boolean returnValue = true;
        // these are the methods to compare.
        String[] methods = { "getIdentifier", "getIdentifierType", "getLocation" };
        Clreplaced<? extends PatientIdentifier> identifierClreplaced = this.getClreplaced();
        // loop over all of the selected methods and compare this and other
        for (String methodName : methods) {
            try {
                Method method = identifierClreplaced.getMethod(methodName);
                Object thisValue = method.invoke(this);
                Object otherValue = method.invoke(otherIdentifier);
                if (otherValue != null) {
                    returnValue &= otherValue.equals(thisValue);
                }
            } catch (NoSuchMethodException e) {
                log.warn("No such method for comparison " + methodName, e);
            } catch (IllegalAccessException | InvocationTargetException e) {
                log.error("Error while comparing identifiers", e);
            }
        }
        return returnValue;
    }

    // property accessors
    /**
     * @return Returns the identifier.
     */
    public String getIdentifier() {
        return identifier;
    }

    /**
     * @param identifier The identifier to set.
     */
    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    /**
     * @return Returns the identifierType.
     */
    public PatientIdentifierType getIdentifierType() {
        return identifierType;
    }

    /**
     * @param identifierType The identifierType to set.
     */
    public void setIdentifierType(PatientIdentifierType identifierType) {
        this.identifierType = identifierType;
    }

    /**
     * @return Returns the location.
     */
    public Location getLocation() {
        return location;
    }

    /**
     * @param location The location to set.
     */
    public void setLocation(Location location) {
        this.location = location;
    }

    /**
     * @return Returns the patient.
     */
    public Patient getPatient() {
        return patient;
    }

    /**
     * @param patient The patient to set.
     */
    public void setPatient(Patient patient) {
        this.patient = patient;
    }

    @Override
    public String toString() {
        return this.identifier;
    }

    /**
     * @return Returns the preferred.
     */
    public Boolean getPreferred() {
        return preferred;
    }

    /**
     * @param preferred The preferred to set.
     */
    public void setPreferred(Boolean preferred) {
        this.preferred = preferred;
    }

    /**
     * @return the preferred status
     *
     * @deprecated as of 2.0, use {@link #getPreferred()}
     */
    @Deprecated
    @JsonIgnore
    public Boolean isPreferred() {
        return getPreferred();
    }

    /**
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     * @deprecated since 1.12. Use DefaultComparator instead.
     * Note: this comparator imposes orderings that are inconsistent with equals.
     */
    @Deprecated
    @Override
    @SuppressWarnings("squid:S1210")
    public int compareTo(PatientIdentifier other) {
        DefaultComparator piDefaultComparator = new DefaultComparator();
        return piDefaultComparator.compare(this, other);
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#getId()
     */
    @Override
    public Integer getId() {
        return getPatientIdentifierId();
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
     */
    @Override
    public void setId(Integer id) {
        setPatientIdentifierId(id);
    }

    /**
     * @since 1.5
     * @return the patientIdentifierId
     */
    public Integer getPatientIdentifierId() {
        return patientIdentifierId;
    }

    /**
     * @since 1.5
     * @param patientIdentifierId the patientIdentifierId to set
     */
    public void setPatientIdentifierId(Integer patientIdentifierId) {
        this.patientIdentifierId = patientIdentifierId;
    }

    /**
     * 	 Provides a default comparator.
     * 	 @since 1.12
     */
    public static clreplaced DefaultComparator implements Comparator<PatientIdentifier>, Serializable {

        private static final long serialVersionUID = 1L;

        @Override
        public int compare(PatientIdentifier pi1, PatientIdentifier pi2) {
            int retValue = 0;
            if (pi2 != null) {
                retValue = pi1.getVoided().compareTo(pi2.getVoided());
                if (retValue == 0) {
                    retValue = pi1.getPreferred().compareTo(pi2.getPreferred());
                }
                if (retValue == 0) {
                    retValue = OpenmrsUtil.compareWithNullAsLatest(pi1.getDateCreated(), pi2.getDateCreated());
                }
                if (pi1.getIdentifierType() == null && pi2.getIdentifierType() == null) {
                    return 0;
                }
                if (pi1.getIdentifierType() == null && pi2.getIdentifierType() != null) {
                    retValue = 1;
                }
                if (pi1.getIdentifierType() == null && pi2.getIdentifierType() != null) {
                    retValue = -1;
                }
                if (retValue == 0) {
                    retValue = OpenmrsUtil.compareWithNullAsGreatest(pi1.getIdentifierType().getPatientIdentifierTypeId(), pi2.getIdentifierType().getPatientIdentifierTypeId());
                }
                if (retValue == 0) {
                    retValue = OpenmrsUtil.compareWithNullAsGreatest(pi1.getIdentifier(), pi2.getIdentifier());
                }
                // if we've gotten this far, just check all identifier values.  If they are
                // equal, leave the objects at 0.  If not, arbitrarily pick retValue=1
                // and return that (they are not equal).
                if (retValue == 0 && !pi1.equalsContent(pi2)) {
                    retValue = 1;
                }
            }
            return retValue;
        }
    }
}

19 View Complete Implementation : ResourceIndexedSearchParamQuantity.java
Copyright Apache License 2.0
Author : jamesagnew
// @formatter:off
@Embeddable
@Enreplacedy
@Table(name = "HFJ_SPIDX_QUANreplacedY", indexes = { // We used to have an index named IDX_SP_QUANreplacedY - Dont reuse
@Index(name = "IDX_SP_QUANreplacedY_HASH", columnList = "HASH_IDENreplacedY,SP_VALUE"), @Index(name = "IDX_SP_QUANreplacedY_HASH_UN", columnList = "HASH_IDENreplacedY_AND_UNITS,SP_VALUE"), @Index(name = "IDX_SP_QUANreplacedY_HASH_SYSUN", columnList = "HASH_IDENreplacedY_SYS_UNITS,SP_VALUE"), @Index(name = "IDX_SP_QUANreplacedY_UPDATED", columnList = "SP_UPDATED"), @Index(name = "IDX_SP_QUANreplacedY_RESID", columnList = "RES_ID") })
public clreplaced ResourceIndexedSearchParamQuanreplacedy extends BaseResourceIndexedSearchParam {

    private static final int MAX_LENGTH = 200;

    private static final long serialVersionUID = 1L;

    @Column(name = "SP_SYSTEM", nullable = true, length = MAX_LENGTH)
    @Field
    public String mySystem;

    @Column(name = "SP_UNITS", nullable = true, length = MAX_LENGTH)
    @Field
    public String myUnits;

    @Column(name = "SP_VALUE", nullable = true)
    @Field
    @NumericField
    @FieldBridge(impl = BigDecimalNumericFieldBridge.clreplaced)
    public BigDecimal myValue;

    @Id
    @SequenceGenerator(name = "SEQ_SPIDX_QUANreplacedY", sequenceName = "SEQ_SPIDX_QUANreplacedY")
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SPIDX_QUANreplacedY")
    @Column(name = "SP_ID")
    private Long myId;

    /**
     * @since 3.5.0 - At some point this should be made not-null
     */
    @Column(name = "HASH_IDENreplacedY_AND_UNITS", nullable = true)
    private Long myHashIdenreplacedyAndUnits;

    /**
     * @since 3.5.0 - At some point this should be made not-null
     */
    @Column(name = "HASH_IDENreplacedY_SYS_UNITS", nullable = true)
    private Long myHashIdenreplacedySystemAndUnits;

    /**
     * @since 3.5.0 - At some point this should be made not-null
     */
    @Column(name = "HASH_IDENreplacedY", nullable = true)
    private Long myHashIdenreplacedy;

    public ResourceIndexedSearchParamQuanreplacedy() {
        super();
    }

    public ResourceIndexedSearchParamQuanreplacedy(String theResourceType, String theParamName, BigDecimal theValue, String theSystem, String theUnits) {
        this();
        setResourceType(theResourceType);
        setParamName(theParamName);
        setSystem(theSystem);
        setValue(theValue);
        setUnits(theUnits);
    }

    @Override
    @PrePersist
    public void calculateHashes() {
        if (myHashIdenreplacedy == null) {
            String resourceType = getResourceType();
            String paramName = getParamName();
            String units = getUnits();
            String system = getSystem();
            setHashIdenreplacedy(calculateHashIdenreplacedy(resourceType, paramName));
            setHashIdenreplacedyAndUnits(calculateHashUnits(resourceType, paramName, units));
            setHashIdenreplacedySystemAndUnits(calculateHashSystemAndUnits(resourceType, paramName, system, units));
        }
    }

    @Override
    protected void clearHashes() {
        myHashIdenreplacedy = null;
        myHashIdenreplacedyAndUnits = null;
    }

    @Override
    public boolean equals(Object theObj) {
        if (this == theObj) {
            return true;
        }
        if (theObj == null) {
            return false;
        }
        if (!(theObj instanceof ResourceIndexedSearchParamQuanreplacedy)) {
            return false;
        }
        ResourceIndexedSearchParamQuanreplacedy obj = (ResourceIndexedSearchParamQuanreplacedy) theObj;
        EqualsBuilder b = new EqualsBuilder();
        b.append(getResourceType(), obj.getResourceType());
        b.append(getParamName(), obj.getParamName());
        b.append(getSystem(), obj.getSystem());
        b.append(getUnits(), obj.getUnits());
        b.append(getValue(), obj.getValue());
        b.append(isMissing(), obj.isMissing());
        return b.isEquals();
    }

    public Long getHashIdenreplacedy() {
        calculateHashes();
        return myHashIdenreplacedy;
    }

    public void setHashIdenreplacedy(Long theHashIdenreplacedy) {
        myHashIdenreplacedy = theHashIdenreplacedy;
    }

    public Long getHashIdenreplacedyAndUnits() {
        calculateHashes();
        return myHashIdenreplacedyAndUnits;
    }

    public void setHashIdenreplacedyAndUnits(Long theHashIdenreplacedyAndUnits) {
        myHashIdenreplacedyAndUnits = theHashIdenreplacedyAndUnits;
    }

    private Long getHashIdenreplacedySystemAndUnits() {
        calculateHashes();
        return myHashIdenreplacedySystemAndUnits;
    }

    public void setHashIdenreplacedySystemAndUnits(Long theHashIdenreplacedySystemAndUnits) {
        myHashIdenreplacedySystemAndUnits = theHashIdenreplacedySystemAndUnits;
    }

    @Override
    public Long getId() {
        return myId;
    }

    @Override
    public void setId(Long theId) {
        myId = theId;
    }

    public String getSystem() {
        return mySystem;
    }

    public void setSystem(String theSystem) {
        clearHashes();
        mySystem = theSystem;
    }

    public String getUnits() {
        return myUnits;
    }

    public void setUnits(String theUnits) {
        clearHashes();
        myUnits = theUnits;
    }

    public BigDecimal getValue() {
        return myValue;
    }

    public ResourceIndexedSearchParamQuanreplacedy setValue(BigDecimal theValue) {
        clearHashes();
        myValue = theValue;
        return this;
    }

    @Override
    public int hashCode() {
        HashCodeBuilder b = new HashCodeBuilder();
        b.append(getResourceType());
        b.append(getParamName());
        b.append(getSystem());
        b.append(getUnits());
        b.append(getValue());
        return b.toHashCode();
    }

    @Override
    public IQueryParameterType toQueryParameterType() {
        return new QuanreplacedyParam(null, getValue(), getSystem(), getUnits());
    }

    @Override
    public String toString() {
        ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
        b.append("paramName", getParamName());
        b.append("resourceId", getResourcePid());
        b.append("system", getSystem());
        b.append("units", getUnits());
        b.append("value", getValue());
        b.append("missing", isMissing());
        b.append("hashIdenreplacedySystemAndUnits", myHashIdenreplacedySystemAndUnits);
        return b.build();
    }

    @Override
    public boolean matches(IQueryParameterType theParam) {
        if (!(theParam instanceof QuanreplacedyParam)) {
            return false;
        }
        QuanreplacedyParam quanreplacedy = (QuanreplacedyParam) theParam;
        boolean retval = false;
        // Only match on system if it wasn't specified
        String quanreplacedyUnitsString = defaultString(quanreplacedy.getUnits());
        if (quanreplacedy.getSystem() == null && isBlank(quanreplacedyUnitsString)) {
            if (Objects.equals(getValue(), quanreplacedy.getValue())) {
                retval = true;
            }
        } else {
            String unitsString = defaultString(getUnits());
            if (quanreplacedy.getSystem() == null) {
                if (unitsString.equalsIgnoreCase(quanreplacedyUnitsString) && Objects.equals(getValue(), quanreplacedy.getValue())) {
                    retval = true;
                }
            } else if (isBlank(quanreplacedyUnitsString)) {
                if (getSystem().equalsIgnoreCase(quanreplacedy.getSystem()) && Objects.equals(getValue(), quanreplacedy.getValue())) {
                    retval = true;
                }
            } else {
                if (getSystem().equalsIgnoreCase(quanreplacedy.getSystem()) && unitsString.equalsIgnoreCase(quanreplacedyUnitsString) && Objects.equals(getValue(), quanreplacedy.getValue())) {
                    retval = true;
                }
            }
        }
        return retval;
    }

    public static long calculateHashSystemAndUnits(String theResourceType, String theParamName, String theSystem, String theUnits) {
        return hash(theResourceType, theParamName, theSystem, theUnits);
    }

    public static long calculateHashUnits(String theResourceType, String theParamName, String theUnits) {
        return hash(theResourceType, theParamName, theUnits);
    }
}

19 View Complete Implementation : Book.java
Copyright Apache License 2.0
Author : infinispan
@Field
@ProtoField(number = 2)
String getreplacedle() {
    return replacedle;
}

19 View Complete Implementation : Person.java
Copyright Apache License 2.0
Author : infinispan
/**
 * @since 9.2
 */
@Indexed
@SuppressWarnings("unused")
public clreplaced Person implements Serializable {

    @Field
    private Integer id;

    @Field
    private String name;

    @Field
    private String surname;

    @Field
    @NumericField
    private Integer age;

    @Field
    private Address address;

    @Field
    private Gender gender;

    @IndexedEmbedded
    private Set<PhoneNumber> phoneNumbers;

    public Person() {
    }

    public Person(Integer id, String name, String surname, Integer age, Address address, Gender gender, Set<PhoneNumber> phoneNumbers) {
        this.id = id;
        this.name = name;
        this.surname = surname;
        this.age = age;
        this.address = address;
        this.gender = gender;
        this.phoneNumbers = phoneNumbers;
    }

    @ProtoField(number = 1)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ProtoField(number = 2)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @ProtoField(number = 3)
    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    @ProtoField(number = 4)
    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    @ProtoField(number = 5)
    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    @ProtoField(number = 6, collectionImplementation = HashSet.clreplaced)
    public Set<PhoneNumber> getPhoneNumbers() {
        return phoneNumbers;
    }

    public void setPhoneNumbers(Set<PhoneNumber> phoneNumbers) {
        this.phoneNumbers = phoneNumbers;
    }

    @ProtoField(number = 7, type = Type.UINT32)
    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}

19 View Complete Implementation : Author.java
Copyright Apache License 2.0
Author : infinispan
/**
 * @author [email protected]
 * @since 9.0
 */
public clreplaced Author implements Serializable {

    @Field(store = Store.YES)
    private String name;

    @Field
    private String surname;

    public Author(String name, String surname) {
        this.name = name;
        this.surname = surname;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    @Override
    public String toString() {
        return "Author{" + "name='" + name + '\'' + ", surname='" + surname + '\'' + '}';
    }
}

19 View Complete Implementation : MagicCard.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Enreplacedy
@Indexed
public clreplaced MagicCard {

    @Id
    @GeneratedValue
    private Long id;

    @Field(replacedyze = replacedyze.NO)
    private String name;

    @Field
    private String artist;

    @Field
    private String manacost;

    @Field
    private Integer power;

    @Field
    private Integer thoughness;

    @Field
    @Temporal(TemporalType.DATE)
    private Date publicationDate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getArtist() {
        return artist;
    }

    public void setArtist(String artist) {
        this.artist = artist;
    }

    public String getManacost() {
        return manacost;
    }

    public void setManacost(String manacost) {
        this.manacost = manacost;
    }

    public Integer getPower() {
        return power;
    }

    public void setPower(Integer power) {
        this.power = power;
    }

    public Integer getThoughness() {
        return thoughness;
    }

    public void setThoughness(Integer thoughness) {
        this.thoughness = thoughness;
    }

    public Date getPublicationDate() {
        return publicationDate;
    }

    public void setPublicationDate(Date publicationDate) {
        this.publicationDate = publicationDate;
    }
}

19 View Complete Implementation : BaseResourceIndexedSearchParam.java
Copyright Apache License 2.0
Author : jamesagnew
@MappedSuperclreplaced
public abstract clreplaced BaseResourceIndexedSearchParam extends BaseResourceIndex {

    static final int MAX_SP_NAME = 100;

    /**
     * Don't change this without careful consideration. You will break existing hashes!
     */
    private static final HashFunction HASH_FUNCTION = Hashing.murmur3_128(0);

    /**
     * Don't make this public 'cause nobody better be able to modify it!
     */
    private static final byte[] DELIMITER_BYTES = "|".getBytes(Charsets.UTF_8);

    private static final long serialVersionUID = 1L;

    // TODO: make this nullable=false and a primitive (written may 2017)
    @Field()
    @Column(name = "SP_MISSING", nullable = true)
    private Boolean myMissing = Boolean.FALSE;

    @Field
    @Column(name = "SP_NAME", length = MAX_SP_NAME, nullable = false)
    private String myParamName;

    @ManyToOne(optional = false, fetch = FetchType.LAZY, cascade = {})
    @JoinColumn(name = "RES_ID", referencedColumnName = "RES_ID", nullable = false)
    @ContainedIn
    private ResourceTable myResource;

    @Column(name = "RES_ID", insertable = false, updatable = false, nullable = false)
    private Long myResourcePid;

    @Field()
    @Column(name = "RES_TYPE", nullable = false, length = Constants.MAX_RESOURCE_NAME_LENGTH)
    private String myResourceType;

    @Field()
    // TODO: make this false after HAPI 2.3
    @Column(name = "SP_UPDATED", nullable = true)
    @Temporal(TemporalType.TIMESTAMP)
    private Date myUpdated;

    /**
     * Subclreplacedes may override
     */
    protected void clearHashes() {
    // nothing
    }

    @Override
    public abstract Long getId();

    public String getParamName() {
        return myParamName;
    }

    public void setParamName(String theName) {
        clearHashes();
        myParamName = theName;
    }

    public ResourceTable getResource() {
        return myResource;
    }

    public BaseResourceIndexedSearchParam setResource(ResourceTable theResource) {
        clearHashes();
        myResource = theResource;
        myResourceType = theResource.getResourceType();
        return this;
    }

    public Long getResourcePid() {
        return myResourcePid;
    }

    public String getResourceType() {
        return myResourceType;
    }

    public void setResourceType(String theResourceType) {
        myResourceType = theResourceType;
    }

    public Date getUpdated() {
        return myUpdated;
    }

    public void setUpdated(Date theUpdated) {
        myUpdated = theUpdated;
    }

    public boolean isMissing() {
        return Boolean.TRUE.equals(myMissing);
    }

    public BaseResourceIndexedSearchParam setMissing(boolean theMissing) {
        myMissing = theMissing;
        return this;
    }

    public abstract IQueryParameterType toQueryParameterType();

    public boolean matches(IQueryParameterType theParam) {
        throw new UnsupportedOperationException("No parameter matcher for " + theParam);
    }

    public static long calculateHashIdenreplacedy(String theResourceType, String theParamName) {
        return hash(theResourceType, theParamName);
    }

    /**
     * Applies a fast and consistent hashing algorithm to a set of strings
     */
    static long hash(String... theValues) {
        Hasher hasher = HASH_FUNCTION.newHasher();
        for (String next : theValues) {
            if (next == null) {
                hasher.putByte((byte) 0);
            } else {
                next = UrlUtil.escapeUrlParam(next);
                byte[] bytes = next.getBytes(Charsets.UTF_8);
                hasher.putBytes(bytes);
            }
            hasher.putBytes(DELIMITER_BYTES);
        }
        HashCode hashCode = hasher.hash();
        return hashCode.asLong();
    }
}

19 View Complete Implementation : StoredUser.java
Copyright GNU Affero General Public License v3.0
Author : headsupdev
/**
 * The basic implementation of a user clreplaced
 *
 * @author Andrew Williams
 * @version $Id$
 * @since 1.0
 */
@Enreplacedy
@Table(name = "Users")
@Indexed(index = "Users")
public clreplaced StoredUser implements User, SearchResult {

    @Id
    @DoreplacedentId
    @Field
    @Publish
    private String username;

    private String preplacedword;

    @Field(index = Index.TOKENIZED)
    @Publish
    private String firstname, lastname, email, telephone;

    @Type(type = "text")
    @Field(index = Index.TOKENIZED)
    @Publish
    private String description;

    @Temporal(TemporalType.TIMESTAMP)
    @Publish
    private Date created = new Date();

    @Temporal(TemporalType.TIMESTAMP)
    @Publish
    private Date lastLogin = null;

    @Publish
    private String timeZoneId;

    private Boolean disabled = Boolean.FALSE;

    private Boolean hiddenInTimeTracking = Boolean.FALSE;

    @ManyToMany(targetEnreplacedy = StoredRole.clreplaced, fetch = FetchType.LAZY)
    private Set<Role> roles = new HashSet<Role>();

    @ManyToMany(targetEnreplacedy = StoredProject.clreplaced, fetch = FetchType.LAZY)
    private Set<Project> projects = new HashSet<Project>();

    @ManyToMany(targetEnreplacedy = StoredProject.clreplaced, fetch = FetchType.LAZY)
    @JoinTable(name = "Users_Subscriptions")
    private Set<Project> subscriptions = new HashSet<Project>();

    private transient Map<String, String> preferences = null;

    StoredUser() {
    }

    public StoredUser(String username) {
        this.username = username;
    }

    public String getUsername() {
        return username;
    }

    public String getPreplacedword() {
        return preplacedword;
    }

    public void setPreplacedword(String preplacedword) {
        if (preplacedword == null) {
            throw new IllegalArgumentException("preplacedword cannot be null");
        }
        this.preplacedword = HashUtil.getMD5Hex(preplacedword);
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getFullname() {
        if (StringUtil.isEmpty(firstname) && StringUtil.isEmpty(lastname)) {
            return username;
        }
        return (((firstname == null) ? "" : firstname) + " " + ((lastname == null) ? "" : lastname)).trim();
    }

    public String getFullnameOrUsername() {
        if (Manager.getStorageInstance().getGlobalConfiguration().getUseFullnamesForUsers()) {
            return getFullname();
        }
        return getUsername();
    }

    public String getInitials() {
        if (StringUtil.isEmpty(firstname) || StringUtil.isEmpty(lastname)) {
            return null;
        }
        return firstname.substring(0, 1).toUpperCase() + lastname.substring(0, 1).toUpperCase();
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getLastLogin() {
        return lastLogin;
    }

    public void setLastLogin(Date last) {
        this.lastLogin = last;
    }

    public boolean canLogin() {
        return disabled == null || disabled == Boolean.FALSE;
    }

    public boolean isDisabled() {
        return disabled == Boolean.TRUE;
    }

    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

    public Set<Role> getRoles() {
        return roles;
    }

    public void addRole(Role role) {
        roles.add(role);
    }

    public Set<Project> getProjects() {
        return projects;
    }

    public Set<Project> getSubscriptions() {
        return subscriptions;
    }

    public boolean isSubscribedTo(Project project) {
        return (getSubscriptions() != null && getSubscriptions().contains(project)) || ((project == null || project.equals(StoredProject.getDefault())) && StoredProject.getDefaultProjectSubscribers().contains(this));
    }

    public void setProjects(Set<Project> projects) {
        this.projects.clear();
        this.projects.addAll(projects);
    }

    public String getIconPath() {
        return null;
    }

    public String getLink() {
        return "/account/username/" + getUsername();
    }

    @Override
    public String getAppId() {
        return "home";
    }

    public String getTimeZoneId() {
        return timeZoneId;
    }

    public void setTimeZoneId(String timeZoneId) {
        this.timeZoneId = timeZoneId;
    }

    public TimeZone getTimeZone() {
        if (StringUtil.isEmpty(getTimeZoneId())) {
            return Manager.getStorageInstance().getGlobalConfiguration().getDefaultTimeZone();
        }
        return TimeZone.getTimeZone(getTimeZoneId());
    }

    public boolean isHiddenInTimeTracking() {
        return hiddenInTimeTracking != null && hiddenInTimeTracking.equals(Boolean.TRUE);
    }

    public void setHiddenInTimeTracking(boolean hidden) {
        this.hiddenInTimeTracking = hidden;
    }

    public void loadPreferences() {
        preferences = new Hashtable<String, String>();
        preferences.putAll(Manager.getStorageInstance().getConfigurationItems("user." + username + "."));
    }

    public Set<String> getPreferenceKeys() {
        if (preferences == null) {
            loadPreferences();
        }
        Set<String> ret = new HashSet<String>();
        for (String key : preferences.keySet()) {
            ret.add(key.substring(6 + username.length()));
        }
        return ret;
    }

    public String getPreference(String key) {
        if (preferences == null) {
            loadPreferences();
        }
        return preferences.get("user." + username + "." + key);
    }

    public String getPreference(String key, String fallback) {
        String ret = getPreference(key);
        if (ret == null) {
            return fallback;
        }
        return ret;
    }

    public boolean getPreference(String key, boolean fallback) {
        String value = getPreference(key);
        if (value == null) {
            return fallback;
        }
        return Boolean.parseBoolean(value);
    }

    public int getPreference(String key, int fallback) {
        String value = getPreference(key);
        if (value == null) {
            return fallback;
        }
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException e) {
            return fallback;
        }
    }

    public Date getPreference(String key, Date fallback) {
        String value = getPreference(key);
        if (value == null) {
            return fallback;
        }
        DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.ENGLISH);
        try {
            return dateFormat.parse(value);
        } catch (ParseException e) {
            return fallback;
        }
    }

    public void savePreferences() {
        for (String key : preferences.keySet()) {
            Manager.getStorageInstance().setConfigurationItem(key, preferences.get(key));
        }
    }

    public void setPreference(String key, String value) {
        String oldValue = getPreference(key);
        if (key == null || (value == null && oldValue == null)) {
            return;
        }
        key = "user." + username + "." + key;
        if (value == null) {
            preferences.remove(key);
            Manager.getStorageInstance().removeConfigurationItem(key);
        } else if (oldValue == null || !value.equals(oldValue)) {
            preferences.put(key, value);
            Manager.getStorageInstance().setConfigurationItem(key, value);
        }
    }

    public void setPreference(String key, int value) {
        setPreference(key, String.valueOf(value));
    }

    public void setPreference(String key, boolean value) {
        setPreference(key, String.valueOf(value));
    }

    public void setPreference(String key, Date value) {
        if (value == null) {
            setPreference(key, (String) null);
            return;
        }
        DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.ENGLISH);
        setPreference(key, dateFormat.format(value));
    }

    public boolean equals(Object user) {
        return user instanceof User && equals((User) user);
    }

    public boolean equals(User user) {
        if (user == null) {
            return false;
        }
        // TODO wtf?
        if (username == null) {
            return user.getUsername() == null;
        }
        return username.equals(user.getUsername());
    }

    public int hashCode() {
        // TODO wtf?
        if (username == null) {
            return 0;
        }
        return username.hashCode();
    }

    public String toString() {
        return getFullnameOrUsername();
    }

    public int compareTo(User u) {
        if (u == null) {
            return 1;
        }
        if (getLastname() == null || u.getLastname() == null) {
            return getUsername().compareToIgnoreCase(u.getUsername());
        }
        if (Manager.getStorageInstance().getGlobalConfiguration().getUseFullnamesForUsers()) {
            return getFullname().compareToIgnoreCase(u.getFullname());
        }
        return u.getUsername().compareToIgnoreCase(u.getUsername());
    }
}

19 View Complete Implementation : User.java
Copyright BSD 3-Clause "New" or "Revised" License
Author : shilongdai
@Basic
@Field
public String getUsername() {
    return username;
}

19 View Complete Implementation : Character.java
Copyright Apache License 2.0
Author : hibernate
@Enreplacedy
public clreplaced Character {

    @Id
    @GeneratedValue
    public long id;

    @Field
    public String nickName;

    @Field
    public String specialPower;

    @ManyToMany(mappedBy = "characters")
    @ContainedIn
    public List<VideoGame> appearsIn = new ArrayList<>();

    Character() {
    }

    public Character(String nickName, String specialPower) {
        this.nickName = nickName;
        this.specialPower = specialPower;
    }

    @Override
    public String toString() {
        return "Character [id=" + id + ", nickName=" + nickName + ", specialPower=" + specialPower + "]";
    }
}

19 View Complete Implementation : Book.java
Copyright Apache License 2.0
Author : infinispan
@Indexed
public clreplaced Book {

    @Field
    private String replacedle;

    @Field
    private String description;

    @IndexedEmbedded
    private Set<Author> authors;

    public Book(String replacedle, String description, Set<Author> authors) {
        this.replacedle = replacedle;
        this.description = description;
        this.authors = authors;
    }

    public String getreplacedle() {
        return replacedle;
    }

    public void setreplacedle(String replacedle) {
        this.replacedle = replacedle;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Set<Author> getAuthors() {
        return authors;
    }

    public void setAuthors(Set<Author> authors) {
        this.authors = authors;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (!(o instanceof Book))
            return false;
        Book other = (Book) o;
        return Objects.equals(replacedle, other.replacedle) && Objects.equals(description, other.description) && Objects.equals(authors, other.authors);
    }

    @Override
    public int hashCode() {
        return Objects.hash(replacedle, description, authors);
    }
}

19 View Complete Implementation : Book.java
Copyright Apache License 2.0
Author : infinispan
@Indexed
public clreplaced Book implements Serializable {

    @Field
    String replacedle;

    @Field
    String author;

    @Field
    String editor;

    public Book(String replacedle, String author, String editor) {
        this.replacedle = replacedle;
        this.author = author;
        this.editor = editor;
    }
}

19 View Complete Implementation : IndexedLabel.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * @author Davide D'Alto <[email protected]>
 */
@Enreplacedy
@Indexed
public clreplaced IndexedLabel {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Field
    private String name;

    public IndexedLabel() {
    }

    public IndexedLabel(String name) {
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClreplaced() != obj.getClreplaced()) {
            return false;
        }
        IndexedLabel other = (IndexedLabel) obj;
        if (name == null) {
            if (other.name != null) {
                return false;
            }
        } else if (!name.equals(other.name)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("IndexedLabel [");
        builder.append(name);
        builder.append("]");
        return builder.toString();
    }
}

19 View Complete Implementation : BaseOpenmrsMetadata.java
Copyright Apache License 2.0
Author : isstac
/**
 * In OpenMRS, we distinguish between data and metadata within our data model. Metadata represent
 * system and descriptive data such as data types — a relationship type or encounter type.
 * Metadata are generally referenced by clinical data but don't represent patient-specific data
 * themselves. This provides a default abstract implementation of the OpenmrsMetadata interface
 *
 * @since 1.5
 * @see OpenmrsMetadata
 */
@MappedSuperclreplaced
public abstract clreplaced BaseOpenmrsMetadata extends BaseOpenmrsObject implements OpenmrsMetadata {

    // ***** Properties *****
    @Column(name = "name", nullable = false, length = 255)
    @Field
    private String name;

    @Column(name = "description", length = 255)
    private String description;

    @ManyToOne(optional = false)
    @JoinColumn(name = "creator")
    private User creator;

    @Column(name = "date_created", nullable = false)
    private Date dateCreated;

    @ManyToOne
    @JoinColumn(name = "changed_by")
    private User changedBy;

    @Column(name = "date_changed")
    private Date dateChanged;

    @Column(name = "retired", nullable = false)
    @Field
    private Boolean retired = Boolean.FALSE;

    @Column(name = "date_retired")
    private Date dateRetired;

    @ManyToOne
    @JoinColumn(name = "retired_by")
    private User retiredBy;

    @Column(name = "retire_reason", length = 255)
    private String retireReason;

    // ***** Constructors *****
    /**
     * Default Constructor
     */
    public BaseOpenmrsMetadata() {
    }

    // ***** Property Access *****
    /**
     * @return the name
     */
    @Override
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    @Override
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the description
     */
    @Override
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    @Override
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @see org.openmrs.OpenmrsMetadata#getCreator()
     */
    @Override
    public User getCreator() {
        return creator;
    }

    /**
     * @see org.openmrs.OpenmrsMetadata#setCreator(org.openmrs.User)
     */
    @Override
    public void setCreator(User creator) {
        this.creator = creator;
    }

    /**
     * @see org.openmrs.OpenmrsMetadata#getDateCreated()
     */
    @Override
    public Date getDateCreated() {
        return dateCreated;
    }

    /**
     * @see org.openmrs.OpenmrsMetadata#setDateCreated(java.util.Date)
     */
    @Override
    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    /**
     * @see org.openmrs.OpenmrsMetadata#getChangedBy()
     * @deprecated as of version 2.2
     */
    @Override
    @Deprecated
    public User getChangedBy() {
        return changedBy;
    }

    /**
     * @see org.openmrs.OpenmrsMetadata#setChangedBy(User)
     * @deprecated as of version 2.2
     */
    @Override
    @Deprecated
    public void setChangedBy(User changedBy) {
        this.changedBy = changedBy;
    }

    /**
     * @see org.openmrs.OpenmrsMetadata#getDateChanged()
     * @deprecated as of version 2.2
     */
    @Override
    @Deprecated
    public Date getDateChanged() {
        return dateChanged;
    }

    /**
     * @see org.openmrs.OpenmrsMetadata#setDateChanged(Date)
     * @deprecated as of version 2.2
     */
    @Override
    @Deprecated
    public void setDateChanged(Date dateChanged) {
        this.dateChanged = dateChanged;
    }

    /**
     * @deprecated as of 2.0, use {@link #getRetired()}
     * @see org.openmrs.Retireable#isRetired()
     */
    @Override
    @Deprecated
    @JsonIgnore
    public Boolean isRetired() {
        return getRetired();
    }

    /**
     * This method delegates to {@link #isRetired()}. This is only needed for jstl syntax like
     * ${fieldType.retired} because the return type is a Boolean object instead of a boolean
     * primitive type.
     *
     * @see org.openmrs.Retireable#isRetired()
     */
    @Override
    public Boolean getRetired() {
        return retired;
    }

    /**
     * @see org.openmrs.Retireable#setRetired(java.lang.Boolean)
     */
    @Override
    public void setRetired(Boolean retired) {
        this.retired = retired;
    }

    /**
     * @see org.openmrs.Retireable#getDateRetired()
     */
    @Override
    public Date getDateRetired() {
        return dateRetired;
    }

    /**
     * @see org.openmrs.Retireable#setDateRetired(java.util.Date)
     */
    @Override
    public void setDateRetired(Date dateRetired) {
        this.dateRetired = dateRetired;
    }

    /**
     * @see org.openmrs.Retireable#getRetiredBy()
     */
    @Override
    public User getRetiredBy() {
        return retiredBy;
    }

    /**
     * @see org.openmrs.Retireable#setRetiredBy(org.openmrs.User)
     */
    @Override
    public void setRetiredBy(User retiredBy) {
        this.retiredBy = retiredBy;
    }

    /**
     * @see org.openmrs.Retireable#getRetireReason()
     */
    @Override
    public String getRetireReason() {
        return retireReason;
    }

    /**
     * @see org.openmrs.Retireable#setRetireReason(java.lang.String)
     */
    @Override
    public void setRetireReason(String retireReason) {
        this.retireReason = retireReason;
    }
}

19 View Complete Implementation : IdProjectId.java
Copyright GNU Affero General Public License v3.0
Author : headsupdev
/**
 * An embeddable enreplacedy that uses an id and a project as the combined id.
 *
 * @author Andrew Williams
 * @version $Id$
 * @since 1.0
 */
@Embeddable
public clreplaced IdProjectId implements Serializable {

    @ManyToOne(targetEnreplacedy = StoredProject.clreplaced, optional = false)
    @Publish
    Project project;

    @Column(nullable = false)
    @GeneratedValue
    @Field
    @Publish
    long id;

    public IdProjectId() {
    }

    public IdProjectId(Project project) {
        this.project = project;
    }

    public Project getProject() {
        return project;
    }

    public long getId() {
        return id;
    }

    @Override
    public String toString() {
        return project.getId() + "/" + id;
    }

    public int hashCode() {
        return (project.getId() + String.valueOf(id)).hashCode();
    }

    public boolean equals(Object o) {
        return o instanceof IdProjectId && equals((IdProjectId) o);
    }

    public boolean equals(IdProjectId id) {
        return project.equals(id.getProject()) && this.id == id.getId();
    }
}

19 View Complete Implementation : Person.java
Copyright Apache License 2.0
Author : isstac
/**
 * A Person in the system. This can be either a small person stub, or indicative of an actual
 * Patient in the system. This clreplaced holds the generic person things that both the stubs and
 * patients share. Things like birthdate, names, addresses, and attributes are all generified into
 * the person table (and hence this super clreplaced)
 *
 * @see org.openmrs.Patient
 */
public clreplaced Person extends BaseChangeableOpenmrsData {

    public static final long serialVersionUID = 2L;

    private static final Logger log = LoggerFactory.getLogger(Person.clreplaced);

    @DoreplacedentId
    protected Integer personId;

    private Set<PersonAddress> addresses = null;

    @ContainedIn
    private Set<PersonName> names = null;

    @ContainedIn
    private Set<PersonAttribute> attributes = null;

    @Field
    private String gender;

    private Date birthdate;

    private Date birthtime;

    private Boolean birthdateEstimated = false;

    private Boolean deathdateEstimated = false;

    @Field
    private Boolean dead = false;

    private Date deathDate;

    private Concept causeOfDeath;

    private User personCreator;

    private Date personDateCreated;

    private User personChangedBy;

    private Date personDateChanged;

    private Boolean personVoided = false;

    private User personVoidedBy;

    private Date personDateVoided;

    private String personVoidReason;

    @Field
    private boolean isPatient;

    /**
     * Convenience map from PersonAttributeType.name to PersonAttribute.<br>
     * <br>
     * This is "cached" for each user upon first load. When an attribute is changed, the cache is
     * cleared and rebuilt on next access.
     */
    Map<String, PersonAttribute> attributeMap = null;

    private Map<String, PersonAttribute> allAttributeMap = null;

    /**
     * default empty constructor
     */
    public Person() {
    }

    /**
     * This constructor is used to build a new Person object copy from another person object
     * (usually a patient or a user subobject). All attributes are copied over to the new object.
     * NOTE! All child collection objects are copied as pointers, each individual element is not
     * copied. <br>
     *
     * @param person Person to create this person object from
     */
    public Person(Person person) {
        if (person == null) {
            return;
        }
        personId = person.getPersonId();
        setUuid(person.getUuid());
        addresses = person.getAddresses();
        names = person.getNames();
        attributes = person.getAttributes();
        gender = person.getGender();
        birthdate = person.getBirthdate();
        birthtime = person.getBirthDateTime();
        birthdateEstimated = person.getBirthdateEstimated();
        deathdateEstimated = person.getDeathdateEstimated();
        dead = person.getDead();
        deathDate = person.getDeathDate();
        causeOfDeath = person.getCauseOfDeath();
        // base creator/voidedBy/changedBy info is not copied here
        // because that is specific to and will be recreated
        // by the subobject upon save
        setPersonCreator(person.getPersonCreator());
        setPersonDateCreated(person.getPersonDateCreated());
        setPersonChangedBy(person.getPersonChangedBy());
        setPersonDateChanged(person.getPersonDateChanged());
        setPersonVoided(person.getPersonVoided());
        setPersonVoidedBy(person.getPersonVoidedBy());
        setPersonDateVoided(person.getPersonDateVoided());
        setPersonVoidReason(person.getPersonVoidReason());
        setPatient(person.getIsPatient());
    }

    /**
     * Default constructor taking in the primary key personId value
     *
     * @param personId Integer internal id for this person
     * @should set person id
     */
    public Person(Integer personId) {
        this.personId = personId;
    }

    // Property accessors
    /**
     * @return Returns the personId.
     */
    public Integer getPersonId() {
        return personId;
    }

    /**
     * @param personId The personId to set.
     */
    public void setPersonId(Integer personId) {
        this.personId = personId;
    }

    /**
     * @return person's gender
     */
    public String getGender() {
        return this.gender;
    }

    /**
     * @param gender person's gender
     */
    public void setGender(String gender) {
        this.gender = gender;
    }

    /**
     * @return person's date of birth
     */
    public Date getBirthdate() {
        return this.birthdate;
    }

    /**
     * @param birthdate person's date of birth
     */
    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    /**
     * @return true if person's birthdate is estimated
     *
     * @deprecated as of 2.0, use {@link #getBirthdateEstimated()}
     */
    @Deprecated
    @JsonIgnore
    public Boolean isBirthdateEstimated() {
        return getBirthdateEstimated();
    }

    public Boolean getBirthdateEstimated() {
        return birthdateEstimated;
    }

    /**
     * @param birthdateEstimated true if person's birthdate is estimated
     */
    public void setBirthdateEstimated(Boolean birthdateEstimated) {
        this.birthdateEstimated = birthdateEstimated;
    }

    public Boolean getDeathdateEstimated() {
        return this.deathdateEstimated;
    }

    /**
     * @param deathdateEstimated true if person's deathdate is estimated
     */
    public void setDeathdateEstimated(Boolean deathdateEstimated) {
        this.deathdateEstimated = deathdateEstimated;
    }

    /**
     * @param birthtime person's time of birth
     */
    public void setBirthtime(Date birthtime) {
        this.birthtime = birthtime;
    }

    /**
     * @return person's time of birth with the date portion set to the date from person's birthdate
     */
    public Date getBirthDateTime() {
        if (birthdate != null && birthtime != null) {
            String birthDateString = new SimpleDateFormat("yyyy-MM-dd").format(birthdate);
            String birthTimeString = new SimpleDateFormat("HH:mm:ss").format(birthtime);
            try {
                return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(birthDateString + " " + birthTimeString);
            } catch (ParseException e) {
                log.error("Failed to parse birth date string", e);
            }
        }
        return null;
    }

    /**
     * @return person's time of birth.
     */
    public Date getBirthtime() {
        return this.birthtime;
    }

    /**
     * @return Returns the death status.
     *
     * @deprecated as of 2.0, use {@link #getDead()}
     */
    @Deprecated
    @JsonIgnore
    public Boolean isDead() {
        return getDead();
    }

    /**
     * @return Returns the death status.
     */
    public Boolean getDead() {
        return dead;
    }

    /**
     * @param dead The dead to set.
     */
    public void setDead(Boolean dead) {
        this.dead = dead;
    }

    /**
     * @return date of person's death
     */
    public Date getDeathDate() {
        return this.deathDate;
    }

    /**
     * @param deathDate date of person's death
     */
    public void setDeathDate(Date deathDate) {
        this.deathDate = deathDate;
        if (deathDate != null) {
            setDead(true);
        }
    }

    /**
     * @return cause of person's death
     */
    public Concept getCauseOfDeath() {
        return this.causeOfDeath;
    }

    /**
     * @param causeOfDeath cause of person's death
     */
    public void setCauseOfDeath(Concept causeOfDeath) {
        this.causeOfDeath = causeOfDeath;
    }

    /**
     * @return list of known addresses for person
     * @see org.openmrs.PersonAddress
     * @should not get voided addresses
     * @should not fail with null addresses
     */
    public Set<PersonAddress> getAddresses() {
        if (addresses == null) {
            addresses = new TreeSet<>();
        }
        return this.addresses;
    }

    /**
     * @param addresses Set<PersonAddress> list of known addresses for person
     * @see org.openmrs.PersonAddress
     */
    public void setAddresses(Set<PersonAddress> addresses) {
        this.addresses = addresses;
    }

    /**
     * @return all known names for person
     * @see org.openmrs.PersonName
     * @should not get voided names
     * @should not fail with null names
     */
    public Set<PersonName> getNames() {
        if (names == null) {
            names = new TreeSet<>();
        }
        return this.names;
    }

    /**
     * @param names update all known names for person
     * @see org.openmrs.PersonName
     */
    public void setNames(Set<PersonName> names) {
        this.names = names;
    }

    /**
     * @return all known attributes for person
     * @see org.openmrs.PersonAttribute
     * @should not get voided attributes
     * @should not fail with null attributes
     */
    public Set<PersonAttribute> getAttributes() {
        if (attributes == null) {
            attributes = new TreeSet<>();
        }
        return this.attributes;
    }

    /**
     * Returns only the non-voided attributes for this person
     *
     * @return list attributes
     * @should not get voided attributes
     * @should not fail with null attributes
     */
    public List<PersonAttribute> getActiveAttributes() {
        List<PersonAttribute> attrs = new ArrayList<>();
        for (PersonAttribute attr : getAttributes()) {
            if (!attr.getVoided()) {
                attrs.add(attr);
            }
        }
        return attrs;
    }

    /**
     * @param attributes update all known attributes for person
     * @see org.openmrs.PersonAttribute
     */
    public void setAttributes(Set<PersonAttribute> attributes) {
        this.attributes = attributes;
        attributeMap = null;
        allAttributeMap = null;
    }

    // Convenience methods
    /**
     * Convenience method to add the <code>attribute</code> to this person's attribute list if the
     * attribute doesn't exist already.<br>
     * <br>
     * Voids any current attribute with type = <code>newAttribute.getAttributeType()</code><br>
     * <br>
     * NOTE: This effectively limits persons to only one attribute of any given type **
     *
     * @param newAttribute PersonAttribute to add to the Person
     * @should fail when new attribute exist
     * @should fail when new atribute are the same type with same value
     * @should void old attribute when new attribute are the same type with different value
     * @should remove attribute when old attribute are temporary
     * @should not save an attribute with a null value
     * @should not save an attribute with a blank string value
     * @should void old attribute when a null or blank string value is added
     */
    public void addAttribute(PersonAttribute newAttribute) {
        newAttribute.setPerson(this);
        boolean newIsNull = !StringUtils.hasText(newAttribute.getValue());
        for (PersonAttribute currentAttribute : getActiveAttributes()) {
            if (currentAttribute.equals(newAttribute)) {
                // if we have the same PersonAttributeId, don't add the new attribute
                return;
            } else if (currentAttribute.getAttributeType().equals(newAttribute.getAttributeType())) {
                if (currentAttribute.getValue() != null && currentAttribute.getValue().equals(newAttribute.getValue())) {
                    // this person already has this attribute
                    return;
                }
                // if the to-be-added attribute isn't already voided itself
                // and if we have the same type, different value
                if (!newAttribute.getVoided() || newIsNull) {
                    if (currentAttribute.getCreator() != null) {
                        currentAttribute.voidAttribute("New value: " + newAttribute.getValue());
                    } else {
                        // remove the attribute if it was just temporary (didn't have a creator
                        // attached to it yet)
                        removeAttribute(currentAttribute);
                    }
                }
            }
        }
        attributeMap = null;
        allAttributeMap = null;
        if (!OpenmrsUtil.collectionContains(attributes, newAttribute) && !newIsNull) {
            attributes.add(newAttribute);
        }
    }

    /**
     * Convenience method to get the <code>attribute</code> from this person's attribute list if the
     * attribute exists already.
     *
     * @param attribute
     * @should not fail when person attribute is null
     * @should not fail when person attribute is not exist
     * @should remove attribute when exist
     */
    public void removeAttribute(PersonAttribute attribute) {
        if (attributes != null && attributes.remove(attribute)) {
            attributeMap = null;
            allAttributeMap = null;
        }
    }

    /**
     * Convenience Method to return the first non-voided person attribute matching a person
     * attribute type. <br>
     * <br>
     * Returns null if this person has no non-voided {@link PersonAttribute} with the given
     * {@link PersonAttributeType}, the given {@link PersonAttributeType} is null, or this person
     * has no attributes.
     *
     * @param pat the PersonAttributeType to look for (can be a stub, see
     *            {@link PersonAttributeType#equals(Object)} for how its compared)
     * @return PersonAttribute that matches the given type
     * @should not fail when attribute type is null
     * @should not return voided attribute
     * @should return null when existing PersonAttributeType is voided
     */
    public PersonAttribute getAttribute(PersonAttributeType pat) {
        if (pat != null) {
            for (PersonAttribute attribute : getAttributes()) {
                if (pat.equals(attribute.getAttributeType()) && !attribute.getVoided()) {
                    return attribute;
                }
            }
        }
        return null;
    }

    /**
     * Convenience method to get this person's first attribute that has a PersonAttributeType.name
     * equal to <code>attributeName</code>.<br>
     * <br>
     * Returns null if this person has no non-voided {@link PersonAttribute} with the given type
     * name, the given name is null, or this person has no attributes.
     *
     * @param attributeName the name string to match on
     * @return PersonAttribute whose {@link PersonAttributeType#getName()} matchs the given name
     *         string
     * @should return person attribute based on attributeName
     * @should return null if AttributeName is voided
     */
    public PersonAttribute getAttribute(String attributeName) {
        if (attributeName != null) {
            for (PersonAttribute attribute : getAttributes()) {
                PersonAttributeType type = attribute.getAttributeType();
                if (type != null && attributeName.equals(type.getName()) && !attribute.getVoided()) {
                    return attribute;
                }
            }
        }
        return null;
    }

    /**
     * Convenience method to get this person's first attribute that has a PersonAttributeTypeId
     * equal to <code>attributeTypeId</code>.<br>
     * <br>
     * Returns null if this person has no non-voided {@link PersonAttribute} with the given type id
     * or this person has no attributes.<br>
     * <br>
     * The given id cannot be null.
     *
     * @param attributeTypeId the id of the {@link PersonAttributeType} to look for
     * @return PersonAttribute whose {@link PersonAttributeType#getId()} equals the given Integer id
     * @should return PersonAttribute based on attributeTypeId
     * @should return null when existing personAttribute with matching attribute type id is voided
     */
    public PersonAttribute getAttribute(Integer attributeTypeId) {
        for (PersonAttribute attribute : getActiveAttributes()) {
            if (attributeTypeId.equals(attribute.getAttributeType().getPersonAttributeTypeId())) {
                return attribute;
            }
        }
        return null;
    }

    /**
     * Convenience method to get all of this person's attributes that have a
     * PersonAttributeType.name equal to <code>attributeName</code>.
     *
     * @param attributeName
     * @should return all PersonAttributes with matching attributeType names
     */
    public List<PersonAttribute> getAttributes(String attributeName) {
        List<PersonAttribute> ret = new ArrayList<>();
        for (PersonAttribute attribute : getActiveAttributes()) {
            PersonAttributeType type = attribute.getAttributeType();
            if (type != null && attributeName.equals(type.getName())) {
                ret.add(attribute);
            }
        }
        return ret;
    }

    /**
     * Convenience method to get all of this person's attributes that have a PersonAttributeType.id
     * equal to <code>attributeTypeId</code>.
     *
     * @param attributeTypeId
     * @should return empty list when matching personAttribute by id is voided
     * @should return list of person attributes based on AttributeTypeId
     */
    public List<PersonAttribute> getAttributes(Integer attributeTypeId) {
        List<PersonAttribute> ret = new ArrayList<>();
        for (PersonAttribute attribute : getActiveAttributes()) {
            if (attributeTypeId.equals(attribute.getAttributeType().getPersonAttributeTypeId())) {
                ret.add(attribute);
            }
        }
        return ret;
    }

    /**
     * Convenience method to get all of this person's attributes that have a PersonAttributeType
     * equal to <code>personAttributeType</code>.
     *
     * @param personAttributeType
     */
    public List<PersonAttribute> getAttributes(PersonAttributeType personAttributeType) {
        List<PersonAttribute> ret = new ArrayList<>();
        for (PersonAttribute attribute : getAttributes()) {
            if (personAttributeType.equals(attribute.getAttributeType()) && !attribute.getVoided()) {
                ret.add(attribute);
            }
        }
        return ret;
    }

    /**
     * Convenience method to get this person's active attributes in map form: <String,
     * PersonAttribute>.
     */
    public Map<String, PersonAttribute> getAttributeMap() {
        if (attributeMap != null) {
            return attributeMap;
        }
        if (log.isDebugEnabled()) {
            log.debug("Current Person Attributes: \n" + printAttributes());
        }
        attributeMap = new HashMap<>();
        for (PersonAttribute attribute : getActiveAttributes()) {
            attributeMap.put(attribute.getAttributeType().getName(), attribute);
        }
        return attributeMap;
    }

    /**
     * Convenience method to get all of this person's attributes (including voided ones) in map
     * form: <String, PersonAttribute>.
     *
     * @return All person's attributes in map form
     * @since 1.12
     */
    public Map<String, PersonAttribute> getAllAttributeMap() {
        if (allAttributeMap != null) {
            return allAttributeMap;
        }
        if (log.isDebugEnabled()) {
            log.debug("Current Person Attributes: \n" + printAttributes());
        }
        allAttributeMap = new HashMap<>();
        for (PersonAttribute attribute : getAttributes()) {
            allAttributeMap.put(attribute.getAttributeType().getName(), attribute);
        }
        return allAttributeMap;
    }

    /**
     * Convenience method for viewing all of the person's current attributes
     *
     * @return Returns a string with all the attributes
     */
    public String printAttributes() {
        StringBuilder s = new StringBuilder("");
        for (PersonAttribute attribute : getAttributes()) {
            s.append(attribute.getAttributeType()).append(" : ").append(attribute.getValue()).append(" : voided? ").append(attribute.getVoided()).append("\n");
        }
        return s.toString();
    }

    /**
     * Convenience method to add the <code>name</code> to this person's name list if the name
     * doesn't exist already.
     *
     * @param name
     */
    public void addName(PersonName name) {
        if (name != null) {
            name.setPerson(this);
            if (names == null) {
                names = new TreeSet<>();
            }
            if (!OpenmrsUtil.collectionContains(names, name)) {
                names.add(name);
            }
        }
    }

    /**
     * Convenience method remove the <code>name</code> from this person's name list if the name
     * exists already.
     *
     * @param name
     */
    public void removeName(PersonName name) {
        if (names != null) {
            names.remove(name);
        }
    }

    /**
     * Convenience method to add the <code>address</code> to this person's address list if the
     * address doesn't exist already.
     *
     * @param address
     * @should not add a person address with blank fields
     */
    public void addAddress(PersonAddress address) {
        if (address != null) {
            address.setPerson(this);
            if (addresses == null) {
                addresses = new TreeSet<>();
            }
            if (!OpenmrsUtil.collectionContains(addresses, address) && !address.isBlank()) {
                addresses.add(address);
            }
        }
    }

    /**
     * Convenience method to remove the <code>address</code> from this person's address list if the
     * address exists already.
     *
     * @param address
     */
    public void removeAddress(PersonAddress address) {
        if (addresses != null) {
            addresses.remove(address);
        }
    }

    /**
     * Convenience method to get the {@link PersonName} object that is marked as "preferred". <br>
     * <br>
     * If two names are marked as preferred (or no names), the database ordering comes into effect
     * and the one that was created most recently will be returned. <br>
     * <br>
     * This method will never return a voided name, even if it is marked as preferred. <br>
     * <br>
     * Null is returned if this person has no names or all voided names.
     *
     * @return the "preferred" person name.
     * @see #getNames()
     * @see PersonName#getPreferred()
     * @should get preferred and not-voided person name if exist
     * @should get not-voided person name if preferred address does not exist
     * @should get voided person address if person is voided and not-voided address does not exist
     * @should return null if person is not-voided and have voided names
     */
    public PersonName getPersonName() {
        // normally the DAO layer returns these in the correct order, i.e. preferred and non-voided first, but it's possible that someone
        // has fetched a Person, changed their names around, and then calls this method, so we have to be careful.
        if (getNames() != null && !getNames().isEmpty()) {
            for (PersonName name : getNames()) {
                if (name.getPreferred() && !name.getVoided()) {
                    return name;
                }
            }
            for (PersonName name : getNames()) {
                if (!name.getVoided()) {
                    return name;
                }
            }
            if (getVoided()) {
                return getNames().iterator().next();
            }
        }
        return null;
    }

    /**
     * Convenience method to get the given name attribute on this person's preferred PersonName
     *
     * @return String given name of the person
     */
    public String getGivenName() {
        PersonName personName = getPersonName();
        if (personName == null) {
            return "";
        } else {
            return personName.getGivenName();
        }
    }

    /**
     * Convenience method to get the middle name attribute on this person's preferred PersonName
     *
     * @return String middle name of the person
     */
    public String getMiddleName() {
        PersonName personName = getPersonName();
        if (personName == null) {
            return "";
        } else {
            return personName.getMiddleName();
        }
    }

    /**
     * Convenience method to get the family name attribute on this person's preferred PersonName
     *
     * @return String family name of the person
     */
    public String getFamilyName() {
        PersonName personName = getPersonName();
        if (personName == null) {
            return "";
        } else {
            return personName.getFamilyName();
        }
    }

    /**
     * Convenience method to get the {@link PersonAddress} object that is marked as "preferred".
     * <br>
     * <br>
     * If two addresses are marked as preferred (or no addresses), the database ordering comes into
     * effect and the one that was created most recently will be returned. <br>
     * <br>
     * This method will never return a voided address, even if it is marked as preferred. <br>
     * <br>
     * Null is returned if this person has no addresses or all voided addresses.
     *
     * @return the "preferred" person address.
     * @see #getAddresses()
     * @see PersonAddress#getPreferred()
     * @should get preferred and not-voided person address if exist
     * @should get not-voided person address if preferred address does not exist
     * @should get voided person address if person is voided and not-voided address does not exist
     * @should return null if person is not-voided and have voided address
     */
    public PersonAddress getPersonAddress() {
        // normally the DAO layer returns these in the correct order, i.e. preferred and non-voided first, but it's possible that someone
        // has fetched a Person, changed their addresses around, and then calls this method, so we have to be careful.
        if (getAddresses() != null && !getAddresses().isEmpty()) {
            for (PersonAddress addr : getAddresses()) {
                if (addr.getPreferred() && !addr.getVoided()) {
                    return addr;
                }
            }
            for (PersonAddress addr : getAddresses()) {
                if (!addr.getVoided()) {
                    return addr;
                }
            }
            if (getVoided()) {
                return getAddresses().iterator().next();
            }
        }
        return null;
    }

    /**
     * Convenience method to calculate this person's age based on the birthdate For a person who
     * lived 1990 to 2000, age would be -5 in 1985, 5 in 1995, 10 in 2000, and 10 2010.
     *
     * @return Returns age as an Integer.
     * @should get correct age after death
     */
    public Integer getAge() {
        return getAge(null);
    }

    /**
     * Convenience method: calculates the person's age on a given date based on the birthdate
     *
     * @param onDate (null defaults to today)
     * @return int value of the person's age
     * @should get age before birthday
     * @should get age on birthday with no minutes defined
     * @should get age on birthday with minutes defined
     * @should get age after birthday
     * @should get age after death
     * @should get age with given date after death
     * @should get age with given date before death
     * @should get age with given date before birth
     */
    public Integer getAge(Date onDate) {
        if (birthdate == null) {
            return null;
        }
        // Use default end date as today.
        Calendar today = Calendar.getInstance();
        // But if given, use the given date.
        if (onDate != null) {
            today.setTime(onDate);
        }
        // If date given is after date of death then use date of death as end date
        if (getDeathDate() != null && today.getTime().after(getDeathDate())) {
            today.setTime(getDeathDate());
        }
        Calendar bday = Calendar.getInstance();
        bday.setTime(birthdate);
        int age = today.get(Calendar.YEAR) - bday.get(Calendar.YEAR);
        // Adjust age when today's date is before the person's birthday
        int todaysMonth = today.get(Calendar.MONTH);
        int bdayMonth = bday.get(Calendar.MONTH);
        int todaysDay = today.get(Calendar.DAY_OF_MONTH);
        int bdayDay = bday.get(Calendar.DAY_OF_MONTH);
        if (todaysMonth < bdayMonth) {
            age--;
        } else if (todaysMonth == bdayMonth && todaysDay < bdayDay) {
            // we're only comparing on month and day, not minutes, etc
            age--;
        }
        return age;
    }

    /**
     * Convenience method: sets a person's birth date from an age as of the given date Also sets
     * flag indicating that the birth date is inexact. This sets the person's birth date to January
     * 1 of the year that matches this age and date
     *
     * @param age (the age to set)
     * @param ageOnDate (null defaults to today)
     */
    public void setBirthdateFromAge(int age, Date ageOnDate) {
        Calendar c = Calendar.getInstance();
        c.setTime(ageOnDate == null ? new Date() : ageOnDate);
        c.set(Calendar.DATE, 1);
        c.set(Calendar.MONTH, Calendar.JANUARY);
        c.add(Calendar.YEAR, -1 * age);
        setBirthdate(c.getTime());
        setBirthdateEstimated(true);
    }

    public User getPersonChangedBy() {
        return personChangedBy;
    }

    public void setPersonChangedBy(User changedBy) {
        this.personChangedBy = changedBy;
        this.setChangedBy(changedBy);
    }

    public Date getPersonDateChanged() {
        return personDateChanged;
    }

    public void setPersonDateChanged(Date dateChanged) {
        this.personDateChanged = dateChanged;
        this.setDateChanged(dateChanged);
    }

    public User getPersonCreator() {
        return personCreator;
    }

    public void setPersonCreator(User creator) {
        this.personCreator = creator;
        this.setCreator(creator);
    }

    public Date getPersonDateCreated() {
        return personDateCreated;
    }

    public void setPersonDateCreated(Date dateCreated) {
        this.personDateCreated = dateCreated;
        this.setDateCreated(dateCreated);
    }

    public Date getPersonDateVoided() {
        return personDateVoided;
    }

    public void setPersonDateVoided(Date dateVoided) {
        this.personDateVoided = dateVoided;
        this.setDateVoided(dateVoided);
    }

    public void setPersonVoided(Boolean voided) {
        this.personVoided = voided;
        this.setVoided(voided);
    }

    public Boolean getPersonVoided() {
        return personVoided;
    }

    /**
     * @deprecated as of 2.0, use {@link #getPersonVoided()}
     */
    @Deprecated
    @JsonIgnore
    public Boolean isPersonVoided() {
        return getPersonVoided();
    }

    public User getPersonVoidedBy() {
        return personVoidedBy;
    }

    public void setPersonVoidedBy(User voidedBy) {
        this.personVoidedBy = voidedBy;
        this.setVoidedBy(voidedBy);
    }

    public String getPersonVoidReason() {
        return personVoidReason;
    }

    public void setPersonVoidReason(String voidReason) {
        this.personVoidReason = voidReason;
        this.setVoidReason(voidReason);
    }

    /**
     * @return true/false whether this person is a patient or not
     *
     * @deprecated as of 2.0, use {@link #getIsPatient()}
     */
    @Deprecated
    @JsonIgnore
    public boolean isPatient() {
        return getIsPatient();
    }

    public boolean getIsPatient() {
        return isPatient;
    }

    /**
     * This should only be set by the database layer by looking at whether a row exists in the
     * patient table
     *
     * @param isPatient whether this person is a patient or not
     */
    protected void setPatient(boolean isPatient) {
        this.isPatient = isPatient;
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "Person(personId=" + personId + ")";
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#getId()
     */
    @Override
    public Integer getId() {
        return getPersonId();
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
     */
    @Override
    public void setId(Integer id) {
        setPersonId(id);
    }
}

19 View Complete Implementation : TestEntity.java
Copyright Apache License 2.0
Author : igloo-project
@Enreplacedy
@Indexed
public clreplaced TestEnreplacedy extends GenericEnreplacedy<Long, TestEnreplacedy> {

    private static final long serialVersionUID = 3827488123984866455L;

    @Id
    @DoreplacedentId
    @GeneratedValue
    private Long id;

    @Field(replacedyzer = @replacedyzer(definition = HibernateSearchreplacedyzer.TEXT))
    @Basic(optional = false)
    private String label;

    @Column
    private String simplePropertyUpdate;

    @Column
    private String simplePropertyUpdateInterceptor;

    @Field
    @Column
    private String clreplacedicInterceptorSave;

    @Column
    private String clreplacedicInterceptorFlushDirty;

    @Field
    @Column
    private Date dateCreation;

    public TestEnreplacedy() {
        super();
    }

    public TestEnreplacedy(String label) {
        super();
        this.label = label;
    }

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    @Override
    public String getNameForToString() {
        return label;
    }

    @Override
    public String getDisplayName() {
        return label;
    }

    public String getSimplePropertyUpdate() {
        return simplePropertyUpdate;
    }

    public void setSimplePropertyUpdate(String simplePropertyUpdate) {
        this.simplePropertyUpdate = simplePropertyUpdate;
    }

    public String getSimplePropertyUpdateInterceptor() {
        return simplePropertyUpdateInterceptor;
    }

    public void setSimplePropertyUpdateInterceptor(String simplePropertyUpdateInterceptor) {
        this.simplePropertyUpdateInterceptor = simplePropertyUpdateInterceptor;
    }

    public String getClreplacedicInterceptorSave() {
        return clreplacedicInterceptorSave;
    }

    public void setClreplacedicInterceptorSave(String clreplacedicInterceptorSave) {
        this.clreplacedicInterceptorSave = clreplacedicInterceptorSave;
    }

    public String getClreplacedicInterceptorFlushDirty() {
        return clreplacedicInterceptorFlushDirty;
    }

    public void setClreplacedicInterceptorFlushDirty(String clreplacedicInterceptorFlushDirty) {
        this.clreplacedicInterceptorFlushDirty = clreplacedicInterceptorFlushDirty;
    }

    public Date getDateCreation() {
        return CloneUtils.clone(dateCreation);
    }

    public void setDateCreation(Date dateCreation) {
        this.dateCreation = CloneUtils.clone(dateCreation);
    }
}

19 View Complete Implementation : ResourceIndexedSearchParamDate.java
Copyright Apache License 2.0
Author : jamesagnew
@Embeddable
@Enreplacedy
@Table(name = "HFJ_SPIDX_DATE", indexes = { // We previously had an index called IDX_SP_DATE - Dont reuse
@Index(name = "IDX_SP_DATE_HASH", columnList = "HASH_IDENreplacedY,SP_VALUE_LOW,SP_VALUE_HIGH"), @Index(name = "IDX_SP_DATE_UPDATED", columnList = "SP_UPDATED"), @Index(name = "IDX_SP_DATE_RESID", columnList = "RES_ID") })
public clreplaced ResourceIndexedSearchParamDate extends BaseResourceIndexedSearchParam {

    private static final long serialVersionUID = 1L;

    @Column(name = "SP_VALUE_HIGH", nullable = true)
    @Temporal(TemporalType.TIMESTAMP)
    @Field
    public Date myValueHigh;

    @Column(name = "SP_VALUE_LOW", nullable = true)
    @Temporal(TemporalType.TIMESTAMP)
    @Field
    public Date myValueLow;

    @Transient
    private transient String myOriginalValue;

    @Id
    @SequenceGenerator(name = "SEQ_SPIDX_DATE", sequenceName = "SEQ_SPIDX_DATE")
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SPIDX_DATE")
    @Column(name = "SP_ID")
    private Long myId;

    /**
     * @since 3.5.0 - At some point this should be made not-null
     */
    @Column(name = "HASH_IDENreplacedY", nullable = true)
    private Long myHashIdenreplacedy;

    /**
     * Constructor
     */
    public ResourceIndexedSearchParamDate() {
        super();
    }

    /**
     * Constructor
     */
    public ResourceIndexedSearchParamDate(String theResourceType, String theParamName, Date theLow, Date theHigh, String theOriginalValue) {
        setResourceType(theResourceType);
        setParamName(theParamName);
        setValueLow(theLow);
        setValueHigh(theHigh);
        myOriginalValue = theOriginalValue;
    }

    @Override
    @PrePersist
    public void calculateHashes() {
        if (myHashIdenreplacedy == null) {
            String resourceType = getResourceType();
            String paramName = getParamName();
            setHashIdenreplacedy(calculateHashIdenreplacedy(resourceType, paramName));
        }
    }

    @Override
    protected void clearHashes() {
        myHashIdenreplacedy = null;
    }

    @Override
    public boolean equals(Object theObj) {
        if (this == theObj) {
            return true;
        }
        if (theObj == null) {
            return false;
        }
        if (!(theObj instanceof ResourceIndexedSearchParamDate)) {
            return false;
        }
        ResourceIndexedSearchParamDate obj = (ResourceIndexedSearchParamDate) theObj;
        EqualsBuilder b = new EqualsBuilder();
        b.append(getResourceType(), obj.getResourceType());
        b.append(getParamName(), obj.getParamName());
        b.append(getTimeFromDate(getValueHigh()), getTimeFromDate(obj.getValueHigh()));
        b.append(getTimeFromDate(getValueLow()), getTimeFromDate(obj.getValueLow()));
        b.append(isMissing(), obj.isMissing());
        return b.isEquals();
    }

    public void setHashIdenreplacedy(Long theHashIdenreplacedy) {
        myHashIdenreplacedy = theHashIdenreplacedy;
    }

    @Override
    public Long getId() {
        return myId;
    }

    @Override
    public void setId(Long theId) {
        myId = theId;
    }

    protected Long getTimeFromDate(Date date) {
        if (date != null) {
            return date.getTime();
        }
        return null;
    }

    public Date getValueHigh() {
        return myValueHigh;
    }

    public ResourceIndexedSearchParamDate setValueHigh(Date theValueHigh) {
        myValueHigh = theValueHigh;
        return this;
    }

    public Date getValueLow() {
        return myValueLow;
    }

    public ResourceIndexedSearchParamDate setValueLow(Date theValueLow) {
        myValueLow = theValueLow;
        return this;
    }

    @Override
    public int hashCode() {
        HashCodeBuilder b = new HashCodeBuilder();
        b.append(getResourceType());
        b.append(getParamName());
        b.append(getTimeFromDate(getValueHigh()));
        b.append(getTimeFromDate(getValueLow()));
        return b.toHashCode();
    }

    @Override
    public IQueryParameterType toQueryParameterType() {
        DateTimeType value = new DateTimeType(myOriginalValue);
        if (value.getPrecision().ordinal() > TemporalPrecisionEnum.DAY.ordinal()) {
            value.setTimeZoneZulu(true);
        }
        return new DateParam(value.getValuereplacedtring());
    }

    @Override
    public String toString() {
        ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
        b.append("paramName", getParamName());
        // TODO: add a field so we don't need to resolve this
        b.append("resourceId", getResource().getId());
        b.append("valueLow", new InstantDt(getValueLow()));
        b.append("valueHigh", new InstantDt(getValueHigh()));
        return b.build();
    }

    @Override
    public boolean matches(IQueryParameterType theParam) {
        if (!(theParam instanceof DateParam)) {
            return false;
        }
        DateParam date = (DateParam) theParam;
        DateRangeParam range = new DateRangeParam(date);
        Date lowerBound = range.getLowerBoundAsInstant();
        Date upperBound = range.getUpperBoundAsInstant();
        if (lowerBound == null && upperBound == null) {
            // should never happen
            return false;
        }
        boolean result = true;
        if (lowerBound != null) {
            result &= (myValueLow.after(lowerBound) || myValueLow.equals(lowerBound));
            result &= (myValueHigh.after(lowerBound) || myValueHigh.equals(lowerBound));
        }
        if (upperBound != null) {
            result &= (myValueLow.before(upperBound) || myValueLow.equals(upperBound));
            result &= (myValueHigh.before(upperBound) || myValueHigh.equals(upperBound));
        }
        return result;
    }
}

19 View Complete Implementation : AffectedStoreRecordKey.java
Copyright Apache License 2.0
Author : Commonjava
/**
 * Created by jdcasey on 3/8/16.
 */
@Deprecated
@Indexed
public clreplaced AffectedStoreRecordKey {

    @IndexedEmbedded
    private TrackingKey key;

    @Field
    private StoreKey storeKey;

    @Field
    private String path;

    @Field
    private StoreEffect effect;

    @Field
    private long index = System.currentTimeMillis();

    public AffectedStoreRecordKey(TrackingKey key, StoreKey storeKey, String path, StoreEffect effect) {
        this.key = key;
        this.storeKey = storeKey;
        this.path = path;
        this.effect = effect;
    }

    public long getIndex() {
        return index;
    }

    public TrackingKey getKey() {
        return key;
    }

    public StoreKey getStoreKey() {
        return storeKey;
    }

    public String getPath() {
        return path;
    }

    public StoreEffect getEffect() {
        return effect;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof AffectedStoreRecordKey)) {
            return false;
        }
        AffectedStoreRecordKey that = (AffectedStoreRecordKey) o;
        if (!getKey().equals(that.getKey())) {
            return false;
        }
        if (!getStoreKey().equals(that.getStoreKey())) {
            return false;
        }
        if (!getPath().equals(that.getPath())) {
            return false;
        }
        return getEffect() == that.getEffect();
    }

    @Override
    public int hashCode() {
        int result = getKey().hashCode();
        result = 31 * result + getStoreKey().hashCode();
        result = 31 * result + getPath().hashCode();
        result = 31 * result + getEffect().hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "AffectedStoreRecordKey{" + "key=" + key + ", storeKey=" + storeKey + ", path='" + path + '\'' + ", effect=" + effect + ", index=" + index + '}';
    }
}

19 View Complete Implementation : Book.java
Copyright Apache License 2.0
Author : realtimeinsights
@Indexed
public clreplaced Book {

    @Field
    String replacedle;

    @Field
    String description;

    @Field
    @DateBridge(resolution = Resolution.YEAR)
    Date publicationYear;

    @IndexedEmbedded
    Set<Author> authors = new HashSet<Author>();
}

19 View Complete Implementation : MultipleEntitiesTest.java
Copyright Apache License 2.0
Author : infinispan
@Indexed(index = "instruments")
clreplaced Debenture {

    @Field
    String issuer;

    @Field
    Double rate;

    public Debenture(String issuer, Double rate) {
        this.issuer = issuer;
        this.rate = rate;
    }
}

19 View Complete Implementation : Employee.java
Copyright Apache License 2.0
Author : infinispan
/**
 * @author [email protected]
 * @since 9.0
 */
@Indexed
public clreplaced Employee {

    @DoreplacedentId
    public String id;

    @Field(replacedyze = replacedyze.NO, indexNullAs = Field.DEFAULT_NULL_TOKEN)
    public String name;

    @Field
    public long position;

    @Field(indexNullAs = "-1")
    public long code;

    @Field
    public String text;

    @Field(replacedyze = replacedyze.NO)
    public String replacedle;

    @Field(name = "replacedyzedInfo", replacedyze = replacedyze.YES)
    @Field(name = "someMoreInfo", replacedyze = replacedyze.NO)
    @Field(name = "sameInfo", replacedyze = replacedyze.NO)
    public String otherInfo;

    @IndexedEmbedded(indexNullAs = Field.DEFAULT_NULL_TOKEN)
    public Company author;

    @IndexedEmbedded
    public List<ContactDetails> contactDetails = new ArrayList<>();

    @IndexedEmbedded
    public List<ContactDetails> alternativeContactDetails = new ArrayList<>();

    public static clreplaced ContactDetails {

        @Field(replacedyze = replacedyze.NO)
        public String email;

        @Field(replacedyze = replacedyze.NO)
        public String phoneNumber;

        @IndexedEmbedded
        public ContactAddress address;

        public static clreplaced ContactAddress {

            @Field(replacedyze = replacedyze.NO)
            public String address;

            @Field(replacedyze = replacedyze.NO)
            public String postCode;

            @IndexedEmbedded(depth = 3)
            public List<ContactAddress> alternatives = new ArrayList<>();
        }
    }
}

19 View Complete Implementation : NfcConcreteResourceWrapper.java
Copyright Apache License 2.0
Author : Commonjava
/**
 * Created by ruhan on 11/29/17.
 */
@Indexed
public clreplaced NfcConcreteResourceWrapper {

    @Field(index = Index.YES, replacedyze = replacedyze.NO)
    private String location;

    @Field(index = Index.YES, replacedyze = replacedyze.NO)
    private String path;

    @Field
    private long timeout;

    public NfcConcreteResourceWrapper(ConcreteResource resource, long timeout) {
        this.location = ((KeyedLocation) resource.getLocation()).getKey().toString();
        this.path = resource.getPath();
        this.timeout = timeout;
    }

    public String getLocation() {
        return location;
    }

    public String getPath() {
        return path;
    }

    public long getTimeout() {
        return timeout;
    }
}

19 View Complete Implementation : Book.java
Copyright Apache License 2.0
Author : infinispan
/**
 * @author [email protected]
 * @since 9.0
 */
@Indexed
public clreplaced Book implements Serializable {

    @Field
    private String replacedle;

    @Field
    private String publisher;

    @Field(replacedyze = replacedyze.NO)
    private String isbn;

    @Field
    private String preface;

    @IndexedEmbedded
    private Author author;

    public Book(String replacedle, String publisher, Author author, String preface) {
        this.replacedle = replacedle;
        this.publisher = publisher;
        this.author = author;
        this.preface = preface;
    }

    public String getreplacedle() {
        return replacedle;
    }

    public void setreplacedle(String replacedle) {
        this.replacedle = replacedle;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public String getPreface() {
        return preface;
    }

    public void setPreface(String preface) {
        this.preface = preface;
    }

    public Author getAuthor() {
        return author;
    }

    public void setAuthor(Author author) {
        this.author = author;
    }

    @Override
    public String toString() {
        return "Book{" + "replacedle='" + replacedle + '\'' + ", publisher='" + publisher + '\'' + ", isbn='" + isbn + '\'' + ", author=" + author + ", preface='" + preface + '\'' + '}';
    }
}

19 View Complete Implementation : Publisher.java
Copyright Apache License 2.0
Author : hibernate
@Embeddable
public clreplaced Publisher {

    @Field
    public String name;

    @Field
    public String address;

    Publisher() {
    }

    public Publisher(String name, String address) {
        this.name = name;
        this.address = address;
    }

    @Override
    public String toString() {
        return "Publisher [name=" + name + ", address=" + address + "]";
    }
}

19 View Complete Implementation : Author.java
Copyright Apache License 2.0
Author : infinispan
@Indexed
public clreplaced Author {

    @Field
    private String name;

    @Field
    private String surname;

    public Author(String name, String surname) {
        this.name = name;
        this.surname = surname;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, surname);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null || getClreplaced() != obj.getClreplaced())
            return false;
        Author other = (Author) obj;
        return Objects.equals(name, other.name) && Objects.equals(surname, other.surname);
    }
}

19 View Complete Implementation : City.java
Copyright Apache License 2.0
Author : infinispan
/**
 * @author Sanne Grinovero <[email protected]> (C) 2011 Red Hat Inc.
 */
public clreplaced City implements Serializable {

    @ProtoField(number = 1)
    @Field
    public String name;
}

19 View Complete Implementation : Insurance.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Field
public String getName() {
    return name;
}

19 View Complete Implementation : Transaction.java
Copyright Apache License 2.0
Author : infinispan
@Indexed(index = "commonIndex")
public clreplaced Transaction implements Serializable {

    @Field(replacedyze = replacedyze.NO)
    private final int size;

    @Field
    private final String script;

    @ProtoFactory
    public Transaction(int size, String script) {
        this.size = size;
        this.script = script;
    }

    @ProtoField(number = 1, defaultValue = "0")
    public int getSize() {
        return size;
    }

    @ProtoField(number = 2)
    public String getScript() {
        return script;
    }

    @Override
    public String toString() {
        return "Transaction{" + "size=" + size + ", script='" + script + '\'' + '}';
    }
}

19 View Complete Implementation : Build.java
Copyright GNU Affero General Public License v3.0
Author : headsupdev
/**
 * A single build for a project. It has an id and a status as well as other data.
 * It references a set of test results and caches the result totals.
 *
 * @author Andrew Williams
 * @version $Id$
 * @since 1.0
 */
@Enreplacedy
@Table(name = "Builds")
@Indexed(index = "Builds")
public clreplaced Build implements Serializable, SearchResult {

    public static final int BUILD_QUEUED = 10;

    public static final int BUILD_RUNNING = 20;

    public static final int BUILD_CANCELLED = 30;

    public static final int BUILD_SUCCEEDED = 40;

    public static final int BUILD_FAILED = 50;

    @EmbeddedId
    @DoreplacedentId
    @FieldBridge(impl = IdProjectBridge.clreplaced)
    @Field
    @Publish
    private IdProjectId id;

    @Field
    @Publish
    private String revision;

    @Temporal(TemporalType.TIMESTAMP)
    @Publish
    private Date startTime = new Date(), endTime;

    @Publish
    private String configName;

    @Publish
    private int status = 0;

    @OneToMany
    private Set<TestResultSet> testResults = new HashSet<TestResultSet>();

    @Publish
    private Integer tests = 0;

    @Publish
    private Integer failures = 0;

    @Publish
    private Integer errors = 0;

    @Publish
    private Integer warnings = 0;

    Build() {
    }

    public Build(Project project, String revision) {
        this.id = new IdProjectId(project);
        this.revision = revision;
    }

    public long getId() {
        return id.getId();
    }

    public String getRevision() {
        return revision;
    }

    public Project getProject() {
        return id.getProject();
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getTests() {
        return tests == null ? 0 : tests;
    }

    public void setTests(int tests) {
        this.tests = tests;
    }

    public int getFailures() {
        return failures == null ? 0 : failures;
    }

    public void setFailures(int failures) {
        this.failures = failures;
    }

    public int getErrors() {
        return errors == null ? 0 : errors;
    }

    public void setErrors(int errors) {
        this.errors = errors;
    }

    public int getWarnings() {
        return warnings == null ? 0 : warnings;
    }

    public void setWarnings(int warnings) {
        this.warnings = warnings;
    }

    public Date getStartTime() {
        return startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getConfigName() {
        return configName;
    }

    public void setConfigName(String configName) {
        this.configName = configName;
    }

    public Set<TestResultSet> getTestResults() {
        return testResults;
    }

    public String getIconPath() {
        switch(status) {
            case BUILD_QUEUED:
                return "images/type/ci/queued.png";
            case BUILD_RUNNING:
                return "images/type/ci/running.png";
            case BUILD_CANCELLED:
                return "images/type/ci/failed.png";
            case BUILD_SUCCEEDED:
                return "images/type/ci/preplaceded.png";
            default:
                return "images/type/ci/failed.png";
        }
    }

    public String getLink() {
        return "/" + getProject().getId() + "/builds/view/id/" + getId();
    }

    @Override
    public String getAppId() {
        return "builds";
    }

    public String toString() {
        String statusName;
        switch(status) {
            case BUILD_QUEUED:
                statusName = "queued";
                break;
            case BUILD_RUNNING:
                statusName = "running";
                break;
            case BUILD_CANCELLED:
                statusName = "cancelled";
                break;
            case BUILD_SUCCEEDED:
                statusName = "succeeded";
                break;
            default:
                statusName = "failed";
        }
        return "Build result " + getId() + " (" + statusName + ")";
    }

    public boolean equals(Object o) {
        return o instanceof Build && equals((Build) o);
    }

    public boolean equals(Build b) {
        return b.getId() == getId() && b.getProject().equals(getProject());
    }

    public int hashCode() {
        return id.hashCode();
    }
}

19 View Complete Implementation : BaseOpenmrsData.java
Copyright Apache License 2.0
Author : isstac
/**
 * In OpenMRS, we distinguish between data and metadata within our data model. Data (as opposed to
 * metadata) generally represent person- or patient-specific data. This provides a default abstract
 * implementation of the OpenmrsData interface
 *
 * @since 1.5
 * @see OpenmrsData
 */
@MappedSuperclreplaced
public abstract clreplaced BaseOpenmrsData extends BaseOpenmrsObject implements OpenmrsData {

    // ***** Properties *****
    @ManyToOne(optional = false)
    @JoinColumn(name = "creator", updatable = false)
    protected User creator;

    @Column(name = "date_created", nullable = false, updatable = false)
    private Date dateCreated;

    @ManyToOne
    @JoinColumn(name = "changed_by")
    private User changedBy;

    @Column(name = "date_changed")
    private Date dateChanged;

    @Column(name = "voided", nullable = false)
    @Field
    private Boolean voided = Boolean.FALSE;

    @Column(name = "date_voided")
    private Date dateVoided;

    @ManyToOne
    @JoinColumn(name = "voided_by")
    private User voidedBy;

    @Column(name = "void_reason", length = 255)
    private String voidReason;

    // ***** Constructors *****
    /**
     * Default Constructor
     */
    public BaseOpenmrsData() {
    }

    // ***** Property Access *****
    /**
     * @see org.openmrs.OpenmrsData#getCreator()
     */
    @Override
    public User getCreator() {
        return creator;
    }

    /**
     * @see org.openmrs.OpenmrsData#setCreator(org.openmrs.User)
     */
    @Override
    public void setCreator(User creator) {
        this.creator = creator;
    }

    /**
     * @see org.openmrs.OpenmrsData#getDateCreated()
     */
    @Override
    public Date getDateCreated() {
        return dateCreated;
    }

    /**
     * @see org.openmrs.OpenmrsData#setDateCreated(java.util.Date)
     */
    @Override
    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    /**
     * @deprecated as of version 2.2
     * @see org.openmrs.OpenmrsData#getChangedBy()
     */
    @Override
    @Deprecated
    public User getChangedBy() {
        return changedBy;
    }

    /**
     * @deprecated as of version 2.2
     * @see org.openmrs.OpenmrsData#setChangedBy(User)
     */
    @Override
    @Deprecated
    public void setChangedBy(User changedBy) {
        this.changedBy = changedBy;
    }

    /**
     * @deprecated as of version 2.2
     * @see org.openmrs.OpenmrsData#getDateChanged()
     */
    @Override
    @Deprecated
    public Date getDateChanged() {
        return dateChanged;
    }

    /**
     * @deprecated as of version 2.2
     * @see org.openmrs.OpenmrsData#setDateChanged(Date)
     */
    @Override
    @Deprecated
    public void setDateChanged(Date dateChanged) {
        this.dateChanged = dateChanged;
    }

    /**
     * @deprecated as of 2.0, use {@link #getVoided()}
     * @see org.openmrs.Voidable#isVoided()
     */
    @Override
    @Deprecated
    @JsonIgnore
    public Boolean isVoided() {
        return getVoided();
    }

    /**
     * @see org.openmrs.Voidable#getVoided()
     */
    @Override
    public Boolean getVoided() {
        return voided;
    }

    /**
     * @see org.openmrs.Voidable#setVoided(java.lang.Boolean)
     */
    @Override
    public void setVoided(Boolean voided) {
        this.voided = voided;
    }

    /**
     * @see org.openmrs.Voidable#getDateVoided()
     */
    @Override
    public Date getDateVoided() {
        return dateVoided;
    }

    /**
     * @see org.openmrs.Voidable#setDateVoided(java.util.Date)
     */
    @Override
    public void setDateVoided(Date dateVoided) {
        this.dateVoided = dateVoided;
    }

    /**
     * @see org.openmrs.Voidable#getVoidedBy()
     */
    @Override
    public User getVoidedBy() {
        return voidedBy;
    }

    /**
     * @see org.openmrs.Voidable#setVoidedBy(org.openmrs.User)
     */
    @Override
    public void setVoidedBy(User voidedBy) {
        this.voidedBy = voidedBy;
    }

    /**
     * @see org.openmrs.Voidable#getVoidReason()
     */
    @Override
    public String getVoidReason() {
        return voidReason;
    }

    /**
     * @see org.openmrs.Voidable#setVoidReason(java.lang.String)
     */
    @Override
    public void setVoidReason(String voidReason) {
        this.voidReason = voidReason;
    }
}

19 View Complete Implementation : Address.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
/**
 * @author Gunnar Morling
 */
@Enreplacedy
@Indexed
public clreplaced Address {

    @Id
    private Long id;

    @Field(store = Store.YES)
    private String street;

    @Field
    private String city;

    @ContainedIn
    @OneToMany(mappedBy = "address")
    private Set<Author> authors;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public Set<Author> getAuthors() {
        return authors;
    }

    public void setAuthors(Set<Author> authors) {
        this.authors = authors;
    }
}

19 View Complete Implementation : ConceptName.java
Copyright Apache License 2.0
Author : isstac
/**
 * ConceptName is the real world term used to express a Concept within the idiom of a particular
 * locale.
 */
@Indexed
@replacedyzerDef(name = "ConceptNamereplacedyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.clreplaced), filters = { @TokenFilterDef(factory = StandardFilterFactory.clreplaced), @TokenFilterDef(factory = LowerCaseFilterFactory.clreplaced) })
@replacedyzer(definition = "ConceptNamereplacedyzer")
public clreplaced ConceptName extends BaseOpenmrsObject implements Auditable, Voidable, java.io.Serializable {

    public static final long serialVersionUID = 2L;

    @DoreplacedentId
    private Integer conceptNameId;

    @IndexedEmbedded(includeEmbeddedObjectId = true)
    private Concept concept;

    @Field
    private String name;

    @Field(replacedyze = replacedyze.NO)
    @FieldBridge(impl = LocaleFieldBridge.clreplaced)
    private Locale // ABK: upgraded from a plain string to a full locale object
    locale;

    private User creator;

    private Date dateCreated;

    @Field
    private Boolean voided = false;

    private User voidedBy;

    private Date dateVoided;

    private String voidReason;

    private Collection<ConceptNameTag> tags;

    @Field
    private ConceptNameType conceptNameType;

    @Field
    private Boolean localePreferred = false;

    private User changedBy;

    private Date dateChanged;

    // Constructors
    /**
     * default constructor
     */
    public ConceptName() {
    }

    /**
     * Convenience constructor to create a ConceptName object by primary key
     *
     * @param conceptNameId
     */
    public ConceptName(Integer conceptNameId) {
        this.conceptNameId = conceptNameId;
    }

    public ConceptName(String name, Locale locale) {
        setName(name);
        setLocale(locale);
    }

    /**
     * @return Returns the conceptId.
     */
    public Integer getConceptNameId() {
        return conceptNameId;
    }

    /**
     * @param conceptNameId The conceptId to set.
     */
    public void setConceptNameId(Integer conceptNameId) {
        this.conceptNameId = conceptNameId;
    }

    public Concept getConcept() {
        return concept;
    }

    public void setConcept(Concept concept) {
        this.concept = concept;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        if (name != null && StringUtils.isBlank(name) && StringUtils.isNotBlank(this.name) && this.getConceptNameType().equals(ConceptNameType.SHORT)) {
            this.setVoided(true);
        } else {
            this.name = name;
        }
    }

    public Locale getLocale() {
        return locale;
    }

    public void setLocale(Locale locale) {
        this.locale = locale;
    }

    /**
     * @return Returns the creator.
     */
    @Override
    public User getCreator() {
        return creator;
    }

    /**
     * @param creator The creator to set.
     */
    @Override
    public void setCreator(User creator) {
        this.creator = creator;
    }

    /**
     * @return Returns the dateCreated.
     */
    @Override
    public Date getDateCreated() {
        return dateCreated;
    }

    /**
     * @param dateCreated The dateCreated to set.
     */
    @Override
    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    /**
     * Returns whether the ConceptName has been voided.
     *
     * @return true if the ConceptName has been voided, false otherwise.
     *
     * @deprecated as of 2.0, use {@link #getVoided()}
     */
    @Override
    @Deprecated
    @JsonIgnore
    public Boolean isVoided() {
        return getVoided();
    }

    /**
     * Returns whether the ConceptName has been voided.
     *
     * @return true if the ConceptName has been voided, false otherwise.
     */
    @Override
    public Boolean getVoided() {
        return voided;
    }

    /**
     * Sets the voided status of this ConceptName.
     *
     * @param voided the voided status to set.
     */
    @Override
    public void setVoided(Boolean voided) {
        this.voided = voided;
    }

    /**
     * Returns the User who voided this ConceptName.
     *
     * @return the User who voided this ConceptName, or null if not set
     */
    @Override
    public User getVoidedBy() {
        return voidedBy;
    }

    /**
     * Sets the User who voided this ConceptName.
     *
     * @param voidedBy the user who voided this ConceptName.
     */
    @Override
    public void setVoidedBy(User voidedBy) {
        this.voidedBy = voidedBy;
    }

    /**
     * Returns the Date this ConceptName was voided.
     *
     * @return the Date this ConceptName was voided.
     */
    @Override
    public Date getDateVoided() {
        return dateVoided;
    }

    /**
     * Sets the Data this ConceptName was voided.
     *
     * @param dateVoided the date the ConceptName was voided.
     */
    @Override
    public void setDateVoided(Date dateVoided) {
        this.dateVoided = dateVoided;
    }

    /**
     * Returns the reason this ConceptName was voided.
     *
     * @return the reason this ConceptName was voided
     */
    @Override
    public String getVoidReason() {
        return voidReason;
    }

    /**
     * Sets the reason this ConceptName was voided.
     *
     * @param voidReason the reason this ConceptName was voided
     */
    @Override
    public void setVoidReason(String voidReason) {
        this.voidReason = voidReason;
    }

    /**
     * Returns the tags which have been attached to this ConceptName.
     *
     * @return the tags.
     */
    public Collection<ConceptNameTag> getTags() {
        return tags;
    }

    /**
     * Set the tags which are attached to this ConceptName.
     *
     * @see Concept#setPreferredName(ConceptName)
     * @see Concept#setFullySpecifiedName(ConceptName)
     * @see Concept#setShortName(ConceptName)
     * @param tags the tags to set.
     */
    public void setTags(Collection<ConceptNameTag> tags) {
        this.tags = tags;
    }

    /**
     * @return the conceptNameType
     */
    public ConceptNameType getConceptNameType() {
        return this.conceptNameType;
    }

    /**
     * @param conceptNameType the conceptNameType to set
     */
    public void setConceptNameType(ConceptNameType conceptNameType) {
        this.conceptNameType = conceptNameType;
    }

    /**
     * Getter for localePreferred
     *
     * @return localPreferred
     *
     * @deprecated as of 2.0, use {@link #getLocalePreferred()}
     */
    @Deprecated
    @JsonIgnore
    public Boolean isLocalePreferred() {
        return getLocalePreferred();
    }

    /**
     * @return true if it is the localePreferred name otherwise false
     */
    public Boolean getLocalePreferred() {
        return localePreferred;
    }

    /**
     * @param localePreferred the localePreferred to set
     */
    public void setLocalePreferred(Boolean localePreferred) {
        this.localePreferred = localePreferred;
    }

    /**
     * Adds a tag to the concept name. If the tag is new (has no existing occurrences) a new
     * ConceptNameTag will be created with a blank description.
     *
     * @see Concept#setPreferredName(ConceptName)
     * @see Concept#setFullySpecifiedName(ConceptName)
     * @see Concept#setShortName(ConceptName)
     * @param tag human-readable text string for the tag
     */
    public void addTag(String tag) {
        addTag(tag, "");
    }

    /**
     * Adds a tag to the concept name. If the tag is new (has no existing occurrences) a new
     * ConceptNameTag will be created with the given description.
     *
     * @see Concept#setPreferredName(ConceptName)
     * @see Concept#setFullySpecifiedName(ConceptName)
     * @see Concept#setShortName(ConceptName)
     * @param tag human-readable text string for the tag
     * @param description description of the tag's purpose
     */
    public void addTag(String tag, String description) {
        ConceptNameTag nameTag = new ConceptNameTag(tag, description);
        addTag(nameTag);
    }

    /**
     * Attaches a tag to the concept name.
     *
     * @see Concept#setPreferredName(ConceptName)
     * @see Concept#setFullySpecifiedName(ConceptName)
     * @see Concept#setShortName(ConceptName)
     * @param tag the tag to add
     */
    public void addTag(ConceptNameTag tag) {
        if (tags == null) {
            tags = new HashSet<>();
        }
        if (!tags.contains(tag)) {
            tags.add(tag);
        }
    }

    /**
     * Removes a tag from the concept name.
     *
     * @see Concept#setPreferredName(ConceptName)
     * @see Concept#setFullySpecifiedName(ConceptName)
     * @see Concept#setShortName(ConceptName)
     * @param tag the tag to remove
     */
    public void removeTag(ConceptNameTag tag) {
        if (tags.contains(tag)) {
            tags.remove(tag);
        }
    }

    /**
     * Checks whether the name has a particular tag.
     *
     * @see #isPreferred()
     * @see #isFullySpecifiedName()
     * @see #isIndexTerm()
     * @see #isSynonym()
     * @see #isShort()
     * @param tagToFind the tag for which to check
     * @return true if the tags include the specified tag, false otherwise
     */
    public Boolean hasTag(ConceptNameTag tagToFind) {
        return hasTag(tagToFind.getTag());
    }

    /**
     * Checks whether the name has a particular tag.
     *
     * @see #isPreferred()
     * @see #isFullySpecifiedName()
     * @see #isIndexTerm()
     * @see #isSynonym()
     * @see #isShort()
     * @param tagToFind the string of the tag for which to check
     * @return true if the tags include the specified tag, false otherwise
     */
    public Boolean hasTag(String tagToFind) {
        boolean foundTag = false;
        if (tags != null) {
            for (ConceptNameTag nameTag : getTags()) {
                if (nameTag.getTag().equals(tagToFind)) {
                    foundTag = true;
                    break;
                }
            }
        }
        return foundTag;
    }

    /**
     * Checks whether the name is explicitly marked as preferred in a locale with a matching
     * language. E.g 'en_US' and 'en_UK' for language en
     *
     * @see #isPreferredForLocale(Locale)
     * @param language ISO 639 2-letter code for a language
     * @return true if the name is preferred in a locale with a matching language code, otherwise
     *         false
     */
    public Boolean isPreferredInLanguage(String language) {
        return !StringUtils.isBlank(language) && this.locale != null && isPreferred() && this.locale.getLanguage().equals(language);
    }

    /**
     * Checks whether the name is explicitly marked as preferred in a locale with a matching country
     * code E.g 'fr_RW' and 'en_RW' for country RW
     *
     * @see #isPreferredForLocale(Locale)
     * @param country ISO 3166 2-letter code for a country
     * @return true if the name is preferred in a locale with a matching country code, otherwise
     *         false
     */
    public Boolean isPreferredInCountry(String country) {
        return !StringUtils.isBlank(country) && this.locale != null && isPreferred() && this.locale.getCountry().equals(country);
    }

    /**
     * Checks whether the name is explicitly marked as preferred for any locale. Note that this
     * method is different from {@link #isPreferredForLocale(Locale)} in that it checks if the given
     * name is marked as preferred irrespective of the locale in which it is preferred.
     *
     * @see #isPreferredForLocale(Locale)
     */
    public Boolean isPreferred() {
        return getLocalePreferred();
    }

    /**
     * Checks whether the name is explicitly marked as preferred for the given locale
     *
     * @param locale the locale in which the name is preferred
     * @return true if the name is marked as preferred for the given locale otherwise false.
     */
    public Boolean isPreferredForLocale(Locale locale) {
        return getLocalePreferred() && this.locale.equals(locale);
    }

    /**
     * Checks whether the concept name is explicitly marked as fully specified
     *
     * @return true if the name is marked as 'fully specified' otherwise false
     * @since Version 1.7
     */
    public Boolean isFullySpecifiedName() {
        return ConceptNameType.FULLY_SPECIFIED.equals(getConceptNameType());
    }

    /**
     * Convenience method for determining whether this is a short name.
     *
     * @return true if the name is marked as a short name, otherwise false
     */
    public Boolean isShort() {
        return ConceptNameType.SHORT.equals(getConceptNameType());
    }

    /**
     * Convenience method for checking whether this is an index Term.
     *
     * @return true if the name is marked as an index term, otherwise false
     * @since Version 1.7
     */
    public Boolean isIndexTerm() {
        return ConceptNameType.INDEX_TERM.equals(getConceptNameType());
    }

    /**
     * Convenience method for determining whether this is an index Term for a given locale.
     *
     * @param locale The locale in which this concept name should belong as an index term
     * @return true if the name is marked as an index term, otherwise false
     */
    public Boolean isIndexTermInLocale(Locale locale) {
        return getConceptNameType() != null && getConceptNameType().equals(ConceptNameType.INDEX_TERM) && locale.equals(getLocale());
    }

    /**
     * Convenience method for determining whether this is a synonym in a given locale.
     *
     * @param locale The locale in which this synonym should belong
     * @return true if the concept name is marked as a synonym in the given locale, otherwise false
     */
    public Boolean isSynonymInLocale(Locale locale) {
        return getConceptNameType() == null && locale.equals(getLocale());
    }

    /**
     * Convenience method for checking whether this is a a synonym.
     *
     * @return true if the name is tagged as a synonym, false otherwise
     * @since Version 1.7
     */
    public Boolean isSynonym() {
        return getConceptNameType() == null;
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        if (this.name == null) {
            return "ConceptNameId: " + this.conceptNameId;
        }
        return this.name;
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#getId()
     */
    @Override
    public Integer getId() {
        return getConceptNameId();
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
     */
    @Override
    public void setId(Integer id) {
        setConceptNameId(id);
    }

    /**
     * @return Returns the changedBy.
     */
    @Override
    public User getChangedBy() {
        return changedBy;
    }

    /**
     * @param changedBy The user that changed this object
     */
    @Override
    public void setChangedBy(User changedBy) {
        this.changedBy = changedBy;
    }

    /**
     * @return Returns the date this object was changed
     */
    @Override
    public Date getDateChanged() {
        return dateChanged;
    }

    /**
     * @param dateChanged The date this object was changed
     */
    @Override
    public void setDateChanged(Date dateChanged) {
        this.dateChanged = dateChanged;
    }
}

19 View Complete Implementation : Holder.java
Copyright BSD 2-Clause "Simplified" License
Author : CESNET
/**
 * Holder of an attribute. Represents who does the attribute belong to. Holder is identified by id and type (member, group..)
 *
 * @author Simona Kruppova
 */
@Indexed
public clreplaced Holder implements Serializable {

    @Field
    @NumericField
    private int id;

    @Field(replacedyze = replacedyze.NO)
    private HolderType type;

    public enum HolderType {

        FACILITY,
        MEMBER,
        VO,
        GROUP,
        HOST,
        RESOURCE,
        USER,
        UES
    }

    public Holder(int id, HolderType type) {
        this.id = id;
        this.type = type;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public HolderType getType() {
        return type;
    }

    public void setType(HolderType type) {
        this.type = type;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("Holder{");
        sb.append("id=").append(id);
        sb.append(", type=").append(type);
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClreplaced() != o.getClreplaced())
            return false;
        Holder holder = (Holder) o;
        if (id != holder.id)
            return false;
        if (type != holder.type)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + type.hashCode();
        return result;
    }
}

19 View Complete Implementation : PatientIdentifierType.java
Copyright Apache License 2.0
Author : isstac
/**
 * PatientIdentifierType
 */
public clreplaced PatientIdentifierType extends BaseChangeableOpenmrsMetadata {

    public static final long serialVersionUID = 211231L;

    /**
     * Enumerates the possible ways that location may be applicable for a particular Patient
     * Identifer Type
     */
    public enum LocationBehavior {

        /**
         * Indicates that location is required for the current identifier type
         */
        REQUIRED,
        /**
         * Indicates that location is not used for the current identifier type
         */
        NOT_USED
    }

    /**
     * Enumeration for the way to handle uniqueness among identifiers for a given identifier type
     */
    public enum UniquenessBehavior {

        /**
         * Indicates that identifiers should be globally unique
         */
        UNIQUE,
        /**
         * Indicates that duplicates identifiers are allowed
         */
        NON_UNIQUE,
        /**
         * Indicates that identifiers should be unique only across a location if the identifier's
         * location property is not null
         */
        LOCATION
    }

    // Fields
    private Integer patientIdentifierTypeId;

    private String format;

    @Field
    private Boolean required = Boolean.FALSE;

    private String formatDescription;

    private String validator;

    private LocationBehavior locationBehavior;

    private UniquenessBehavior uniquenessBehavior;

    /**
     * default constructor
     */
    public PatientIdentifierType() {
    }

    /**
     * constructor with id
     */
    public PatientIdentifierType(Integer patientIdentifierTypeId) {
        this.patientIdentifierTypeId = patientIdentifierTypeId;
    }

    // Property accessors
    /**
     * @return Returns the formatDescription.
     */
    public String getFormatDescription() {
        return formatDescription;
    }

    /**
     * @param formatDescription The formatDescription to set.
     */
    public void setFormatDescription(String formatDescription) {
        this.formatDescription = formatDescription;
    }

    /**
     * @return Returns the required.
     */
    public Boolean getRequired() {
        return required;
    }

    /**
     * @param required The required to set.
     */
    public void setRequired(Boolean required) {
        this.required = required;
    }

    /**
     * @return Returns the locationBehavior
     */
    public LocationBehavior getLocationBehavior() {
        return locationBehavior;
    }

    /**
     * @param locationBehavior The locationBehavior to set
     */
    public void setLocationBehavior(LocationBehavior locationBehavior) {
        this.locationBehavior = locationBehavior;
    }

    /**
     * @return the uniquenessBehavior
     * @since 1.10
     */
    public UniquenessBehavior getUniquenessBehavior() {
        return uniquenessBehavior;
    }

    /**
     * @param uniquenessBehavior the uniquenessBehavior to set
     * @since 1.10
     */
    public void setUniquenessBehavior(UniquenessBehavior uniquenessBehavior) {
        this.uniquenessBehavior = uniquenessBehavior;
    }

    /**
     * @return Returns the format.
     */
    public String getFormat() {
        return format;
    }

    /**
     * @param format The format to set.
     */
    public void setFormat(String format) {
        this.format = format;
    }

    /**
     * @return Returns the patientIdentifierTypeId.
     */
    public Integer getPatientIdentifierTypeId() {
        return patientIdentifierTypeId;
    }

    /**
     * @param patientIdentifierTypeId The patientIdentifierTypeId to set.
     */
    public void setPatientIdentifierTypeId(Integer patientIdentifierTypeId) {
        this.patientIdentifierTypeId = patientIdentifierTypeId;
    }

    public String getValidator() {
        return validator;
    }

    public void setValidator(String validator) {
        this.validator = validator;
    }

    /**
     * @return Whether this identifier type has a validator.
     */
    public boolean hasValidator() {
        return StringUtils.isNotEmpty(validator);
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return getName();
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#getId()
     */
    @Override
    public Integer getId() {
        return getPatientIdentifierTypeId();
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
     */
    @Override
    public void setId(Integer id) {
        setPatientIdentifierTypeId(id);
    }
}

19 View Complete Implementation : Member.java
Copyright GNU Lesser General Public License v2.1
Author : hibernate
@Enreplacedy
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "email"))
@Indexed
public clreplaced Member implements Serializable {

    /**
     * Default value included to remove warning. Remove or modify at will. *
     */
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue
    private Long id;

    private String name;

    @Field
    private String email;

    @Column(name = "phone_number")
    private String phoneNumber;

    @ElementCollection(fetch = FetchType.EAGER)
    private List<Address> addresses = new ArrayList<Address>();

    @Temporal(TemporalType.TIMESTAMP)
    private Date registrationDate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public List<Address> getAddresses() {
        return addresses;
    }

    public void setAddresses(List<Address> addresses) {
        this.addresses = addresses;
    }

    public Date getRegistrationDate() {
        return registrationDate;
    }

    public void setRegistrationDate(Date registrationDate) {
        this.registrationDate = registrationDate;
    }
}

19 View Complete Implementation : PersonAttributeType.java
Copyright Apache License 2.0
Author : isstac
/**
 * PersonAttributeType
 */
public clreplaced PersonAttributeType extends BaseChangeableOpenmrsMetadata implements java.io.Serializable, Comparable<PersonAttributeType> {

    public static final long serialVersionUID = 2112313431211L;

    private Integer personAttributeTypeId;

    private String format;

    private Integer foreignKey;

    private Double sortWeight;

    @Field
    private Boolean searchable = false;

    private Privilege editPrivilege;

    /**
     * default constructor
     */
    public PersonAttributeType() {
    }

    /**
     * constructor with id
     */
    public PersonAttributeType(Integer myPersonAttributeTypeId) {
        this.personAttributeTypeId = myPersonAttributeTypeId;
    }

    // Property accessors
    /**
     * @return Returns the format.
     */
    public String getFormat() {
        return format;
    }

    /**
     * @param format The format to set.
     */
    public void setFormat(String format) {
        this.format = format;
    }

    /**
     * @return the foreignKey
     */
    public Integer getForeignKey() {
        return foreignKey;
    }

    /**
     * @param foreignKey the foreignKey to set
     */
    public void setForeignKey(Integer foreignKey) {
        this.foreignKey = foreignKey;
    }

    /**
     * @return the sortWeight
     */
    public Double getSortWeight() {
        return sortWeight;
    }

    /**
     * @param sortWeight the formOrder to set
     */
    public void setSortWeight(Double sortWeight) {
        this.sortWeight = sortWeight;
    }

    /**
     * @return Returns the PersonAttributeTypeId.
     */
    public Integer getPersonAttributeTypeId() {
        return personAttributeTypeId;
    }

    /**
     * @param newPersonAttributeTypeId The PersonAttributeTypeId to set.
     */
    public void setPersonAttributeTypeId(Integer newPersonAttributeTypeId) {
        this.personAttributeTypeId = newPersonAttributeTypeId;
    }

    /**
     * @return the searchable status
     *
     * @deprecated as of 2.0, use {@link #getSearchable()}
     */
    @Deprecated
    @JsonIgnore
    public Boolean isSearchable() {
        return getSearchable();
    }

    /**
     * @return the searchable status
     */
    public Boolean getSearchable() {
        return searchable;
    }

    /**
     * @param searchable the searchable to set
     */
    public void setSearchable(Boolean searchable) {
        this.searchable = searchable;
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return getName();
    }

    /**
     * The privilege required in order to edit this attribute
     *
     * @return Returns the required privilege
     * @since 1.5
     */
    public Privilege getEditPrivilege() {
        return editPrivilege;
    }

    /**
     * The privilege required in order to edit this attribute If <code>editPrivilege</code> is null,
     * no extra permissions are required to edit this type
     *
     * @param editPrivilege
     * @since 1.5
     */
    public void setEditPrivilege(Privilege editPrivilege) {
        this.editPrivilege = editPrivilege;
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#getId()
     */
    @Override
    public Integer getId() {
        return getPersonAttributeTypeId();
    }

    /**
     * @since 1.5
     * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
     */
    @Override
    public void setId(Integer id) {
        setPersonAttributeTypeId(id);
    }

    /**
     * @deprecated since 1.12. Use DefaultComparator instead.
     * Note: this comparator imposes orderings that are inconsistent with equals.
     */
    @Override
    @SuppressWarnings("squid:S1210")
    public int compareTo(PersonAttributeType other) {
        DefaultComparator patDefaultComparator = new DefaultComparator();
        return patDefaultComparator.compare(this, other);
    }

    /**
     * 	 Provides a default comparator.
     * 	 @since 1.12
     */
    public static clreplaced DefaultComparator implements Comparator<PersonAttributeType>, Serializable {

        private static final long serialVersionUID = 1L;

        @Override
        public int compare(PersonAttributeType pat1, PersonAttributeType pat2) {
            return OpenmrsUtil.compareWithNullAsGreatest(pat1.getPersonAttributeTypeId(), pat2.getPersonAttributeTypeId());
        }
    }
}

19 View Complete Implementation : ScmChange.java
Copyright GNU Affero General Public License v3.0
Author : headsupdev
/**
 * TODO add a description
 *
 * @author Andrew Williams
 * @version $Id$
 * @since 1.0
 */
@Enreplacedy
@Table(name = "Changes")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "changeType", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue("file")
public clreplaced ScmChange implements Change, Serializable {

    public static final int TYPE_ADDED = 1;

    public static final int TYPE_CHANGED = 2;

    public static final int TYPE_REMOVED = 3;

    @Id
    @GeneratedValue
    private long id;

    @Field
    private String name, revision;

    private int type;

    @Type(type = "text")
    @Column(length = 2147483647)
    @Field(index = Index.TOKENIZED)
    private String diff;

    @ManyToOne(fetch = FetchType.LAZY, targetEnreplacedy = ScmChangeSet.clreplaced)
    private ChangeSet set;

    public ScmChange() {
    }

    public ScmChange(String name, int type, String diff, ChangeSet set) {
        this(name, null, type, diff, set);
    }

    public ScmChange(String name, String revision, int type, String diff, ChangeSet set) {
        this.name = name;
        this.revision = revision;
        this.type = type;
        this.diff = diff;
        this.set = set;
    }

    public long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getRevision() {
        return revision;
    }

    public int getType() {
        return type;
    }

    public String getDiff() {
        return diff;
    }

    public ChangeSet getSet() {
        return set;
    }

    public boolean equals(Object o) {
        return o instanceof ScmChange && equals((ScmChange) o);
    }

    public boolean equals(ScmChange change) {
        return change != null && id == change.getId();
    }

    public int hashCode() {
        return ((Long) id).hashCode();
    }
}

19 View Complete Implementation : ResourceIndexedSearchParamCoords.java
Copyright Apache License 2.0
Author : jamesagnew
@Embeddable
@Enreplacedy
@Table(name = "HFJ_SPIDX_COORDS", indexes = { @Index(name = "IDX_SP_COORDS_HASH", columnList = "HASH_IDENreplacedY,SP_LAreplacedUDE,SP_LONGITUDE"), @Index(name = "IDX_SP_COORDS_UPDATED", columnList = "SP_UPDATED"), @Index(name = "IDX_SP_COORDS_RESID", columnList = "RES_ID") })
public clreplaced ResourceIndexedSearchParamCoords extends BaseResourceIndexedSearchParam {

    public static final int MAX_LENGTH = 100;

    private static final long serialVersionUID = 1L;

    @Column(name = "SP_LAreplacedUDE")
    @Field
    public double myLareplacedude;

    @Column(name = "SP_LONGITUDE")
    @Field
    public double myLongitude;

    @Id
    @SequenceGenerator(name = "SEQ_SPIDX_COORDS", sequenceName = "SEQ_SPIDX_COORDS")
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SPIDX_COORDS")
    @Column(name = "SP_ID")
    private Long myId;

    /**
     * @since 3.5.0 - At some point this should be made not-null
     */
    @Column(name = "HASH_IDENreplacedY", nullable = true)
    private Long myHashIdenreplacedy;

    public ResourceIndexedSearchParamCoords() {
    }

    public ResourceIndexedSearchParamCoords(String theResourceType, String theParamName, double theLareplacedude, double theLongitude) {
        setResourceType(theResourceType);
        setParamName(theParamName);
        setLareplacedude(theLareplacedude);
        setLongitude(theLongitude);
    }

    @Override
    @PrePersist
    public void calculateHashes() {
        if (myHashIdenreplacedy == null) {
            String resourceType = getResourceType();
            String paramName = getParamName();
            setHashIdenreplacedy(calculateHashIdenreplacedy(resourceType, paramName));
        }
    }

    @Override
    protected void clearHashes() {
        myHashIdenreplacedy = null;
    }

    @Override
    public boolean equals(Object theObj) {
        if (this == theObj) {
            return true;
        }
        if (theObj == null) {
            return false;
        }
        if (!(theObj instanceof ResourceIndexedSearchParamCoords)) {
            return false;
        }
        ResourceIndexedSearchParamCoords obj = (ResourceIndexedSearchParamCoords) theObj;
        EqualsBuilder b = new EqualsBuilder();
        b.append(getResourceType(), obj.getResourceType());
        b.append(getParamName(), obj.getParamName());
        b.append(getLareplacedude(), obj.getLareplacedude());
        b.append(getLongitude(), obj.getLongitude());
        b.append(isMissing(), obj.isMissing());
        return b.isEquals();
    }

    public void setHashIdenreplacedy(Long theHashIdenreplacedy) {
        myHashIdenreplacedy = theHashIdenreplacedy;
    }

    @Override
    public Long getId() {
        return myId;
    }

    @Override
    public void setId(Long theId) {
        myId = theId;
    }

    public double getLareplacedude() {
        return myLareplacedude;
    }

    public ResourceIndexedSearchParamCoords setLareplacedude(double theLareplacedude) {
        myLareplacedude = theLareplacedude;
        return this;
    }

    public double getLongitude() {
        return myLongitude;
    }

    public ResourceIndexedSearchParamCoords setLongitude(double theLongitude) {
        myLongitude = theLongitude;
        return this;
    }

    @Override
    public int hashCode() {
        HashCodeBuilder b = new HashCodeBuilder();
        b.append(getParamName());
        b.append(getResourceType());
        b.append(getLareplacedude());
        b.append(getLongitude());
        return b.toHashCode();
    }

    @Override
    public IQueryParameterType toQueryParameterType() {
        return null;
    }

    @Override
    public String toString() {
        ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
        b.append("paramName", getParamName());
        b.append("resourceId", getResourcePid());
        b.append("lat", getLareplacedude());
        b.append("lon", getLongitude());
        return b.build();
    }
}

19 View Complete Implementation : Person.java
Copyright Apache License 2.0
Author : igloo-project
@Enreplacedy
@Indexed
@Inheritance(strategy = InheritanceType.JOINED)
public clreplaced Person extends GenericEnreplacedy<Long, Person> {

    private static final long serialVersionUID = -2471930493134125282L;

    @Id
    @DoreplacedentId
    @GeneratedValue
    private Long id;

    @Field
    private String firstName;

    @Field
    private String lastName;

    @ManyToOne
    private Company company;

    @ManyToMany
    @JoinTable(joinColumns = @JoinColumn(name = "persons_id"), inverseJoinColumns = @JoinColumn(name = "project_id"))
    private List<Project> workedProjects = new LinkedList<Project>();

    private Date creationDate;

    /**
     * cf {@link TestMetaModel}
     */
    private PersonSubTypeA otherPerson;

    /**
     * cf {@link TestMetaModel}
     */
    private StubEnumeration enumeration;

    /**
     * cf {@link TestMetaModel}
     */
    @Enumerated(EnumType.STRING)
    private StubEnumeration enumerationString;

    /**
     * cf {@link TestMetaModel}
     */
    @OneToMany
    private Map<StubEnumeration, PersonSubTypeA> enumMap;

    /**
     * cf {@link TestMetaModel}
     */
    @OneToMany
    @MapKeyEnumerated(EnumType.STRING)
    private Map<StubEnumeration, PersonSubTypeA> enumMapString;

    /**
     * cf {@link TestMetaModel}
     */
    @ElementCollection
    private List<StubEnumeration> enumList;

    /**
     * cf {@link TestMetaModel}
     */
    @ElementCollection
    @Enumerated(EnumType.STRING)
    private List<StubEnumeration> enumListString;

    /**
     * cf {@link TestMetaModel}
     */
    @ElementCollection
    private Map<Long, StubEnumeration> enumMapValue;

    /**
     * cf {@link TestMetaModel}
     */
    @ElementCollection
    @Enumerated(EnumType.STRING)
    private Map<Long, StubEnumeration> enumMapValueString;

    public Person() {
    }

    public Person(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public List<Project> getWorkedProjects() {
        return workedProjects;
    }

    public void setWorkedProjects(List<Project> workedProjects) {
        this.workedProjects = workedProjects;
    }

    public void addWorkedProjects(Project project) {
        this.workedProjects.add(project);
        project.getTeam().add(this);
    }

    public void removeWorkedProjects(Project project) {
        this.workedProjects.remove(project);
        project.getTeam().remove(this);
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public PersonSubTypeA getOtherPerson() {
        return otherPerson;
    }

    public void setOtherPerson(PersonSubTypeA otherPerson) {
        this.otherPerson = otherPerson;
    }

    public StubEnumeration getEnumeration() {
        return enumeration;
    }

    public void setEnumeration(StubEnumeration enumeration) {
        this.enumeration = enumeration;
    }

    public Map<StubEnumeration, PersonSubTypeA> getEnumMap() {
        return enumMap;
    }

    public void setEnumMap(Map<StubEnumeration, PersonSubTypeA> enumMap) {
        this.enumMap = enumMap;
    }

    @Override
    public String getNameForToString() {
        return getDisplayName();
    }

    @Override
    public String getDisplayName() {
        return getLastName() + " " + getFirstName();
    }
}

19 View Complete Implementation : ResourceIndexedSearchParamNumber.java
Copyright Apache License 2.0
Author : jamesagnew
@Embeddable
@Enreplacedy
@Table(name = "HFJ_SPIDX_NUMBER", indexes = { // We used to have an index with name IDX_SP_NUMBER - Dont reuse
@Index(name = "IDX_SP_NUMBER_HASH_VAL", columnList = "HASH_IDENreplacedY,SP_VALUE"), @Index(name = "IDX_SP_NUMBER_UPDATED", columnList = "SP_UPDATED"), @Index(name = "IDX_SP_NUMBER_RESID", columnList = "RES_ID") })
public clreplaced ResourceIndexedSearchParamNumber extends BaseResourceIndexedSearchParam {

    private static final long serialVersionUID = 1L;

    @Column(name = "SP_VALUE", nullable = true)
    @Field
    @NumericField
    @FieldBridge(impl = BigDecimalNumericFieldBridge.clreplaced)
    public BigDecimal myValue;

    @Id
    @SequenceGenerator(name = "SEQ_SPIDX_NUMBER", sequenceName = "SEQ_SPIDX_NUMBER")
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SPIDX_NUMBER")
    @Column(name = "SP_ID")
    private Long myId;

    /**
     * @since 3.5.0 - At some point this should be made not-null
     */
    @Column(name = "HASH_IDENreplacedY", nullable = true)
    private Long myHashIdenreplacedy;

    public ResourceIndexedSearchParamNumber() {
    }

    public ResourceIndexedSearchParamNumber(String theResourceType, String theParamName, BigDecimal theValue) {
        setResourceType(theResourceType);
        setParamName(theParamName);
        setValue(theValue);
    }

    @Override
    @PrePersist
    public void calculateHashes() {
        if (myHashIdenreplacedy == null) {
            String resourceType = getResourceType();
            String paramName = getParamName();
            setHashIdenreplacedy(calculateHashIdenreplacedy(resourceType, paramName));
        }
    }

    @Override
    protected void clearHashes() {
        myHashIdenreplacedy = null;
    }

    @Override
    public boolean equals(Object theObj) {
        if (this == theObj) {
            return true;
        }
        if (theObj == null) {
            return false;
        }
        if (!(theObj instanceof ResourceIndexedSearchParamNumber)) {
            return false;
        }
        ResourceIndexedSearchParamNumber obj = (ResourceIndexedSearchParamNumber) theObj;
        EqualsBuilder b = new EqualsBuilder();
        b.append(getResourceType(), obj.getResourceType());
        b.append(getParamName(), obj.getParamName());
        b.append(getValue(), obj.getValue());
        b.append(isMissing(), obj.isMissing());
        return b.isEquals();
    }

    public Long getHashIdenreplacedy() {
        calculateHashes();
        return myHashIdenreplacedy;
    }

    public void setHashIdenreplacedy(Long theHashIdenreplacedy) {
        myHashIdenreplacedy = theHashIdenreplacedy;
    }

    @Override
    public Long getId() {
        return myId;
    }

    @Override
    public void setId(Long theId) {
        myId = theId;
    }

    public BigDecimal getValue() {
        return myValue;
    }

    public void setValue(BigDecimal theValue) {
        myValue = theValue;
    }

    @Override
    public int hashCode() {
        HashCodeBuilder b = new HashCodeBuilder();
        b.append(getResourceType());
        b.append(getParamName());
        b.append(getValue());
        b.append(isMissing());
        return b.toHashCode();
    }

    @Override
    public IQueryParameterType toQueryParameterType() {
        return new NumberParam(myValue.toPlainString());
    }

    @Override
    public String toString() {
        ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
        b.append("paramName", getParamName());
        // TODO: add a field so we don't need to resolve this
        b.append("resourceId", getResource().getId());
        b.append("value", getValue());
        return b.build();
    }

    @Override
    public boolean matches(IQueryParameterType theParam) {
        if (!(theParam instanceof NumberParam)) {
            return false;
        }
        NumberParam number = (NumberParam) theParam;
        return Objects.equals(getValue(), number.getValue());
    }
}

19 View Complete Implementation : PostPO.java
Copyright Apache License 2.0
Author : Anstoner
/**
 * @author langhsu
 */
@Enreplacedy
@Table(name = "mto_posts")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Indexed(index = "posts")
public clreplaced PostPO implements Serializable {

    private static final long serialVersionUID = 7144425803920583495L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENreplacedY)
    @DoreplacedentId
    private long id;

    @Field
    @NumericField
    @Column(name = "group_", length = 5)
    private int group;

    @Field
    @Column(name = "replacedle", length = 64)
    private String // 标题
    replacedle;

    @Field
    private String // 摘要
    summary;

    @Field
    private String // 标签
    tags;

    @Field
    @NumericField
    @Column(name = "author_id")
    private long // 作者
    authorId;

    // 编辑器
    private String editor;

    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Type(type = "text")
    private String // 内容
    content;

    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Type(type = "text")
    private String // markdown 内容
    markdown;

    @Column(name = "last_image_id")
    private long lastImageId;

    @Temporal(value = TemporalType.TIMESTAMP)
    private Date created;

    /**
     * @see EnumPrivacy
     */
    @Field
    @NumericField
    private int // 私密
    privacy;

    // 图片统计
    private int images;

    // 推荐状态
    private int featured;

    // 喜欢数
    private int favors;

    // 评论数
    private int comments;

    // 阅读数
    private int views;

    // 文章状态
    private int status;

    @OneToOne(cascade = CascadeType.ALL)
    @PrimaryKeyJoinColumn
    private PostAttribute attribute;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getGroup() {
        return group;
    }

    public void setGroup(int group) {
        this.group = group;
    }

    public String getreplacedle() {
        return replacedle;
    }

    public void setreplacedle(String replacedle) {
        this.replacedle = replacedle;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public long getLastImageId() {
        return lastImageId;
    }

    public void setLastImageId(long lastImageId) {
        this.lastImageId = lastImageId;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public long getAuthorId() {
        return authorId;
    }

    public void setAuthorId(long authorId) {
        this.authorId = authorId;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getFeatured() {
        return featured;
    }

    public void setFeatured(int featured) {
        this.featured = featured;
    }

    public int getFavors() {
        return favors;
    }

    public void setFavors(int favors) {
        this.favors = favors;
    }

    public int getComments() {
        return comments;
    }

    public void setComments(int comments) {
        this.comments = comments;
    }

    public int getViews() {
        return views;
    }

    public void setViews(int views) {
        this.views = views;
    }

    public String getMarkdown() {
        return markdown;
    }

    public void setMarkdown(String markdown) {
        this.markdown = markdown;
    }

    public String getEditor() {
        return editor;
    }

    public void setEditor(String editor) {
        this.editor = editor;
    }

    public int getImages() {
        return images;
    }

    public void setImages(int images) {
        this.images = images;
    }

    public int getPrivacy() {
        return privacy;
    }

    public void setPrivacy(int privacy) {
        this.privacy = privacy;
    }

    public PostAttribute getAttribute() {
        return attribute;
    }

    public void setAttribute(PostAttribute attribute) {
        this.attribute = attribute;
    }
}

19 View Complete Implementation : Author.java
Copyright Apache License 2.0
Author : realtimeinsights
public clreplaced Author {

    @Field
    String name;

    @Field
    String surname;

    public int hashCode() {
        return name.hashCode() + surname.hashCode();
    }

    public boolean equals(Object obj) {
        boolean result = false;
        if (obj instanceof Author) {
            Author a = (Author) obj;
            return a.name == name && a.surname == surname;
        }
        return result;
    }
}

19 View Complete Implementation : MultipleEntitiesTest.java
Copyright Apache License 2.0
Author : infinispan
@Indexed(index = "instruments")
clreplaced Bond {

    @Field
    Date maturity;

    @Field
    Long price;

    public Bond(Date maturity, Long price) {
        this.maturity = maturity;
        this.price = price;
    }
}

19 View Complete Implementation : TransactionalScmChangeSet.java
Copyright GNU Affero General Public License v3.0
Author : headsupdev
/**
 * TODO add a description
 *
 * @author Andrew Williams
 * @version $Id$
 * @since 1.0
 */
@Enreplacedy
@DiscriminatorValue("scm-transaction")
@Indexed(index = "ChangeSets")
public clreplaced TransactionalScmChangeSet extends ScmChangeSet {

    @Column
    @Field
    private String revision;

    public TransactionalScmChangeSet() {
    }

    public TransactionalScmChangeSet(String revision, String author, String comment, Date date, Project project) {
        super(author, comment, date, project);
        this.revision = revision;
        this.id = new NameProjectId(revision, project);
    }

    public String getRevision() {
        return revision;
    }

    public String toString() {
        return "ScmChangeSet " + revision + " by " + getAuthor() + " \"" + getComment() + "\"";
    }

    public boolean equals(Object o) {
        return o instanceof TransactionalScmChangeSet && equals((TransactionalScmChangeSet) o);
    }

    public boolean equals(TransactionalScmChangeSet set) {
        return set != null && getRevision().equals(set.getRevision());
    }

    public int hashCode() {
        return getRevision().hashCode();
    }
}

19 View Complete Implementation : Book.java
Copyright GNU General Public License v3.0
Author : adrianmilne
/**
 * Book JPA Enreplacedy.
 */
@Enreplacedy
@Indexed
public clreplaced Book {

    @Id
    @GeneratedValue
    private Long id;

    @Field
    @Boost(value = 1.5f)
    private String replacedle;

    @Field
    @Lob
    private String description;

    @Field
    @Enumerated(EnumType.STRING)
    private BookCategory category;

    public Book() {
    }

    public Book(String replacedle, BookCategory category, String description) {
        this.replacedle = replacedle;
        this.category = category;
        this.description = description;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getreplacedle() {
        return replacedle;
    }

    public void setreplacedle(String replacedle) {
        this.replacedle = replacedle;
    }

    public BookCategory getCategory() {
        return category;
    }

    public void setCategory(BookCategory category) {
        this.category = category;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        return "Book [id=" + id + ", replacedle=" + replacedle + ", description=" + description + ", category=" + category + "]";
    }
}

19 View Complete Implementation : DaoFollow.java
Copyright GNU Affero General Public License v3.0
Author : BloatIt
@Enreplacedy
// @formatter:off
@NamedQueries(value = { @NamedQuery(name = "follow.find", query = "FROM DaoFollow " + "WHERE actor = :follower " + "AND followed = :content "), @NamedQuery(name = "follow.getByFeature", query = "FROM DaoFollow " + "WHERE followed = :feature "), @NamedQuery(name = "follow.getByFeature.size", query = "SELECT COUNT(*) " + "FROM DaoFollow " + "WHERE followed = :feature ") })
public clreplaced DaoFollow extends DaoIdentifiable {

    public enum FollowState {

        /**
         * Used when a content is being actively followed
         */
        ACTIVE,
        /**
         * Used when a user manually cancels the following of a content
         */
        CANCELED,
        /**
         * Used when a content is no longer being followed because the content
         * expired
         */
        EXPIRED,
        /**
         * Used when a content is deleted
         */
        DELETE
    }

    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    @Cascade(value = { CascadeType.PERSIST })
    private DaoActor actor;

    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    @Cascade(value = { CascadeType.PERSIST })
    private DaoFeature followed;

    @Basic(optional = false)
    @Column(updatable = false)
    private Date creationDate;

    // NOTE : This is not used (or updated) yet
    @Basic(optional = false)
    @Column(updatable = false)
    private Date lastConsultationDate;

    @Basic(optional = false)
    @Field
    @Enumerated
    private FollowState followState;

    // ======================================================================
    // Construction
    // ======================================================================
    /**
     * Creates a new Money Withdrawal, with a default state of ACTIVE, or
     * reactivate an already existing follow
     */
    public static DaoFollow createAndPersist(final DaoActor actor, final DaoFeature followed) {
        final DaoFollow alreadyFollowed = getFollow(followed, actor);
        if (alreadyFollowed != null) {
            // Already exists
            switch(alreadyFollowed.getFollowState()) {
                case CANCELED:
                case DELETE:
                case EXPIRED:
                    alreadyFollowed.setState(FollowState.ACTIVE);
                    break;
            }
            return alreadyFollowed;
        } else {
            final DaoFollow follow = new DaoFollow(actor, followed);
            try {
                SessionManager.getSessionFactory().getCurrentSession().save(follow);
            } catch (final HibernateException e) {
                SessionManager.getSessionFactory().getCurrentSession().getTransaction().rollback();
                throw e;
            }
            return follow;
        }
    }

    private DaoFollow(final DaoActor actor, final DaoFeature followed) {
        this.actor = actor;
        this.followed = followed;
        this.creationDate = new Date();
        this.lastConsultationDate = new Date();
        this.followState = FollowState.ACTIVE;
    }

    public void delete() {
        SessionManager.getSessionFactory().getCurrentSession().delete(this);
    }

    // ======================================================================
    // Getters
    // ======================================================================
    /**
     * The actor following a content
     */
    public DaoActor getActor() {
        return actor;
    }

    /**
     * @return The content being followed
     */
    public DaoFeature getFollowed() {
        return followed;
    }

    /**
     * @return the date where the user started to follow the content
     */
    public Date getCreationDate() {
        return creationDate;
    }

    /**
     * @return the last date the user checked the followed content
     */
    public Date getLastConsultationDate() {
        return lastConsultationDate;
    }

    /**
     * @return the state of the content ()
     */
    public FollowState getFollowState() {
        return followState;
    }

    // ======================================================================
    // Setters
    // ======================================================================
    private void setState(final FollowState newState) {
        this.followState = newState;
    }

    // ======================================================================
    // Static accessors
    // ======================================================================
    /**
     * @return the state of the follow matching both <code>content</code> and
     *         <code>follower</code> or null if none matches
     */
    public static DaoFollow getFollow(final DaoFeature content, final DaoActor follower) {
        return (DaoFollow) SessionManager.getNamedQuery("follow.find").setEnreplacedy("follower", follower).setEnreplacedy("content", content).uniqueResult();
    }

    /**
     * @param feature the feature for which you want to find follows
     * @return all the follow for the matching <code>feature</code>
     */
    public static PageIterable<DaoFollow> getFollow(final DaoFeature feature) {
        return new QueryCollection<DaoFollow>("follow.getByFeature").setEnreplacedy("feature", feature);
    }

    // ======================================================================
    // Visitor
    // ======================================================================
    @Override
    public <ReturnType> ReturnType accept(final DataClreplacedVisitor<ReturnType> visitor) {
        return visitor.visit(this);
    }

    // ======================================================================
    // For hibernate mapping
    // ======================================================================
    /**
     * Instantiates a new dao join team invitation.
     */
    protected DaoFollow() {
        super();
    }

    // ======================================================================
    // equals and hashcode
    // ======================================================================
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((actor == null) ? 0 : actor.hashCode());
        result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode());
        result = prime * result + ((followState == null) ? 0 : followState.hashCode());
        result = prime * result + ((followed == null) ? 0 : followed.hashCode());
        result = prime * result + ((lastConsultationDate == null) ? 0 : lastConsultationDate.hashCode());
        return result;
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClreplaced() != obj.getClreplaced()) {
            return false;
        }
        final DaoFollow other = (DaoFollow) obj;
        if (actor == null) {
            if (other.actor != null) {
                return false;
            }
        } else if (!actor.equals(other.actor)) {
            return false;
        }
        if (creationDate == null) {
            if (other.creationDate != null) {
                return false;
            }
        } else if (!creationDate.equals(other.creationDate)) {
            return false;
        }
        if (followState != other.followState) {
            return false;
        }
        if (followed == null) {
            if (other.followed != null) {
                return false;
            }
        } else if (!followed.equals(other.followed)) {
            return false;
        }
        if (lastConsultationDate == null) {
            if (other.lastConsultationDate != null) {
                return false;
            }
        } else if (!lastConsultationDate.equals(other.lastConsultationDate)) {
            return false;
        }
        return true;
    }
}

19 View Complete Implementation : Attachment.java
Copyright GNU Affero General Public License v3.0
Author : headsupdev
/**
 * Simple clreplaced used for attachments on issues and doreplacedents.
 *
 * @author Andrew Williams
 * @version $Id$
 * @since 1.0
 */
@Enreplacedy
@Table(name = "Attachments")
public clreplaced Attachment implements Serializable {

    @Id
    @GeneratedValue
    private long id;

    @OneToOne(targetEnreplacedy = StoredUser.clreplaced)
    @IndexedEmbedded(targetElement = StoredUser.clreplaced)
    private User user;

    @Temporal(TemporalType.TIMESTAMP)
    private Date created;

    @Field
    private String filename;

    @OneToOne
    @IndexedEmbedded
    private Comment comment;

    public long getId() {
        return id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Comment getComment() {
        return comment;
    }

    public void setComment(Comment comment) {
        if (comment != null && comment.getComment() != null) {
            this.comment = comment;
        }
    }

    public boolean equals(Object o) {
        return o instanceof Attachment && equals((Attachment) o);
    }

    public boolean equals(Attachment a) {
        return a.getId() == id;
    }

    public int hashCode() {
        return ((Long) id).hashCode();
    }

    public File getFile(Storage storage) {
        File attachDir = new File(storage.getDataDirectory(), "attachments");
        File fileDir = new File(attachDir, String.valueOf(id));
        return new File(fileDir, filename);
    }
}

19 View Complete Implementation : VideoGame.java
Copyright Apache License 2.0
Author : hibernate
@Enreplacedy
@Indexed(index = "videogame")
public clreplaced VideoGame {

    @Id
    @GeneratedValue
    public long id;

    @Field()
    public String replacedle;

    @Field
    public String description;

    @Field
    public int rating;

    @Field(name = "release")
    public Date publishingDate;

    @IndexedEmbedded
    public Publisher publisher;

    @ElementCollection
    @Field
    @IndexedEmbedded
    public List<String> tags = new ArrayList<>();

    @ManyToMany
    @IndexedEmbedded
    public List<Character> characters = new ArrayList<>();

    VideoGame() {
    }

    private VideoGame(String replacedle, String description, int rating, Date publishingDate, Publisher publisher, List<Character> characters, List<String> tags) {
        this.replacedle = replacedle;
        this.description = description;
        this.rating = rating;
        this.publishingDate = publishingDate;
        this.publisher = publisher;
        this.characters.addAll(characters);
        this.tags.addAll(tags);
    }

    public String getreplacedle() {
        return replacedle;
    }

    @Override
    public String toString() {
        return "VideoGame [id=" + id + ", replacedle=" + replacedle + ", description=" + description + "]";
    }

    public static clreplaced Builder {

        private String replacedle;

        private String description;

        private int rating;

        private Date publishingDate;

        private Publisher publisher;

        private final List<String> tags = new ArrayList<>();

        private final List<Character> characters = new ArrayList<>();

        public Builder withreplacedle(String replacedle) {
            this.replacedle = replacedle;
            return this;
        }

        public Builder withDescription(String description) {
            this.description = description;
            return this;
        }

        public Builder withRating(int rating) {
            this.rating = rating;
            return this;
        }

        public Builder withPublishingDate(Date publishingDate) {
            this.publishingDate = publishingDate;
            return this;
        }

        public Builder withPublisher(Publisher publisher) {
            this.publisher = publisher;
            return this;
        }

        public Builder withTags(String... tags) {
            this.tags.addAll(Arrays.asList(tags));
            return this;
        }

        public Builder withCharacters(Character... characters) {
            this.characters.addAll(Arrays.asList(characters));
            return this;
        }

        public VideoGame build() {
            VideoGame game = new VideoGame(replacedle, description, rating, publishingDate, publisher, characters, tags);
            for (Character character : game.characters) {
                character.appearsIn.add(game);
            }
            return game;
        }
    }
}

19 View Complete Implementation : Country.java
Copyright Apache License 2.0
Author : infinispan
/**
 * @author Sanne Grinovero <[email protected]> (C) 2011 Red Hat Inc.
 */
@Indexed
public clreplaced Country implements Serializable {

    @ProtoField(number = 1)
    public Long id;

    @ProtoField(number = 2)
    @Field
    public String countryName;

    @ProtoField(number = 3, collectionImplementation = HashSet.clreplaced)
    @IndexedEmbedded
    public Set<City> cities = new HashSet<>();
}