-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #23 by adding the IPHeader and moving some existing elements in…
…to it.
- Loading branch information
1 parent
07c793a
commit 0105ece
Showing
4 changed files
with
143 additions
and
23 deletions.
There are no files selected for viewing
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
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
34 changes: 34 additions & 0 deletions
34
src/main/java/org/roda_project/commons_ip/model/IPAltRecordID.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,34 @@ | ||
package org.roda_project.commons_ip.model; | ||
|
||
public class IPAltRecordID { | ||
private String value; | ||
private String type; | ||
|
||
public IPAltRecordID() { | ||
this.value = ""; | ||
this.type = ""; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public IPAltRecordID setValue(String value) { | ||
this.value = value; | ||
return this; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public IPAltRecordID setType(String type) { | ||
this.type = type; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "IPAltRecordID [value=" + value + ", type=" + type + "]"; | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
src/main/java/org/roda_project/commons_ip/model/IPHeader.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,77 @@ | ||
package org.roda_project.commons_ip.model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import javax.xml.datatype.XMLGregorianCalendar; | ||
|
||
import org.roda_project.commons_ip.utils.IPEnums; | ||
import org.roda_project.commons_ip.utils.Utils; | ||
|
||
public class IPHeader { | ||
private Optional<XMLGregorianCalendar> createDate; | ||
private Optional<XMLGregorianCalendar> modificationDate; | ||
private IPEnums.IPStatus status; | ||
private List<IPAgent> agents; | ||
private List<IPAltRecordID> altRecordIDs; | ||
|
||
public IPHeader() { | ||
this.createDate = Utils.getCurrentTime(); | ||
this.modificationDate = Optional.empty(); | ||
this.status = IPEnums.IPStatus.NEW; | ||
this.altRecordIDs = new ArrayList<>(); | ||
this.agents = new ArrayList<>(); | ||
} | ||
|
||
public Optional<XMLGregorianCalendar> getCreateDate() { | ||
return createDate; | ||
} | ||
|
||
public IPHeader setCreateDate(XMLGregorianCalendar date) { | ||
this.createDate = Optional.ofNullable(date); | ||
return this; | ||
} | ||
|
||
public Optional<XMLGregorianCalendar> getModificationDate() { | ||
return modificationDate; | ||
} | ||
|
||
public IPHeader setModificationDate(XMLGregorianCalendar date) { | ||
this.modificationDate = Optional.ofNullable(date); | ||
return this; | ||
} | ||
|
||
public IPEnums.IPStatus getStatus() { | ||
return status; | ||
} | ||
|
||
public IPHeader setStatus(IPEnums.IPStatus status) { | ||
this.status = status; | ||
return this; | ||
} | ||
|
||
public List<IPAltRecordID> getAltRecordIDs() { | ||
return altRecordIDs; | ||
} | ||
|
||
public IPHeader addAltRecordID(IPAltRecordID altRecordID) { | ||
altRecordIDs.add(altRecordID); | ||
return this; | ||
} | ||
|
||
public List<IPAgent> getAgents() { | ||
return agents; | ||
} | ||
|
||
public IPHeader addAgent(IPAgent sipAgent) { | ||
agents.add(sipAgent); | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "IPHeader [createDate=" + createDate + ", modificationDate=" + modificationDate + ", status=" + status | ||
+ ", altRecordIDs=" + altRecordIDs + ", agents=" + agents + "]"; | ||
} | ||
} |