Commit 1dbffc98 authored by Benjamin Rokseth's avatar Benjamin Rokseth
Browse files

Services: remove all circulation code

parent cc9a2345
......@@ -2,7 +2,6 @@ package no.deichman.services;
import no.deichman.services.datasource.Datasource;
import no.deichman.services.entity.AuthorizedValuesResource;
import no.deichman.services.entity.CirculationResource;
import no.deichman.services.entity.EntityResource;
import no.deichman.services.entity.ResourceBase;
import no.deichman.services.marc.MarcResource;
......@@ -118,7 +117,6 @@ public final class App {
VersionResource.class.getCanonicalName(),
TranslationResource.class.getCanonicalName(),
Datasource.class.getCanonicalName(),
CirculationResource.class.getCanonicalName(),
ImmediateFeature.class.getCanonicalName(),
TemplateResource.class.getCanonicalName()
)));
......
package no.deichman.services.circulation;
import java.util.Map;
/**
* Responsibility: provide interface for generic methods on circulation objects.
*/
public interface CirculationObject {
void setRecordId(String recordId);
String getRecordId();
void setWorkURI(String workURI);
void setPublicationURI(String publicationUri);
void setPublicationImage(String publicationImage);
void setContributor(Map<String, String> contributor);
void setMediaType(String mediaType);
String getWorkURI();
String getPublicationURI();
void setRelativePublicationPath(String relativePublicationPath);
void setTitle(String title);
void setPublicationYear(String publicationYear);
String getStatus();
void setBranchCode(String branchCode);
void setId(String id);
void decorateWithPublicationData(Map<String, String> publicationData) throws Exception;
}
package no.deichman.services.circulation;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import no.deichman.services.uridefaults.XURI;
import java.util.HashMap;
import java.util.Map;
/**
* Responsibility: Top-level object for circulation data.
*/
class CirculationObjectBase implements CirculationObject {
@Expose
@SerializedName(value = "recordId", alternate = "biblionumber")
private String recordId;
@SerializedName(value = "borrowerNumber", alternate = "borrowernumber")
private String borrowerNumber;
@Expose
private String workURI;
@Expose
private String publicationURI;
@Expose
private String publicationImage;
@Expose
private Map<String, String> contributor = new HashMap<>();
@Expose
private String mediaType;
@Expose
@SerializedName(value = "branchCode", alternate = "branchcode")
private String branchCode;
@Expose
private String title;
@Expose
private String publicationYear;
@Expose
private String relativePublicationPath;
private String status;
@Expose
@SerializedName(value = "id", alternate = {"issue_id", "reserve_id"})
private String id;
public void setRecordId(String recordId) {
this.recordId = recordId;
}
public String getRecordId() {
return this.recordId;
}
public void setWorkURI(String workURI) {
this.workURI = workURI;
}
public void setPublicationURI(String publicationUri) {
this.publicationURI = publicationUri;
}
public void setPublicationImage(String publicationImage) {
this.publicationImage = publicationImage;
}
public void setContributor(Map<String, String> contributor) {
this.contributor = contributor;
}
public void setMediaType(String mediaType) {
this.mediaType = mediaType;
}
@Override
public String getWorkURI() {
return workURI;
}
@Override
public String getPublicationURI() {
return publicationURI;
}
@Override
public void setRelativePublicationPath(String relativePublicationPath) {
this.relativePublicationPath = relativePublicationPath;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPublicationYear() {
return publicationYear;
}
public void setPublicationYear(String publicationYear) {
this.publicationYear = publicationYear;
}
@Override
public String getStatus() {
return status;
}
@Override
public void setBranchCode(String branchCode) {
this.branchCode = branchCode;
}
@Override
public void setId(String id) {
this.id = id;
}
@Override
public void decorateWithPublicationData(Map<String, String> publicationData) throws Exception {
publicationData.forEach((key, value) -> {
switch (key) {
case "agentUri":
case "contributorName":
case "contributorNationality":
case "role":
contributor.put(key, value);
break;
case "title":
setTitle(value);
break;
case "mediaType":
setMediaType(value);
break;
case "publicationImage":
setPublicationImage(value);
break;
case "publicationUri":
setPublicationURI(value);
break;
case "publicationYear":
setPublicationYear(value);
break;
case "workUri":
setWorkURI(value);
break;
default:
break;
}
});
if (getWorkURI() != null && getPublicationURI() != null) {
XURI work = new XURI(getWorkURI());
XURI publication = new XURI(getPublicationURI());
String path = work.getPath()
+ publication.getPath();
setRelativePublicationPath(path);
}
}
public String getRelativePublicationPath() {
return relativePublicationPath;
}
public String getPublicationImage() {
return publicationImage;
}
public String getMediaType() {
return mediaType;
}
public String getBranchCode() {
return branchCode;
}
public String getBorrowerNumber() {
return borrowerNumber;
}
public void setBorrowerNumber(String borrowerNumber) {
this.borrowerNumber = borrowerNumber;
}
public Map<String, String> getContributor() {
return contributor;
}
public String getId() {
return id;
}
}
package no.deichman.services.circulation;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Responsibility: object for circulation profile data.
*/
public class CirculationProfile {
@Expose
private List<Loan> loans;
@Expose
@SerializedName(value = "reservations", alternate = "holds")
private List<Reservation> holds;
@Expose
private List<Pickup> pickups;
public final void setLoans(List<Loan> loans) {
this.loans = loans;
}
public final void setHolds(List<Reservation> holds) {
this.holds = holds;
}
public final void setPickups(List<Pickup> pickups) {
this.pickups = pickups;
}
}
package no.deichman.services.circulation;
import java.util.List;
/**
* Responsibility: contain holds and pickups.
*/
public class HoldsAndPickups {
private List<Reservation> holds;
private List<Pickup> pickups;
public final List<Reservation> getHolds() {
return holds;
}
public final void setPickups(List<Pickup> pickups) {
this.pickups = pickups;
}
public final void setHolds(List<Reservation> holds) {
this.holds = holds;
}
public final List<Pickup> getPickups() {
return pickups;
}
}
package no.deichman.services.circulation;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Responsibility: Container object for loans.
*/
public final class Loan extends CirculationObjectBase {
@Expose
@SerializedName(value = "itemNumber", alternate = "itemnumber")
private String itemNumber;
@SerializedName("return")
private String returnNOOP;
@Expose
@SerializedName(value = "dueDate", alternate = "date_due")
private String dueDate;
@SerializedName("renewals")
private int renewals;
@SerializedName("timestamp")
private String timestamp;
@SerializedName(value = "returnDate", alternate = "returndate")
private String returnDate;
@SerializedName("auto_renew")
private String autorenew;
@SerializedName("lastrenewdate")
private String lastRenewDate;
@SerializedName("issuedate")
private String issueDate;
public String getItemNumber() {
return itemNumber;
}
public void setItemNumber(String itemNumber) {
this.itemNumber = itemNumber;
}
public void setDueDate(String dueDate) {
this.dueDate = dueDate;
}
}
package no.deichman.services.circulation;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Responsibility: Provide a container object for library system manifestation records.
*/
public final class LoanRecord {
@Expose
@SerializedName("biblionumber")
private String id;
@Expose
@SerializedName("collectionvolume")
private String collectionVolume;
@Expose
@SerializedName("reserves")
private String reserves;
@Expose
@SerializedName("renewals")
private String renewals;
@Expose
@SerializedName("seriestitle")
private String seriesTitle;
@Expose
@SerializedName("issues")
private String issues;
@Expose
@SerializedName("cn_class")
private String cnClass;
@Expose
@SerializedName("number")
private String number;
@Expose
@SerializedName("paidfor")
private String paidFor;
@Expose
@SerializedName("itemlost_on") // "2017-02-15 02:00:29"
private String itemLostOn;
@Expose
@SerializedName("itemcallnumber")
private String itemCallNumber;
@Expose
@SerializedName("location")
private String location;
@Expose
@SerializedName("pages")
private String pages;
@Expose
@SerializedName("ean")
private String ean;
@Expose
@SerializedName("lccn")
private String lccn;
@Expose
@SerializedName("editionstatement")
private String editionStatement;
@Expose
@SerializedName("biblioitemnumber")
private String biblioItemNumber;
@Expose
@SerializedName("timestamp") // "2016-10-08 23:09:14"
private String timestamp;
@Expose
@SerializedName("notforloan")
private String notForLoan;
@Expose
@SerializedName("homebranch")
private String homeBranch;
@Expose
@SerializedName("price")
private String price;
@Expose
@SerializedName("barcode")
private String barcode;
@Expose
@SerializedName("onloan") // "2017-01-10"
private String onLoan;
@Expose
@SerializedName("cn_item")
private String cnItem;
@Expose
@SerializedName("url")
private String url;
@Expose
@SerializedName("copyrightdate")
private String copyRightDate;
@Expose
@SerializedName("datelastborrowed") //"2016-10-18"
private String dateLastBorrowed;
@Expose
@SerializedName("size")
private String size;
@Expose
@SerializedName("itemnotes")
private String itemNotes;
@Expose
@SerializedName("notes")
private String notes;
@Expose
@SerializedName("stocknumber")
private String stockNumber;
@Expose
@SerializedName("restricted")
private String restricted;
@Expose
@SerializedName("withdrawn_on")
private String withdrawnOn;
@Expose
@SerializedName("stack")
private String stack;
@Expose
@SerializedName("itemlost")
private String itemLost;
@Expose
@SerializedName("replacementpricedate") // "2016-10-07"
private String replacementPriceDate;
@Expose
@SerializedName("datelastseen") // "2016-10-18",
private String dateLastSeen;
@Expose
@SerializedName("issn")
private String issn;
@Expose
@SerializedName("uri")
private String uri;
@Expose
@SerializedName("materials")
private String materials;
@Expose
@SerializedName("frameworkcode")
private String frameworkCode;
@Expose
@SerializedName("cn_sort")
private String cnSort;
@Expose
@SerializedName("publishercode")
private String publisherCode;
@Expose
@SerializedName("withdrawn")
private String withdrawn;
@Expose
@SerializedName("damaged")
private String damaged;
@Expose
@SerializedName("marcxml")
private String marcXml;
@Expose
@SerializedName("holdingbranch")
private String holdingBranch;
@Expose
@SerializedName("editionresponsibility")
private String editionResponsibility;
@Expose
@SerializedName("volume")
private String volume;
@Expose
@SerializedName("cn_source")
private String cnSource;
@Expose
@SerializedName("title")
private String title;
@Expose
@SerializedName("author")
private String author;
@Expose
@SerializedName("copynumber")
private String copyNumber;
@Expose
@SerializedName("cn_suffix")
private String cnSuffix;
@Expose
@SerializedName("itype")
private String iType;
@Expose
@SerializedName("abstract")
private String abstractText;
@Expose
@SerializedName("totalissues")
private String totalIssues;
@Expose
@SerializedName("unititle")
private String uniformTitle;
@Expose
@SerializedName("isbn") //"978-82-02-25363-9 | 82-02-25363-2"
private String isbn;
@Expose
@SerializedName("replacementprice")
private String replacementPrice;
@Expose
@SerializedName("itemnotes_nonpublic")
private String itemNotesNonPublic;
@Expose
@SerializedName("ccode")
private String cCode;
@Expose
@SerializedName("datecreated") // "2016-10-07"
private String dateCreated;
@Expose
@SerializedName("more_subfields_xml")
private String moreSubfieldsXml;
@Expose
@SerializedName("coded_location_qualifier")
private String codedLocationQualifier;
@Expose
@SerializedName("publicationyear")
private String publicationYear;
@Expose
@SerializedName("permanent_location")
private String permanentLocation;
@Expose
@SerializedName("volumedesc")
private String volumeDescription;
@Expose
@SerializedName("collectiontitle")
private String collectionTitle;
@Expose
@SerializedName("serial")
private String serial;