org.mayocat.model.Association类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.mayocat.model.Association类的一些代码示例,展示了Association类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Association类的具体详情如下:
包路径:org.mayocat.model.Association
类名称:Association

Association介绍

[英]Intended to wrap an entity field in an option style construct that let consumers test whether the field has been loaded or not. Typically loaded will mean "loaded from database". When backed by a RDBMS, this is useful for fields that require sub-querying, or joins, or any costy operation. Those fields would be typically loaded only when needed.
[中]用于将实体字段包装在选项样式构造中,让使用者测试字段是否已加载。通常,加载意味着“从数据库加载”。当由RDBMS支持时,这对于需要子查询、联接或任何开销操作的字段非常有用。这些字段通常仅在需要时加载。

代码示例

代码示例来源:origin: jvelo/mayocat-shop

@Override
public boolean equals(Object obj)
{
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final Association<T> other = (Association<T>) obj;
  return Objects.equal(this.get(), other.get());
}

代码示例来源:origin: jvelo/mayocat-shop

public T or(T t)
{
  return this.isLoaded() ? reference : t;
}

代码示例来源:origin: jvelo/mayocat-shop

@Override
public void setAddons(Map<String, AddonGroup> addons)
{
  this.addons = new Association(addons);
}

代码示例来源:origin: stackoverflow.com

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"));

代码示例来源:origin: jvelo/mayocat-shop

public boolean apply(@Nullable Product input)
  {
    return input.getCollections().isLoaded() && input.getCollections().get().contains(collection);
  }
}).toList();

代码示例来源:origin: stackoverflow.com

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>&#8364; " + 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>");

代码示例来源:origin: jvelo/mayocat-shop

public boolean apply(@Nullable Product input)
  {
    return input.getCollections().isLoaded() && input.getCollections().get().isEmpty();
  }
}).toList();

代码示例来源:origin: jvelo/mayocat-shop

public boolean apply(@Nullable Product input)
  {
    return input.getCollections().isLoaded() && input.getCollections().get().contains(collection)
        && input.getOnShelf();
  }
}).toList();

代码示例来源:origin: jvelo/mayocat-shop

public T get()
{
  if (!isLoaded()) {
    throw new IllegalStateException("Cannot access a value not loaded");
  }
  return reference;
}

代码示例来源:origin: jvelo/mayocat-shop

@Override
public void setAddons(Map<String, AddonGroup> addons)
{
  this.addons = new Association(addons);
}

代码示例来源:origin: jvelo/mayocat-shop

Map<String, AddonGroup> entityAddons = ((HasAddons) copiedEntity).getAddons().get();
  final Map<String, Object> localizedAddons =
    (Map<String, Object>) copiedEntity.getLocalizedVersions().get(locale).get("addons");

代码示例来源:origin: jvelo/mayocat-shop

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();
}

代码示例来源:origin: jvelo/mayocat-shop

private boolean hasLoadedAddons(Entity entity)
{
  return HasAddons.class.isAssignableFrom(entity.getClass()) && ((HasAddons) entity).getAddons().isLoaded();
}

代码示例来源:origin: jvelo/mayocat-shop

@Override
public void setAddons(Map<String, AddonGroup> addons)
{
  this.addons = new Association(addons);
}

代码示例来源:origin: jvelo/mayocat-shop

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;
}

代码示例来源:origin: jvelo/mayocat-shop

if (tenant.getAddons().isLoaded()) {
  Map<String, Object> addons = addonsWebObjectBuilder.build(tenantData);
  site.put("addons", addons);

代码示例来源:origin: jvelo/mayocat-shop

public static Association notLoaded()
{
  return new Association(null);
}

代码示例来源:origin: jvelo/mayocat-shop

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();
}

代码示例来源:origin: jvelo/mayocat-shop

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;
}

代码示例来源:origin: jvelo/mayocat-shop

public void setCollections(List<Collection> collections)
{
  this.collections = new Association<>(collections);
}

相关文章

微信公众号

最新文章

更多