Skip to content

Commit

Permalink
Review representation REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
hmiguim committed Jun 7, 2024
1 parent 378832c commit e6f9c13
Show file tree
Hide file tree
Showing 94 changed files with 2,953 additions and 2,631 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ public enum DateGranularity {
public static final String API_REST_V2_DOWNLOAD_HANDLER = "/binary";
public static final String API_REST_V2_REPRESENTATION_OTHER_METADATA = "/other-metadata";

// aips
public static final String API_REST_V2_AIPS = "api/v2/aips";

// transferred resource
public static final String API_REST_V2_RESOURCES = "api/v2/transfers/";
public static final String API_REST_V2_TRANSFERRED_RESOURCE_CREATE_RESOURCE = "create/resource";
Expand Down Expand Up @@ -1976,8 +1979,15 @@ public enum RODA_TYPE {
public static final String PERMISSION_METHOD_FIND_REPRESENTATION = "org.roda.wui.api.controllers.Browser.find(IndexedRepresentation)";
public static final String PERMISSION_METHOD_FIND_FILE = "org.roda.wui.api.controllers.Browser.find(IndexedFile)";
public static final String PERMISSION_METHOD_FIND_DIP = "org.roda.wui.api.controllers.Browser.find(IndexedDIP)";
public static final String PERMISSION_METHOD_FIND_TRANSFERRED_RESOURCE = "org.roda.wui.api.controllers.Browser.find(TransferredResource)";
public static final String PERMISSION_METHOD_FIND_RODA_MEMBER = "org.roda.wui.api.controllers.Browser.find(RodaMember)";
public static final String PERMISSION_METHOD_FIND_DISPOSAL_CONFIRMATION = "org.roda.wui.api.controllers.Browser.find(DisposalConfirmation)";
public static final String PERMISSION_METHOD_FIND_JOB_REPORT = "org.roda.wui.api.controllers.Browser.find(IndexedReport)";
public static final String PERMISSION_METHOD_FIND_JOB = "org.roda.wui.api.controllers.Browser.find(Job)";
public static final String PERMISSION_METHOD_FIND_NOTIFICATION = "org.roda.wui.api.controllers.Browser.find(Notification)";
public static final String PERMISSION_METHOD_FIND_RISK_INCIDENCE = "org.roda.wui.api.controllers.Browser.find(RiskIncidence)";
public static final String PERMISSION_METHOD_FIND_PRESERVATION_EVENT = "org.roda.wui.api.controllers.Browser.find(IndexedPreservationEvent)";
public static final String PERMISSION_METHOD_FIND_PRESERVATION_AGENT = "org.roda.wui.api.controllers.Browser.find(IndexedPreservationAgent)";
public static final String PERMISSION_METHOD_FIND_LOG_ENTRY = "org.roda.wui.api.controllers.Browser.find(LogEntry)";
public static final String PERMISSION_METHOD_FIND_REPRESENTATION_INFORMATION = "org.roda.wui.api.controllers.Browser.find(RepresentationInformation)";
public static final String PERMISSION_METHOD_FIND_RISK = "org.roda.wui.api.controllers.Browser.find(IndexedRisk)";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package org.roda.core.data.v2.index;

import java.io.Serial;
import java.io.Serializable;

import org.roda.core.data.v2.index.filter.Filter;
Expand All @@ -18,6 +19,7 @@
*/
public class CountRequest implements Serializable {

@Serial
private static final long serialVersionUID = -6793510712321710035L;

/** Class name of resources to return. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
package org.roda.core.data.v2.index;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
* @author Miguel Guimarães <[email protected]>
*/
public class IndexedFileRequest implements Serializable {
public class IndexedFileRequest extends IndexedRepresentationRequest {
@Serial
private static final long serialVersionUID = -2001647419031311764L;

private String aipId;
private String representationId;
private List<String> directoryPaths = new ArrayList<>();
private String fileId;

public IndexedFileRequest() {
}

public String getAipId() {
return aipId;
}

public void setAipId(String aipId) {
this.aipId = aipId;
}

public String getRepresentationId() {
return representationId;
}

public void setRepresentationId(String representationId) {
this.representationId = representationId;
// empty constructor
}

public List<String> getDirectoryPaths() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.roda.core.data.v2.index;

import java.io.Serial;
import java.io.Serializable;

/**
* @author Miguel Guimarães <[email protected]>
*/
public class IndexedRepresentationRequest implements Serializable {
@Serial
private static final long serialVersionUID = -345956922313791766L;

private String aipId;
private String representationId;

public IndexedRepresentationRequest() {
// empty constructor
}

public IndexedRepresentationRequest(String aipId, String representationId) {
this.aipId = aipId;
this.representationId = representationId;
}

public String getAipId() {
return aipId;
}

public void setAipId(String aipId) {
this.aipId = aipId;
}

public String getRepresentationId() {
return representationId;
}

public void setRepresentationId(String representationId) {
this.representationId = representationId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.roda.core.data.v2.index;

import java.io.Serial;
import java.io.Serializable;

/**
* @author Miguel Guimarães <[email protected]>
*/
public class SuggestRequest implements Serializable {

@Serial
private static final long serialVersionUID = -4752301854207083738L;

private String field;
private String query;
private boolean allowPartial;

public SuggestRequest() {
// empty constructor
}

public SuggestRequest(String field, String query, boolean allowPartial) {
this.field = field;
this.query = query;
this.allowPartial = allowPartial;
}

public String getQuery() {
return query;
}

public void setQuery(String query) {
this.query = query;
}

public String getField() {
return field;
}

public void setField(String field) {
this.field = field;
}

public boolean isAllowPartial() {
return allowPartial;
}

public void setAllowPartial(boolean allowPartial) {
this.allowPartial = allowPartial;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package org.roda.core.data.v2.ip;

import java.io.Serial;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
Expand All @@ -20,6 +21,7 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public class IndexedRepresentation extends Representation
implements IsIndexed, SetsUUID, HasPermissionFilters, HasStateFilter, HasInstanceID, HasInstanceName {
@Serial
private static final long serialVersionUID = -950545608880793468L;

private String uuid;
Expand All @@ -33,11 +35,13 @@ public class IndexedRepresentation extends Representation
private long numberOfSchemaFiles;

private String instanceName;
private boolean isLocalInstance = false;

private List<String> ancestors;

private Map<String, Object> fields;


public IndexedRepresentation() {
super();
}
Expand Down Expand Up @@ -139,6 +143,14 @@ public void setFields(Map<String, Object> fields) {
this.fields = fields;
}

public boolean isLocalInstance() {
return isLocalInstance;
}

public void setLocalInstance(boolean localInstance) {
isLocalInstance = localInstance;
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down Expand Up @@ -209,5 +221,4 @@ public List<String> liteFields() {
return Arrays.asList(RodaConstants.INDEX_UUID, RodaConstants.REPRESENTATION_AIP_ID,
RodaConstants.REPRESENTATION_ID);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
package org.roda.core.data.v2.ip.metadata;

import java.io.Serial;

import org.roda.core.data.common.RodaConstants;
import org.roda.core.data.v2.IsModelObject;

Expand All @@ -16,6 +18,7 @@
@jakarta.xml.bind.annotation.XmlRootElement(name = RodaConstants.RODA_OBJECT_DESCRIPTIVE_METADATA)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DescriptiveMetadata implements IsModelObject {
@Serial
private static final long serialVersionUID = 5460845130599998867L;

private String id;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.roda.core.data.v2.ip.metadata;

import java.io.Serial;
import java.io.Serializable;

/**
* @author Carlos Afonso <[email protected]>
*/
public class DescriptiveMetadataInfo implements Serializable {
@Serial
private static final long serialVersionUID = -9057023345058040380L;

private String id;
private String label;
private boolean hasHistory;

public DescriptiveMetadataInfo() {
// empty constructor
}

public DescriptiveMetadataInfo(String id, String label, boolean hasHistory) {
this.id = id;
this.label = label;
this.hasHistory = hasHistory;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getLabel() {
return label;
}

public void setLabel(String label) {
this.label = label;
}

public boolean hasHistory() {
return hasHistory;
}

public void setHasHistory(boolean hasHistory) {
this.hasHistory = hasHistory;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.roda.core.data.v2.ip.metadata;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
* @author Carlos Afonso <[email protected]>
*/
public class DescriptiveMetadataInfos implements Serializable {

@Serial
private static final long serialVersionUID = -4552881362783492103L;

private List<DescriptiveMetadataInfo> descriptiveMetadataInfoList = new ArrayList<>();

public DescriptiveMetadataInfos() {
// empty constructor
}
public DescriptiveMetadataInfos(List<DescriptiveMetadataInfo> descriptiveMetadataInfoList) {
this.descriptiveMetadataInfoList = descriptiveMetadataInfoList;
}


public List<DescriptiveMetadataInfo> getDescriptiveMetadataInfoList() {
return descriptiveMetadataInfoList;
}

public void setDescriptiveMetadataInfoList(List<DescriptiveMetadataInfo> descriptiveMetadataInfoList) {
this.descriptiveMetadataInfoList = descriptiveMetadataInfoList;
}

public void addObject(DescriptiveMetadataInfo descriptiveMetadataInfo) {
this.descriptiveMetadataInfoList.add(descriptiveMetadataInfo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@
*/
package org.roda.core.data.v2.ip.metadata;

import java.io.Serial;
import java.util.ArrayList;
import java.util.List;

import jakarta.xml.bind.annotation.XmlElement;

import org.roda.core.data.common.RodaConstants;
import org.roda.core.data.v2.common.RODAObjectList;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import jakarta.xml.bind.annotation.XmlElement;

/**
* @author Hélder Silva <[email protected]>
*/
@jakarta.xml.bind.annotation.XmlRootElement(name = RodaConstants.RODA_OBJECT_DESCRIPTIVE_METADATA_LIST)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DescriptiveMetadataList implements RODAObjectList<DescriptiveMetadata> {
@Serial
private static final long serialVersionUID = -2795788423413555545L;
private List<DescriptiveMetadata> metadataList;

Expand Down
Loading

0 comments on commit e6f9c13

Please sign in to comment.