public void setProductAsConverted(final ImportedProduct product) { DataDefinition importedProductDataDefinition = dataDefinitionService.get( SfcSimpleConstants.PLUGIN_IDENTIFIER, SfcSimpleConstants.MODEL_IMPORTED_PRODUCT); Entity importedProduct = importedProductDataDefinition.get(product.getOriginalEntityId()); importedProduct.setField(FIELD_CONVERTED, "1"); importedProductDataDefinition.save(importedProduct); }
private ImportedProduct createImportedProduct( final Entity productEntity, final boolean isOrderConversion) { ImportedProduct product = new ImportedProduct(productEntity.getId()); if ("02service".equals(productEntity.getField(FIELD_TYPE))) { return null; } else if (isOrderConversion || "04set".equals(productEntity.getField(FIELD_TYPE))) { product.setTypeOfMaterial("03finalProduct"); } else { product.setTypeOfMaterial("01component"); } product.setNumber(productEntity.getStringField(FIELD_IDENTIFICATION_CODE)); product.setName(productEntity.getStringField(FIELD_NAME)); product.setEan(productEntity.getStringField("ean")); product.setUnit(productEntity.getStringField(FIELD_UNIT)); return product; }