perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r5976 - in trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java /org/perfsonar/service/measurementArchive/rrdType/storage/ persistence: . entity
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r5976 - in trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java /org/perfsonar/service/measurementArchive/rrdType/storage/ persistence: . entity
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r5976 - in trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java /org/perfsonar/service/measurementArchive/rrdType/storage/ persistence: . entity
- Date: Tue, 28 Aug 2012 13:47:50 +0100 (BST)
Author: nordunet.behrmann
Date: 2012-08-28 13:47:50 +0100 (Tue, 28 Aug 2012)
New Revision: 5976
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/MetadaKeyResponse.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/SetupDataKeyResponse.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/entity/Interfaces.java
Log:
perfsonar-java-rrd-ma-SQL_backend: Add JPA meta data annotations
This lets Hibernate create the interfaces table with the same column
types as the rrdma_db.sql script.
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/MetadaKeyResponse.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/MetadaKeyResponse.java
2012-08-28 12:47:49 UTC (rev 5975)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/MetadaKeyResponse.java
2012-08-28 12:47:50 UTC (rev 5976)
@@ -106,7 +106,7 @@
StringBuilder sb = new StringBuilder();
try {
- sb.append("<nmwg:data
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
id=\"data").append(intf.getMetadataId().trim()).append("\"
metadataIdRef=\"").append(intf.getMetadataId().trim()).append("\">").append("\n");
+ sb.append("<nmwg:data
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
id=\"data").append(intf.getMetadataId()).append("\"
metadataIdRef=\"").append(intf.getMetadataId()).append("\">").append("\n");
sb.append("<nmwg:key>" + "\n");
sb.append("<nmwg:parameters>"+ "\n");
sb.append("<nmwg:parameter
name=\"file\">").append(intf.getFile().trim()).append("</nmwg:parameter>").append("\n");
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/SetupDataKeyResponse.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/SetupDataKeyResponse.java
2012-08-28 12:47:49 UTC (rev 5975)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/SetupDataKeyResponse.java
2012-08-28 12:47:50 UTC (rev 5976)
@@ -60,7 +60,7 @@
params.addParameter(getParameter(("eventType"),
intf.getEventType()));
k.setParameters(params);
d.setKey(k);
- d.setId(intf.getMetadataId());
+ d.setId(String.valueOf(intf.getMetadataId()));
d.setMetadataIdRef(id);
return d;
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/entity/Interfaces.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/entity/Interfaces.java
2012-08-28 12:47:49 UTC (rev 5975)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/entity/Interfaces.java
2012-08-28 12:47:50 UTC (rev 5976)
@@ -1,9 +1,12 @@
package
org.perfsonar.service.measurementArchive.rrdType.storage.persistence.entity;
+import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedNativeQuery;
import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
@Entity
@@ -13,31 +16,65 @@
public static final String ALL = "allInterfaces";
public static final String TABLE = "interfaces m";
- @Id
- private String metadataId;
-
+
+ @Id @GeneratedValue
+ private int metadataId;
+
+ @Column(length=20, nullable=false)
private String subjId;
+
+ @Column(length=20, nullable=false)
private String hostName;
+
+ @Column(length=20, nullable=false)
private String ifAddress;
+
+ @Column(length=4, nullable=false)
private String ifAddressType;
+
+ @Column(length=100, nullable=false)
private String ifName;
+
+ @Column(length=255, nullable=false)
private String ifDescription;
+
+ @Column(length=20, nullable=false)
private String direction;
+
+ @Column(length=20, nullable=false)
private String capacity;
+
+ @Column(length=100, nullable=false)
private String keyword;
+ @Column(length=100, nullable=false)
private String file;
+
+ @Column(length=20, nullable=false)
private String dataSource;
+
+ @Column(length=20, nullable=false)
private String valueUnits;
+
+ @Column(length=100, nullable=false)
private String eventType;
+
+ @Column(length=20)
private String dataSourceStep;
- private String dataSourceType;
- private String dataSourceHeartbeat;
- private String dataSourceMinValue;
- private String dataSourceMaxValue;
+
+ @Column(length=20)
+ private String dataSourceType;
+
+ @Column(length=20)
+ private String dataSourceHeartbeat;
+
+ @Column(length=20)
+ private String dataSourceMinValue;
+
+ @Column(length=20)
+ private String dataSourceMaxValue;
- public Interfaces(){
-
+ public Interfaces() {
}
/**
@@ -57,7 +94,12 @@
* @param dataSourceMinValue
* @param dataSourceMaxValue
*/
- public Interfaces(final String metadataId, final String subjId, final
String hostNam, final String ifName, final String ifAddress,final String
ifAddressType , final String ifDescription, final String direction, final
String capacity, final String keyword, final String file, final String
dataSource, final String valueUnits, final String eventType, final String
dataSourceStep, final String dataSourceType,final String dataSourceHeartbeat,
final String dataSourceMinValue, final String dataSourceMaxValue) {
+ public Interfaces(final int metadataId, final String subjId, final
String hostNam, final String ifName,
+ final String ifAddress,final String ifAddressType ,
final String ifDescription,
+ final String direction, final String capacity, final
String keyword, final String file,
+ final String dataSource, final String valueUnits,
final String eventType,
+ final String dataSourceStep, final String
dataSourceType, final String dataSourceHeartbeat,
+ final String dataSourceMinValue, final String
dataSourceMaxValue) {
this.metadataId = metadataId;
this.subjId = subjId;
this.hostName = hostNam;
@@ -235,16 +277,10 @@
}
- public String getMetadataId() {
+ public int getMetadataId() {
return metadataId;
}
-
- public void setMetadataId(String metadataId) {
- this.metadataId = metadataId;
- }
-
-
public String getSubjId() {
return subjId;
}
@@ -268,7 +304,7 @@
@Override
public int hashCode() {
final int PRIME = 31;
- int result = 1;
+ int result = metadataId;
result = PRIME * result + ((capacity == null) ? 0 :
capacity.hashCode());
result = PRIME * result + ((keyword == null) ? 0 :
keyword.hashCode());
result = PRIME * result + ((dataSource == null) ? 0 :
dataSource.hashCode());
@@ -285,7 +321,6 @@
result = PRIME * result + ((ifAddress == null) ? 0 :
ifAddress.hashCode());
result = PRIME * result + ((ifAddressType == null) ? 0 :
ifAddressType.hashCode());
result = PRIME * result + ((ifDescription == null) ? 0 :
ifDescription.hashCode());
- result = PRIME * result + ((metadataId == null) ? 0 :
metadataId.hashCode());
result = PRIME * result + ((subjId == null) ? 0 :
subjId.hashCode());
result = PRIME * result + ((valueUnits == null) ? 0 :
valueUnits.hashCode());
return result;
@@ -381,11 +416,9 @@
return false;
} else if (!ifDescription.equals(other.ifDescription))
return false;
- if (metadataId == null) {
- if (other.metadataId != null)
- return false;
- } else if (!metadataId.equals(other.metadataId))
- return false;
+ if (metadataId != other.metadataId) {
+ return false;
+ }
if (subjId == null) {
if (other.subjId != null)
return false;
- [pS-dev] [GEANT/SA2/ps-java-services] r5976 - in trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java /org/perfsonar/service/measurementArchive/rrdType/storage/ persistence: . entity, svn-noreply, 08/28/2012
Archive powered by MHonArc 2.6.16.