Example usage for org.apache.poi.xwpf.usermodel ParagraphAlignment CENTER

List of usage examples for org.apache.poi.xwpf.usermodel ParagraphAlignment CENTER

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel ParagraphAlignment CENTER.

Prototype

ParagraphAlignment CENTER

To view the source code for org.apache.poi.xwpf.usermodel ParagraphAlignment CENTER.

Click Source Link

Usage

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

public void createPageFooter() {
    CTP ctp = CTP.Factory.newInstance();

    // this add page number incremental
    ctp.addNewR().addNewPgNum();//from   www.  j a  va2  s .  c o m

    XWPFParagraph codePara = new XWPFParagraph(ctp, document);
    XWPFParagraph[] paragraphs = new XWPFParagraph[1];
    paragraphs[0] = codePara;

    // position of number
    codePara.setAlignment(ParagraphAlignment.CENTER);

    CTSectPr sectPr = document.getDocument().getBody().addNewSectPr();

    try {
        XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
        headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, paragraphs);
    } catch (IOException e) {
        LOG.error("Failed to createFooter. Exception: " + e.getMessage());
    }
}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

private void createTableC() {
    List<List<POIField>> headers = new ArrayList<>();
    POIField[] sHeader = {//from   ww w . j a v  a 2s  .c  o m
            new POIField(this.getText("crossCuttingDimensions.tableC.crossCutting"), ParagraphAlignment.CENTER),
            new POIField(this.getText("crossCuttingDimensions.tableC.principal"), ParagraphAlignment.CENTER),
            new POIField(this.getText("crossCuttingDimensions.tableC.significant"), ParagraphAlignment.CENTER),
            new POIField(this.getText("crossCuttingDimensions.tableC.notTargeted"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualreport.tablec.field5"), ParagraphAlignment.CENTER) };
    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);
    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;
    // Setup Table C
    tableC = reportSynthesisCrossCuttingDimensionManager.getTableC(this.getSelectedPhase(),
            this.getLoggedCrp());
    if (tableC != null) {
        POIField[] sData = { new POIField("Gender", ParagraphAlignment.LEFT),
                new POIField(percentageFormat.format(round(tableC.getPercentageGenderPrincipal() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField(percentageFormat.format(round(tableC.getPercentageGenderSignificant() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField(percentageFormat.format(round(tableC.getPercentageGenderNotScored() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField(String.valueOf((int) tableC.getTotal()), ParagraphAlignment.CENTER) };
        data = Arrays.asList(sData);
        datas.add(data);
        POIField[] sData2 = { new POIField("Youth", ParagraphAlignment.LEFT),
                new POIField(percentageFormat.format(round(tableC.getPercentageYouthPrincipal() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField(percentageFormat.format(round(tableC.getPercentageYouthSignificant() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField(percentageFormat.format(round(tableC.getPercentageYouthNotScored() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField("", ParagraphAlignment.LEFT) };
        data = Arrays.asList(sData2);
        datas.add(data);
        POIField[] sData3 = { new POIField("CapDev", ParagraphAlignment.LEFT),
                new POIField(percentageFormat.format(round(tableC.getPercentageCapDevPrincipal() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField(percentageFormat.format(round(tableC.getPercentageCapDevSignificant() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField(percentageFormat.format(round(tableC.getPercentageCapDevNotScored() / 100, 4)),
                        ParagraphAlignment.CENTER),
                new POIField("", ParagraphAlignment.LEFT) };
        data = Arrays.asList(sData3);
        datas.add(data);
    }

    poiSummary.textTable(document, headers, datas, true, "tableCAnnualReport");
}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

public void createTableD1() {
    List<List<POIField>> headers = new ArrayList<>();

    POIField[] sHeader = {/*from w  w w.ja v a 2 s.  c  o  m*/
            new POIField(this.getText("summaries.annualReport.tableD1.field1"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableD1.field2"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableD1.field3"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableD1.field4"), ParagraphAlignment.CENTER) };

    List<RepIndSynthesisIndicator> listRepIndSynthesis = repIndSynthesisIndicatorManager.findAll();
    List<ReportSynthesisIndicator> reportSynthesisIndicatorList = reportSynthesisPMU
            .getReportSynthesisIndicatorGeneral().getReportSynthesisIndicators().stream()
            .filter(si -> si.isActive() && si.getRepIndSynthesisIndicator() != null
                    && si.getRepIndSynthesisIndicator().isMarlo())
            .sorted((i1, i2) -> i1.getRepIndSynthesisIndicator().getIndicator()
                    .compareTo(i2.getRepIndSynthesisIndicator().getIndicator()))
            .collect(Collectors.toList());

    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);
    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;

    String lastType = "";

    if (listRepIndSynthesis != null && !listRepIndSynthesis.isEmpty()) {
        for (RepIndSynthesisIndicator repIndSynthesisIndicator : listRepIndSynthesis) {
            String type = "", indicator = "", name = "", dataRep = "", comments = "";

            if (type.equals(lastType)) {
                type = "";
            } else {
                lastType = type;
            }

            type = repIndSynthesisIndicator.getType();
            indicator = repIndSynthesisIndicator.getIndicator();
            name = repIndSynthesisIndicator.getName();

            if (reportSynthesisIndicatorList != null && !reportSynthesisIndicatorList.isEmpty()) {
                for (ReportSynthesisIndicator reportSynthesisIndicator : reportSynthesisIndicatorList) {
                    if (reportSynthesisIndicator.getRepIndSynthesisIndicator()
                            .getId() == repIndSynthesisIndicator.getId()) {

                        if (reportSynthesisIndicator.getData() != null) {
                            dataRep = reportSynthesisIndicator.getData();
                        }

                        if (reportSynthesisIndicator.getComment() != null) {
                            comments = reportSynthesisIndicator.getComment();
                        }

                    }
                }
            }

            Boolean bold = false;
            String blackColor = "000000";
            POIField[] sData = { new POIField(type, ParagraphAlignment.CENTER, bold, blackColor),
                    new POIField(indicator + "." + name, ParagraphAlignment.LEFT, bold, blackColor),
                    new POIField(dataRep, ParagraphAlignment.LEFT, bold, blackColor),
                    new POIField(comments, ParagraphAlignment.LEFT, bold, blackColor) };
            data = new ArrayList<>();
            data = Arrays.asList(sData);
            datas.add(data);
        }
    }
    poiSummary.textTable(document, headers, datas, true, "tableD1AnnualReport");

}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

private void createTableD2() {
    List<List<POIField>> headers = new ArrayList<>();
    POIField[] sHeader = {//  w  w  w  .ja v  a  2s.com
            new POIField(this.getText("summaries.annualReport.tableD2.field1"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableD2.field2"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableD2.field3"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableD2.field4"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableD2.field5"), ParagraphAlignment.CENTER), };
    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);

    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;

    flagshipPlannedInnovations = reportSynthesisCrossCuttingDimensionManager.getPlannedInnovationList(
            flagshipLiaisonInstitutions, this.getSelectedPhase().getId(), this.getLoggedCrp(), pmuInstitution);

    if (flagshipPlannedInnovations != null && !flagshipPlannedInnovations.isEmpty()) {
        for (ReportSynthesisCrossCuttingInnovationDTO reportSynthesisCrossCuttingInnovationDTO : flagshipPlannedInnovations
                .stream()
                .sorted((f1, f2) -> f1.getProjectInnovation().getProjectInnovationInfo(this.getSelectedPhase())
                        .getTitle().compareTo(f2.getProjectInnovation()
                                .getProjectInnovationInfo(this.getSelectedPhase()).getTitle()))
                .collect(Collectors.toList())) {
            String title = " ", stage = "", degree = " ", contribution = " ", geographicScope = " ";
            if (reportSynthesisCrossCuttingInnovationDTO.getProjectInnovation()
                    .getProjectInnovationInfo(this.getSelectedPhase()) != null) {
                ProjectInnovationInfo projectInnovationInfo = reportSynthesisCrossCuttingInnovationDTO
                        .getProjectInnovation().getProjectInnovationInfo(this.getSelectedPhase());
                title = projectInnovationInfo.getTitle() != null && !projectInnovationInfo.getTitle().isEmpty()
                        ? projectInnovationInfo.getTitle()
                        : this.getText("global.untitled");
                stage = projectInnovationInfo.getRepIndStageInnovation() != null
                        && projectInnovationInfo.getRepIndStageInnovation().getName() != null
                        && !projectInnovationInfo.getRepIndStageInnovation().getName().isEmpty()
                                ? projectInnovationInfo.getRepIndStageInnovation().getName()
                                : this.getText("global.untitled");
                if (projectInnovationInfo.getRepIndDegreeInnovation() != null) {
                    degree = projectInnovationInfo.getRepIndDegreeInnovation().getName();
                }
                if (projectInnovationInfo.getRepIndContributionOfCrp() != null) {
                    contribution = projectInnovationInfo.getRepIndContributionOfCrp().getName();
                }
                if (projectInnovationInfo.getRepIndGeographicScope() != null) {
                    geographicScope = projectInnovationInfo.getRepIndGeographicScope().getName();
                }

                if (title != null && stage != null && degree != null && contribution != null
                        && geographicScope != null) {
                    POIField[] sData = { new POIField(title, ParagraphAlignment.CENTER),
                            new POIField(stage, ParagraphAlignment.CENTER),
                            new POIField(degree, ParagraphAlignment.CENTER),
                            new POIField(contribution, ParagraphAlignment.CENTER),
                            new POIField(geographicScope, ParagraphAlignment.CENTER) };

                    data = Arrays.asList(sData);
                    datas.add(data);
                }
            }
        }
    }

    poiSummary.textTable(document, headers, datas, false, "tableD2AnnualReport");

}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

private void createTableE() {
    List<ReportSynthesisCrossCuttingAssetDTO> flagshipPlannedAssets = reportSynthesisCrossCuttingDimensionManager
            .getPlannedAssetsList(flagshipLiaisonInstitutions, this.getSelectedPhase().getId(),
                    this.getLoggedCrp(), pmuInstitution);
    List<List<POIField>> headers = new ArrayList<>();

    POIField[] sHeader = {//from  w w w. j  a  v a 2  s.  c om
            new POIField(this.getText("summaries.annualReport.tableE.field1"), ParagraphAlignment.LEFT),
            new POIField(this.getText("summaries.annualReport.tableE.field2"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableE.field3"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableE.field4"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableE.field5"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableE.field6"), ParagraphAlignment.CENTER) };

    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);
    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;

    if (flagshipPlannedAssets != null && !flagshipPlannedAssets.isEmpty()) {
        for (ReportSynthesisCrossCuttingAssetDTO reportSynthesisCrossCuttingAssetDTO : flagshipPlannedAssets) {
            String year = "", patent = "", applicant = "", aditional = "", registration = "",
                    communication = "", status = "";

            if (reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset().getDeliverable()
                    .getDeliverableInfo(this.getSelectedPhase()) != null) {
                if (reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset().getDeliverable()
                        .getDeliverableInfo().getStatus() != null
                        && reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                                .getDeliverable().getDeliverableInfo().getStatus() != -1) {
                    status = ProjectStatusEnum
                            .getValue(reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                                    .getDeliverable().getDeliverableInfo().getStatus())
                            .getStatus();
                }
                if (status.equals(ProjectStatusEnum.Extended.getStatus())) {
                    year = reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                            .getDeliverable().getDeliverableInfo().getNewExpectedYear() + "";
                } else {
                    year = reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                            .getDeliverable().getDeliverableInfo().getYear() + "";
                }
            }

            if (reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset().getApplicant() != null) {
                applicant = reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                        .getApplicant();
            }

            if (reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset().getType() != null) {
                patent = reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset().getTypeName();
            }
            if (reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                    .getAdditionalInformation() != null) {
                aditional = reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                        .getAdditionalInformation();
            }

            if (reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset().getLink() != null) {
                registration = reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset().getLink();
            }

            if (reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                    .getPublicCommunication() != null) {
                communication = reportSynthesisCrossCuttingAssetDTO.getDeliverableIntellectualAsset()
                        .getPublicCommunication();
            }

            POIField[] sData = { new POIField(year, ParagraphAlignment.CENTER),
                    new POIField(applicant, ParagraphAlignment.LEFT),
                    new POIField(patent, ParagraphAlignment.CENTER),
                    new POIField(aditional, ParagraphAlignment.LEFT),
                    new POIField(registration, ParagraphAlignment.LEFT),
                    new POIField(communication, ParagraphAlignment.LEFT) };
            data = Arrays.asList(sData);
            datas.add(data);
        }
    }
    poiSummary.textTable(document, headers, datas, false, "tableAAnnualReport");
}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

private void createTableF() {

    List<List<POIField>> headers = new ArrayList<>();
    POIField[] sHeader = {/* ww w. j  a  v  a2  s  . c  om*/
            new POIField(this.getText("financialPlan.tableF.expenditureArea") + "*", ParagraphAlignment.LEFT),
            new POIField(
                    this.getText("financialPlan.tableF.estimatedPercentage",
                            new String[] { String.valueOf(this.getSelectedYear()) }) + "**",
                    ParagraphAlignment.LEFT),
            new POIField(this.getText("financialPlan.tableF.comments2017"), ParagraphAlignment.LEFT) };

    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);

    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;

    if (reportSynthesisPMU.getReportSynthesisFundingUseSummary()
            .getReportSynthesisFundingUseExpendituryAreas() != null
            && !reportSynthesisPMU.getReportSynthesisFundingUseSummary()
                    .getReportSynthesisFundingUseExpendituryAreas().isEmpty()) {
        reportSynthesisPMU.getReportSynthesisFundingUseSummary()
                .setExpenditureAreas(new ArrayList<>(reportSynthesisPMU.getReportSynthesisFundingUseSummary()
                        .getReportSynthesisFundingUseExpendituryAreas().stream().filter(t -> t.isActive())
                        .sorted((f1, f2) -> f1.getId().compareTo(f2.getId())).collect(Collectors.toList())));
    } else {
        reportSynthesisPMU.getReportSynthesisFundingUseSummary().setExpenditureAreas(new ArrayList<>());
        List<PowbExpenditureAreas> expAreas = new ArrayList<>(
                powbExpenditureAreasManager.findAll().stream().filter(x -> x.isActive() && x.getIsExpenditure())
                        .sorted((f1, f2) -> f1.getId().compareTo(f2.getId())).collect(Collectors.toList()));
        for (PowbExpenditureAreas powbExpenditureAreas : expAreas) {
            ReportSynthesisFundingUseExpendituryArea fundingUseExpenditureArea = new ReportSynthesisFundingUseExpendituryArea();
            fundingUseExpenditureArea.setExpenditureArea(powbExpenditureAreas);
            reportSynthesisPMU.getReportSynthesisFundingUseSummary().getExpenditureAreas()
                    .add(fundingUseExpenditureArea);
        }
    }
    List<ReportSynthesisFundingUseExpendituryArea> reportSynthesisFundingUseExpendituryAreaList = reportSynthesisPMU
            .getReportSynthesisFundingUseSummary().getExpenditureAreas();
    Double totalEstimatedPercentajeFS = 0.0;
    if (reportSynthesisFundingUseExpendituryAreaList != null
            && !reportSynthesisFundingUseExpendituryAreaList.isEmpty()) {
        for (ReportSynthesisFundingUseExpendituryArea reportSynthesisFundingUseExpendituryArea : reportSynthesisFundingUseExpendituryAreaList) {

            String expenditureArea = "", commentsSpace = "";
            Double estimatedPercentajeFS = 0.0;
            expenditureArea = reportSynthesisFundingUseExpendituryArea.getExpenditureArea()
                    .getExpenditureArea() != null
                            ? reportSynthesisFundingUseExpendituryArea.getExpenditureArea().getExpenditureArea()
                            : "";
            estimatedPercentajeFS = reportSynthesisFundingUseExpendituryArea.getW1w2Percentage() != null
                    ? reportSynthesisFundingUseExpendituryArea.getW1w2Percentage()
                    : 0;
            commentsSpace = reportSynthesisFundingUseExpendituryArea.getComments() != null
                    ? reportSynthesisFundingUseExpendituryArea.getComments()
                    : "";

            totalEstimatedPercentajeFS += estimatedPercentajeFS;
            POIField[] sData = { new POIField(expenditureArea, ParagraphAlignment.LEFT),
                    new POIField(percentageFormat.format(round(estimatedPercentajeFS / 100, 4)),
                            ParagraphAlignment.CENTER),
                    new POIField(commentsSpace, ParagraphAlignment.LEFT) };
            data = Arrays.asList(sData);
            datas.add(data);
        }

    }

    Boolean bold = true;
    String blackColor = "000000";

    totalw1w2 = reportSynthesisFinancialSummaryBudgetManager
            .getTotalW1W2ActualExpenditure(reportSynthesisPMU.getId());

    POIField[] sData = { new POIField("TOTAL FUNDING (AMOUNT)***", ParagraphAlignment.LEFT, bold, blackColor),
            new POIField(
                    currencyFormat.format(round(((totalw1w2) * totalEstimatedPercentajeFS / 100) / 1000, 2)),
                    ParagraphAlignment.CENTER, bold, blackColor) };

    data = Arrays.asList(sData);
    datas.add(data);

    poiSummary.textTable(document, headers, datas, true, "tableFAnnualReport");
}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

private void createTableG() {
    List<List<POIField>> headers = new ArrayList<>();

    List<LiaisonInstitution> liaisonInstitutions = new ArrayList<>(this.getLoggedCrp().getLiaisonInstitutions()
            .stream()//from  w  w  w. j a va  2 s .  c  o  m
            .filter(c -> c.getCrpProgram() != null && c.isActive()
                    && c.getCrpProgram().getProgramType() == ProgramType.FLAGSHIP_PROGRAM_TYPE.getValue())
            .collect(Collectors.toList()));

    POIField[] sHeader = {
            new POIField(this.getText("summaries.annualReport.tableG.field1"), ParagraphAlignment.LEFT),
            new POIField(this.getText("summaries.annualReport.tableG.field2"), ParagraphAlignment.LEFT),
            new POIField(this.getText("summaries.annualReport.tableG.field3"), ParagraphAlignment.LEFT),
            new POIField(this.getText("summaries.annualReport.tableG.field4"), ParagraphAlignment.LEFT),
            new POIField(this.getText("summaries.annualReport.tableG.field5"), ParagraphAlignment.LEFT) };

    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);
    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;

    List<ReportSynthesisExternalPartnershipDTO> flagshipExternalPlannedList = reportSynthesisExternalPartnershipManager
            .getPlannedPartnershipList(liaisonInstitutions, this.getSelectedPhase().getId(),
                    this.getLoggedCrp(), pmuInstitution);

    if (flagshipExternalPlannedList != null && !flagshipExternalPlannedList.isEmpty()) {
        for (int i = 0; i < flagshipExternalPlannedList.size(); i++) {

            String FP = "", stage = "", partner = "", partnerType = "", mainArea = "";
            if (flagshipExternalPlannedList.get(i).getProjectPartnerPartnership() != null) {

                // **Getting flagships **/

                for (ProjectFocus projectFocuses : flagshipExternalPlannedList.get(i)
                        .getProjectPartnerPartnership().getProjectPartner().getProject().getProjectFocuses()
                        .stream()
                        .sorted((o1, o2) -> o1.getCrpProgram().getAcronym()
                                .compareTo(o2.getCrpProgram().getAcronym()))
                        .filter(c -> c.isActive()
                                && c.getCrpProgram().getProgramType() == ProgramType.FLAGSHIP_PROGRAM_TYPE
                                        .getValue()
                                && c.getPhase() != null && c.getPhase().equals(this.getSelectedPhase()))
                        .collect(Collectors.toList())) {
                    if (FP != "") {
                        FP += ", ";
                    }
                    FP += crpProgramManager.getCrpProgramById(projectFocuses.getCrpProgram().getId())
                            .getAcronym();

                }

                if (flagshipExternalPlannedList.get(i).getProjectPartnerPartnership().getProjectPartner()
                        .getInstitution().getName() != null
                        && !flagshipExternalPlannedList.get(i).getProjectPartnerPartnership()
                                .getProjectPartner().getInstitution().getName().isEmpty()) {
                    partner = flagshipExternalPlannedList.get(i).getProjectPartnerPartnership()
                            .getProjectPartner().getInstitution().getName();
                }
                if (flagshipExternalPlannedList.get(i).getProjectPartnerPartnership()
                        .getPartnershipResearchPhases() != null
                        && !flagshipExternalPlannedList.get(i).getProjectPartnerPartnership()
                                .getPartnershipResearchPhases().isEmpty()) {
                    for (int j = 0; j < flagshipExternalPlannedList.get(i).getProjectPartnerPartnership()
                            .getPartnershipResearchPhases().size(); j++) {

                        stage += flagshipExternalPlannedList.get(i).getProjectPartnerPartnership()
                                .getPartnershipResearchPhases().get(j).getRepIndPhaseResearchPartnership()
                                .getName() + "\n";
                    }
                }
                if (stage == null || stage.isEmpty()) {
                    stage = this.getText("global.untitled");
                }
                if (flagshipExternalPlannedList.get(i).getProjectPartnerPartnership().getMainArea() != null) {
                    mainArea = flagshipExternalPlannedList.get(i).getProjectPartnerPartnership().getMainArea();
                }
                partnerType = flagshipExternalPlannedList.get(i).getProjectPartnerPartnership()
                        .getProjectPartner().getInstitution().getInstitutionType().getRepIndOrganizationType()
                        .getName();

                POIField[] sData = { new POIField(FP, ParagraphAlignment.CENTER),
                        new POIField(stage, ParagraphAlignment.CENTER),
                        new POIField(partner, ParagraphAlignment.CENTER),
                        new POIField(partnerType, ParagraphAlignment.CENTER),
                        new POIField(mainArea, ParagraphAlignment.LEFT) };
                data = Arrays.asList(sData);
                datas.add(data);
            }
        }
    }
    poiSummary.textTable(document, headers, datas, false, "tableAAnnualReport");
}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

private void createTableH() {
    List<List<POIField>> headers = new ArrayList<>();
    POIField[] sHeader = {//  w  w  w .j a  v  a2s  .  c o  m
            new POIField(this.getText("summaries.annualReport.tableG.crpName"), ParagraphAlignment.LEFT),
            new POIField(this.getText("summaries.annualReport.tableG.description"), ParagraphAlignment.LEFT),
            new POIField(this.getText("summaries.annualReport.tableG.relevantFP"), ParagraphAlignment.LEFT) };
    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);

    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;

    List<ReportSynthesisCrossCgiarCollaboration> reportSynthesisCrossCgiarCollaborationList = reportSynthesisCrossCgiarCollaborationManager
            .getFlagshipCollaborations(flagshipLiaisonInstitutions, this.getSelectedPhase().getId());
    if (reportSynthesisCrossCgiarCollaborationList != null
            && !reportSynthesisCrossCgiarCollaborationList.isEmpty()) {
        for (ReportSynthesisCrossCgiarCollaboration reportSynthesisCrossCgiarCollaboration : reportSynthesisCrossCgiarCollaborationList) {
            String crpPlatform = " ", descriptionCollaboration = " ", relevantFP = " ";

            if (reportSynthesisCrossCgiarCollaboration.getGlobalUnit().getAcronym() != null) {
                crpPlatform = reportSynthesisCrossCgiarCollaboration.getGlobalUnit().getAcronym();
            }

            if (reportSynthesisCrossCgiarCollaboration.getDescription() != null) {
                descriptionCollaboration = reportSynthesisCrossCgiarCollaboration.getDescription();
            }

            if (reportSynthesisCrossCgiarCollaboration.getFlagship() != null) {
                relevantFP = reportSynthesisCrossCgiarCollaboration.getFlagship();
            }

            POIField[] sData = { new POIField(crpPlatform, ParagraphAlignment.CENTER),
                    new POIField(descriptionCollaboration, ParagraphAlignment.LEFT),
                    new POIField(relevantFP, ParagraphAlignment.LEFT) };
            data = Arrays.asList(sData);
            datas.add(data);
        }
    }

    poiSummary.textTable(document, headers, datas, false, "tableAAnnualReport");
}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

private void createTableI1() {

    List<List<POIField>> headers = new ArrayList<>();
    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;/*from  w ww.  j av  a 2 s.  c om*/
    POIField[] sHeader = {
            new POIField(
                    this.getText("annualReport.melia.tableI.studies",
                            new String[] { String.valueOf(this.getSelectedYear()) }),
                    ParagraphAlignment.CENTER),
            new POIField(this.getText("annualReport.melia.tableI.status"), ParagraphAlignment.CENTER),
            new POIField(this.getText("annualReport.melia.tableI.comments"), ParagraphAlignment.CENTER) };
    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);

    List<LiaisonInstitution> liaisonInstitutionsList = new ArrayList<>(this.getLoggedCrp()
            .getLiaisonInstitutions().stream()
            .filter(c -> c.getCrpProgram() != null && c.isActive()
                    && c.getCrpProgram().getProgramType() == ProgramType.FLAGSHIP_PROGRAM_TYPE.getValue())
            .collect(Collectors.toList()));
    liaisonInstitutionsList.sort(Comparator.comparing(LiaisonInstitution::getAcronym));

    flagshipPlannedList = reportSynthesisMeliaManager.getMeliaPlannedList(liaisonInstitutionsList,
            this.getSelectedPhase().getId(), this.getLoggedCrp(), pmuInstitution);
    if (flagshipPlannedList != null && !flagshipPlannedList.isEmpty()) {
        for (int i = 0; i < flagshipPlannedList.size(); i++) {
            String studies = "", status = "", comments = "";
            studies = flagshipPlannedList.get(i).getProjectExpectedStudy()
                    .getProjectExpectedStudyInfo(this.getSelectedPhase()).getTitle();
            status = flagshipPlannedList.get(i).getProjectExpectedStudy()
                    .getProjectExpectedStudyInfo(this.getSelectedPhase()).getStatusName();
            if (flagshipPlannedList.get(i).getProjectExpectedStudy()
                    .getProjectExpectedStudyInfo(this.getSelectedPhase()).getTopLevelComments() != null) {
                comments = flagshipPlannedList.get(i).getProjectExpectedStudy()
                        .getProjectExpectedStudyInfo(this.getSelectedPhase()).getTopLevelComments();
            }

            POIField[] sData = { new POIField(studies, ParagraphAlignment.LEFT),
                    new POIField(status, ParagraphAlignment.CENTER),
                    new POIField(comments, ParagraphAlignment.LEFT) };
            data = Arrays.asList(sData);
            datas.add(data);
        }
    }

    poiSummary.textTable(document, headers, datas, false, "tableIAnnualReport");
}

From source file:org.cgiar.ccafs.marlo.action.summaries.AnualReportPOISummaryAction.java

License:Open Source License

private void createTableI2() {
    List<List<POIField>> headers = new ArrayList<>();
    POIField[] sHeader = {/*from   w  w  w .  ja va2 s  .  co  m*/
            new POIField(this.getText("annualReport.melia.evaluation.name"), ParagraphAlignment.CENTER),
            new POIField(this.getText("annualReport.melia.evaluation.recommendation"),
                    ParagraphAlignment.CENTER),
            new POIField(this.getText("annualReport.melia.evaluation.managementResponse") + " - Action Plan",
                    ParagraphAlignment.CENTER),
            new POIField(this.getText("annualReport.melia.evaluation.whom"), ParagraphAlignment.CENTER),
            new POIField(this.getText("annualReport.melia.evaluation.when"), ParagraphAlignment.CENTER),
            new POIField(this.getText("summaries.annualReport.tableI2.field6"), ParagraphAlignment.CENTER) };
    List<POIField> header = Arrays.asList(sHeader);
    headers.add(header);

    List<List<POIField>> datas = new ArrayList<>();
    List<POIField> data;
    if (reportSynthesisPMU.getReportSynthesisMelia().getReportSynthesisMeliaEvaluations() != null
            && !reportSynthesisPMU.getReportSynthesisMelia().getReportSynthesisMeliaEvaluations().isEmpty()) {
        List<ReportSynthesisMeliaEvaluation> reportSynthesisMeliaEvaluationList = reportSynthesisPMU
                .getReportSynthesisMelia().getReportSynthesisMeliaEvaluations().stream()
                .filter(e -> e.isActive()).collect(Collectors.toList());

        for (ReportSynthesisMeliaEvaluation reportSynthesisMeliaEvaluation : reportSynthesisMeliaEvaluationList) {
            String nameEvaluation = "", recommendation = "", response = "", whom = "", when = "", status = "";

            if (reportSynthesisMeliaEvaluation.getNameEvaluation() != null) {
                nameEvaluation = reportSynthesisMeliaEvaluation.getNameEvaluation();
            }
            if (reportSynthesisMeliaEvaluation.getRecommendation() != null) {
                recommendation = reportSynthesisMeliaEvaluation.getRecommendation();
            }
            if (reportSynthesisMeliaEvaluation.getManagementResponse() != null) {
                response = reportSynthesisMeliaEvaluation.getManagementResponse();
            }
            if (reportSynthesisMeliaEvaluation.getTextWhom() != null) {
                whom = reportSynthesisMeliaEvaluation.getTextWhom();
            }
            if (reportSynthesisMeliaEvaluation.getTextWhen() != null) {
                when = reportSynthesisMeliaEvaluation.getTextWhen();
            }

            if (reportSynthesisMeliaEvaluation.getStatus() != null
                    && reportSynthesisMeliaEvaluation.getStatus() != -1) {
                int temp = Integer.parseInt(reportSynthesisMeliaEvaluation.getStatus().toString());
                status = ProjectStatusEnum.getValue(temp).getStatus();
            }

            POIField[] sData = { new POIField(nameEvaluation, ParagraphAlignment.CENTER),
                    new POIField(recommendation, ParagraphAlignment.LEFT),
                    new POIField(response, ParagraphAlignment.LEFT),
                    new POIField(whom, ParagraphAlignment.LEFT), new POIField(when, ParagraphAlignment.LEFT),
                    new POIField(status, ParagraphAlignment.LEFT) };

            data = Arrays.asList(sData);
            datas.add(data);
        }
    }

    poiSummary.textTable(document, headers, datas, false, "tableIAnnualReport");
}