add JavaDoc

This commit is contained in:
Mykhaylo
2021-10-08 15:06:21 +02:00
parent df7231e6b6
commit 62917409a4
6 changed files with 61 additions and 4 deletions

View File

@@ -55,6 +55,7 @@ import org.junit.Test;
public class CSVMetadataImportReferenceIT extends AbstractIntegrationTestWithDatabase {
//Common collection to utilize for test
private Collection col;
private Collection col1;
private Collection col2;
@@ -76,6 +77,10 @@ public class CSVMetadataImportReferenceIT extends AbstractIntegrationTestWithDat
.withName("Parent Community")
.build();
col = CollectionBuilder.createCollection(context, parentCommunity)
.withName("Collection")
.build();
col1 = CollectionBuilder.createCollection(context, parentCommunity)
.withEntityType("Person")
.withName("Collection 1")
@@ -83,7 +88,7 @@ public class CSVMetadataImportReferenceIT extends AbstractIntegrationTestWithDat
col2 = CollectionBuilder.createCollection(context, parentCommunity)
.withEntityType("Publication")
.withName("Collection 1")
.withName("Collection 2")
.build();
context.turnOffAuthorisationSystem();
@@ -149,6 +154,18 @@ public class CSVMetadataImportReferenceIT extends AbstractIntegrationTestWithDat
cleanupImportItems(items);
}
@Test
public void testSingleMdRefIntoCollectionWithoutEntityTypeTest() throws Exception {
String[] csv = {"id,dspace.entity.type,relation.isAuthorOfPublication,collection,dc.identifier.other",
"+,Person,," + col.getHandle() + ",0",
"+,Publication,dc.identifier.other:0," + col.getHandle() + ",1"};
Item[] items = runImport(csv);
assertRelationship(items[1], items[0], 1, "left", 0);
// remove created items
cleanupImportItems(items);
}
/**
* return an array of items given a representation of a CSV as a string array
*

View File

@@ -222,6 +222,16 @@ public class CollectionRestRepository extends DSpaceObjectRestRepository<Collect
}
}
/**
* Returns Collections for which the current user has 'submit' privileges.
*
* @param query The query used in the lookup
* @param entityTypeLabel The EntityType label object that will be used to limit the returned collection
* to those related to given entity type
* @param pageable The pagination information
* @return
* @throws SearchServiceException If search error
*/
@SearchRestMethod(name = "findSubmitAuthorizedByEntityType")
public Page<CollectionRest> findSubmitAuthorizedByEntityType(
@Parameter(value = "query") String query,
@@ -244,6 +254,16 @@ public class CollectionRestRepository extends DSpaceObjectRestRepository<Collect
}
}
/**
* Returns Collections for which the current user has 'submit' privileges limited by parent community.
*
* @param query The query used in the lookup
* @param communityUuid UUID of the parent community
* @param entityTypeLabel The EntityType label object that will be used to limit the returned collection
* to those related to given entity type
* @param pageable The pagination information
* @return
*/
@SearchRestMethod(name = "findSubmitAuthorizedByCommunityAndEntityType")
public Page<CollectionRest> findSubmitAuthorizedByCommunityAndEntityType(
@Parameter(value = "query") String query,

View File

@@ -63,6 +63,12 @@ public class EntityTypeRestRepository extends DSpaceRestRepository<EntityTypeRes
}
}
/**
* Retrieves all entity types related to the collections on which the current user can deposit.
*
* @param pageable The pagination information
* @return
*/
@SearchRestMethod(name = "findAllByAuthorizedCollection")
public Page<EntityTypeRest> findAllByAuthorizedCollection(Pageable pageable) {
try {
@@ -84,6 +90,13 @@ public class EntityTypeRestRepository extends DSpaceRestRepository<EntityTypeRes
}
}
/**
* Retrieves all entity types related to the collections
* on which the current user can deposit and supported by External provider
*
* @param pageable The pagination information
* @return
*/
@SearchRestMethod(name = "findAllByAuthorizedExternalSource")
public Page<EntityTypeRest> findAllByAuthorizedExternalSource(Pageable pageable) {
try {

View File

@@ -99,6 +99,14 @@ public class ExternalSourceRestRepository extends DSpaceRestRepository<ExternalS
return converter.toRestPage(externalSources, pageable, utils.obtainProjection());
}
/**
* Retrieves all ExternalDataProviders that supports the provided EntityType.
*
* @param context The relevant DSpace context
* @param pageable The pagination information
* @param entityType Entity type label
* @return
*/
@PreAuthorize("permitAll()")
@SearchRestMethod(name = "findByEntityType")
public Page<ExternalSourceRest> findByEntityType(Context context, Pageable pageable,

View File

@@ -24,7 +24,6 @@ import org.dspace.builder.EntityTypeBuilder;
import org.dspace.content.Community;
import org.dspace.content.EntityType;
import org.dspace.content.service.EntityTypeService;
import org.dspace.core.Constants;
import org.dspace.external.provider.AbstractExternalDataProvider;
import org.dspace.external.service.ExternalDataService;
import org.hamcrest.Matchers;

View File

@@ -75,7 +75,7 @@
<property name="supportedEntityTypes">
<list>
<value>Publication</value>
<value>unset</value>
<value>none</value>
</list>
</property>
</bean>
@@ -87,7 +87,7 @@
<property name="supportedEntityTypes">
<list>
<value>Publication</value>
<value>unset</value>
<value>none</value>
</list>
</property>
</bean>