public static BigDecimal findPounds(BigDecimal weight, WeightUnitOfMeasureType type) { if (type.equals(WeightUnitOfMeasureType.KILOGRAMS)) { weight = UnitOfMeasureUtil.convertKilogramsToPounds(weight); } return weight; }
public static BigDecimal findOunces(BigDecimal weight, WeightUnitOfMeasureType type) { if (type.equals(WeightUnitOfMeasureType.KILOGRAMS)) { weight = UnitOfMeasureUtil.convertKilogramsToPounds(weight); } BigDecimal ounces = UnitOfMeasureUtil.convertPoundsToOunces(weight); return ounces; }
public String getTitle() { if (title != null) { return title; } else if (key != null) { return BLCMessageUtils.getMessage(key); } return null; }
@Override public boolean getAutomaticallyMergeLikeItems() { if (automaticallyMergeLikeItems != null) { return automaticallyMergeLikeItems; } return BLCSystemProperty.resolveBooleanSystemProperty("automatically.merge.like.items", true); }
@Override public <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, int transactionBehavior, int isolationLevel) throws G { runOptionalTransactionalOperation(operation, exceptionType, true, transactionBehavior, isolationLevel, false, getTransactionManager()); }
@Override public StaticAssetStorage findStaticAssetStorageById(final Long id) { final StaticAssetStorage[] storage = new StaticAssetStorage[1]; transUtil.runTransactionalOperation(new StreamCapableTransactionalOperationAdapter() { @Override public void execute() { storage[0] = staticAssetStorageDao.readStaticAssetStorageById(id); } }, RuntimeException.class); return storage[0]; }
public Map<String, Property> getPMap() { if (pMap == null) { pMap = BLCMapUtils.keyedMap(properties, new TypedClosure<String, Property>() { @Override public String getKey(Property value) { return value.getName(); } }); } return pMap; }
/** * Default implementation is to convert everything to pounds for consistent weight types * * @param weight * @param type * @return */ protected BigDecimal convertWeight(BigDecimal weight, WeightUnitOfMeasureType type) { return UnitOfMeasureUtil.findPounds(weight, type); }
public TableCreator addRow(Col[] cols) { String[] data = new String[cols.length]; for (int i = 0; i < cols.length; i++) { data[i] = cols[i].title; } return addRow(data); }
@Override public <G extends Throwable> void runTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, PlatformTransactionManager transactionManager) throws G { runOptionalTransactionalOperation(operation, exceptionType, true, TransactionDefinition.PROPAGATION_REQUIRED, TransactionDefinition.ISOLATION_DEFAULT, false, transactionManager); }
@Override public boolean shouldRetryOnTransactionLockAcquisitionFailure() { return super.shouldRetryOnTransactionLockAcquisitionFailure(); } }, RuntimeException.class, transactionManager);
@Override public <G extends Throwable> void runStreamingTransactionalOperation(final StreamCapableTransactionalOperation streamOperation, Class<G> exceptionType) throws G { runStreamingTransactionalOperation(streamOperation, exceptionType, TransactionDefinition.PROPAGATION_REQUIRED, TransactionDefinition.ISOLATION_DEFAULT); }
private boolean isFinalPage(Holder holder, int pagedItemCount, Long totalCount) { int processedItemCount = holder.getVal() + pagedItemCount; return processedItemCount >= totalCount; } };
public void setDimensionUnitOfMeasure(final DimensionUnitOfMeasureType dimensionUnitOfMeasure) { if (dimensionUnitOfMeasure != null) { this.dimensionUnitOfMeasure = dimensionUnitOfMeasure.getType(); } }
/** * A helper method used to construct a list of Credit Card Expiration Years * Useful for expiration dropdown menus. * * @return List of the next ten years starting with the current year. */ protected List<String> populateExpirationYears() { return BLCPaymentMethodUtils.getExpirationYearOptions(); }
/** * Returns the message requested by the code with no arguments and the currently set Java Locale on * the {@link BroadleafRequestContext} as returned by {@link BroadleafRequestContext#getJavaLocale()} * * @param code * @return the message */ public static String getMessage(String code) { return getMessage(code, (Object) null); }
@Override public <G extends Throwable> void runOptionalTransactionalOperation(StreamCapableTransactionalOperation operation, Class<G> exceptionType, boolean useTransaction) throws G { runOptionalTransactionalOperation(operation, exceptionType, useTransaction, TransactionDefinition.PROPAGATION_REQUIRED, TransactionDefinition.ISOLATION_DEFAULT, false, getTransactionManager()); }
@Override public Map<String, SearchFacetDTO> getNamedFacetMap(List<SearchFacetDTO> facets, final SearchCriteria searchCriteria) { return BLCMapUtils.keyedMap(facets, new TypedClosure<String, SearchFacetDTO>() { @Override public String getKey(SearchFacetDTO facet) { return getPropertyNameForIndexField(facet.getFacet().getFieldType().getIndexField(), FieldType.getInstance(facet.getFacet().getFacetFieldType())); } }); }
@Override public boolean shouldRetryOnTransactionLockAcquisitionFailure() { return super.shouldRetryOnTransactionLockAcquisitionFailure(); } }, RuntimeException.class, transactionManager);
public Map<String, Property> getPMap() { if (pMap == null) { pMap = BLCMapUtils.keyedMap(properties, new TypedClosure<String, Property>() { @Override public String getKey(Property value) { return value.getName(); } }); } return pMap; }