Example usage for org.joda.time DateTime getDayOfMonth

List of usage examples for org.joda.time DateTime getDayOfMonth

Introduction

In this page you can find the example usage for org.joda.time DateTime getDayOfMonth.

Prototype

public int getDayOfMonth() 

Source Link

Document

Get the day of month field value.

Usage

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showDecemberData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareSeptemberData(jsonObject, response);
    prepareOctoberData(jsonObject, response);
    prepareNovemberData(jsonObject, response);

    if (response.getDec01to15target() != null && !response.getDec01to15target().isNaN())
        jsonObject.addProperty(DEC_01_TO_15_TARGET, BigDecimal.valueOf(response.getDec01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else/*w  w  w.  jav  a 2 s  .c  om*/
        jsonObject.addProperty(DEC_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getDec01to15actual() != null && !response.getDec01to15actual().isNaN())
        jsonObject.addProperty(DEC_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getDec01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(DEC_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getDec01to15variance() != null)
        jsonObject.addProperty(DEC_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getDec01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(DEC_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getDec16to31target() != null && !response.getDec16to31target().isNaN())
            jsonObject.addProperty(DEC_16_TO_31_TARGET, BigDecimal.valueOf(response.getDec16to31target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(DEC_16_TO_31_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getDec16to31actual() != null && !response.getDec16to31actual().isNaN())
            jsonObject.addProperty(DEC_16_TO_31_ACTUAL, BigDecimal.valueOf(response.getDec16to31actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(DEC_16_TO_31_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getDec16to31variance() != null)
            jsonObject.addProperty(DEC_16_TO_31_VARIANCE, BigDecimal.valueOf(response.getDec16to31variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(DEC_16_TO_31_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

        if (response.getDec16to31actual() != null && !response.getDec16to31actual().isNaN()) {
            if (response.getDec16to31target() != null && !response.getDec16to31target().isNaN()
                    && response.getDec16to31target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getDec16to31actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    } else if (response.getDec01to15actual() != null && !response.getDec01to15actual().isNaN()) {
        if (response.getDec01to15target() != null && !response.getDec01to15target().isNaN()
                && response.getDec01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getDec01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showNovemberData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareAugustData(jsonObject, response);
    prepareSeptemberData(jsonObject, response);
    prepareOctoberData(jsonObject, response);

    if (response.getNov01to15target() != null && !response.getNov01to15target().isNaN())
        jsonObject.addProperty(NOV_01_TO_15_TARGET, BigDecimal.valueOf(response.getNov01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else//  w w  w .  j  a v  a2 s  .  com
        jsonObject.addProperty(NOV_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getNov01to15actual() != null && !response.getNov01to15actual().isNaN())
        jsonObject.addProperty(NOV_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getNov01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(NOV_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getNov01to15variance() != null)
        jsonObject.addProperty(NOV_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getNov01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(NOV_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getNov16to30target() != null && !response.getNov16to30target().isNaN())
            jsonObject.addProperty(NOV_16_TO_30_TARGET, BigDecimal.valueOf(response.getNov16to30target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(NOV_16_TO_30_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getNov16to30actual() != null && !response.getNov16to30actual().isNaN())
            jsonObject.addProperty(NOV_16_TO_30_ACTUAL, BigDecimal.valueOf(response.getNov16to30actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(NOV_16_TO_30_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getNov16to30variance() != null)
            jsonObject.addProperty(NOV_16_TO_30_VARIANCE, BigDecimal.valueOf(response.getNov16to30variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(NOV_16_TO_30_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getNov16to30actual() != null && !response.getNov16to30actual().isNaN()) {
            if (response.getNov16to30target() != null && !response.getNov16to30target().isNaN()
                    && response.getNov16to30target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getNov16to30actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    } else if (response.getNov01to15actual() != null && !response.getNov01to15actual().isNaN()) {
        if (response.getNov01to15target() != null && !response.getNov01to15target().isNaN()
                && response.getNov01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getNov01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showOctoberData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareJulyData(jsonObject, response);
    prepareAugustData(jsonObject, response);
    prepareSeptemberData(jsonObject, response);

    if (response.getOct01to15target() != null && !response.getOct01to15target().isNaN())
        jsonObject.addProperty(OCT_01_TO_15_TARGET, BigDecimal.valueOf(response.getOct01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else//from   w ww. j a v a 2  s  .c o m
        jsonObject.addProperty(OCT_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getOct01to15actual() != null && !response.getOct01to15actual().isNaN())
        jsonObject.addProperty(OCT_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getOct01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(OCT_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getOct01to15variance() != null)
        jsonObject.addProperty(OCT_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getOct01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(OCT_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getOct16to31target() != null && !response.getOct16to31target().isNaN())
            jsonObject.addProperty(OCT_16_TO_31_TARGET, BigDecimal.valueOf(response.getOct16to31target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(OCT_16_TO_31_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getOct16to31actual() != null && !response.getOct16to31actual().isNaN())
            jsonObject.addProperty(OCT_16_TO_31_ACTUAL, BigDecimal.valueOf(response.getOct16to31actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(OCT_16_TO_31_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getOct16to31variance() != null)
            jsonObject.addProperty(OCT_16_TO_31_VARIANCE, BigDecimal.valueOf(response.getOct16to31variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(OCT_16_TO_31_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getOct16to31actual() != null && !response.getOct16to31actual().isNaN()) {
            if (response.getOct16to31target() != null && !response.getOct16to31target().isNaN()
                    && response.getOct16to31target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getOct16to31actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    } else if (response.getOct01to15actual() != null && !response.getOct01to15actual().isNaN()) {
        if (response.getOct01to15target() != null && !response.getOct01to15target().isNaN()
                && response.getOct01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getOct01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showSeptemberData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareJuneData(jsonObject, response);
    prepareJulyData(jsonObject, response);
    prepareAugustData(jsonObject, response);

    if (response.getSep01to15target() != null && !response.getSep01to15target().isNaN())
        jsonObject.addProperty(SEP_01_TO_15_TARGET, BigDecimal.valueOf(response.getSep01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else/*w w w.  j  a v a2 s .  com*/
        jsonObject.addProperty(SEP_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getSep01to15actual() != null && !response.getSep01to15actual().isNaN())
        jsonObject.addProperty(SEP_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getSep01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(SEP_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getSep01to15variance() != null)
        jsonObject.addProperty(SEP_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getSep01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(SEP_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getSep16to30target() != null && !response.getSep16to30target().isNaN())
            jsonObject.addProperty(SEP_16_TO_30_TARGET, BigDecimal.valueOf(response.getSep16to30target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(SEP_16_TO_30_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getSep16to30actual() != null && !response.getSep16to30actual().isNaN())
            jsonObject.addProperty(SEP_16_TO_30_ACTUAL, BigDecimal.valueOf(response.getSep16to30actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(SEP_16_TO_30_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getSep16to30variance() != null)
            jsonObject.addProperty(SEP_16_TO_30_VARIANCE, BigDecimal.valueOf(response.getSep16to30variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(SEP_16_TO_30_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getSep16to30actual() != null && !response.getSep16to30actual().isNaN()) {
            if (response.getSep16to30target() != null && !response.getSep16to30target().isNaN()
                    && response.getSep16to30target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getSep16to30actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    } else if (response.getSep01to15actual() != null && !response.getSep01to15actual().isNaN()) {
        if (response.getSep01to15target() != null && !response.getSep01to15target().isNaN()
                && response.getSep01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getSep01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showAugustData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareMayData(jsonObject, response);
    prepareJuneData(jsonObject, response);
    prepareJulyData(jsonObject, response);

    if (response.getAug01to15target() != null && !response.getAug01to15target().isNaN())
        jsonObject.addProperty(AUG_01_TO_15_TARGET, BigDecimal.valueOf(response.getAug01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else/*  ww  w . java  2s.c om*/
        jsonObject.addProperty(AUG_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getAug01to15actual() != null && !response.getAug01to15actual().isNaN())
        jsonObject.addProperty(AUG_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getAug01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(AUG_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getAug01to15variance() != null)
        jsonObject.addProperty(AUG_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getAug01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(AUG_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getAug16to31target() != null && !response.getAug16to31target().isNaN())
            jsonObject.addProperty(AUG_16_TO_31_TARGET, BigDecimal.valueOf(response.getAug16to31target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(AUG_16_TO_31_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getAug16to31actual() != null && !response.getAug16to31actual().isNaN())
            jsonObject.addProperty(AUG_16_TO_31_ACTUAL, BigDecimal.valueOf(response.getAug16to31actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(AUG_16_TO_31_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getAug16to31variance() != null)
            jsonObject.addProperty(AUG_16_TO_31_VARIANCE, BigDecimal.valueOf(response.getAug16to31variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(AUG_16_TO_31_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getAug16to31actual() != null && !response.getAug16to31actual().isNaN()) {
            if (response.getAug16to31target() != null && !response.getAug16to31target().isNaN()
                    && response.getAug16to31target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getAug16to31actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    } else if (response.getAug01to15actual() != null && !response.getAug01to15actual().isNaN()) {
        if (response.getAug01to15target() != null && !response.getAug01to15target().isNaN()
                && response.getAug01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getAug01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showJulyData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareAprilData(jsonObject, response);
    prepareMayData(jsonObject, response);
    prepareJuneData(jsonObject, response);

    if (response.getJul01to15target() != null && !response.getJul01to15target().isNaN())
        jsonObject.addProperty(JUL_01_TO_15_TARGET, BigDecimal.valueOf(response.getJul01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else/*from   ww  w  . ja  va  2  s.  c o  m*/
        jsonObject.addProperty(JUL_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getJul01to15actual() != null && !response.getJul01to15actual().isNaN())
        jsonObject.addProperty(JUL_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getJul01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(JUL_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getJul01to15variance() != null)
        jsonObject.addProperty(JUL_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getJul01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(JUL_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getJul16to31target() != null && !response.getJul16to31target().isNaN())
            jsonObject.addProperty(JUL_16_TO_31_TARGET, BigDecimal.valueOf(response.getJul16to31target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(JUL_16_TO_31_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getJul16to31actual() != null && !response.getJul16to31actual().isNaN())
            jsonObject.addProperty(JUL_16_TO_31_ACTUAL, BigDecimal.valueOf(response.getJul16to31actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(JUL_16_TO_31_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getJul16to31variance() != null)
            jsonObject.addProperty(JUL_16_TO_31_VARIANCE, BigDecimal.valueOf(response.getJul16to31variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(JUL_16_TO_31_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getJul16to31actual() != null && !response.getJul16to31actual().isNaN()) {
            if (response.getJul16to31target() != null && !response.getJul16to31target().isNaN()
                    && response.getJul16to31target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getJul16to31actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    } else if (response.getJun01to15actual() != null && !response.getJul01to15actual().isNaN()) {
        if (response.getJul01to15target() != null && !response.getJul01to15target().isNaN()
                && response.getJul01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getJul01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showJuneData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareMarchData(jsonObject, response);
    prepareAprilData(jsonObject, response);
    prepareMayData(jsonObject, response);

    if (response.getJun01to15target() != null && !response.getJun01to15target().isNaN())
        jsonObject.addProperty(JUN_01_TO_15_TARGET, BigDecimal.valueOf(response.getJun01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else/*from w w  w  .ja  va 2s  .c om*/
        jsonObject.addProperty(JUN_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getJun01to15actual() != null && !response.getJun01to15actual().isNaN())
        jsonObject.addProperty(JUN_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getJun01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(JUN_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getJun01to15variance() != null)
        jsonObject.addProperty(JUN_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getJun01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(JUN_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getJun16to30target() != null && !response.getJun16to30target().isNaN())
            jsonObject.addProperty(JUN_16_TO_30_TARGET, BigDecimal.valueOf(response.getJun16to30target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(JUN_16_TO_30_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getJun16to30actual() != null && !response.getJun16to30actual().isNaN())
            jsonObject.addProperty(JUN_16_TO_30_ACTUAL, BigDecimal.valueOf(response.getJun16to30actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(JUN_16_TO_30_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getJun16to30variance() != null)
            jsonObject.addProperty(JUN_16_TO_30_VARIANCE, BigDecimal.valueOf(response.getJun16to30variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(JUN_16_TO_30_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getJun16to30actual() != null && !response.getJun16to30actual().isNaN()) {
            if (response.getJun16to30target() != null && !response.getJun16to30target().isNaN()
                    && response.getJun16to30target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getJun16to30actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    } else if (response.getJun01to15actual() != null && !response.getJun01to15actual().isNaN()) {
        if (response.getJun01to15target() != null && !response.getJun01to15target().isNaN()
                && response.getJun01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getJun01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showMayData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareFebruaryData(jsonObject, response);
    prepareMarchData(jsonObject, response);
    prepareAprilData(jsonObject, response);

    if (response.getMay01to15target() != null && !response.getMay01to15target().isNaN())
        jsonObject.addProperty(MAY_01_TO_15_TARGET, BigDecimal.valueOf(response.getMay01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else//w ww. j  ava2s .  c o  m
        jsonObject.addProperty(MAY_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getMay01to15actual() != null && !response.getMay01to15actual().isNaN())
        jsonObject.addProperty(MAY_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getMay01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(MAY_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getMay01to15variance() != null)
        jsonObject.addProperty(MAY_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getMay01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(MAY_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getMay16to31target() != null && !response.getMay16to31target().isNaN())
            jsonObject.addProperty(MAY_16_TO_31_TARGET, BigDecimal.valueOf(response.getMay16to31target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(MAY_16_TO_31_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getMay16to31actual() != null && !response.getMay16to31actual().isNaN())
            jsonObject.addProperty(MAY_16_TO_31_ACTUAL, BigDecimal.valueOf(response.getMay16to31actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(MAY_16_TO_31_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getMay16to31variance() != null)
            jsonObject.addProperty(MAY_16_TO_31_VARIANCE, BigDecimal.valueOf(response.getMay16to31variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(MAY_16_TO_31_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getMay16to31actual() != null && !response.getMay16to31actual().isNaN()) {
            if (response.getMay16to31target() != null && !response.getMay16to31target().isNaN()
                    && response.getMay16to31target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getMay16to31actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    } else if (response.getMay01to15actual() != null && !response.getMay01to15actual().isNaN()) {
        if (response.getMay01to15target() != null && !response.getMay01to15target().isNaN()
                && response.getMay01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getMay01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showAprilData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareJanuaryData(jsonObject, response);
    prepareFebruaryData(jsonObject, response);
    prepareMarchData(jsonObject, response);

    if (response.getApr01to15target() != null && !response.getApr01to15target().isNaN())
        jsonObject.addProperty(APR_01_TO_15_TARGET, BigDecimal.valueOf(response.getApr01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else//from w  w w  .java  2  s . com
        jsonObject.addProperty(APR_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getApr01to15actual() != null && !response.getApr01to15actual().isNaN())
        jsonObject.addProperty(APR_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getApr01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(APR_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getApr01to15variance() != null)
        jsonObject.addProperty(APR_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getApr01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(APR_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getApr16to30target() != null && !response.getApr16to30target().isNaN())
            jsonObject.addProperty(APR_16_TO_30_TARGET, BigDecimal.valueOf(response.getApr16to30target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(APR_16_TO_30_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getApr16to30actual() != null && !response.getApr16to30actual().isNaN())
            jsonObject.addProperty(APR_16_TO_30_ACTUAL, BigDecimal.valueOf(response.getApr16to30actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(APR_16_TO_30_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getApr16to30variance() != null)
            jsonObject.addProperty(APR_16_TO_30_VARIANCE, BigDecimal.valueOf(response.getApr16to30variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(APR_16_TO_30_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getApr16to30actual() != null && !response.getApr16to30actual().isNaN()) {
            if (response.getApr16to30target() != null && !response.getApr16to30target().isNaN()
                    && response.getApr16to30target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getApr16to30actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    } else if (response.getApr01to15actual() != null && !response.getApr01to15actual().isNaN()) {
        if (response.getApr01to15target() != null && !response.getApr01to15target().isNaN()
                && response.getApr01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getApr01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}

From source file:org.egov.works.web.adaptor.WorksReportJsonAdaptorHelper.java

License:Open Source License

public void showMarchData(final WorksMilestoneIndexResponse response, final JsonObject jsonObject,
        final DateTime currentDate) {
    prepareDecemberData(jsonObject, response);
    prepareJanuaryData(jsonObject, response);
    prepareFebruaryData(jsonObject, response);

    if (response.getMar01to15target() != null && !response.getMar01to15target().isNaN())
        jsonObject.addProperty(MAR_01_TO_15_TARGET, BigDecimal.valueOf(response.getMar01to15target())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else/*from  w  ww .ja va  2  s  .co m*/
        jsonObject.addProperty(MAR_01_TO_15_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getMar01to15actual() != null && !response.getMar01to15actual().isNaN())
        jsonObject.addProperty(MAR_01_TO_15_ACTUAL, BigDecimal.valueOf(response.getMar01to15actual())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(MAR_01_TO_15_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
    if (response.getMar01to15variance() != null)
        jsonObject.addProperty(MAR_01_TO_15_VARIANCE, BigDecimal.valueOf(response.getMar01to15variance())
                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    else
        jsonObject.addProperty(MAR_01_TO_15_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    if (currentDate.getDayOfMonth() > 15) {
        if (response.getMar16to31target() != null && !response.getMar16to31target().isNaN())
            jsonObject.addProperty(MAR_16_TO_31_TARGET, BigDecimal.valueOf(response.getMar16to31target())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(MAR_16_TO_31_TARGET, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getMar16to31actual() != null && !response.getMar16to31actual().isNaN())
            jsonObject.addProperty(MAR_16_TO_31_ACTUAL, BigDecimal.valueOf(response.getMar16to31actual())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(MAR_16_TO_31_ACTUAL, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        if (response.getMar16to31variance() != null)
            jsonObject.addProperty(MAR_16_TO_31_VARIANCE, BigDecimal.valueOf(response.getMar16to31variance())
                    .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        else
            jsonObject.addProperty(MAR_16_TO_31_VARIANCE, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

        if (response.getMar16to31actual() != null && !response.getMar16to31actual().isNaN()) {
            if (response.getMar16to31target() != null && !response.getMar16to31target().isNaN()
                    && response.getMar16to31target().compareTo((double) 0) == 0)
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
            else
                jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                        BigDecimal.valueOf(100 - response.getMar16to31actual())
                                .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
        } else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);

    } else if (response.getMar01to15actual() != null && !response.getMar01to15actual().isNaN()) {
        if (response.getMar01to15target() != null && !response.getMar01to15target().isNaN()
                && response.getMar01to15target().compareTo((double) 0) == 0)
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
        else
            jsonObject.addProperty(TOTAL_OF_BALANCE_WORK,
                    BigDecimal.valueOf(100 - response.getMar01to15actual())
                            .setScale(2, BigDecimal.ROUND_HALF_EVEN).toString());
    } else
        jsonObject.addProperty(TOTAL_OF_BALANCE_WORK, PHYSICAL_PROGRESS_DEFAULT_EMPTY_VALUE);
}