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

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

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

Entity.getId介绍

暂无

代码示例

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

private Long toId(Entity entity) {
  if (entity == null) {
    return null;
  }
  return entity.getId();
}

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

private boolean isCoverageLocationAlreadyUsed(final Entity coverageLocation, final Entity addedCoverageLocation,
    final Entity location, final Entity addedLocation) {
  return ((coverageLocation.getId() == null) || !coverageLocation.getId().equals(addedCoverageLocation.getId()))
      && addedLocation.getId().equals(location.getId());
}

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

private boolean storageLocationChanged(final Entity oldResourde, final Entity newStorageLocation) {
  Entity oldStorageLocation = oldStorageLocation(oldResourde);
  return (newStorageLocation != null && oldStorageLocation != null) ? (newStorageLocation.getId().compareTo(
      oldStorageLocation.getId()) != 0) : !(newStorageLocation == null && oldStorageLocation == null);
}

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

public RegisterEntry(Entity entry) {
  this.entry = entry;
  this.productId = entry.getBelongsToField("product").getId();
  this.tocId = entry.getBelongsToField("technologyOperationComponent").getId();
}

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

private boolean checkIfWarehouseHasChanged(final Entity oldDocument, final Entity newDocument, final String warehouseField) {
  Entity oldWarehouse = oldDocument.getBelongsToField(warehouseField);
  Entity newWarehouse = newDocument.getBelongsToField(warehouseField);
  if (oldWarehouse == null && newWarehouse == null) {
    return false;
  } else if (oldWarehouse != null && newWarehouse != null) {
    return oldWarehouse.getId().compareTo(newWarehouse.getId()) != 0;
  }
  return true;
}

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

@Override
public void updateCostNormsForProductsFromWarehouses(final List<Entity> products, final List<Entity> warehouses) {
  List<Long> productIds = products.stream().map(product -> product.getId()).collect(Collectors.toList());
  List<Long> warehousesIds = warehouses.stream().filter(warehouse -> warehouse != null).map(warehouse -> warehouse.getId())
      .collect(Collectors.toList());
  List<CostNorm> lastPurchases = costNormsDao.getLastPurchaseCostsForProducts(productIds, warehousesIds);
  List<CostNorm> averageCosts = costNormsDao.getAverageCostForProducts(productIds, warehousesIds);
  costNormsDao.updateCostNormsForProducts(mergeCostNorms(lastPurchases, averageCosts));
}

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

private void clearAssociatedBarcodeOperationComponents(final StateChangeContext stateChangeContext) {
  final Entity order = stateChangeContext.getOwner();
  if (order != null && order.getId() != null) {
    String query = "DELETE FROM technologies_barcodeoperationcomponent WHERE order_id = :id";
    jdbcTemplate.update(query, new MapSqlParameterSource("id", order.getId()));
  }
}

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

private void fillCoverageProductForDelivery(final Map<Long, Entity> productAndCoverageProducts, final Entity product,
    final Entity coverageProductLogging) {
  if (coverageProductLogging != null) {
    if (productAndCoverageProducts.containsKey(product.getId())) {
      updateCoverageProductForDelivery(productAndCoverageProducts, product, coverageProductLogging);
    } else {
      addCoverageProductForDelivery(productAndCoverageProducts, product, coverageProductLogging);
    }
  }
}

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

public List<Entity> findComponentRegistryEntries(final Entity order) {
  StringBuilder query = new StringBuilder();
  query.append("select registry from #orderSupplies_coverageRegister as registry, ");
  query.append("#technologies_operationProductInComponent as operationProductInComponent ");
  query.append("where registry.order.id = :orderId and eventType in ('04orderInput','03operationInput') ");
  query.append("and productType = '02intermediate' ");
  query.append("and operationProductInComponent.operationComponent = registry.technologyOperationComponent ");
  query.append("and operationProductInComponent.product = registry.product order by operationProductInComponent.priority ");
  return dataDefinitionService.get(OrderSuppliesConstants.PLUGIN_IDENTIFIER, "coverageRegister").find(query.toString())
      .setParameter("orderId", order.getId()).list().getEntities();
}

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

public List<Long> getRegisterOrderProductsIds(final List<Entity> order) {
  List<Long> orderIds = order.stream().map(o -> o.getId()).collect(Collectors.toList());
  List<Entity> entries = dataDefinitionService
      .get(OrderSuppliesConstants.PLUGIN_IDENTIFIER, OrderSuppliesConstants.MODEL_COVERAGE_REGISTER).find()
      .createAlias(CoverageRegisterFields.ORDER, "ord", JoinType.LEFT)
      .add(SearchRestrictions.in("ord.id", Lists.newArrayList(orderIds))).list().getEntities();
  return entries.stream().map(r -> r.getBelongsToField(CoverageRegisterFields.PRODUCT).getId())
      .collect(Collectors.toList());
}

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

private void cleanLocations(Entity technology) {
  List<Entity> opocs = findOPOCs(technology.getId());
  for (Entity opoc : opocs) {
    cleanOperationProduct(opoc);
  }
  List<Entity> opics = findOPICs(technology.getId());
  for (Entity opic : opics) {
    cleanOperationProduct(opic);
  }
}

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

private Date findCalculatedStartAllOrders(final Entity order) {
  List<Entity> ordersTimeCalculations = dataDefinitionService
      .get(TimeNormsConstants.PLUGIN_PRODUCTION_SCHEDULING_IDENTIFIER, TimeNormsConstants.MODEL_ORDER_TIME_CALCULATION)
      .find().createAlias("order", "ord", JoinType.LEFT)
      .add(SearchRestrictions.in("ord.id",
          getOrderAndSubOrders(order.getId()).stream().map(entity -> entity.getId()).collect(Collectors.toList())))
      .list().getEntities();
  return ordersTimeCalculations.stream().map(e -> e.getDateField(OrderTimeCalculationFields.EFFECTIVE_DATE_FROM))
      .min(Comparator.<Date>naturalOrder()).get();
}

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

private Integer getWorkstationsQuantityFromMap(final Map<Long, Integer> workstations, final Entity operationComponent) {
  Entity operComp = operationComponent;
  String entityType = operationComponent.getDataDefinition().getName();
  if (!TechnologiesConstants.MODEL_TECHNOLOGY_OPERATION_COMPONENT.equals(entityType)) {
    operComp = operComp.getBelongsToField(L_TECHNOLOGY_OPERATION_COMPONENT).getDataDefinition()
        .get(operComp.getBelongsToField(L_TECHNOLOGY_OPERATION_COMPONENT).getId());
  }
  return workstations.get(operComp.getId());
}

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

private BigDecimal getOperationRunsFromMap(final Map<Long, BigDecimal> operationRuns, final Entity operationComponent) {
  Entity operComp = operationComponent;
  String entityType = operationComponent.getDataDefinition().getName();
  if (!TechnologiesConstants.MODEL_TECHNOLOGY_OPERATION_COMPONENT.equals(entityType)) {
    operComp = operComp.getBelongsToField(L_TECHNOLOGY_OPERATION_COMPONENT).getDataDefinition()
        .get(operComp.getBelongsToField(L_TECHNOLOGY_OPERATION_COMPONENT).getId());
  }
  return BigDecimalUtils.convertNullToZero(operationRuns.get(operComp.getId()));
}

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

public void restrictToUserLocations(final SearchCriteriaBuilder scb, final FilterValueHolder filterValue) {
  Long currentUserId = securityService.getCurrentUserId();
  if (Objects.nonNull(currentUserId)) {
    EntityList userLocations = userDataDefinition().get(currentUserId).getHasManyField(UserFieldsMF.USER_LOCATIONS);
    if (!userLocations.isEmpty()) {
      Set<Integer> locationIds = userLocations.stream().map(ul -> ul.getBelongsToField(UserLocationFields.LOCATION))
          .mapToInt(e -> e.getId().intValue()).boxed().collect(Collectors.toSet());
      scb.add(SearchRestrictions.in(LOCATION_ID, locationIds));
    }
  }
}

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

public List<Entity> generateMaterialAvailabilityForOrder(Entity order) {
  Entity technology = order.getBelongsToField(OrderFields.TECHNOLOGY);
  if (order.getId() == null || technology == null) {
    return Collections.EMPTY_LIST;
  }
  List<Entity> materialsAvailability = createMaterialAvailability(order, technology);
  updateQuantityAndAvailability(materialsAvailability);
  return materialsAvailability;
}

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

public Entity findOrderForTechnology(Entity technology) {
  String sql = "select o from #orders_order o left join o.technology tech where tech.id = :technologyID";
  return dataDefinitionService.get(OrdersConstants.PLUGIN_IDENTIFIER, OrdersConstants.MODEL_ORDER).find(sql)
      .setParameter("technologyID", technology.getId()).setMaxResults(1).uniqueResult();
}

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

private List<Entity> findReservationsForDelivery(final Entity delivery) {
  String query = buildQueryForDeliveredProductReservations(delivery);
  return dataDefinitionService
      .get(DeliveriesConstants.PLUGIN_IDENTIFIER, DeliveriesConstants.MODEL_DELIVERED_PRODUCT_RESERVATION).find(query)
      .setParameter(DELIVER_ID, delivery.getId()).list().getEntities();
}

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

private Entity copyTechnology(final Entity technologyPrototype, final Entity order) {
  String number = technologyServiceO.generateNumberForTechnologyInOrder(order, technologyPrototype);
  Entity copyOfTechnology = technologyServiceO.getTechnologyDD().copy(technologyPrototype.getId()).get(0);
  copyOfTechnology.setField(TechnologyFields.NUMBER, number);
  copyOfTechnology.setField(TechnologyFields.TECHNOLOGY_PROTOTYPE, technologyPrototype);
  copyOfTechnology.setField(TechnologyFields.TECHNOLOGY_TYPE, getTechnologyType(order));
  copyOfTechnology = copyOfTechnology.getDataDefinition().save(copyOfTechnology);
  return copyOfTechnology;
}

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

private void fillForComponentsOne(final Entity technology) {
  List<Entity> opics = operationComponentDataProvider.getOperationProductsForTechnology(technology.getId());
  Entity componentsLocation = technology.getBelongsToField(OperationProductOutComponentFieldsPFTD.COMPONENTS_LOCATION);
  Entity componentsOutputLocation = technology.getBelongsToField(TechnologyFieldsPFTD.COMPONENTS_OUTPUT_LOCATION);
  for (Entity op : opics) {
    cleanOperationProduct(op);
    op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_LOCATION, componentsLocation);
    op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_OUTPUT_LOCATION, componentsOutputLocation);
    op.getDataDefinition().fastSave(op);
  }
}

相关文章