-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: develop
Are you sure you want to change the base?
Conversation
Can one of the admins verify this patch? |
top part of PR is not completely filled out. |
citesphere/pom.xml
Outdated
@@ -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> |
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.
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); |
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.
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); |
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.
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 { |
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.
Is there a reason this is not part of the citation manager class? Also, tests are missing.
Resolve conflicts please |
|
||
private final Logger logger = LoggerFactory.getLogger(getClass()); | ||
|
||
private List<IAuthorityEntry> authorityEntries = new ArrayList(); |
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.
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); |
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.
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)); |
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.
this seems to be missing the logged in person (only citations the user has access to should be shown).
|
||
List<ICitation> filteredCitations = allCitations.stream() | ||
.filter(citation -> groupIds.contains(citation.getGroup().toString())) | ||
.collect(Collectors.toList()); |
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.
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) { |
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.
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?
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.
also needs tests
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]
).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 ...