/**
* Company name
*/
- @Basic (optional = false)
- @Column (name = "company_name", length = 100, nullable = false, unique = true)
+ @Column (name = "company_name", unique = true)
private String companyName;
+ /**
+ * Short company name
+ */
+ @Basic (optional = false)
+ @Column (name = "company_short_name", length = 100, nullable = false, unique = true)
+ private String companyShortName;
+
/**
* Tax number
*/
}
/**
- * Constructor with company name
+ * Constructor with company short name
* <p>
- * @param companyName Company name
+ * @param companyShortName Company short name
*/
- public BusinessBasicData (final String companyName) {
+ public BusinessBasicData (final String companyShortName) {
// First, validate all parameter
- if (companyName == null) {
+ if (companyShortName == null) {
// Is null
- throw new NullPointerException("companyName is null"); //NOI18N
- } else if (companyName.isEmpty()) {
+ throw new NullPointerException("companyShortName is null"); //NOI18N
+ } else if (companyShortName.isEmpty()) {
// Is null
- throw new IllegalArgumentException("companyName is empty"); //NOI18N
+ throw new IllegalArgumentException("companyShortName is empty"); //NOI18N
}
- // Set company name
- this.companyName = companyName;
+ // Set company short name
+ this.companyShortName = companyShortName;
}
@Override
// Init comparators
final int comparators[] = {
- // First compare company name
- this.getCompanyName().compareToIgnoreCase(basicData.getCompanyName()),
+ // First compare company short name
+ this.getCompanyShortName().compareToIgnoreCase(basicData.getCompanyShortName()),
+ // ... 2nd compare company name
+ StringUtils.compareIgnoreCase(this.getCompanyName(), basicData.getCompanyName()),
// ... next tax number
StringUtils.compareIgnoreCase(this.getCompanyTaxNumber(), basicData.getCompanyTaxNumber()),
// ... and email address
if (!Objects.equals(this.getBasicDataId(), other.getBasicDataId())) {
return false;
+ } else if (!Objects.equals(this.getCompanyShortName(), other.getCompanyShortName())) {
+ return false;
} else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) {
return false;
}
this.companyName = companyName;
}
+ @Override
+ public String getCompanyShortName () {
+ return this.companyShortName;
+ }
+
+ @Override
+ public void setCompanyShortName (final String companyShortName) {
+ this.companyShortName = companyShortName;
+ }
+
@Override
public String getCompanyTaxNumber () {
return this.companyTaxNumber;
int hash = 3;
hash = 37 * hash + Objects.hashCode(this.getBasicDataId());
+ hash = 37 * hash + Objects.hashCode(this.getCompanyShortName());
hash = 37 * hash + Objects.hashCode(this.getCompanyName());
return hash;