com.qcadoo.model.api.Entity.getError()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(98)

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

Entity.getError介绍

暂无

代码示例

代码示例来源:origin: qcadoo/mes

public void fillDoneQuantityField(final ViewDefinitionState view, final ComponentState state, final String[] args) {
  FormComponent form = (FormComponent) view.getComponentByReference(L_FORM);
  FieldComponent producedQuantity = (FieldComponent) view
      .getComponentByReference(BasicProductionCountingFields.PRODUCED_QUANTITY);
  Long basicProductionCountingId = form.getEntityId();
  if (basicProductionCountingId != null) {
    Entity basicProductionCounting = basicProductionCountingService.getBasicProductionCounting(basicProductionCountingId);
    Entity order = basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER);
    Entity product = basicProductionCounting.getBelongsToField(BasicProductionCountingFields.PRODUCT);
    if (order.getBelongsToField(OrderFields.PRODUCT).getId().equals(product.getId())) {
      final String fieldValue = (String) producedQuantity.getFieldValue();
      if (fieldValue == null || fieldValue.isEmpty()) {
        return;
      }
      try {
        final BigDecimal doneQuantity = new BigDecimal(fieldValue.replace(",", ".").replace(" ", "")
            .replace("\u00A0", ""));
        order.setField(OrderFields.DONE_QUANTITY, doneQuantity);
        order = order.getDataDefinition().save(order);
      } catch (NumberFormatException ex) {
        return;
      }
      if (!order.isValid()) {
        producedQuantity.addMessage(order.getError(OrderFields.DONE_QUANTITY));
      }
    }
  }
}

代码示例来源:origin: qcadoo/mes

public final void assignProductInComponentValidationErrors(final ViewDefinitionState view) {
  AwesomeDynamicListComponent adl = getMainAwesomeDynamicList(view);
  for (FormComponent form : adl.getFormComponents()) {
    Entity productInComponent = form.getEntity();
    if (!productInComponent.isFieldValid(L_PRODUCT_IN_COMPONENT)) {
      ErrorMessage errorMessage = productInComponent.getError(L_PRODUCT_IN_COMPONENT);
      form.findFieldComponentByName(L_PRODUCT_INFO_LOOKUP).addMessage(errorMessage.getMessage(), MessageType.FAILURE);
    }
  }
}

相关文章