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())) {
Object linkedObject = readMethod.invoke(data);
if (linkedObject instanceof RestAddressableModel
&& linkRest.linkClass().isAssignableFrom(linkedObject.getClass())) {
if (linkedObject instanceof RestAddressableModel) {
linkToSubResource = utils
.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
public EPersonRest getEPersonRest() {
return ePersonRest;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -54,12 +54,4 @@ public @interface LinkRest {
* @return the method name, or the empty string if unspecified by the annotation.
*/
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;
}
@LinkRest(linkClass = RelationshipTypeRest.class)
@LinkRest
@JsonIgnore
public RelationshipTypeRest getRelationshipType() {
return relationshipType;

View File

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

View File

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

View File

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