public T or(T t) { return this.isLoaded() ? reference : t; }
@Override public void setAddons(Map<String, AddonGroup> addons) { this.addons = new Association(addons); }
AssociationService serv = new AssociationService(); Association logassoc = new Association(); logassoc.addFileExtension("DAN"); logassoc.addAction( new Action("open", "C:\\WINDOWS\\JAVA.EXE -jar C:\\dan.jar %1"));
List<Card> cards = new ArrayList<Card>(); Association asso = new Association(); cards = asso.showAvailableCards(); out.print("<br>"); out.print("<h2>Available cards:</h2>"); out.print("<Table width=100% align=center border='1'>"); out.print("<input type=hidden name=\"idcard\">"); out.print("<tr><th>card Id</th><th>Card number</th><th>Attivation code</th> <th>Pin</th><th>Amount</th><th>Expiry date</th> <th>Select</th></tr>"); for (int i = 0; i < cards.size(); i++) { Card card = new Card(); card = cards.get(i); out.print("<tr>"); int idcard = card.getId(); out.print("<td align=center>" + card.getId() + "</td>"); out.print("<td align=center>" + card.getCardNumber + "</td>"); out.print("<td align=center>" + getAttCode() + "</td>"); out.print("<td align=center>" + card.getPin() + "</td>"); out.print("<td align=center>€ " + card.getAmount() + "</td>"); out.print("<td align=center>" + card.getExpiryMonth() + "/" + card.getExpiryYear() + "</td>"); out.print("<td align= center><input type=\"button\" value=\"Select\" onclick=\"exeForm(1,'CardExe.jsp'," + card.getId() + ")\">"); out.print("</tr>"); } out.print("</table>");
public T get() { if (!isLoaded()) { throw new IllegalStateException("Cannot access a value not loaded"); } return reference; }
@Override public void setAddons(Map<String, AddonGroup> addons) { this.addons = new Association(addons); }
Map<String, AddonGroup> entityAddons = ((HasAddons) copiedEntity).getAddons().get(); final Map<String, Object> localizedAddons = (Map<String, Object>) copiedEntity.getLocalizedVersions().get(locale).get("addons");
public Optional<BigDecimal> getActualUnitPrice() { if (this.price != null) { return Optional.of(price); } else if (this.getParent().isPresent() && this.getParent().get().isLoaded()) { Purchasable parent = this.getParent().get().get(); if (!Product.class.isAssignableFrom(parent.getClass())) { throw new RuntimeException("Cannot handle a parent purchasable that is not a product"); } Product parentProduct = (Product) parent; return Optional.fromNullable(parentProduct.getPrice()); } return Optional.absent(); }
private boolean hasLoadedAddons(Entity entity) { return HasAddons.class.isAssignableFrom(entity.getClass()) && ((HasAddons) entity).getAddons().isLoaded(); }
@Override public void setAddons(Map<String, AddonGroup> addons) { this.addons = new Association(addons); }
public BigDecimal getItemTotal(Taxable item) { BigDecimal total = BigDecimal.ZERO; BigDecimal unitPrice = item.getUnitPrice(); if (unitPrice == null && item.getParent().isPresent() && item.getParent().get().isLoaded()) { unitPrice = item.getParent().get().get().getUnitPrice(); } if (items.containsKey(item) && unitPrice != null && items.get(item) > 0) { total = total.add(unitPrice.multiply(BigDecimal.valueOf(items.get(item)))); } return total; }
if (tenant.getAddons().isLoaded()) { Map<String, Object> addons = addonsWebObjectBuilder.build(tenantData); site.put("addons", addons);
public static Association notLoaded() { return new Association(null); }
public Optional<BigDecimal> getActualWeight() { if (this.weight != null) { return Optional.of(weight); } else if (this.getParent().isPresent() && this.getParent().get().isLoaded()) { Purchasable parent = this.getParent().get().get(); if (!Product.class.isAssignableFrom(parent.getClass())) { throw new RuntimeException("Cannot handle a parent purchasable that is not a product"); } Product parentProduct = (Product) parent; return Optional.fromNullable(parentProduct.getWeight()); } return Optional.absent(); }
public Feature createFeature(final Feature feature) throws InvalidEntityException, EntityAlreadyExistsException { if (feature.getParentId() == null) { throw new InvalidEntityException("Cannot create a feature without a parent product specified"); } Product product = this.findById(feature.getParentId()); if (product == null) { throw new InvalidEntityException("Specified parent product does not exist"); } boolean exists = findFeature(product, feature.getFeature(), feature.getFeatureSlug()) != null; if (exists) { throw new EntityAlreadyExistsException(); } if (!feature.getAddons().isLoaded()) { feature.setAddons(new HashMap<String, AddonGroup>()); } getObservationManager().notify(new EntityCreatingEvent(), feature); this.featureDao.begin(); UUID entityId = UUID.randomUUID(); feature.setId(entityId); this.featureDao.createChildEntity(feature, FEATURE_TABLE_NAME, getTenant()); this.featureDao.createFeature(feature); this.featureDao.createOrUpdateAddons(feature); this.featureDao.commit(); getObservationManager().notify(new EntityCreatedEvent(), feature); return feature; }
public void setCollections(List<Collection> collections) { this.collections = new Association<>(collections); }