List of usage examples for java.lang Short valueOf
@HotSpotIntrinsicCandidate public static Short valueOf(short s)
From source file:org.mifos.application.servicefacade.CollectionSheetServiceImpl.java
private CollectionSheetCustomerAccountDto sumAccountCollections( final List<CollectionSheetCustomerAccountCollectionDto> customerAccountCollections) { Double totalFee = Double.valueOf("0.0"); if (customerAccountCollections == null) { return new CollectionSheetCustomerAccountDto(-1, Short.valueOf("-1"), totalFee); }//from w ww . j ava 2 s .c om if (customerAccountCollections.size() > 1) { throw new IllegalStateException("Multiple currency"); } return new CollectionSheetCustomerAccountDto(customerAccountCollections.get(0).getAccountId(), customerAccountCollections.get(0).getCurrencyId(), customerAccountCollections.get(0).getAccountCollectionPayment()); }
From source file:org.mifos.accounts.productsmix.struts.action.ProductMixAction.java
@TransactionDemarcate(validateAndResetToken = true) @CloseSession/* www. j a v a 2s . c o m*/ public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ProductMixActionForm prdMixActionForm = (ProductMixActionForm) form; PrdOfferingBO prdOfferingBO = getPrdMixBusinessService() .getPrdOfferingByID(Short.valueOf(prdMixActionForm.getProductInstance())); prdOfferingBO.updatePrdOfferingFlag(); List<PrdOfferingBO> notAllowedProductList = (List<PrdOfferingBO>) SessionUtils .getAttribute(ProductDefinitionConstants.NOTALLOWEDPRODUCTLIST, request); PrdOfferingBO productOff = getPrdMixBusinessService() .getPrdOfferingByID(Short.valueOf(prdMixActionForm.getProductInstance())); productOff.setUserContext(getUserContext(request)); List<PrdOfferingBO> oldNotAllowedProductList = (List<PrdOfferingBO>) SessionUtils .getAttribute(ProductDefinitionConstants.OLDNOTALLOWEDPRODUCTLIST, request); if (null != oldNotAllowedProductList && oldNotAllowedProductList.size() != 0) { for (PrdOfferingBO oldnotallowedProduct : oldNotAllowedProductList) { ProductMixBO product = getPrdMixBusinessService().getPrdOfferingMixByPrdOfferingID( productOff.getPrdOfferingId(), oldnotallowedProduct.getPrdOfferingId()); // product.setUserContext(getUserContext(request)); if (null != product) { product.delete(); } ProductMixBO productmix = getPrdMixBusinessService().getPrdOfferingMixByPrdOfferingID( oldnotallowedProduct.getPrdOfferingId(), productOff.getPrdOfferingId()); if (null != productmix) { productmix.delete(); } } } if (null != notAllowedProductList) { for (PrdOfferingBO notallowedProduct : notAllowedProductList) { ProductMixBO product = new ProductMixBO(productOff, notallowedProduct); product.setUserContext(getUserContext(request)); product.update(); } } prdOfferingBO = null; return mapping.findForward(ActionForwards.update_success.toString()); }
From source file:org.codice.ddf.spatial.ogc.csw.catalog.common.source.CswFilterDelegate.java
@Override public FilterType propertyIsBetween(String propertyName, short lowerBoundary, short upperBoundary) { isComparisonOperationSupported(ComparisonOperatorType.BETWEEN); propertyName = mapPropertyName(propertyName); if (isPropertyQueryable(propertyName)) { return cswFilterFactory.buildPropertyIsBetweenFilter(propertyName, Short.valueOf(lowerBoundary), Short.valueOf(upperBoundary)); } else {/*from w w w.j a v a 2 s. c o m*/ return new FilterType(); } }
From source file:org.apache.ambari.server.controller.internal.UpgradeResourceProvider.java
private void makeActionStage(UpgradeContext context, RequestStageContainer request, UpgradeItemEntity entity, StageWrapper wrapper, boolean skippable, boolean allowRetry) throws AmbariException { if (0 == wrapper.getHosts().size()) { throw new AmbariException( String.format("Cannot create action for '%s' with no hosts", wrapper.getText())); }/* www .java 2s.com*/ Cluster cluster = context.getCluster(); // add each host to this stage RequestResourceFilter filter = new RequestResourceFilter("", "", new ArrayList<String>(wrapper.getHosts())); Map<String, String> params = new HashMap<String, String>(); params.put(COMMAND_PARAM_TASKS, entity.getTasks()); params.put(COMMAND_PARAM_VERSION, context.getVersion()); params.put(COMMAND_PARAM_DIRECTION, context.getDirection().name().toLowerCase()); // Because custom task may end up calling a script/function inside a service, it is necessary to set the // service_package_folder and hooks_folder params. AmbariMetaInfo ambariMetaInfo = s_metaProvider.get(); StackId stackId = cluster.getDesiredStackVersion(); StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion()); if (wrapper.getTasks() != null && wrapper.getTasks().size() > 0) { String serviceName = wrapper.getTasks().get(0).getService(); ServiceInfo serviceInfo = ambariMetaInfo.getService(stackId.getStackName(), stackId.getStackVersion(), serviceName); params.put(SERVICE_PACKAGE_FOLDER, serviceInfo.getServicePackageFolder()); params.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder()); } ActionExecutionContext actionContext = new ActionExecutionContext(cluster.getClusterName(), "ru_execute_tasks", Collections.singletonList(filter), params); actionContext.setIgnoreMaintenance(true); actionContext.setTimeout(Short.valueOf(s_configuration.getDefaultAgentTaskTimeout(false))); Map<String, String> hostLevelParams = new HashMap<String, String>(); hostLevelParams.put(JDK_LOCATION, getManagementController().getJdkResourceUrl()); ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(actionContext, cluster); Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari", cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getClusterHostInfo(), jsons.getCommandParamsForStage(), jsons.getHostParamsForStage()); stage.setSkippable(skippable); long stageId = request.getLastStageId() + 1; if (0L == stageId) { stageId = 1L; } stage.setStageId(stageId); entity.setStageId(Long.valueOf(stageId)); s_actionExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, allowRetry); // need to set meaningful text on the command for (Map<String, HostRoleCommand> map : stage.getHostRoleCommands().values()) { for (HostRoleCommand hrc : map.values()) { hrc.setCommandDetail(entity.getText()); } } request.addStages(Collections.singletonList(stage)); }
From source file:org.apache.jasper.compiler.JspUtil.java
public static String coerceToPrimitiveShort(String s, boolean isNamedAttribute) { if (isNamedAttribute) { return "org.apache.jasper.runtime.JspRuntimeLibrary.coerceToShort(" + s + ")"; } else {/* ww w . j a va 2 s .co m*/ if (s == null || s.length() == 0) return "(short) 0"; else return "((short) " + Short.valueOf(s).toString() + ")"; } }
From source file:org.apache.jasper.compiler.JspUtil.java
public static String coerceToShort(String s, boolean isNamedAttribute) { if (isNamedAttribute) { return "(Short) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s + ", Short.class)"; } else {//ww w. j a v a2 s . c om if (s == null || s.length() == 0) { return "new Short((short) 0)"; } else { // Detect format error at translation time return "new Short(\"" + Short.valueOf(s).toString() + "\")"; } } }
From source file:com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.java
private boolean isConversionMatched(String sentinel, Object selectedValue) { boolean match = false; if (sentinel.length() == 0) { if (selectedValue == null) { match = true;/*w w w .ja v a 2s . co m*/ } } else if (selectedValue instanceof Long) { if (selectedValue.equals(Long.valueOf(sentinel))) { match = true; } } else if (selectedValue instanceof Byte) { if (selectedValue.equals(Byte.valueOf(sentinel))) { match = true; } } else if (selectedValue instanceof Integer) { if (selectedValue.equals(Integer.valueOf(sentinel))) { match = true; } } else if (selectedValue instanceof Short) { if (selectedValue.equals(Short.valueOf(sentinel))) { match = true; } } else if (selectedValue instanceof Double) { if (selectedValue.equals(Double.valueOf(sentinel))) { match = true; } } else if (selectedValue instanceof Float) { if (selectedValue.equals(Float.valueOf(sentinel))) { match = true; } } else if (selectedValue instanceof Boolean) { if (selectedValue.equals(Boolean.valueOf(sentinel))) { match = true; } } return match; }
From source file:org.mifos.accounts.loan.business.LoanBORedoDisbursalIntegrationTest.java
@Ignore @Test/*from w w w. j a v a 2s . com*/ public void testRedoLoanApplyFractionalMiscFeeAfterFullPayment() throws Exception { try { LoanBO loan = redoLoanWithMondayMeetingAndVerify(userContext, 14, new ArrayList<AccountFeesEntity>()); disburseLoanAndVerify(userContext, loan, 14); LoanTestUtils.assertInstallmentDetails(loan, 1, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 2, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 3, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 4, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 5, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 6, 45.5, 0.5, 0.0, 0.0, 0.0); // make one full repayment applyAndVerifyPayment(userContext, loan, 7, new Money(getCurrency(), "51")); LoanTestUtils.assertInstallmentDetails(loan, 1, 0.0, 0.0, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 2, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 3, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 4, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 5, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 6, 45.5, 0.5, 0.0, 0.0, 0.0); // Should throw AccountException applyCharge(loan, Short.valueOf(AccountConstants.MISC_FEES), new Double("33.7")); LoanTestUtils.assertInstallmentDetails(loan, 1, 0.0, 0.0, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 2, 51.2, 0.1, 0.0, 33.7, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 3, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 4, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 5, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 6, 45.2, 0.8, 0.0, 0.0, 0.0); Assert.fail("Expected AccountException !!"); } catch (AccountException e) { } }
From source file:org.codice.ddf.spatial.ogc.csw.catalog.converter.impl.CswRecordConverter.java
/** * Converts the CSW record property to the specified Metacard attribute format. * /*w w w. ja va 2 s . c o m*/ * @param attributeFormat * @param reader * @return */ protected Serializable convertRecordPropertyToMetacardAttribute(AttributeFormat attributeFormat, HierarchicalStreamReader reader) { LOGGER.debug("converting csw record property {}", reader.getValue()); Serializable ser = null; switch (attributeFormat) { case BOOLEAN: ser = Boolean.valueOf(reader.getValue()); break; case DOUBLE: ser = Double.valueOf(reader.getValue()); break; case FLOAT: ser = Float.valueOf(reader.getValue()); break; case INTEGER: ser = Integer.valueOf(reader.getValue()); break; case LONG: ser = Long.valueOf(reader.getValue()); break; case SHORT: ser = Short.valueOf(reader.getValue()); break; case XML: case STRING: ser = reader.getValue(); break; case DATE: ser = convertStringValueToMetacardValue(attributeFormat, reader.getValue()); break; case GEOMETRY: // We pass in isLonLatOrder, so we can determine coord order (LAT/LON vs // LON/LAT). ser = new BoundingBoxReader(reader, isLonLatOrder).getWkt(); LOGGER.debug("WKT = {}", (String) ser); break; case BINARY: try { ser = reader.getValue().getBytes(UTF8_ENCODING); } catch (UnsupportedEncodingException e) { LOGGER.warn("Error encoding the binary value into the metacard.", e); } break; default: break; } return ser; }
From source file:org.mifos.customers.client.struts.action.ClientCustAction.java
private boolean isTrained(Short trainedValue) { return Short.valueOf("1").equals(trainedValue); }