Skip to content
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

Story/cite 177: There needs to be an import from Crossref #271

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

PradnyaC11
Copy link
Contributor

@PradnyaC11 PradnyaC11 commented Jun 13, 2024

Guidelines for Pull Requests

If you haven't yet read our code review guidelines, please do so, You can find them here.

Please confirm the following by adding an x for each item (turn [ ] into [x]).

  • I have removed all code style changes that are not necessary (e.g. changing blanks across the whole file that don’t need to be changed, adding empty lines in parts other than your own code)
  • I am not making any changes to files that don’t have any effect (e.g. imports added that don’t need to be added)
  • I do not have any sysout statements in my code or commented out code that isn’t needed anymore
  • I am not reformatting any files in the wrong format or without cause.
  • I am not changing file encoding or line endings to something else than UTF-8, LF
  • My pull request does not show an insane amount of files being changed although my ticket only requires a few files being changed
  • I have added Javadoc/documentation where appropriate
  • I have added test cases where appropriate
  • I have explained any part of my code/implementation decisions that is not be self-explanatory

Please provide a brief description of your ticket

The user should be able to search in crossref to references to import. whatever search results from Crossref a user selects should then be imported into citesphere. This could be all search results or just a few or one.

For now, let's put add an entry to the import menu and let the user select which group to import the results into from a dropdown menu.

The importing should be done from Citesphere Importer (not Citesphere), similar how entries from files are imported.

For querying crossref, this library should be used: https://github.com/diging/crossref-connect. However, this is not yet released into maven central, so talk to Julia before picking up this ticket.

... Put ticket description here and add link to ticket ...
https://diging.atlassian.net/browse/CITE-177

Are there any other pull requests that this one depends on?

diging/citesphere-importer#22
diging/citesphere-messages#12

Anything else the reviewer needs to know?

... describe here ...

@diging-jenkins
Copy link

Can one of the admins verify this patch?

@PradnyaC11 PradnyaC11 changed the title Story/cite 177 Story/cite 177: There needs to be an import from Crossref Jun 13, 2024
@PradnyaC11 PradnyaC11 requested a review from jdamerow June 13, 2024 19:05
@PradnyaC11 PradnyaC11 marked this pull request as draft June 13, 2024 21:10
@PradnyaC11 PradnyaC11 marked this pull request as ready for review June 13, 2024 22:41
<citesphere.model.version>1.19</citesphere.model.version>
<crossref-connect-version>0.1</crossref-connect-version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason citesphere uses a different version than the importer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed version to 0.3-SNAPSHOT, which is latest version in both repositories.

Map<String, Object> response = new HashMap<>();
try {
jobManager.createJob((IUser) authentication.getPrincipal(), groupId, dois);
System.out.println("=============================================================================================================");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow our testing naming convention

@jdamerow jdamerow closed this Jun 25, 2024
@PradnyaC11 PradnyaC11 reopened this Jul 2, 2024
@PradnyaC11 PradnyaC11 requested a review from jdamerow July 2, 2024 22:54
<citesphere.model.version>1.19</citesphere.model.version>
<crossref-connect-version>0.3-SNAPSHOT</crossref-connect-version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is not 0.3-SNAPSHOT version. if you made changes to this plugin, there needs to be a pr (and that needs to be linked here).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to 0.2 as citesphere-import

</div>
<div id="failAlert" style="display: none;" class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">x</span></button>
Import Failed! Please check the logs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no logs the user could check, so this message is confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the message to actual error received from controller.

assertNotNull(job);
assertEquals(JobStatus.FAILURE, job.getStatus());
assertEquals(1, job.getPhases().size());
assertEquals("Error creating message", job.getPhases().get(0).getMessage());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not worth checking; if the text changes the method logic won't change but it'll make the test fail.

@jdamerow jdamerow closed this Jul 10, 2024
@PradnyaC11 PradnyaC11 reopened this Jul 11, 2024
@PradnyaC11 PradnyaC11 requested a review from jdamerow July 11, 2024 23:48
ArrayNode doisNode = mapper.createArrayNode();
((IImportCrossrefJob)job).getDois().forEach(d -> doisNode.add(d));
node.set("dois", doisNode);
node.put("groupId", ((IImportCrossrefJob)job).getCitationGroup());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's time to clean this up. let's create a map that maps object type to methods that are then called here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still

$("#failAlert").show();
}
}
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something is off with the indentation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@jdamerow jdamerow closed this Aug 1, 2024
@PradnyaC11 PradnyaC11 reopened this Aug 5, 2024
ArrayNode doisNode = mapper.createArrayNode();
((IImportCrossrefJob)job).getDois().forEach(d -> doisNode.add(d));
node.set("dois", doisNode);
node.put("groupId", ((IImportCrossrefJob)job).getCitationGroup());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still

$("#failAlert").show();
}
}
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@jdamerow jdamerow closed this Sep 4, 2024
@PradnyaC11 PradnyaC11 reopened this Sep 6, 2024
List<String> doisList = new ArrayList<>();
((IImportCrossrefJob)job).getDois().forEach(d -> doisList.add(d));
reponse.put("dois", doisList);
reponse.put("groupId", ((IImportCrossrefJob)job).getCitationGroup());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where the comment went, but I made one here before about handling this differently (put the code in methods and map those to job types).

@jdamerow jdamerow closed this Sep 10, 2024
} else if (job instanceof IExportJob) {
handleExportJob(response, (IExportJob) job);
} else if (job instanceof IImportCrossrefJob) {
handleImportCrossrefJob(response, (IImportCrossrefJob) job);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's time to clean this up. let's create a map that maps object type to methods that are then called here.

Create a map and map class to method, then call map.get(job.getClass()) to get method to execute.

@jdamerow jdamerow closed this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants