Skip to content

Commit

Permalink
Merge branch 'aiccra-staging' into AICCRA
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjitm committed Dec 17, 2024
2 parents 8b1a153 + 033dd8f commit 13337f2
Show file tree
Hide file tree
Showing 17 changed files with 400 additions and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ public final class APConstants {

public static final String IGNORE_NEWER_YEARS = "ignoreNewer";
public static final String DELIVERABLE_CRP_PROGRAM_OUTCOME_DEPRECATED = "DEPRECATED";
public static final String CRP_PROGRAM_OUTCOME_DEPRECATED = "DEPRECATED";

public static final int EXPECTED_OTHER_ALLIANCE_LEVER_ID = 9;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public interface DeliverableInfoDAO {
public List<DeliverableInfo> getDeliverablesInfoByPhase(Phase phase);


/**
* This method gets a list of DeliverableInfo that are active by a given phase, project and status
*
* @return a list from DeliverableInfo null if no exist records
*/
public List<DeliverableInfo> getDeliverablesInfoByPhaseProjectAndStatus(Phase phase, long projectId, long statusId);

/**
* This method gets a list of DeliverableInfo that are active by a given phase and project
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,36 @@ public List<DeliverableInfo> getDeliverablesInfoByPhase(Phase phase) {
return deliverableInfos;
}

@Override
public List<DeliverableInfo> getDeliverablesInfoByPhaseProjectAndStatus(Phase phase, long projectId, long statusId) {

StringBuilder query = new StringBuilder();
query.append("SELECT DISTINCT ");
query.append("di.id as id ");
query.append("FROM ");
query.append("deliverables_info AS di ");
query.append("INNER JOIN deliverables AS d ON d.id = di.deliverable_id ");
query.append("WHERE d.is_active = 1 AND ");
query.append("d.project_id IS NOT NULL AND ");
query.append("di.is_active = 1 AND ");
query.append("di.`id_phase` =" + phase.getId());
query.append(" AND d.project_id =" + projectId);
query.append(" AND di.status !=" + statusId);

List<Map<String, Object>> rList = super.findCustomQuery(query.toString());
List<DeliverableInfo> deliverableInfos = new ArrayList<>();

if (rList != null) {
for (Map<String, Object> map : rList) {
DeliverableInfo deliverableInfo = this.find(Long.parseLong(map.get("id").toString()));
deliverableInfos.add(deliverableInfo);
}
}

return deliverableInfos;
}


@Override
public List<DeliverableInfo> getDeliverablesInfoByProjectAndPhase(Phase phase, Project project) {
StringBuilder query = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ public interface DeliverableInfoManager {

public List<DeliverableInfo> getDeliverablesInfoByPhase(Phase phase);

/**
* This method gets a list of DeliverableInfo that are active by a given phase, project and status
*
* @return a list from DeliverableInfo null if no exist records
*/
public List<DeliverableInfo> getDeliverablesInfoByPhaseProjectAndStatus(Phase phase, long projectId, long statusId);

/**
* This method gets a list of DeliverableInfo that are active by a given phase and type
*
Expand All @@ -80,14 +87,14 @@ public interface DeliverableInfoManager {
*/
List<DeliverableInfo> getDeliverablesInfoByProjectAndPhaseWithSharedProjects(Phase phase, Project project);


/**
* This method gets a list of DeliverableInfo that are active by a given phase and type
*
* @return a list from DeliverableInfo null if no exist records
*/
public List<DeliverableInfo> getDeliverablesInfoByType(Phase phase, DeliverableType deliverableType);


public boolean isDeliverableSubcategoryIncludedWebsite(long deliverableID, Phase phase);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ public List<DeliverableInfo> getDeliverablesInfoByPhase(Phase phase) {
return deliverableInfoDAO.getDeliverablesInfoByPhase(phase);
}

@Override
public List<DeliverableInfo> getDeliverablesInfoByPhaseProjectAndStatus(Phase phase, long projectId, long statusId) {
return deliverableInfoDAO.getDeliverablesInfoByPhaseProjectAndStatus(phase, projectId, statusId);
}


@Override
public List<DeliverableInfo> getDeliverablesInfoByProjectAndPhase(Phase phase, Project project) {
return deliverableInfoDAO.getDeliverablesInfoByProjectAndPhase(phase, project);
Expand All @@ -116,7 +122,6 @@ public List<DeliverableInfo> getDeliverablesInfoByType(Phase phase, DeliverableT
return deliverableInfoDAO.getDeliverablesInfoByType(phase, deliverableType);
}


@Override
public boolean isDeliverableSubcategoryIncludedWebsite(long deliverableID, Phase phase) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,22 +658,40 @@ public String getInnovationsComposedName() {
}

try {
handle = deliverableTemp.getDeliverableMetadataElements().stream()
.filter(me -> me != null && me.getMetadataElement() != null && me.getMetadataElement().getId() != null
&& me.getMetadataElement().getId().longValue() == 35L && me.getDeliverable().getId().equals(this.getId())
&& !StringUtils.isBlank(me.getElementValue()))
.findFirst().orElse(null).getElementValue();
if (handle == null || handle.isEmpty()) {
handle = "Not defined";
if (deliverableTemp.getDeliverableMetadataElements() != null && this.getDeliverableInfo().getPhase() != null) {
deliverableTemp.setMetadataElements(new ArrayList<>(deliverableTemp.getDeliverableMetadataElements().stream()
.filter(c -> c.isActive() && c.getPhase().equals(this.getDeliverableInfo().getPhase())
&& c.getMetadataElement() != null && c.getMetadataElement().getId() != null
&& c.getMetadataElement().getId().longValue() == 35L && c.getDeliverable().getId().equals(this.getId())
&& !StringUtils.isBlank(c.getElementValue()))
.collect(Collectors.toList())));
if (deliverableTemp.getMetadataElements() != null && deliverableTemp.getMetadataElements().get(0) != null
&& deliverableTemp.getMetadataElements().get(0).getElementValue() != null
&& !deliverableTemp.getMetadataElements().get(0).getElementValue().isEmpty()) {
handle = "<p><small style=\"width: 100%;\">Handle: <a href=\""
+ deliverableTemp.getMetadataElements().get(0).getElementValue() + "\" target=\"_blank\">"
+ deliverableTemp.getMetadataElements().get(0).getElementValue();
}
}

} catch (Exception e) {
// error
}
try {

if (deliverableTemp.getDeliverableDisseminations() != null) {
deliverableTemp.setDisseminations(new ArrayList<>(deliverableTemp.getDeliverableDisseminations().stream()
.filter(c -> c.isActive() && c.getPhase().equals(this.getDeliverableInfo().getPhase()))
.collect(Collectors.toList())));
if (!deliverableTemp.getDisseminations().isEmpty()) {
deliverableTemp.setDissemination(deliverableTemp.getDisseminations().get(0));
} else {
deliverableTemp.setDissemination(new DeliverableDissemination());
}
}
if (deliverableTemp.getDissemination() != null
&& deliverableTemp.getDissemination().getDisseminationChannelName() != null) {
disseminationChannel = deliverableTemp.getDissemination().getDisseminationChannelName();
&& deliverableTemp.getDissemination().getDisseminationChannelName() != null
&& !deliverableTemp.getDissemination().getDisseminationChannelName().isEmpty()) {
disseminationChannel = " (" + deliverableTemp.getDissemination().getDisseminationChannelName() + ")";
}
} catch (Exception e) {
// error
Expand Down Expand Up @@ -735,9 +753,8 @@ public String getInnovationsComposedName() {
statusInfo = statusInfo.trim();
}
return "<div class=\"option_deliverable_inner_select_innovation\">" + "<p>D" + this.getId() + " - "
+ this.getDeliverableInfo().getTitle() + "</p>" + "<small style=\"width: 100%;\">Handle: <a href=\""
+ this.getDeliverableInfo().getTitle() + "\" target=\"_blank\">" + this.getDeliverableInfo().getTitle()
+ "</a></small>" + "<small style=\"width: 100%;\">Type: " + deliverableType + "</small>" + "</div>";
+ this.getDeliverableInfo().getTitle() + disseminationChannel + "</p>" + handle + "</a></small></p>"
+ "<small style=\"width: 100%;\">Type: " + deliverableType + "</small>" + "</div>";

} catch (Exception e) {
return "<b> (D" + this.getId() + ") </b> - " + this.getDeliverableInfo().getTitle();
Expand Down
Loading

0 comments on commit 13337f2

Please sign in to comment.