Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

/*
* BillingCode.java
* Copyright (c) 2017 Veterans Affairs.
*/
package gov.va.oneconsult.seoc.api.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* Description: BillingCode model object for the table BillingCode.
*
* @author AbleVets
*/
@Entity
@Table(name = "billingcode")
@JsonIgnoreProperties(value = { "services" })
@JsonPropertyOrder({ "id", "billingcode", "codetype", "description", "precertRequired" })
public final class BillingCode
{

/**
* Id field of Billing Code value. Auto generated value. Guaranteed to be not
* null.
*/
@Id
@Column(name = "id")
@NotNull
@GeneratedValue(strategy = GenerationType.AUTO)
@JsonProperty("id")
private int id;

/**
* Billing code data. Guaranteed to be not null. Size not exceeding 25 chars in
* length.
*/
@Column(name = "billingcode")
@Size(max = 25, message = "BillingCode should not exceed 25 characters")
@JsonProperty("billingCode")
@NotNull
@NotEmpty
private String billingCode;

/**
* Type of Billing Code. Ex:CPT. Guaranteed to be not null.
*/
@Column(name = "codetype")
@Size(max = 25, message = "CodeType should not exceed 25 characters")
@JsonProperty("codeType")
@NotNull
private String codeType;

/**
* Description of the Billing Code.
*/
@Column(name = "description")
@Size(max = 2000, message = "description should not exceed 2000 characters")
@JsonProperty("description")
@NotNull
private String description;

/**
* Value if preCertification is required for the Billing code. Default value is
* false.
*/
@Column(name = "precertrqd")
@JsonProperty("precertRequired")
private Boolean precertRequired;

/**
* Value if deactivated is indicates if the Billing code is deleted. Default value is
* false.
*/
@Column(name = "deactivated")
@JsonProperty("deactivated")
private Boolean deactivated;

/**
* {@link PayableService} values associated with this BillingCode.
*/
@JsonProperty("services")
@JsonIgnore
@ManyToMany(mappedBy = "billingCodes", cascade = { CascadeType.PERSIST, CascadeType.DETACH })
private Set<PayableService> services;

/**
* Default Constructor
*/
public BillingCode()
{
}
/**
* @param billingCode
* @param codeType
* @param description
* @param precertRequired
*/
private BillingCode(String billingCode, String codeType, String description, Boolean precertRequired)
{
this.billingCode = billingCode;
this.codeType = codeType;
this.description = description;
this.precertRequired = precertRequired;
}

/**
* Description: Method to create a cloned object of the current object
* @return BillingCode
*/
public BillingCode deepClone()
{
BillingCode thatBillingCode = new BillingCode(this.getBillingCode(), this.getCodeType(), this.getDescription(), this.getPrecertRequired()) ;
Set<PayableService> thatServices = new HashSet<PayableService>();
Set<PayableService> thisServices = this.getServices();
if(thisServices!=null && !thisServices.isEmpty())
{
thisServices.forEach(serv -> {
thatServices.add(serv);
});
}
thatBillingCode.setServices(thatServices);
return thatBillingCode;
}

/**
* @return id
*/
public int getId()
{
return id;
}

/**
* @param id
*/
public void setId(int id)
{
this.id = id;
}

/**
* @return billingCode
*/
public String getBillingCode()
{
return billingCode;
}

/**
* @param billingCode
*/
public void setBillingCode(String billingCode)
{
this.billingCode = billingCode;
}

/**
* @return codeType
*/
public String getCodeType()
{
return codeType;
}

/**
* @param codeType
*/
public void setCodeType(String codeType)
{
this.codeType = codeType;
}

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

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

/**
* @return precertRequired
*/
public Boolean getPrecertRequired()
{
return precertRequired;
}

/**
* @param precertRequired
*/
public void setPrecertRequired(Boolean precertRequired)
{
this.precertRequired = precertRequired;
}

/**
* Description:
* @return
*/
public Boolean getDeactivated()
{
return deactivated;
}

/**
* Description:
* @param deactivated
*/
public void setDeactivated(Boolean deactivated)
{
this.deactivated = deactivated;
}

/**
* @return services
*/
public Set<PayableService> getServices()
{
return services;
}

/**
* @param services
*/
public void setServices(Set<PayableService> services)
{
this.services = services;
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((billingCode == null) ? 0 : billingCode.hashCode());
result = prime * result + ((codeType == null) ? 0 : codeType.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + id;
result = prime * result + ((precertRequired == null) ? 0 : precertRequired.hashCode());
result = prime * result + ((deactivated == null) ? 0 : deactivated.hashCode());
return result;
}

/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}

BillingCode other = (BillingCode) obj;

if (billingCode == null) {
if (other.billingCode != null) {
return false;
}
} else if (!billingCode.equals(other.billingCode)) {
return false;
}
if (codeType == null) {
if (other.codeType != null) {
return false;
}
} else if (!codeType.equals(other.codeType)) {
return false;
}
if (description == null) {
if (other.description != null) {
return false;
}
} else if (!description.equals(other.description)) {
return false;
}
if (id != other.id) {
return false;
}
if (precertRequired == null) {
if (other.precertRequired != null) {
return false;
}
} else if (!precertRequired.equals(other.precertRequired)) {
return false;
}
if (deactivated == null) {
if (other.deactivated != null) {
return false;
}
} else if (!deactivated.equals(other.deactivated)) {
return false;
}
return true;
}

/**
* {@inheritDoc}
*/
@Override
public String toString()
{
return "BillingCode [id=" + id + ", billingCode=" + billingCode + ", codeType=" + codeType
+ ", description=" + description + ", precertRequired=" + precertRequired + ", deactivated=" + deactivated + "]";
}

}