package com.hida.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * POJO for PURLs, logical units of transaction that can be resolved into
 * various records and locations.
 *
 * @author lruffin
 * @author: leland lopez
 */
@Entity
@Table(name = "PURL_TABLE")
public class Purl {

    //variables
    @Id 
    @Column(name = "NAME")
    private String Identifier;
    
    @Column(name = "URL")
    private String URL;    
    
    @Column(name = "ERC")
    private String ERC;
    
    @Column(name = "WHO")
    private String Who;
    
    @Column(name = "WHAT")
    private String What;
    
    @Column(name = "TIMESTAMP")
    private String When;

    /**
     * Purl Constructor
     *
     * @param PURL purlid of model_purl
     */
    public Purl(String PURL) {
        this.Identifier = PURL;
    }

    public Purl(String Identifier, String URL, String ERC, String Who, String What, String When) {
        this.Identifier = Identifier;
        this.URL = URL;
        this.ERC = ERC;
        this.Who = Who;
        this.What = What;
        this.When = When;
    }
    
    

    /**
     * No-arg constructor used by Hibernate
     */
    public Purl() {

    }

    public String getURL() {
        return URL;
    }

    public void setURL(String URL) {
        this.URL = URL;
    }

    public String getIdentifier() {
        return Identifier;
    }

    public void setIdentifier(String Identifier) {
        this.Identifier = Identifier;
    }

    public String getERC() {
        return ERC;
    }

    public void setERC(String ERC) {
        this.ERC = ERC;
    }

    public String getWho() {
        return Who;
    }

    public void setWho(String who) {
        Who = who;
    }

    public String getWhat() {
        return What;
    }

    public void setWhat(String what) {
        What = what;
    }

    public String getWhen() {
        return When;
    }

    public void setWhen(String when) {
        When = when;
    }

    /**
     *
     * @return Json String
     */
    public String toJSON() {
        String json = "";
        json += "{";
        json += "\"PURL\":\"" + Identifier + "\",";
        json += "\"URL\":\"" + URL + "\",";
        json += "\"ERC\":\"" + ERC + "\",";
        json += "\"Who\":\"" + Who + "\",";
        json += "\"What\":\"" + What + "\",";
        json += "\"When\":\"" + When + "\"";
        json += "}";
        return json;
    }

}

@@ -415,12 +415,11 @@
  = %22
-NAME
+PID
 %22)%0A 
@@ -436,26 +436,19 @@
  String 
-Identifier
+Pid
 ;%0A    %0A 
@@ -696,17 +696,12 @@
  = %22
-TIMESTAMP
+DATE
 %22)%0A 
@@ -718,20 +718,20 @@
  String 
-When
+Date
 ;%0A%0A    /
@@ -856,26 +856,19 @@
    this.
-Identifier
+Pid
  = PURL;
@@ -983,34 +983,27 @@
        this.
-Identifier
+Pid
  = Identifie
@@ -1116,20 +1116,20 @@
    this.
-When
+Date
  = When;
@@ -1409,26 +1409,19 @@
  return 
-Identifier
+Pid
 ;%0A    %7D%0A
@@ -1485,26 +1485,19 @@
    this.
-Identifier
+Pid
  = Ident
@@ -1899,20 +1899,20 @@
 ring get
-When
+Date
 () %7B%0A   
@@ -1923,20 +1923,20 @@
  return 
-When
+Date
 ;%0A    %7D%0A
@@ -1955,20 +1955,20 @@
 void set
-When
+Date
 (String 
@@ -1983,20 +1983,20 @@
         
-When
+Date
  = when;
@@ -2161,26 +2161,19 @@
 %22:%5C%22%22 + 
-Identifier
+Pid
  + %22%5C%22,%22
@@ -2384,20 +2384,20 @@
 %22:%5C%22%22 + 
-When
+Date
  + %22%5C%22%22;

Rename some of the fields in Purl