Skip to content

Commit

Permalink
🔧 chore(OICRs): Get soil indicators from database
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjitm committed Feb 21, 2024
1 parent 4e190b3 commit 7354127
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import org.cgiar.ccafs.marlo.data.manager.RepositoryChannelManager;
import org.cgiar.ccafs.marlo.data.manager.ShfrmPriorityActionManager;
import org.cgiar.ccafs.marlo.data.manager.ShfrmSubActionManager;
import org.cgiar.ccafs.marlo.data.manager.SoilIndicatorManager;
import org.cgiar.ccafs.marlo.data.manager.UserManager;
import org.cgiar.ccafs.marlo.data.model.Activity;
import org.cgiar.ccafs.marlo.data.model.CgiarCrossCuttingMarker;
Expand Down Expand Up @@ -147,6 +148,7 @@
import org.cgiar.ccafs.marlo.data.model.RepositoryChannel;
import org.cgiar.ccafs.marlo.data.model.ShfrmPriorityAction;
import org.cgiar.ccafs.marlo.data.model.ShfrmSubAction;
import org.cgiar.ccafs.marlo.data.model.SoilIndicator;
import org.cgiar.ccafs.marlo.data.model.User;
import org.cgiar.ccafs.marlo.security.Permission;
import org.cgiar.ccafs.marlo.utils.APConfig;
Expand Down Expand Up @@ -261,6 +263,7 @@ public class DeliverableAction extends BaseAction {
private ShfrmSubActionManager shfrmSubActionManager;
private DeliverableShfrmPriorityActionManager deliverableShfrmPriorityActionManager;
private DeliverableShfrmSubActionManager deliverableShfrmSubActionManager;
private SoilIndicatorManager soilIndicatorManager;

// Variables
private List<DeliverableQualityAnswer> answers;
Expand Down Expand Up @@ -310,6 +313,7 @@ public class DeliverableAction extends BaseAction {
private String DOI;
private String handle;
private String disseminationURL;
private String soilIndicatorsText;


private List<RepIndGenderYouthFocusLevel> focusLevels;
Expand Down Expand Up @@ -363,7 +367,7 @@ public DeliverableAction(APConfig config, DeliverableTypeManager deliverableType
DeliverableTraineesIndicatorManager deliverableTraineesIndicatorManager,
ShfrmPriorityActionManager shfrmPriorityActionManager, ShfrmSubActionManager shfrmSubActionManager,
DeliverableShfrmPriorityActionManager deliverableShfrmPriorityActionManager,
DeliverableShfrmSubActionManager deliverableShfrmSubActionManager) {
DeliverableShfrmSubActionManager deliverableShfrmSubActionManager, SoilIndicatorManager soilIndicatorManager) {
super(config);
this.activityManager = activityManager;
this.deliverableManager = deliverableManager;
Expand Down Expand Up @@ -429,6 +433,7 @@ public DeliverableAction(APConfig config, DeliverableTypeManager deliverableType
this.shfrmSubActionManager = shfrmSubActionManager;
this.deliverableShfrmPriorityActionManager = deliverableShfrmPriorityActionManager;
this.deliverableShfrmSubActionManager = deliverableShfrmSubActionManager;
this.soilIndicatorManager = soilIndicatorManager;
}

/**
Expand All @@ -450,6 +455,7 @@ public DeliverableClusterParticipant actualDeliverableClusterParticipant() {
}
}


@Override
public String cancel() {

Expand All @@ -474,6 +480,7 @@ public String cancel() {
return SUCCESS;
}


public Boolean candEditExpectedYear(long deliverableID) {
Deliverable deliverable = deliverableManager.getDeliverableById(deliverableID);

Expand Down Expand Up @@ -680,6 +687,27 @@ public void fillClusterParticipantsList() {
}
}

public void fillSoilIndicatorsText() {
try {
soilIndicatorsText = null;
List<SoilIndicator> soilIndicators = soilIndicatorManager.findAll();
if (soilIndicators != null && !soilIndicators.isEmpty()) {
for (SoilIndicator soilIndicator : soilIndicators) {
if (soilIndicator != null && soilIndicator.getIndicatorName() != null) {
if (soilIndicatorsText == null) {
soilIndicatorsText = soilIndicator.getIndicatorName();
} else {
soilIndicatorsText.concat(", " + soilIndicator.getIndicatorName());
}
}

}
}
} catch (Exception e) {
Log.info("error getting soil indicators " + e);
}
}

public void fillSubActionsGeneralList() {
try {
if (shfrmPriorityActions != null && !shfrmPriorityActions.isEmpty()) {
Expand Down Expand Up @@ -762,7 +790,6 @@ public List<Activity> getActivities() {
return activities;
}


/**
* Get the ID of the clusterParticipantObject for this cluster in actual phase
*
Expand All @@ -784,15 +811,16 @@ public long getActualClusterParticipantID() {
}
}


public List<DeliverableQualityAnswer> getAnswers() {
return answers;
}


public List<DeliverableQualityAnswer> getAnswersDataDic() {
return answersDataDic;
}


private Path getAutoSaveFilePath() {

// get the class simple name
Expand Down Expand Up @@ -930,20 +958,20 @@ public GlobalUnit getLoggedCrp() {
return loggedCrp;
}


public List<Project> getMyProjects() {
return myProjects;
}


public List<Institution> getPartnerInstitutions() {
return partnerInstitutions;
}


public List<ProjectPartnerPerson> getPartnerPersons() {
return partnerPersons;
}


public List<ProjectPartner> getPartners() {
return partners;
}
Expand Down Expand Up @@ -1038,6 +1066,10 @@ public List<ShfrmPriorityAction> getShfrmPriorityActions() {
return shfrmPriorityActions;
}

public String getSoilIndicatorsText() {
return soilIndicatorsText;
}

public Map<String, String> getStatus() {
return status;
}
Expand Down Expand Up @@ -1584,7 +1616,7 @@ public void prepare() throws Exception {
}
}


this.fillSoilIndicatorsText();
}

// Expected Study Geographic Regions List
Expand Down Expand Up @@ -4426,6 +4458,10 @@ public void setShfrmPriorityActions(List<ShfrmPriorityAction> shfrmPriorityActio
this.shfrmPriorityActions = shfrmPriorityActions;
}

public void setSoilIndicatorsText(String soilIndicatorsText) {
this.soilIndicatorsText = soilIndicatorsText;
}

public void setStatus(Map<String, String> status) {
this.status = status;
}
Expand Down
1 change: 1 addition & 0 deletions marlo-web/src/main/resources/custom/aicrra.properties
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ deliverable.shfrmContribution.priorityAction=To which priority action of the SHF
deliverable.shfrmContribution.priorityAction.help=Select a priority action
deliverable.shfrmContribution.subAction=To which specific sub-action of the SHFRM is this deliverable contributing to?
deliverable.shfrmContribution.subAction.help=Select sub-action(s)
deliverable.shfrmContribution.indicators.help=Soil Indicator(s):

intellectualAsset.fillingType=Type of filling
intellectualAsset.patentStatus=Patent status
Expand Down
1 change: 1 addition & 0 deletions marlo-web/src/main/resources/global.properties
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ deliverable.shfrmContribution.priorityAction=To which priority action of the SHF
deliverable.shfrmContribution.priorityAction.help=Select a priority action
deliverable.shfrmContribution.subAction=To which specific sub-action of the SHFRM is this deliverable contributing to?
deliverable.shfrmContribution.subAction.help=Select sub-action(s)
deliverable.shfrmContribution.indicators.help=Soil Indicator(s):

intellectualAsset.fillingType=Type of filling
intellectualAsset.patentStatus=Patent status
Expand Down

0 comments on commit 7354127

Please sign in to comment.