Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
DJWalker42 committed Feb 12, 2025
2 parents 535efc9 + f7140df commit 23742d3
Showing 1 changed file with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,44 @@ public class SubmittedProposalResource extends ObjectResourceBase{
ProposalDocumentStore proposalDocumentStore;

@GET
@Operation(summary = "get the identifiers for the SubmittedProposals in the ProposalCycle")
@Operation(summary = "get the identifiers for the SubmittedProposals in the ProposalCycle, note optional use of sourceProposalId overrides title and investigatorName")
public List<ObjectIdentifier> getSubmittedProposals(
@PathParam("cycleCode") Long cycleCode,
@RestQuery String title,
@RestQuery String investigatorName
@RestQuery String investigatorName,
@RestQuery Long sourceProposalId
)
{
String qlString = getQlString(cycleCode, title, investigatorName);

Query query = em.createQuery(qlString);
if (sourceProposalId != null) {
String qlString = getQlString(cycleCode);
Query query = em.createQuery(qlString);
query.setParameter("sourceProposalId", sourceProposalId);
return getObjectIdentifiersAlt(query);

if (investigatorName != null) query.setParameter("investigatorName", investigatorName);
if (title != null) query.setParameter("title", title);
} else {

return getObjectIdentifiersAlt(query);
String qlString = getQlString(cycleCode, title, investigatorName);
Query query = em.createQuery(qlString);
if (investigatorName != null) query.setParameter("investigatorName", investigatorName);
if (title != null) query.setParameter("title", title);
return getObjectIdentifiersAlt(query);

}

}

private String getQlString(Long cycleCode) {
String baseStr = "select distinct s._id,cast(s.submissionDate as string),s.title "
+ "from ProposalCycle c "
+ "inner join c.submittedProposals s "
+ "inner join s.relatedProposals r "
+ "where c._id=" + cycleCode + " "
+ "and r.proposal._id = :sourceProposalId ";

String orderByStr = "order by s._id";

return baseStr + orderByStr;
}

private static String getQlString(Long cycleCode, String title, String investigatorName) {
Expand Down

0 comments on commit 23742d3

Please sign in to comment.