DS-3533 Drop linkClass; unused

This commit is contained in:
Chris Wilper
2020-02-04 13:44:47 -05:00
parent 7d3885f939
commit 6ef0e165dc
17 changed files with 13 additions and 47 deletions

View File

@@ -57,8 +57,7 @@ public class DSpaceResourceHalLinkFactory extends HalLinkFactory<DSpaceResource,
if (StringUtils.isBlank(linkRest.method())) { if (StringUtils.isBlank(linkRest.method())) {
Object linkedObject = readMethod.invoke(data); Object linkedObject = readMethod.invoke(data);
if (linkedObject instanceof RestAddressableModel if (linkedObject instanceof RestAddressableModel) {
&& linkRest.linkClass().isAssignableFrom(linkedObject.getClass())) {
linkToSubResource = utils linkToSubResource = utils
.linkToSingleResource((RestAddressableModel) linkedObject, name); .linkToSingleResource((RestAddressableModel) linkedObject, name);

View File

@@ -56,7 +56,7 @@ public class AuthenticationStatusRest extends BaseObjectRest<Integer> {
} }
} }
@LinkRest(linkClass = EPersonRest.class, name = "eperson") @LinkRest(name = "eperson")
@JsonIgnore @JsonIgnore
public EPersonRest getEPersonRest() { public EPersonRest getEPersonRest() {
return ePersonRest; return ePersonRest;

View File

@@ -16,12 +16,10 @@ import org.dspace.app.rest.RestResourceController;
*/ */
@LinksRest(links = { @LinksRest(links = {
@LinkRest(name = AuthorityRest.ENTRIES, @LinkRest(name = AuthorityRest.ENTRIES,
linkClass = AuthorityEntryRest.class,
method = "query" method = "query"
), ),
@LinkRest( @LinkRest(
name = AuthorityRest.ENTRY, name = AuthorityRest.ENTRY,
linkClass = AuthorityEntryRest.class,
method = "getResource" method = "getResource"
) )
}) })

View File

@@ -18,12 +18,10 @@ import com.fasterxml.jackson.annotation.JsonProperty.Access;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = BitstreamRest.BUNDLE, name = BitstreamRest.BUNDLE,
linkClass = BundleRest.class,
method = "getBundle" method = "getBundle"
), ),
@LinkRest( @LinkRest(
name = BitstreamRest.FORMAT, name = BitstreamRest.FORMAT,
linkClass = BitstreamFormatRest.class,
method = "getFormat" method = "getFormat"
) )
}) })

View File

@@ -21,12 +21,10 @@ import org.dspace.app.rest.RestResourceController;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = BrowseIndexRest.ITEMS, name = BrowseIndexRest.ITEMS,
linkClass = ItemRest.class,
method = "listBrowseItems" method = "listBrowseItems"
), ),
@LinkRest( @LinkRest(
name = BrowseIndexRest.ENTRIES, name = BrowseIndexRest.ENTRIES,
linkClass = BrowseEntryRest.class,
method = "listBrowseEntries" method = "listBrowseEntries"
) )
}) })

View File

@@ -18,12 +18,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = BundleRest.BITSTREAMS, name = BundleRest.BITSTREAMS,
linkClass = BitstreamRest.class,
method = "getBitstreams" method = "getBitstreams"
), ),
@LinkRest( @LinkRest(
name = BundleRest.PRIMARY_BITSTREAM, name = BundleRest.PRIMARY_BITSTREAM,
linkClass = BitstreamRest.class,
method = "getPrimaryBitstream" method = "getPrimaryBitstream"
) )
}) })

View File

@@ -17,22 +17,18 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = CollectionRest.DEFAULT_ACCESS_CONDITIONS, name = CollectionRest.DEFAULT_ACCESS_CONDITIONS,
linkClass = ResourcePolicyRest.class,
method = "getDefaultAccessConditions" method = "getDefaultAccessConditions"
), ),
@LinkRest( @LinkRest(
name = CollectionRest.LICENSE, name = CollectionRest.LICENSE,
linkClass = LicenseRest.class,
method = "getLicense" method = "getLicense"
), ),
@LinkRest( @LinkRest(
name = CollectionRest.LOGO, name = CollectionRest.LOGO,
linkClass = BitstreamRest.class,
method = "getLogo" method = "getLogo"
), ),
@LinkRest( @LinkRest(
name = CollectionRest.MAPPED_ITEMS, name = CollectionRest.MAPPED_ITEMS,
linkClass = ItemRest.class,
method = "getMappedItems" method = "getMappedItems"
) )
}) })

View File

@@ -17,17 +17,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = CommunityRest.COLLECTIONS, name = CommunityRest.COLLECTIONS,
linkClass = CollectionRest.class,
method = "getCollections" method = "getCollections"
), ),
@LinkRest( @LinkRest(
name = CommunityRest.LOGO, name = CommunityRest.LOGO,
linkClass = BitstreamRest.class,
method = "getLogo" method = "getLogo"
), ),
@LinkRest( @LinkRest(
name = CommunityRest.SUBCOMMUNITIES, name = CommunityRest.SUBCOMMUNITIES,
linkClass = CommunityRest.class,
method = "getSubcommunities" method = "getSubcommunities"
) )
}) })

View File

@@ -22,7 +22,6 @@ import org.dspace.app.rest.RestResourceController;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = EPersonRest.GROUPS, name = EPersonRest.GROUPS,
linkClass = GroupRest.class,
method = "getGroups" method = "getGroups"
) )
}) })

View File

@@ -20,7 +20,6 @@ import org.dspace.app.rest.RestResourceController;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = GroupRest.GROUPS, name = GroupRest.GROUPS,
linkClass = GroupRest.class,
method = "getGroups" method = "getGroups"
) )
}) })

View File

@@ -156,7 +156,7 @@ public class HarvestedCollectionRest extends BaseObjectRest<Integer> {
this.lastHarvested = lastHarvested; this.lastHarvested = lastHarvested;
} }
@LinkRest(linkClass = HarvesterMetadataRest.class, name = "harvestermetadata") @LinkRest(name = "harvestermetadata")
@JsonIgnore @JsonIgnore
public HarvesterMetadataRest getMetadataConfigs() { public HarvesterMetadataRest getMetadataConfigs() {
return metadata_configs; return metadata_configs;

View File

@@ -19,27 +19,22 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = ItemRest.BUNDLES, name = ItemRest.BUNDLES,
linkClass = BundleRest.class,
method = "getBundles" method = "getBundles"
), ),
@LinkRest( @LinkRest(
name = ItemRest.MAPPED_COLLECTIONS, name = ItemRest.MAPPED_COLLECTIONS,
linkClass = CollectionRest.class,
method = "getMappedCollections" method = "getMappedCollections"
), ),
@LinkRest( @LinkRest(
name = ItemRest.OWNING_COLLECTION, name = ItemRest.OWNING_COLLECTION,
linkClass = CollectionRest.class,
method = "getOwningCollection" method = "getOwningCollection"
), ),
@LinkRest( @LinkRest(
name = ItemRest.RELATIONSHIPS, name = ItemRest.RELATIONSHIPS,
linkClass = RelationshipRest.class,
method = "getRelationships" method = "getRelationships"
), ),
@LinkRest( @LinkRest(
name = ItemRest.TEMPLATE_ITEM_OF, name = ItemRest.TEMPLATE_ITEM_OF,
linkClass = CollectionRest.class,
method = "getTemplateItemOf" method = "getTemplateItemOf"
) )
}) })

View File

@@ -54,12 +54,4 @@ public @interface LinkRest {
* @return the method name, or the empty string if unspecified by the annotation. * @return the method name, or the empty string if unspecified by the annotation.
*/ */
String method() default ""; String method() default "";
/**
* The class of object returned by invoking the link method. If a list or page is returned, this should
* specify the inner type.
*
* @return the class.
*/
Class linkClass();
} }

View File

@@ -56,7 +56,7 @@ public class RelationshipRest extends BaseObjectRest<Integer> {
this.leftId = leftId; this.leftId = leftId;
} }
@LinkRest(linkClass = RelationshipTypeRest.class) @LinkRest
@JsonIgnore @JsonIgnore
public RelationshipTypeRest getRelationshipType() { public RelationshipTypeRest getRelationshipType() {
return relationshipType; return relationshipType;

View File

@@ -123,7 +123,7 @@ public class RelationshipTypeRest extends BaseObjectRest<Integer> {
this.rightMaxCardinality = rightMaxCardinality; this.rightMaxCardinality = rightMaxCardinality;
} }
@LinkRest(linkClass = EntityTypeRest.class) @LinkRest
@JsonIgnore @JsonIgnore
public EntityTypeRest getLeftType() { public EntityTypeRest getLeftType() {
return leftType; return leftType;
@@ -133,7 +133,7 @@ public class RelationshipTypeRest extends BaseObjectRest<Integer> {
this.leftType = leftType; this.leftType = leftType;
} }
@LinkRest(linkClass = EntityTypeRest.class) @LinkRest
@JsonIgnore @JsonIgnore
public EntityTypeRest getRightType() { public EntityTypeRest getRightType() {
return rightType; return rightType;

View File

@@ -48,7 +48,7 @@ public class SubmissionDefinitionRest extends BaseObjectRest<String> {
this.panels = panels; this.panels = panels;
} }
@LinkRest(name = SubmissionSectionRest.ATTRIBUTE_NAME, linkClass = SubmissionSectionRest.class) @LinkRest(name = SubmissionSectionRest.ATTRIBUTE_NAME)
@JsonIgnore @JsonIgnore
public List<SubmissionSectionRest> getPanels() { public List<SubmissionSectionRest> getPanels() {
return panels; return panels;
@@ -77,7 +77,7 @@ public class SubmissionDefinitionRest extends BaseObjectRest<String> {
return CATEGORY; return CATEGORY;
} }
@LinkRest(linkClass = CollectionRest.class) @LinkRest
@JsonIgnore @JsonIgnore
public List<CollectionRest> getCollections() { public List<CollectionRest> getCollections() {
return collections; return collections;

View File

@@ -16,17 +16,14 @@ import org.dspace.app.rest.projection.Projection;
@LinksRest(links = { @LinksRest(links = {
@LinkRest( @LinkRest(
name = MockObjectRest.O_CHILDREN, name = MockObjectRest.O_CHILDREN,
linkClass = MockObjectRest.class,
method = "getMockObjectChildren" method = "getMockObjectChildren"
), ),
@LinkRest( @LinkRest(
name = MockObjectRest.A_CHILDREN, name = MockObjectRest.A_CHILDREN,
linkClass = MockObjectRest.class,
method = "getMockObjectChildren" method = "getMockObjectChildren"
), ),
@LinkRest( @LinkRest(
name = MockObjectRest.N_CHILDREN, name = MockObjectRest.N_CHILDREN,
linkClass = MockObjectRest.class,
method = "getMockObjectChildren" method = "getMockObjectChildren"
) )
}) })
@@ -87,7 +84,7 @@ public class MockObjectRest extends BaseObjectRest<Long> {
this.value = value; this.value = value;
} }
@LinkRest(linkClass = MockObjectRest.class) @LinkRest
public MockObjectRest getRestProp1() { public MockObjectRest getRestProp1() {
return restProp1; return restProp1;
} }
@@ -96,7 +93,7 @@ public class MockObjectRest extends BaseObjectRest<Long> {
this.restProp1 = restProp1; this.restProp1 = restProp1;
} }
@LinkRest(linkClass = MockObjectRest.class) @LinkRest
public MockObjectRest getRestProp2() { public MockObjectRest getRestProp2() {
return restProp2; return restProp2;
} }
@@ -105,7 +102,7 @@ public class MockObjectRest extends BaseObjectRest<Long> {
this.restProp2 = restProp2; this.restProp2 = restProp2;
} }
@LinkRest(linkClass = MockObjectRest.class) @LinkRest
public MockObjectRest getRestProp3() { public MockObjectRest getRestProp3() {
return restProp3; return restProp3;
} }
@@ -114,7 +111,7 @@ public class MockObjectRest extends BaseObjectRest<Long> {
this.restProp3 = restProp3; this.restProp3 = restProp3;
} }
@LinkRest(linkClass = MockObjectRest.class) @LinkRest
public MockObjectRest getRestProp4() { public MockObjectRest getRestProp4() {
return restProp4; return restProp4;
} }
@@ -123,7 +120,7 @@ public class MockObjectRest extends BaseObjectRest<Long> {
this.restProp4 = restProp4; this.restProp4 = restProp4;
} }
@LinkRest(linkClass = MockObjectRest.class, name = "restPropFive") @LinkRest(name = "restPropFive")
public MockObjectRest getRestProp5() { public MockObjectRest getRestProp5() {
return restProp5; return restProp5;
} }