Commit 509b21cf authored by Gerrit Hübbers's avatar Gerrit Hübbers 🃏
Browse files

Introduce Ssoar REST domain classes and some REST client

parent 26ef5e90
package org.gesis.dda.feeder.ssoar;
import javax.inject.Inject;
import org.gesis.dda.wizard.config.IngesterProperties;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
public class SsoarRestService {
private RestTemplate restTemplate;
private String authenticationToken;
private boolean isAuthenticated = false;
@Inject
public SsoarRestService(IngesterProperties ingesterProperties) {
restTemplate = new RestTemplate();
}
public boolean login() {
boolean wasSuccessful = false;
return wasSuccessful;
}
}
package org.gesis.dda.feeder.ssoar.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Bitstream extends DSpaceObject {
private String bundleName;
private String description;
private String format;
private String mimeType;
private Long sizeBytes;
private DSpaceObject parentObject;
private String retrieveLink;
private CheckSum checkSum;
private Integer sequenceId;
private ResourcePolicy[] policies;
public String getBundleName() {
return bundleName;
}
public void setBundleName(String bundleName) {
this.bundleName = bundleName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public Long getSizeBytes() {
return sizeBytes;
}
public void setSizeBytes(Long sizeBytes) {
this.sizeBytes = sizeBytes;
}
public DSpaceObject getParentObject() {
return parentObject;
}
public void setParentObject(DSpaceObject parentObject) {
this.parentObject = parentObject;
}
public String getRetrieveLink() {
return retrieveLink;
}
public void setRetrieveLink(String retrieveLink) {
this.retrieveLink = retrieveLink;
}
public CheckSum getCheckSum() {
return checkSum;
}
public void setCheckSum(CheckSum checkSum) {
this.checkSum = checkSum;
}
public Integer getSequenceId() {
return sequenceId;
}
public void setSequenceId(Integer sequenceId) {
this.sequenceId = sequenceId;
}
public ResourcePolicy[] getPolicies() {
return policies;
}
public void setPolicies(ResourcePolicy[] policies) {
this.policies = policies;
}
}
package org.gesis.dda.feeder.ssoar.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class CheckSum {
private String checkSumAlgorithm;
private String value;
public String getCheckSumAlgorithm() {
return checkSumAlgorithm;
}
public void setCheckSumAlgorithm(String checkSumAlgorithm) {
this.checkSumAlgorithm = checkSumAlgorithm;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package org.gesis.dda.feeder.ssoar.domain;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Collection extends DSpaceObject {
private Bitstream logo;
private Community parentCommunity;
private List<Community> parentCommunityList = new ArrayList<Community>();
private List<Item> items = new ArrayList<Item>();
private String license;
private String copyrightText, introductoryText, shortDescription, sidebarText;
private Integer numberItems;
public Bitstream getLogo() {
return logo;
}
public void setLogo(Bitstream logo) {
this.logo = logo;
}
public Community getParentCommunity() {
return parentCommunity;
}
public void setParentCommunity(Community parentCommunity) {
this.parentCommunity = parentCommunity;
}
public List<Community> getParentCommunityList() {
return parentCommunityList;
}
public void setParentCommunityList(List<Community> parentCommunityList) {
this.parentCommunityList = parentCommunityList;
}
public List<Item> getItems() {
return items;
}
public void setItems(List<Item> items) {
this.items = items;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
public String getCopyrightText() {
return copyrightText;
}
public void setCopyrightText(String copyrightText) {
this.copyrightText = copyrightText;
}
public String getIntroductoryText() {
return introductoryText;
}
public void setIntroductoryText(String introductoryText) {
this.introductoryText = introductoryText;
}
public String getShortDescription() {
return shortDescription;
}
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getSidebarText() {
return sidebarText;
}
public void setSidebarText(String sidebarText) {
this.sidebarText = sidebarText;
}
public Integer getNumberItems() {
return numberItems;
}
public void setNumberItems(Integer numberItems) {
this.numberItems = numberItems;
}
}
package org.gesis.dda.feeder.ssoar.domain;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Community extends DSpaceObject {
private Bitstream logo;
private Community parentCommunity;
private String copyrightText, introductoryText, shortDescription, sidebarText;
private Integer countItems;
private List<Community> subcommunities = new ArrayList<Community>();
private List<Collection> collections = new ArrayList<Collection>();
public Bitstream getLogo() {
return logo;
}
public void setLogo(Bitstream logo) {
this.logo = logo;
}
public Community getParentCommunity() {
return parentCommunity;
}
public void setParentCommunity(Community parentCommunity) {
this.parentCommunity = parentCommunity;
}
public String getCopyrightText() {
return copyrightText;
}
public void setCopyrightText(String copyrightText) {
this.copyrightText = copyrightText;
}
public String getIntroductoryText() {
return introductoryText;
}
public void setIntroductoryText(String introductoryText) {
this.introductoryText = introductoryText;
}
public String getShortDescription() {
return shortDescription;
}
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getSidebarText() {
return sidebarText;
}
public void setSidebarText(String sidebarText) {
this.sidebarText = sidebarText;
}
public Integer getCountItems() {
return countItems;
}
public void setCountItems(Integer countItems) {
this.countItems = countItems;
}
public List<Community> getSubcommunities() {
return subcommunities;
}
public void setSubcommunities(List<Community> subcommunities) {
this.subcommunities = subcommunities;
}
public List<Collection> getCollections() {
return collections;
}
public void setCollections(List<Collection> collections) {
this.collections = collections;
}
}
package org.gesis.dda.feeder.ssoar.domain;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class DSpaceObject {
private Integer id;
private String name;
private String handle;
private String type;
private String link;
private List<String> expand = new ArrayList<String>();
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public List<String> getExpand() {
return expand;
}
public void setExpand(List<String> expand) {
this.expand = expand;
}
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
package org.gesis.dda.feeder.ssoar.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Item extends DSpaceObject {
private String isArchived;
private String isWithdrawn;
private String lastModified;
private Collection parentCollection;
private List<Collection> parentCollectionList;
private List<Community> parentCommunityList;
private List<MetadataEntry> metadata;
private List<Bitstream> bitstreams;
public String getIsArchived() {
return isArchived;
}
public void setIsArchived(String isArchived) {
this.isArchived = isArchived;
}
public String getIsWithdrawn() {
return isWithdrawn;
}
public void setIsWithdrawn(String isWithdrawn) {
this.isWithdrawn = isWithdrawn;
}
public String getLastModified() {
return lastModified;
}
public void setLastModified(String lastModified) {
this.lastModified = lastModified;
}
public Collection getParentCollection() {
return parentCollection;
}
public void setParentCollection(Collection parentCollection) {
this.parentCollection = parentCollection;
}
public List<Collection> getParentCollectionList() {
return parentCollectionList;
}
public void setParentCollectionList(List<Collection> parentCollectionList) {
this.parentCollectionList = parentCollectionList;
}
public List<Community> getParentCommunityList() {
return parentCommunityList;
}
public void setParentCommunityList(List<Community> parentCommunityList) {
this.parentCommunityList = parentCommunityList;
}
public List<MetadataEntry> getMetadata() {
return metadata;
}
public void setMetadata(List<MetadataEntry> metadata) {
this.metadata = metadata;
}
public List<Bitstream> getBitstreams() {
return bitstreams;
}
public void setBitstreams(List<Bitstream> bitstreams) {
this.bitstreams = bitstreams;
}
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
package org.gesis.dda.feeder.ssoar.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class MetadataEntry {
private String key;
private String value;
private String language;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
}
package org.gesis.dda.feeder.ssoar.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ResourcePolicy {
public enum Action {
READ, WRITE, DELETE;
}
private Integer id;
private Action action;
private Integer epersonId;
private Integer groupId;
private Integer resourceId;
private String resourceType;
private String rpDescription;
private String rpName;
private String rpType;
private Date startDate;
private Date endDate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Action getAction() {
return action;
}