Example usage for java.math BigDecimal ONE

List of usage examples for java.math BigDecimal ONE

Introduction

In this page you can find the example usage for java.math BigDecimal ONE.

Prototype

BigDecimal ONE

To view the source code for java.math BigDecimal ONE.

Click Source Link

Document

The value 1, with a scale of 0.

Usage

From source file:org.yes.cart.web.page.component.product.ProductInListView.java

/**
 * Get product or his sku price./*from w  w w .  ja v  a 2 s  . c o m*/
 * In case of multisku product the minimal regular price from multiple sku was used for single item.
 *
 * @param firstAvailableSkuCode first available sku code.
 * @return {@link org.yes.cart.domain.entity.SkuPrice}
 */
private SkuPrice getSkuPrice(final String firstAvailableSkuCode) {
    return productServiceFacade.getSkuPrice(null, firstAvailableSkuCode, BigDecimal.ONE,
            ApplicationDirector.getShoppingCart().getCurrencyCode(),
            ApplicationDirector.getCurrentShop().getShopId());
}

From source file:org.estatio.dom.lease.invoicing.InvoiceCalculationService.java

/**
 * Calculates a term with a given invoicing frequency
 *///from www  . j  a  v  a  2s. c  o  m
@Programmatic
public List<CalculationResult> calculateDueDateRange(final LeaseTerm leaseTerm,
        final InvoiceCalculationParameters parameters) {
    final List<CalculationResult> results = Lists.newArrayList();
    final LocalDateInterval termInterval = leaseTerm.getEffectiveInterval();
    final LocalDateInterval rangeInterval = parameters.invoiceRunType().equals(InvoiceRunType.RETRO_RUN)
            && leaseTerm.getLeaseItem().getLease().getStartDate()
                    .compareTo(parameters.dueDateRange().startDate()) < 0
                            ? new LocalDateInterval(leaseTerm.getLeaseItem().getLease().getStartDate(),
                                    parameters.dueDateRange().endDateExcluding(),
                                    IntervalEnding.EXCLUDING_END_DATE)
                            : parameters.dueDateRange();
    final InvoicingFrequency invoicingFrequency = leaseTerm.getLeaseItem().getInvoicingFrequency();
    // TODO: As a result of EST-413 the check for 'termInterval != null &&
    // termInterval.isValid()' is removed because this is blocking the
    // calculation of periods outside the interval of the leases. As a
    // result the invoice calculation will be more eager so improving
    // performance, EST-315, should get some attention.
    if (rangeInterval.isValid()) {
        final List<InvoicingInterval> intervals = invoicingFrequency.intervalsInDueDateRange(rangeInterval,
                termInterval);
        for (final InvoicingInterval invoicingInterval : intervals) {
            final LocalDateInterval effectiveInterval = invoicingInterval.asLocalDateInterval()
                    .overlap(termInterval);
            if (effectiveInterval == null) {
                results.add(new CalculationResult(invoicingInterval));
            } else {
                final BigDecimal overlapDays = new BigDecimal(effectiveInterval.days());
                final BigDecimal frequencyDays = new BigDecimal(invoicingInterval.days());
                final BigDecimal rangeFactor = leaseTerm.valueType().equals(LeaseTermValueType.FIXED)
                        ? BigDecimal.ONE
                        : overlapDays.divide(frequencyDays, MathContext.DECIMAL64);
                final BigDecimal annualFactor = invoicingFrequency.annualMultiplier();
                final LocalDate epochDate = ObjectUtils.firstNonNull(leaseTerm.getLeaseItem().getEpochDate(),
                        systemEpochDate());
                BigDecimal mockValue = BigDecimal.ZERO;
                if (epochDate != null && invoicingInterval.dueDate().isBefore(epochDate)) {
                    mockValue = leaseTerm.valueForDate(epochDate);
                }
                results.add(new CalculationResult(invoicingInterval, effectiveInterval,
                        calculateValue(rangeFactor, annualFactor,
                                leaseTerm.valueForDate(
                                        parameters.dueDateRange().endDateExcluding().minusDays(1))),
                        calculateValue(rangeFactor, annualFactor,
                                leaseTerm.valueForDate(invoicingInterval.dueDate())),
                        calculateValue(rangeFactor, annualFactor, mockValue)));
            }
        }
    }
    return results;
}

From source file:uk.dsxt.voting.client.web.MockVotingApiResource.java

License:asdf

@POST
@Path("/votingResults")
@Produces("application/json")
public RequestResult votingResults(@FormParam("cookie") String cookie, @FormParam("votingId") String votingId) {
    log.debug("votingResults method called. votingId={}", votingId);
    final AnswerWeb[] answers1 = new AnswerWeb[4];
    answers1[0] = new AnswerWeb("1", "answer_1", BigDecimal.TEN);
    answers1[1] = new AnswerWeb("2", "answer_2", BigDecimal.ONE);
    answers1[2] = new AnswerWeb("3", "answer_3", BigDecimal.TEN);
    answers1[3] = new AnswerWeb("4", "answer_4", BigDecimal.ONE);

    final AnswerWeb[] answers2 = new AnswerWeb[1];
    answers2[0] = new AnswerWeb("1", "yes", BigDecimal.TEN);

    final QuestionWeb[] questions = new QuestionWeb[3];
    questions[0] = new QuestionWeb("1", "question_1_multi", answers1, true, 1);
    questions[1] = new QuestionWeb("2", "question_2_yes_no", answers2, false, 1);
    questions[2] = new QuestionWeb("3", "question_3_no_vote", new AnswerWeb[0], false, 1);
    return new RequestResult<>(new VotingInfoWeb(questions, new BigDecimal(22), null,
            "asdkfhbwerjhwbejhsdhfsjjsjdf3k345k", VoteResultStatus.OK, System.currentTimeMillis(), "nodeSign"),
            null);/*from w w w .j  a  v  a  2s.c o  m*/
}

From source file:org.libreplan.business.planner.entities.StretchesFunction.java

private Stretch getLastStretch() {
    Stretch result = Stretch.create(BigDecimal.ONE, BigDecimal.ONE);
    result.readOnly(true);

    return result;
}

From source file:org.multibit.utils.CSMiscUtils.java

public static BigDecimal getDisplayUnitsForRawUnits(CSAsset asset, BigInteger rawQuantity) {
    if (asset == null)
        return BigDecimal.ZERO;
    CoinSparkGenesis genesis = asset.getGenesis();
    if (genesis == null)
        return BigDecimal.ZERO; // This can happen with brand new Manually transferred asset which has not yet been validated.
    int chargeBasisPoints = genesis.getChargeBasisPoints();
    int chargeExponent = genesis.getChargeFlatExponent();
    int chargeMantissa = genesis.getChargeFlatMantissa();
    int qtyExponent = genesis.getQtyExponent();
    int qtyMantissa = genesis.getQtyMantissa();

    double interestRate = asset.getInterestRate();
    Date issueDate = asset.getIssueDate();

    BigDecimal result = new BigDecimal(rawQuantity.toString());

    //System.out.println("interest rate = " + interestRate);
    //System.out.println("issue date = " + issueDate);

    //System.out.println("raw units =" + result);

    // 1. Compute interest
    if (issueDate != null && interestRate != 0.0) {

        BigDecimal rate = new BigDecimal(String.valueOf(interestRate));
        rate = rate.divide(new BigDecimal(100));
        rate = rate.add(BigDecimal.ONE);
        //interestRate = interestRate / 100;

        //System.out.println("interest rate 1 + ir/100 = " + rate.toPlainString());

        // get years elapsed
        DateTime d1 = new DateTime(issueDate);
        DateTime d2 = new DateTime();

        //System.out.println("Issue: " + d1 + "   Now: " + d2);
        int seconds = Math.abs(Seconds.secondsBetween(d1, d2).getSeconds());

        //System.out.println("...Number of seconds difference: " + seconds);

        BigDecimal elapsedSeconds = new BigDecimal(seconds);

        //System.out.println("...Number of seconds difference: " + elapsedSeconds.toPlainString());

        // To avoid exception, we need to set a precision.
        // java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
        // http://stackoverflow.com/questions/4591206/arithmeticexception-non-terminating-decimal-expansion-no-exact-representable
        BigDecimal elapsedYears = elapsedSeconds.divide(new BigDecimal(COINSPARK_SECONDS_IN_YEAR),
                MathContext.DECIMAL32);
        //System.out.println("...Number of years difference: " + elapsedYears.toPlainString());

        double base = elapsedSeconds.doubleValue();
        double exp = elapsedYears.doubleValue();
        //System.out.println("...base=" + base + "  exponent=" + exp);
        double interestMultipler = Math.pow(rate.doubleValue(), elapsedYears.doubleValue());

        //System.out.println("interest multipler =" + interestMultipler);

        result = result.multiply(new BigDecimal(interestMultipler));

        //System.out.println("raw units with interest multiplier =" + result);

        result = result.setScale(0, RoundingMode.DOWN);

        //System.out.println("raw units with interest multiplier, floored =" + result);

    }/*from  w  ww .  ja  v a  2 s.  c  om*/

    // 2. Apply multiple
    int decimalPlaces = CSMiscUtils.getNumberOfDisplayDecimalPlaces(asset);
    BigDecimal display = result;
    if (decimalPlaces != 0) {
        //       System.out.println(">>>>> display = " + display.toPlainString());
        display = result.movePointLeft(decimalPlaces);
        //       System.out.println(">>>>> display = " + display.toPlainString());
    }

    //long qty = Utils.mantissaExponentToQty(qtyMantissa, qtyExponent);
    //   double multiple = asset.getMultiple();
    // let's just do it for now to make sure code is corret   
    //if (multiple != 1.0)
    //   BigDecimal m = new BigDecimal(String.valueOf(multiple));
    //   BigDecimal display = result.multiply(m);

    //System.out.println("multiplier=" + m + ", display=" + display);
    // Stripping zeros from internal zero with different scale does not work, so use 
    // JDK bug still seems to exist
    // http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6480539
    // http://stackoverflow.com/questions/5239137/clarification-on-behavior-of-bigdecimal-striptrailingzeroes
    int cmpZeroResult = display.compareTo(BigDecimal.ZERO);
    if (decimalPlaces == 0) {
        display = display.stripTrailingZeros();
    }

    // Stripping trailing zeros from internal zero with different scale does not work, so set to ZERO instead.
    if (0 == cmpZeroResult) {
        display = BigDecimal.ZERO;
    }
    return display;
}

From source file:Main.java

/**
 * Add two positive Duration objects.//ww w.  j  av  a2 s  .  c o m
 * @param d1 The first Duration.
 * @param d2 The second Duration.
 * @return The sum of the two durations.
 */
private static Duration addPositiveDurations(Duration d1, Duration d2) {
    BigDecimal s1 = fractionalSeconds(d1);
    BigDecimal s2 = fractionalSeconds(d2);
    BigDecimal extraSeconds = s1.add(s2);

    Duration strip1 = stripFractionalSeconds(d1);
    Duration strip2 = stripFractionalSeconds(d2);

    Duration stripResult = strip1.add(strip2);

    if (extraSeconds.compareTo(BigDecimal.ONE) >= 0) {
        stripResult = stripResult.add(DURATION_1_SECOND);
        extraSeconds = extraSeconds.subtract(BigDecimal.ONE);
    }

    BigDecimal properSeconds = BigDecimal.valueOf(stripResult.getSeconds()).add(extraSeconds);

    return FACTORY.newDuration(true, BigInteger.valueOf(stripResult.getYears()),
            BigInteger.valueOf(stripResult.getMonths()), BigInteger.valueOf(stripResult.getDays()),
            BigInteger.valueOf(stripResult.getHours()), BigInteger.valueOf(stripResult.getMinutes()),
            properSeconds);
}

From source file:com.opengamma.integration.tool.portfolio.PortfolioZipFormatExamplesGenerator.java

private ManageablePosition createPosition(ManageableSecurity security, boolean includeTrade) {
    ManageablePosition position = new ManageablePosition(BigDecimal.ONE, security.getExternalIdBundle());
    if (includeTrade) {
        ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, security.getExternalIdBundle(),
                LocalDate.now().minusDays(3), OffsetTime.now(), ExternalId.of("Cpty", "GOLDMAN"));
        position.addTrade(trade);/*from www.  j a va  2s  .c o  m*/
    }
    return position;
}

From source file:net.pms.util.Rational.java

/**
 * Returns an instance that represents the value of {@code value}.
 *
 * @param value the value./*from www  .  j av a2  s. c o  m*/
 * @return An instance that represents the value of {@code value}.
 */
@Nullable
public static Rational valueOf(@Nullable BigDecimal value) {
    if (value == null) {
        return null;
    }
    BigInteger numerator;
    BigInteger denominator;
    if (value.signum() == 0) {
        return ZERO;
    }
    if (BigDecimal.ONE.equals(value)) {
        return ONE;
    }
    if (value.scale() > 0) {
        BigInteger unscaled = value.unscaledValue();
        BigInteger tmpDenominator = BigInteger.TEN.pow(value.scale());
        BigInteger tmpGreatestCommonDivisor = unscaled.gcd(tmpDenominator);
        numerator = unscaled.divide(tmpGreatestCommonDivisor);
        denominator = tmpDenominator.divide(tmpGreatestCommonDivisor);
    } else {
        numerator = value.toBigIntegerExact();
        denominator = BigInteger.ONE;
    }
    return new Rational(numerator, denominator, BigInteger.ONE, numerator, denominator);
}

From source file:pe.gob.mef.gescon.hibernate.impl.ContenidoDaoImpl.java

@Override
public List<HashMap> getConcimientosVinculados(HashMap filters) {
    String nconocimientoid = filters.get("nconocimientoid").toString();
    String ntipoconocimientoid = filters.get("ntipoconocimientoid").toString();
    Boolean flag = (Boolean) filters.get("flag");
    Object object = null;/* w w  w . jav  a  2 s .c o  m*/
    final StringBuilder sql = new StringBuilder();
    if (StringUtils.isNotBlank(ntipoconocimientoid)
            && (ntipoconocimientoid.equals("3") || ntipoconocimientoid.equals("4")
                    || ntipoconocimientoid.equals("5") || ntipoconocimientoid.equals("6"))) {
        sql.append("SELECT ");
        sql.append(
                "    a.nvinculoid as ID, a.nconocimientovinc as IDCONOCIMIENTO, '' AS NUMERO, b.vtitulo AS NOMBRE, b.vdescripcion AS SUMILLA, ");
        sql.append("    b.ncategoriaid AS IDCATEGORIA, c.vnombre AS CATEGORIA, b.dfechacreacion AS FECHA, ");
        sql.append("    b.ntpoconocimientoid AS IDTIPOCONOCIMIENTO, e.vnombre AS TIPOCONOCIMIENTO, ");
        sql.append("    b.nsituacionid AS IDESTADO, d.vnombre AS ESTADO ");
        sql.append("FROM TVINCULO a ");
        sql.append("INNER JOIN TCONOCIMIENTO b ");
        sql.append("    INNER JOIN MTCATEGORIA c ON b.ncategoriaid = c.ncategoriaid ");
        sql.append("    INNER JOIN MTSITUACION d ON b.nsituacionid = d.nsituacionid ");
        sql.append("    INNER JOIN MTTIPO_CONOCIMIENTO e ON b.ntpoconocimientoid = e.ntpoconocimientoid ");
        sql.append("ON a.nconocimientovinc = b.nconocimientoid ");
        sql.append("AND a.ntipoconocimientovinc = b.ntpoconocimientoid ");
        sql.append("AND b.nactivo = :ACTIVO ");
        sql.append("WHERE a.nconocimientoid = ").append(nconocimientoid).append(" ");
        sql.append("AND a.ntipoconocimientovinc = ").append(ntipoconocimientoid).append(" ");
        sql.append("ORDER BY 7 DESC ");
    }
    if (StringUtils.isNotBlank(ntipoconocimientoid) && ntipoconocimientoid.equals("2")) {
        sql.append("SELECT ");
        sql.append(
                "    a.nvinculoid as ID, a.nconocimientovinc as IDCONOCIMIENTO, '' AS NUMERO, b.vasunto AS NOMBRE , b.vrespuesta AS SUMILLA, ");
        sql.append("    b.ncategoriaid AS IDCATEGORIA, c.vnombre AS CATEGORIA, b.dfechacreacion AS FECHA, ");
        sql.append("    2 AS IDTIPOCONOCIMIENTO, 'Preguntas y Respuestas' AS TIPOCONOCIMIENTO, ");
        sql.append("    b.nsituacionid AS IDESTADO, d.vnombre AS ESTADO ");
        sql.append("FROM TVINCULO a ");
        sql.append("INNER JOIN TPREGUNTA b ");
        sql.append("    INNER JOIN MTCATEGORIA c ON b.ncategoriaid = c.ncategoriaid ");
        sql.append("    INNER JOIN MTSITUACION d ON b.nsituacionid = d.nsituacionid ");
        sql.append("ON a.nconocimientovinc = b.npreguntaid ");
        sql.append("AND a.ntipoconocimientovinc = 2 ");
        sql.append("AND b.nactivo = :ACTIVO ");
        sql.append("WHERE a.nconocimientoid = ").append(nconocimientoid).append(" ");
        sql.append("ORDER BY 7 DESC ");
    }
    if (StringUtils.isNotBlank(ntipoconocimientoid) && ntipoconocimientoid.equals("1")) {
        sql.append("SELECT ");
        sql.append(
                "    a.nvinculoid as ID, a.nconocimientovinc as IDCONOCIMIENTO, b.vnumero AS NUMERO, b.vnombre AS NOMBRE, ");
        sql.append(
                "    b.vsumilla AS SUMILLA, b.ncategoriaid AS IDCATEGORIA, c.vnombre AS CATEGORIA, b.dfechacreacion AS FECHA, ");
        sql.append("    1 AS IDTIPOCONOCIMIENTO, 'Base Legal' AS TIPOCONOCIMIENTO, ");
        sql.append("    b.nestadoid AS IDESTADO, d.vnombre AS ESTADO ");
        sql.append("FROM TVINCULO a ");
        sql.append("INNER JOIN TBASELEGAL b ");
        sql.append("    INNER JOIN MTCATEGORIA c ON b.ncategoriaid = c.ncategoriaid ");
        sql.append("    INNER JOIN MTESTADO_BASELEGAL d ON b.nestadoid = d.nestadoid ");
        sql.append("ON a.nconocimientovinc = b.nbaselegalid ");
        sql.append("AND a.ntipoconocimientovinc = 1 ");
        sql.append("AND b.nactivo = :ACTIVO ");
        sql.append("WHERE a.nconocimientoid = ").append(nconocimientoid).append(" ");
        sql.append("ORDER BY 7 DESC ");
    }
    try {
        object = getHibernateTemplate().execute(new HibernateCallback() {
            @Override
            public Object doInHibernate(Session session) throws HibernateException {
                Query query = session.createSQLQuery(sql.toString());
                query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);
                if (StringUtils.isNotBlank(sql.toString())) {
                    query.setParameter("ACTIVO", BigDecimal.ONE);
                }
                return query.list();
            }
        });
    } catch (Exception e) {
        e.getMessage();
        e.printStackTrace();
    }
    return (List<HashMap>) object;
}

From source file:pe.gob.mef.gescon.hibernate.impl.ConocimientoDaoImpl.java

@Override
public List<HashMap> getConcimientosVinculados(HashMap filters) {
    String nconocimientoid = (String) filters.get("nconocimientoid");
    String ntipoconocimientoid = (String) filters.get("ntipoconocimientoid");
    Boolean flag = (Boolean) filters.get("flag");
    Object object = null;/*from www .j  ava2s.c  o m*/
    final StringBuilder sql = new StringBuilder();
    if (StringUtils.isNotBlank(ntipoconocimientoid)
            && (ntipoconocimientoid.equals("3") || ntipoconocimientoid.equals("4")
                    || ntipoconocimientoid.equals("5") || ntipoconocimientoid.equals("6"))) {
        sql.append("SELECT ");
        sql.append(
                "    a.nvinculoid as ID, a.nconocimientovinc as IDCONOCIMIENTO, '' AS NUMERO, b.vtitulo AS NOMBRE, b.vdescripcion AS SUMILLA, ");
        sql.append("    b.ncategoriaid AS IDCATEGORIA, c.vnombre AS CATEGORIA, b.dfechapublicacion AS FECHA, ");
        sql.append("    b.ntpoconocimientoid AS IDTIPOCONOCIMIENTO, e.vnombre AS TIPOCONOCIMIENTO, ");
        sql.append("    b.nsituacionid AS IDESTADO, d.vnombre AS ESTADO ");
        sql.append("FROM TVINCULO a ");
        sql.append("INNER JOIN TCONOCIMIENTO b ");
        sql.append("    INNER JOIN MTCATEGORIA c ON b.ncategoriaid = c.ncategoriaid ");
        sql.append("    INNER JOIN MTSITUACION d ON b.nsituacionid = d.nsituacionid ");
        sql.append("    INNER JOIN MTTIPO_CONOCIMIENTO e ON b.ntpoconocimientoid = e.ntpoconocimientoid ");
        sql.append("ON a.nconocimientovinc = b.nconocimientoid ");
        sql.append("AND a.ntipoconocimientovinc = b.ntpoconocimientoid ");
        sql.append("AND b.nactivo = :ACTIVO ");
        sql.append("WHERE a.nconocimientoid = ").append(nconocimientoid).append(" ");
        if (flag) {
            sql.append("AND a.ntipoconocimientovinc = ").append(ntipoconocimientoid).append(" ");
        }
        sql.append("ORDER BY 7 DESC ");
    }
    if (StringUtils.isNotBlank(ntipoconocimientoid) && ntipoconocimientoid.equals("2")) {
        sql.append("SELECT ");
        sql.append(
                "    a.nvinculoid as ID, a.nconocimientovinc as IDCONOCIMIENTO, '' AS NUMERO, b.vasunto AS NOMBRE , b.vdetalle AS SUMILLA, ");
        sql.append("    b.ncategoriaid AS IDCATEGORIA, c.vnombre AS CATEGORIA, b.dfechapublicacion AS FECHA, ");
        sql.append("    2 AS IDTIPOCONOCIMIENTO, 'Preguntas y Respuestas' AS TIPOCONOCIMIENTO, ");
        sql.append("    b.nsituacionid AS IDESTADO, d.vnombre AS ESTADO ");
        sql.append("FROM TVINCULO a ");
        sql.append("INNER JOIN TPREGUNTA b ");
        sql.append("    INNER JOIN MTCATEGORIA c ON b.ncategoriaid = c.ncategoriaid ");
        sql.append("    INNER JOIN MTSITUACION d ON b.nsituacionid = d.nsituacionid ");
        sql.append("ON a.nconocimientovinc = b.npreguntaid ");
        sql.append("AND a.ntipoconocimientovinc = 2 ");
        sql.append("AND b.nactivo = :ACTIVO ");
        sql.append("WHERE a.nconocimientoid = ").append(nconocimientoid).append(" ");
        sql.append("ORDER BY 7 DESC ");
    }
    if (StringUtils.isNotBlank(ntipoconocimientoid) && ntipoconocimientoid.equals("1")) {
        sql.append("SELECT ");
        sql.append(
                "    a.nvinculoid as ID, a.nconocimientovinc as IDCONOCIMIENTO, b.vnumero AS NUMERO, b.vnombre AS NOMBRE , b.vsumilla AS SUMILLA, ");
        sql.append("    b.ncategoriaid AS IDCATEGORIA, c.vnombre AS CATEGORIA, b.dfechapublicacion AS FECHA, ");
        sql.append("    1 AS IDTIPOCONOCIMIENTO, 'Base Legal' AS TIPOCONOCIMIENTO, ");
        sql.append("    b.nestadoid AS IDESTADO, d.vnombre AS ESTADO ");
        sql.append("FROM TVINCULO a ");
        sql.append("INNER JOIN TBASELEGAL b ");
        sql.append("    INNER JOIN MTCATEGORIA c ON b.ncategoriaid = c.ncategoriaid ");
        sql.append("    INNER JOIN MTESTADO_BASELEGAL d ON b.nestadoid = d.nestadoid ");
        sql.append("ON a.nconocimientovinc = b.nbaselegalid ");
        sql.append("AND a.ntipoconocimientovinc = 1 ");
        sql.append("AND b.nactivo = :ACTIVO ");
        sql.append("WHERE a.nconocimientoid = ").append(nconocimientoid).append(" ");
        sql.append("ORDER BY 7 DESC ");
    }
    try {
        object = getHibernateTemplate().execute(new HibernateCallback() {
            @Override
            public Object doInHibernate(Session session) throws HibernateException {
                Query query = session.createSQLQuery(sql.toString());
                query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);
                if (StringUtils.isNotBlank(sql.toString())) {
                    query.setParameter("ACTIVO", BigDecimal.ONE);
                }
                return query.list();
            }
        });
    } catch (Exception e) {
        e.getMessage();
        e.printStackTrace();
    }
    return (List<HashMap>) object;
}