-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ufal/be-collection2item-table-is-not-migrated #439
ufal/be-collection2item-table-is-not-migrated #439
Conversation
…-not-migrated' into ufal/be-collection2item-table-is-not-migrated
try { | ||
Object obj = parser.parse(new InputStreamReader(request.getInputStream())); | ||
|
||
for (Object entity : (JSONArray) obj) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I will add some control if obj is JSONArray
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check added
throw new RuntimeException("Context is null - cannot import item's mapped collections."); | ||
} | ||
|
||
// Load List of collection self links |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean single collection? If not, use collections
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not I think more collections, not one
List<DSpaceObject> listDsoFoundInRequest | ||
= utils.constructDSpaceObjectList(context, requestAsStringList); | ||
|
||
if (listDsoFoundInRequest.size() < 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use const for 1, but as you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used CollectionUtils.isEmpty(listDsoFoundInRequest)
instead
...e-server-webapp/src/main/java/org/dspace/app/rest/repository/ClarinItemImportController.java
Show resolved
Hide resolved
|
||
private boolean checkIfOwningCollection(Item item, UUID collectionID) { | ||
return item.getOwningCollection().getID().equals(collectionID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure that item has collection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a check
// It is owning collection | ||
String col1SelfLink = "https://localhost:8080/spring-rest/api/core/collections/" + col1.getID(); | ||
String col2SelfLink = "https://localhost:8080/spring-rest/api/core/collections/" + col2.getID(); | ||
String col3SelfLink = "https://localhost:8080/spring-rest/api/core/collections/" + col3.getID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use const for common parts of links
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinItemImportControllerIT.java
Show resolved
Hide resolved
dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinItemImportControllerIT.java
Show resolved
Hide resolved
* Created endpoint for importing item's mapped collections and created test for it * Fixed checkstyle issues * Fixed conflicts * refactoring * Refactoring according to request changes
Problem description
I have a big problem with parsing
Content-Type: 'text-uri'
, because it cannot recognize new line string\n
passed from Python. I wanted to use Vanilla endpoint"/api/core/items/{ITEM_UUI}/mappedCollections/"
at first, but after a few hours of failing I decided to create a new one/api/clarin/import/item/{ITEM_UUID}/mappedCollections
.