From: Roland Häder Date: Mon, 8 Aug 2016 14:00:36 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0defdbfcb008257ccaabb9e23fae30ae12bfbdc2;p=jphone-core.git Continued a bit: - added named queries for all cellphone, land-line and fax numbers separately - added annotation for ignoring not fixable warnings - sorted members --- diff --git a/src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java b/src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java index 8868c24..d2e835f 100644 --- a/src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java +++ b/src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java @@ -45,7 +45,10 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; @Entity (name = "cellphone_numbers") @Table (name = "cellphone_numbers") @NamedQueries ( - @NamedQuery (name = "SearchCellphoneId", query = "SELECT c FROM cellphone_numbers AS c WHERE c.phoneId = :cellphoneId") + { + @NamedQuery (name = "AllCellphoneNumbers", query = "SELECT c FROM cellphone_numbers AS c ORDER BY c.phoneId ASC"), + @NamedQuery (name = "SearchCellphoneId", query = "SELECT c FROM cellphone_numbers AS c WHERE c.phoneId = :cellphoneId") + } ) @SuppressWarnings ("PersistenceUnitPresent") public class CellphoneNumber implements DialableCellphoneNumber { @@ -103,7 +106,7 @@ public class CellphoneNumber implements DialableCellphoneNumber { * Constructor with cellphone provider and number *

* @param cellphoneProvider Cellphone provider instance - * @param cellphoneNumber Cellphone number + * @param cellphoneNumber Cellphone number */ public CellphoneNumber (final MobileProvider cellphoneProvider, final Long cellphoneNumber) { // Call default constructor @@ -142,14 +145,6 @@ public class CellphoneNumber implements DialableCellphoneNumber { return true; } - @Override - public int hashCode () { - int hash = 5; - hash = 97 * hash + Objects.hashCode(this.getCellphoneProvider()); - hash = 97 * hash + Objects.hashCode(this.getPhoneNumber()); - return hash; - } - @Override public MobileProvider getCellphoneProvider () { return this.cellphoneProvider; @@ -228,4 +223,14 @@ public class CellphoneNumber implements DialableCellphoneNumber { this.phoneNumber = phoneNumber; } + @Override + public int hashCode () { + int hash = 5; + + hash = 97 * hash + Objects.hashCode(this.getCellphoneProvider()); + hash = 97 * hash + Objects.hashCode(this.getPhoneNumber()); + + return hash; + } + } diff --git a/src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java b/src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java index eb63977..92dd5d9 100644 --- a/src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java +++ b/src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java @@ -44,7 +44,10 @@ import org.mxchange.jcountry.data.CountryData; @Entity (name = "fax_numbers") @Table (name = "fax_numbers") @NamedQueries ( - @NamedQuery (name = "SearchFaxId", query = "SELECT f FROM fax_numbers AS f WHERE f.phoneId = :faxId") + { + @NamedQuery (name = "AllFaxNumbers", query = "SELECT f FROM fax_numbers AS f ORDER BY f.phoneId ASC"), + @NamedQuery (name = "SearchFaxId", query = "SELECT f FROM fax_numbers AS f WHERE f.phoneId = :faxId") + } ) @SuppressWarnings ("PersistenceUnitPresent") public class FaxNumber implements DialableFaxNumber { @@ -108,9 +111,9 @@ public class FaxNumber implements DialableFaxNumber { /** * Constructor with country, area code and number *

- * @param faxCountry Country instance - * @param faxAreaCode Area code (without leading zeros) - * @param faxNumber Fax number (without area code and leading zero) + * @param faxCountry Country instance + * @param faxAreaCode Area code (without leading zeros) + * @param faxNumber Fax number (without area code and leading zero) */ public FaxNumber (final Country faxCountry, final Integer faxAreaCode, final Long faxNumber) { // Call default constructor diff --git a/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java b/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java index 6d6dfde..c567c4c 100644 --- a/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java +++ b/src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java @@ -44,7 +44,10 @@ import org.mxchange.jcountry.data.CountryData; @Entity (name = "phone_numbers") @Table (name = "phone_numbers") @NamedQueries ( - @NamedQuery (name = "SearchLandLineId", query = "SELECT p FROM phone_numbers AS p WHERE p.phoneId = :phoneId") + { + @NamedQuery (name = "AllLandLineNumbers", query = "SELECT p FROM phone_numbers AS p ORDER BY p.phoneId ASC"), + @NamedQuery (name = "SearchLandLineId", query = "SELECT p FROM phone_numbers AS p WHERE p.phoneId = :phoneId") + } ) @SuppressWarnings ("PersistenceUnitPresent") public class LandLineNumber implements DialableLandLineNumber { @@ -108,9 +111,9 @@ public class LandLineNumber implements DialableLandLineNumber { /** * Constructor with country instance, area code and number *

- * @param phoneCountry Country instance - * @param phoneAreaCode Phone area code - * @param phoneNumber Phone number + * @param phoneCountry Country instance + * @param phoneAreaCode Phone area code + * @param phoneNumber Phone number */ public LandLineNumber (final Country phoneCountry, final Integer phoneAreaCode, final Long phoneNumber) { // Call default constructor @@ -153,15 +156,6 @@ public class LandLineNumber implements DialableLandLineNumber { return true; } - @Override - public int hashCode () { - int hash = 7; - hash = 47 * hash + Objects.hashCode(this.getPhoneNumber()); - hash = 47 * hash + Objects.hashCode(this.getPhoneAreaCode()); - hash = 47 * hash + Objects.hashCode(this.getPhoneCountry()); - return hash; - } - @Override public Integer getPhoneAreaCode () { return this.phoneAreaCode; @@ -189,6 +183,7 @@ public class LandLineNumber implements DialableLandLineNumber { } @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") public void setPhoneEntryCreated (final Calendar phoneEntryCreated) { this.phoneEntryCreated = phoneEntryCreated; } @@ -200,6 +195,7 @@ public class LandLineNumber implements DialableLandLineNumber { } @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) { this.phoneEntryUpdated = phoneEntryUpdated; } @@ -224,4 +220,15 @@ public class LandLineNumber implements DialableLandLineNumber { this.phoneNumber = phoneNumber; } + @Override + public int hashCode () { + int hash = 7; + + hash = 47 * hash + Objects.hashCode(this.getPhoneNumber()); + hash = 47 * hash + Objects.hashCode(this.getPhoneAreaCode()); + hash = 47 * hash + Objects.hashCode(this.getPhoneCountry()); + + return hash; + } + }