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 172 - From the managed authority page, there should be a link that lists all citations that reference that authority #272

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

Conversation

PradnyaC11
Copy link
Contributor

@PradnyaC11 PradnyaC11 commented Jun 18, 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

Authorities are used for editors, authors, etc. The managed authority page lists all authorities used by a user or group. When I'm on the managed authority page, there should be a link for each authority that brings up all the citations that use that specific authority.

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

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

diging/citesphere-model#55

Anything else the reviewer needs to know?

... describe here ...

@diging-jenkins
Copy link

Can one of the admins verify this patch?

@PradnyaC11 PradnyaC11 requested a review from jdamerow June 18, 2024 22:18
@jdamerow
Copy link
Member

top part of PR is not completely filled out.

@jdamerow jdamerow closed this Jun 26, 2024
@PradnyaC11 PradnyaC11 reopened this Jul 2, 2024
@@ -25,7 +25,7 @@
<spring.kafka.version>2.2.6.RELEASE</spring.kafka.version>
<spring-social-zotero.version>0.12</spring-social-zotero.version>
<citesphere.messages.version>0.4</citesphere.messages.version>
<citesphere.model.version>1.19</citesphere.model.version>
<citesphere.model.version>1.22-SNAPSHOT</citesphere.model.version>
Copy link
Member

Choose a reason for hiding this comment

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

That's not a real version number.


@RequestMapping("/auth/authority/items")
public String showPage(Model model, @RequestParam("uri") String uri, Authentication authentication) {
userEntries = authorityService.findByUri((IUser) authentication.getPrincipal(), uri);
Copy link
Member

Choose a reason for hiding this comment

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

why is this variable called userEntries? It's not users that are held in this list.

userEntries = authorityService.findByUri((IUser) authentication.getPrincipal(), uri);

if(userEntries == null || userEntries.isEmpty()) {
logger.error("No entry found for URI: " + uri);
Copy link
Member

Choose a reason for hiding this comment

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

that would just mean there are no authority with the uri, it's not an exception in the system really. so no need to log as error, maybe info.

import edu.asu.diging.citesphere.model.transfer.impl.Citations;

@Service
public class AuthorityItemsService implements IAuthorityItemsService {
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 this is not part of the citation manager class? Also, tests are missing.

@jdamerow jdamerow closed this Sep 6, 2024
@PradnyaC11 PradnyaC11 reopened this Sep 24, 2024
@PradnyaC11 PradnyaC11 requested a review from jdamerow September 24, 2024 16:57
@jdamerow
Copy link
Member

Resolve conflicts please

@jdamerow jdamerow closed this Oct 25, 2024
@PradnyaC11 PradnyaC11 reopened this Oct 28, 2024

private final Logger logger = LoggerFactory.getLogger(getClass());

private List<IAuthorityEntry> authorityEntries = new ArrayList();
Copy link
Member

Choose a reason for hiding this comment

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

This class is a singleton, so using a global variable like this is a big no no (all request will have the same variable/share the same data).

authorityEntries = authorityService.findByUri((IUser) authentication.getPrincipal(), uri);

if(authorityEntries == null || authorityEntries.isEmpty()) {
logger.info("No entry found for URI: " + uri);
Copy link
Member

Choose a reason for hiding this comment

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

remove, this is not really useful here.

logger.error("Found multiple entries for URI: " + uri);
model.addAttribute("error", "Found multiple entries for URI: " + uri);
} else {
Citations citations = citationManager.findAuthorityItems(authorityEntries.get(0));
Copy link
Member

Choose a reason for hiding this comment

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

this seems to be missing the logged in person (only citations the user has access to should be shown).

@jdamerow jdamerow closed this Nov 26, 2024
@PradnyaC11 PradnyaC11 reopened this Dec 9, 2024

List<ICitation> filteredCitations = allCitations.stream()
.filter(citation -> groupIds.contains(citation.getGroup().toString()))
.collect(Collectors.toList());
Copy link
Member

Choose a reason for hiding this comment

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

this filtering should happen on the db level (when calling findCitationsByPersonUri)

@@ -506,6 +510,27 @@ public CitationPage getPrevAndNextCitation(IUser user, String groupId, String co
public void deleteLocalGroupCitations(String groupId) {
citationStore.deleteCitationByGroupId(groupId);
}

@Override
public Citations findAuthorityItems(IAuthorityEntry entry, IUser user) {
Copy link
Member

Choose a reason for hiding this comment

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

that's a confusing name. Why "items"? and it's not finding "authority items", it's finding citations that refer to the given authority, doesn't it?

Copy link
Member

Choose a reason for hiding this comment

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

also needs tests

@jdamerow jdamerow closed this Jan 9, 2025
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