comparison src/main/java/edu/harvard/iq/dataverse/ForeignMetadataFormatMapping.java @ 10:a50cf11e5178

Rewrite LGDataverse completely upgrading to dataverse4.0
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 08 Sep 2015 17:00:21 +0200
parents
children
comparison
equal deleted inserted replaced
9:5926d6419569 10:a50cf11e5178
1 /*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7 package edu.harvard.iq.dataverse;
8
9 import java.io.Serializable;
10 import javax.persistence.Entity;
11 import javax.persistence.GeneratedValue;
12 import javax.persistence.GenerationType;
13 import javax.persistence.Id;
14 import java.util.List;
15 import javax.persistence.CascadeType;
16 import javax.persistence.Column;
17 import javax.persistence.NamedQueries;
18 import javax.persistence.NamedQuery;
19 import javax.persistence.OneToMany;
20
21 /**
22 *
23 * @author Leonid Andreev
24 */
25
26 @NamedQueries({
27 @NamedQuery( name="ForeignMetadataFormatMapping.listAll", query = "SELECT fmfm FROM ForeignMetadataFormatMapping fmfm"),
28 @NamedQuery( name="ForeignMetadataFormatMapping.findByName", query = "SELECT fmfm FROM ForeignMetadataFormatMapping fmfm WHERE fmfm.name=:name")
29 })
30 @Entity
31 public class ForeignMetadataFormatMapping implements Serializable {
32 private static final long serialVersionUID = 1L;
33 @Id
34 @GeneratedValue(strategy = GenerationType.IDENTITY)
35 private Long id;
36
37 @OneToMany(mappedBy = "foreignMetadataFormatMapping", cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
38 private List<ForeignMetadataFieldMapping> foreignMetadataFieldMappings;
39
40 @Column( nullable = false )
41 private String name;
42 @Column( nullable = false )
43 private String displayName;
44 private String schemaLocation;
45 private String startElement;
46
47 /* getters/setters: */
48
49 public Long getId() {
50 return id;
51 }
52
53 public void setId(Long id) {
54 this.id = id;
55 }
56
57 public List<ForeignMetadataFieldMapping> getDatasetFieldTypes() {
58 return foreignMetadataFieldMappings;
59 }
60
61 public void setDatasetFieldTypes(List<ForeignMetadataFieldMapping> foreignMetadataFieldMappings) {
62 this.foreignMetadataFieldMappings = foreignMetadataFieldMappings;
63 }
64
65 public String getName() {
66 return name;
67 }
68 public void setName(String name) {
69 this.name = name;
70 }
71
72 public String getDisplayName() {
73 return displayName;
74 }
75 public void setDisplayName(String displayName) {
76 this.displayName = displayName;
77 }
78
79 public String getSchemaLocation() {
80 return schemaLocation ;
81 }
82 public void setSchemaLocation(String schemaLocation) {
83 this.schemaLocation = schemaLocation;
84 }
85
86 public String getStartElement() {
87 return startElement;
88 }
89 public void setStartElement(String startElement) {
90 this.startElement = startElement;
91 }
92
93 /* overrides: */
94
95 @Override
96 public int hashCode() {
97 int hash = 0;
98 hash += (id != null ? id.hashCode() : 0);
99 return hash;
100 }
101
102 @Override
103 public boolean equals(Object object) {
104 // TODO: Warning - this method won't work in the case the id fields are not set
105 if (!(object instanceof ForeignMetadataFormatMapping)) {
106 return false;
107 }
108 ForeignMetadataFormatMapping other = (ForeignMetadataFormatMapping) object;
109 if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
110 return false;
111 }
112 return true;
113 }
114
115
116
117 @Override
118 public String toString() {
119 return "edu.harvard.iq.dataverse.ForeignMetadataFormatMapping[ id=" + id + " ]";
120 }
121
122 }
123