From da3c9a9c57a676c9f24c16eb9a2983cef7a3be7e Mon Sep 17 00:00:00 2001 From: Bojnourdi Date: Mon, 24 Aug 2015 16:57:37 +0200 Subject: [PATCH] Fixe GDEFile Changed AttributeGroupId and DataProfileId to objets. Objets can be null, this is important for the database when there is no relations. --- .../java/com/edf/gde/entities/GDEFile.java | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/projects/GDE_App/GDE-ejb/src/java/com/edf/gde/entities/GDEFile.java b/projects/GDE_App/GDE-ejb/src/java/com/edf/gde/entities/GDEFile.java index c7851b7..824c50e 100644 --- a/projects/GDE_App/GDE-ejb/src/java/com/edf/gde/entities/GDEFile.java +++ b/projects/GDE_App/GDE-ejb/src/java/com/edf/gde/entities/GDEFile.java @@ -69,9 +69,9 @@ public class GDEFile implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date deletionDate; @Column(name = "attribute_group_id") - private long attributeGroupId; + private Long attributeGroupId; @Column(name = "data_profile_id") - private long dataProfileId; + private Long dataProfileId; // No member for chunks: data are accessed with SQL requests public GDEFile() { @@ -153,19 +153,19 @@ public class GDEFile implements Serializable { this.deletionDate = deletionDate; } - public long getAttributeGroupId() { + public Long getAttributeGroupId() { return attributeGroupId; } - public void setAttributeGroupId(long attributeGroupId) { + public void setAttributeGroupId(Long attributeGroupId) { this.attributeGroupId = attributeGroupId; } - public long getDataProfileId() { + public Long getDataProfileId() { return dataProfileId; } - public void setDataProfileId(long dataProfileId) { + public void setDataProfileId(Long dataProfileId) { this.dataProfileId = dataProfileId; } @@ -175,13 +175,13 @@ public class GDEFile implements Serializable { f.creationDate = fto.getCreationDate(); f.deleted = fto.getDeleted(); f.deletionDate = fto.getDeletionDate(); - f.attributeGroupId = fto.getAttributeGroupId(); + f.attributeGroupId = fto.getAttributeGroupId()==0?null:fto.getAttributeGroupId(); f.id = fto.getId(); f.length = fto.getLength(); f.name = fto.getName(); f.updateDate = fto.getUpdateDate(); f.valid = fto.getValid(); - f.dataProfileId = fto.getDataProfileId(); + f.dataProfileId = fto.getDataProfileId()==0?null:fto.getDataProfileId(); return f; } @@ -191,13 +191,13 @@ public class GDEFile implements Serializable { fto.setCreationDate(this.creationDate); fto.setDeleted(this.deleted); fto.setDeletionDate(this.deletionDate); - fto.setAttributeGroupId(this.attributeGroupId); + fto.setAttributeGroupId(this.attributeGroupId==null?0:this.attributeGroupId); fto.setId(this.id); fto.setLength(this.length); fto.setName(this.name); fto.setUpdateDate(this.updateDate); fto.setValid(this.valid); - fto.setDataProfileId(this.dataProfileId); + fto.setDataProfileId(this.dataProfileId==null?0:this.dataProfileId); return fto; } @@ -208,18 +208,9 @@ public class GDEFile implements Serializable { @Override public int hashCode() { - int hash = 5; - hash = 23 * hash + (int) (this.id ^ (this.id >>> 32)); - hash = 23 * hash + Objects.hashCode(this.name); - hash = 23 * hash + (int) (this.length ^ (this.length >>> 32)); - hash = 23 * hash + Objects.hashCode(this.checksum); - hash = 23 * hash + Objects.hashCode(this.creationDate); - hash = 23 * hash + Objects.hashCode(this.updateDate); - hash = 23 * hash + Objects.hashCode(this.valid); - hash = 23 * hash + Objects.hashCode(this.deleted); - hash = 23 * hash + Objects.hashCode(this.deletionDate); - hash = 23 * hash + (int) (this.attributeGroupId ^ (this.attributeGroupId >>> 32)); - hash = 23 * hash + (int) (this.dataProfileId ^ (this.dataProfileId >>> 32)); + int hash = 7; + hash = 67 * hash + (int) (this.id ^ (this.id >>> 32)); + hash = 67 * hash + Objects.hashCode(this.name); return hash; } -- 2.39.2