forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from lubitchv/5513-database-variablemetadata
5513 database variablemetadata
- Loading branch information
Showing
2 changed files
with
101 additions
and
6 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
src/main/java/edu/harvard/iq/dataverse/datavariable/CategoryMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package edu.harvard.iq.dataverse.datavariable; | ||
|
||
import javax.persistence.Index; | ||
import javax.persistence.Entity; | ||
import javax.persistence.Table; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.JoinColumn; | ||
|
||
@Entity | ||
@Table(indexes = {@Index(columnList="category_id"), @Index(columnList="variablemetadata_id")}) | ||
public class CategoryMetadata { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(nullable=false) | ||
VariableCategory category; | ||
|
||
@ManyToOne | ||
@JoinColumn(nullable=false) | ||
private VariableMetadata variableMetadata; | ||
|
||
Double wfreq; | ||
|
||
public CategoryMetadata() {} | ||
|
||
public CategoryMetadata(VariableMetadata variableMetadata) { | ||
this.variableMetadata = variableMetadata; | ||
} | ||
|
||
public Double getWfreq() { | ||
return wfreq; | ||
} | ||
|
||
public void setWfreq(Double wfreq) { | ||
this.wfreq = wfreq; | ||
} | ||
|
||
public VariableCategory getCategory() { | ||
return category; | ||
} | ||
|
||
public void setCategory(VariableCategory category) { | ||
this.category = category; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public void setVariableMetadata(VariableMetadata variableMetadata) { | ||
this.variableMetadata = variableMetadata; | ||
} | ||
|
||
public VariableMetadata getVariableMetadata() { | ||
return variableMetadata; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int hash = 0; | ||
hash += (this.id != null ? this.id.hashCode() : 0); | ||
return hash; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
if (!(object instanceof CategoryMetadata)) { | ||
return false; | ||
} | ||
|
||
CategoryMetadata other = (CategoryMetadata) object; | ||
if (this.id != other.id ) { | ||
if (this.id == null || !this.id.equals(other.id)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters