List of usage examples for java.math BigDecimal ONE
BigDecimal ONE
To view the source code for java.math BigDecimal ONE.
Click Source Link
From source file:org.openvpms.web.component.im.edit.act.ProductTemplateExpanderTestCase.java
/** * Tests template expansion where products are included based on weight ranges. *//*www .j a v a2s . c o m*/ @Test public void testExpandWeightRange() { Product productX = TestHelper.createProduct(); Product productY = TestHelper.createProduct(); Product productZ = TestHelper.createProduct(); Product templateA = createTemplate("templateA"); Product templateB = createTemplate("templateB"); Product templateC = createTemplate("templateC"); addInclude(templateA, templateB, 1, 1, 0, 2); addInclude(templateA, templateC, 2, 4, 2, 4); addInclude(templateB, productX, 1, 1, 0, 2); addInclude(templateB, productY, 1, 1, 2, 4); addInclude(templateC, productX, 1, 1, 0, 2); addInclude(templateC, productZ, 1, 1, 2, 4); Collection<TemplateProduct> includes = expand(templateA, BigDecimal.ZERO); assertEquals(0, includes.size()); // failed to expand as no weight specified includes = expand(templateA, BigDecimal.ONE); assertEquals(1, includes.size()); checkInclude(includes, productX, 1, 1, false); includes = expand(templateA, BigDecimal.valueOf(2)); assertEquals(1, includes.size()); checkInclude(includes, productZ, 2, 4, false); includes = expand(templateA, BigDecimal.valueOf(4)); assertEquals(0, includes.size()); // nothing in the weight range }
From source file:pe.gob.mef.gescon.hibernate.impl.RangoDaoImpl.java
@Override public List<Mtrango> getMtrangosActivosByTipo(BigDecimal id) throws Exception { DetachedCriteria criteria = DetachedCriteria.forClass(Mtrango.class); criteria.add(Restrictions.eq("ntiponormaid", id)); criteria.add(Restrictions.eq("nactivo", BigDecimal.ONE)); criteria.addOrder(Order.asc("vnombre")); return (List<Mtrango>) getHibernateTemplate().findByCriteria(criteria); }
From source file:pe.gob.mef.gescon.hibernate.impl.PerfilDaoImpl.java
@Override public List<HashMap> getMtperfilesByMtuser(final Mtuser mtuser) throws Exception { final StringBuilder sql = new StringBuilder(); Object object = null;/*from www . j a v a2 s.co m*/ try { sql.append( "SELECT a.nperfilid AS ID, a.vnombre AS NOMBRE, a.vdescripcion AS SUMILLA, a.nactivo AS ACTIVO, "); sql.append( " a.vusuariocreacion AS USUARIOCREACION, a.vusuariomodificacion AS USUARIOMODIFICACION, "); sql.append(" a.dfechacreacion AS FECHACREACION, a.dfechamodificacion AS FECHAMODIFICACION "); sql.append("FROM MTPERFIL a "); sql.append("INNER JOIN TUSER_PERFIL b ON a.nperfilid = b.nperfilid "); sql.append("WHERE a.nactivo = :ACTIVO "); sql.append("AND b.nusuarioid = :USERID "); sql.append("ORDER BY a.nperfilid "); 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); query.setParameter("ACTIVO", BigDecimal.ONE); query.setParameter("USERID", mtuser.getNusuarioid()); return query.list(); } }); } catch (Exception e) { e.getMessage(); e.printStackTrace(); } return (List<HashMap>) object; }
From source file:org.jrecruiter.service.JobServiceTest.java
private Job getJob() { Job job = new Job(); job.setBusinessAddress1("businessAddress1"); job.setBusinessAddress2("businessAddress2"); job.setBusinessCity("businessCity"); job.setBusinessEmail("businessEmail"); job.setRegionOther("businessLocation"); job.setBusinessName("businessName"); job.setBusinessPhone("businessPhone"); job.setBusinessState("businessState"); job.setBusinessZip("businessZip"); job.setDescription("description"); job.setJobRestrictions("jobRestrictions"); job.setJobTitle("jobTitle"); job.setLatitude(BigDecimal.ONE); job.setLongitude(BigDecimal.ZERO); job.setOfferedBy(OfferedBy.RECRUITER); job.setRegistrationDate(new Date()); job.setSalary("10000"); job.setStatus(JobStatus.ACTIVE); job.setUpdateDate(new Date()); job.setWebsite("www.google.com"); return job;//w w w .j av a2 s . co m }
From source file:info.magnolia.test.mock.jcr.MockValueTest.java
@Test(expected = ValueFormatException.class) public void testGetBooleanmWithWrongValueType() throws Exception { new MockValue(BigDecimal.ONE).getBoolean(); }
From source file:org.efaps.admin.datamodel.ui.RateUI.java
@Override public Object transformObject(final UIValue _uiValue, final Object _object) throws EFapsException { final Attribute attribute = _uiValue.getAttribute(); Object value = null;/* w w w . j a va 2 s . c om*/ boolean inverted = false; if (attribute != null && attribute.hasEvents(EventType.RATE_VALUE)) { if (_uiValue.getObject() == null && _object != null) { _uiValue.setDbValue((Serializable) _object); } final List<Return> returns = attribute.executeEvents(EventType.RATE_VALUE, ParameterValues.UIOBJECT, _uiValue, ParameterValues.ACCESSMODE, _uiValue.getTargetMode(), ParameterValues.CALL_INSTANCE, _uiValue.getCallInstance(), ParameterValues.INSTANCE, _uiValue.getInstance(), ParameterValues.PARAMETERS, Context.getThreadContext().getParameters()); for (final Return values : returns) { value = values.get(ReturnValues.VALUES); inverted = values.get(ReturnValues.TRUE) != null; } } else { value = _uiValue.getDbValue(); } final BigDecimal denominator; final BigDecimal numerator; if (value instanceof Object[]) { final Object[] values = (Object[]) value; if (values[0] instanceof BigDecimal) { numerator = (BigDecimal) values[0]; } else { numerator = DecimalType.parseLocalized(values[0].toString()); } if (values[1] instanceof BigDecimal) { denominator = (BigDecimal) values[1]; } else { denominator = DecimalType.parseLocalized(values[1].toString()); } } else { numerator = BigDecimal.ONE; denominator = BigDecimal.ONE; } return new Value(numerator, denominator, inverted); }
From source file:io.curly.advisor.web.HttpSecurityAntMatchersTests.java
public String entity() { ReviewEntity reviewEntity = new ReviewEntity(); reviewEntity.setArtifact(ObjectId.get().toHexString()); reviewEntity.setContent("abcd"); reviewEntity.setTitle("some fancy title"); reviewEntity.setRate(BigDecimal.ONE); MockHttpOutputMessage message = new MockHttpOutputMessage(); try {/*w w w . ja va 2s. co m*/ new MappingJackson2HttpMessageConverter().write(reviewEntity, MediaType.APPLICATION_JSON, message); } catch (IOException ignore) { } return message.getBodyAsString(); }
From source file:org.kuali.kfs.module.endow.businessobject.Security.java
/** * Constructs a Security.java.// w w w . j a va2 s . co m */ public Security() { super(); unitValue = BigDecimal.ONE; unitsHeld = BigDecimal.ZERO; carryValue = BigDecimal.ZERO; ticklers = new ArrayList<Tickler>(); }
From source file:org.mifos.framework.components.batchjobs.helpers.BranchReportClientSummaryHelperIntegrationTest.java
private IBranchReportService getBranchReportServiceStub() { return new BranchReportService() { @Override/*from w w w.ja v a 2s . co m*/ public BigDecimal extractPortfolioAtRiskForOffice(OfficeBO office, Integer daysInArrears) throws ServiceException { return BigDecimal.ONE; } }; }
From source file:io.curly.advisor.web.ReviewResourceControllerTests.java
private void createReview() { this.reviewEntity = new ReviewEntity(); reviewEntity.setArtifact(ObjectId.get().toHexString()); reviewEntity.setContent("abcd"); reviewEntity.setTitle("some fancy title"); reviewEntity.setRate(BigDecimal.ONE); }