private void deleteProductStructureTree(List<Entity> treeEntities) { for (Entity entity : treeEntities) { entity.getDataDefinition().delete(entity.getId()); } }
public EntityOpResult delete(final Iterable<Long> ids) { if (Iterables.isEmpty(ids)) { return EntityOpResult.successfull(); } return getPfdDataDefinition().delete(FluentIterable.from(ids).toArray(Long.class)); }
public void delete(Long id) { DataDefinition dataDefinition = getActionForPlannedEventDD(); try { dataDefinition.delete(id); } catch (IllegalStateException exc) { throw new BasicException( translationService.translate("actionsGrid.notification.entityInUse", LocaleContextHolder.getLocale())); } }
public EntityOpResult deleteExistingMasterOrderProducts(final Entity masterOrder) { if (masterOrder == null || masterOrder.getId() == null) { return EntityOpResult.successfull(); } Collection<Long> belongingProductIds = findBelongingProductIds(masterOrder); if (belongingProductIds.isEmpty()) { return EntityOpResult.successfull(); } return getMasterOrderProductDD().delete(belongingProductIds.toArray(new Long[] {})); }
/** * Deleting coverageProductSelected */ private void deleteSelected() { coverageProductSelectedDataDefinition.find().list().getEntities().forEach(entity -> { coverageProductSelectedDataDefinition.delete(entity.getId()); }); }
private void removeAlreadyExistsMergesForOrder(Entity order) { List<Entity> mergedProductInsByOrder = operationMergeService.findMergedProductInByOrder(order); for (Entity entity : mergedProductInsByOrder) { entity.getDataDefinition().delete(entity.getId()); } List<Entity> mergedProductOutsByOrder = operationMergeService.findMergedProductOutByOrder(order); for (Entity entity : mergedProductOutsByOrder) { entity.getDataDefinition().delete(entity.getId()); } }
private void removeAlreadyExistsMergesForOrder(Entity order) { List<Entity> mergedProductInsByOrder = operationMergeService.findMergedProductInByOrder(order); for (Entity entity : mergedProductInsByOrder) { entity.getDataDefinition().delete(entity.getId()); } List<Entity> mergedProductOutsByOrder = operationMergeService.findMergedProductOutByOrder(order); for (Entity entity : mergedProductOutsByOrder) { entity.getDataDefinition().delete(entity.getId()); } }
private void deleteOldEntries() { DataDefinition deliveredProductMulti = dataDefinitionService.get(DeliveriesConstants.PLUGIN_IDENTIFIER, DeliveriesConstants.MODEL_DELIVERED_PRODUCT_MULTI); Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -1); List<Entity> oldEntries = deliveredProductMulti.find().add(SearchRestrictions.lt("updateDate", cal.getTime())).list() .getEntities(); oldEntries.stream().forEach(e -> e.getDataDefinition().delete(e.getId())); }
private boolean deletePreviousReservations(List<Entity> orderedOrDeliveredProducts) { int countReservations = 0; for (Entity p : orderedOrDeliveredProducts) { EntityList reservations = p.getHasManyField(DeliveredProductFields.RESERVATIONS); countReservations += reservations.size(); reservations.stream().forEach(reservation -> { reservation.getDataDefinition().delete(reservation.getId()); }); } return countReservations > 0; }
public boolean onDelete(final DataDefinition operationalTaskDD, final Entity operationalTask) { boolean isDeleted = true; Entity techOperCompOperationalTask = operationalTask .getBelongsToField(OperationalTaskFieldsOTFO.TECH_OPER_COMP_OPERATIONAL_TASK); if (techOperCompOperationalTask != null) { isDeleted = techOperCompOperationalTask.getDataDefinition().delete(techOperCompOperationalTask.getId()) .isSuccessfull(); } return isDeleted; }
private void deleteMaterialAvailability(final Entity order) { EntityList orderMaterialAvailability = order.getHasManyField(OrderFieldsPFTD.MATERIAL_AVAILABILITY); if (!orderMaterialAvailability.isEmpty()) { DataDefinition materialAvailabilityDD = dataDefinitionService.get(ProductFlowThruDivisionConstants.PLUGIN_IDENTIFIER, ProductFlowThruDivisionConstants.MODEL_MATERIAL_AVAILABILITY); for (Entity materialAvailability : orderMaterialAvailability) { materialAvailabilityDD.delete(materialAvailability.getId()); } } }
public boolean onDelete(final DataDefinition technologyOperationComponentDD, final Entity technologyOperationComponent) { boolean isDeleted = true; Entity techOperCompTimeCalculation = technologyOperationComponent .getBelongsToField(TechnologyOperationComponentFieldsTNFO.TECH_OPER_COMP_TIME_CALCULATION); if (techOperCompTimeCalculation != null) { isDeleted = techOperCompTimeCalculation.getDataDefinition().delete(techOperCompTimeCalculation.getId()) .isSuccessfull(); } return isDeleted; }
public void deleteColumn(final String pluginIdentifier, final String model, final Map<String, String> columnAttributes) { final List<Entity> columns = getColumnDD(pluginIdentifier, model).find() .add(SearchRestrictions.eq(IDENTIFIER, columnAttributes.get(IDENTIFIER))).list().getEntities(); for (Entity column : columns) { column.getDataDefinition().delete(column.getId()); } }
private void deleteTemporaryPalletNumberHelpers() { List<Entity> palletNumberHelpers = getPalletNumberHelperDD().find() .add(SearchRestrictions.eq(PalletNumberHelperFields.TEMPORARY, true)).list().getEntities(); palletNumberHelpers.forEach(palletNumberHelper -> palletNumberHelper.getDataDefinition().delete( palletNumberHelper.getId())); }
private void deleteOperationTaskForOrder(final Entity order) { DataDefinition operationTaskDD = dataDefinitionService.get(OperationalTasksConstants.PLUGIN_IDENTIFIER, OperationalTasksConstants.MODEL_OPERATIONAL_TASK); List<Entity> operationTasks = operationTaskDD.find() .add(SearchRestrictions.belongsTo(OperationalTaskFieldsOTFO.ORDER, order)).list().getEntities(); for (Entity operationalTask : operationTasks) { operationTaskDD.delete(operationalTask.getId()); } }
private boolean deleteBasicProductionCounting(final Entity productionCountingQuantity) { boolean isDeleted = true; Entity basicProductionCounting = productionCountingQuantity .getBelongsToField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING); if ((basicProductionCounting != null) && checkIfItIsLastProductionCountingQuantity(basicProductionCounting)) { productionCountingQuantity.setField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING, null); productionCountingQuantity.getDataDefinition().save(productionCountingQuantity); isDeleted = basicProductionCounting.getDataDefinition().delete(basicProductionCounting.getId()).isSuccessfull(); } return isDeleted; }
public void removeBarcode(final Entity order) { List<Entity> barcodes = getBarcodeOperationComponentDD().find() .add(SearchRestrictions.belongsTo(BarcodeOperationComponentFields.ORDER, order)).list() .getEntities(); for(Entity code : barcodes) { getBarcodeOperationComponentDD().delete(code.getId()); } } }
private void deleteTechOperCompOperationalTasks(final Entity technologyOperationComponent) { Entity techOperCompOperationalTask = operationalTasksForOrdersService .getTechOperCompOperationalTaskDD() .find() .add(SearchRestrictions.belongsTo(TechOperCompOperationalTasksFields.TECHNOLOGY_OPERATION_COMPONENT, technologyOperationComponent)).setMaxResults(1).uniqueResult(); if (techOperCompOperationalTask != null) { techOperCompOperationalTask.getDataDefinition().delete(techOperCompOperationalTask.getId()); } }
private void deleteOperationsTreeIfExists(final Entity costCalculation) { Entity yetAnotherCostCalculation = costCalculation.getDataDefinition().get(costCalculation.getId()); EntityTree existingOperationsTree = yetAnotherCostCalculation.getTreeField(L_CALCULATION_OPERATION_COMPONENTS); if (existingOperationsTree == null || existingOperationsTree.getRoot() == null) { return; } debug("existing calculation operation components tree will be removed.."); EntityTreeNode existingOperationsTreeRoot = existingOperationsTree.getRoot(); existingOperationsTreeRoot.getDataDefinition().delete(existingOperationsTreeRoot.getId()); }
public void deleteExistingNodes(final Entity savedContext) { DataDefinition nodesDD = getGeneratorTreeNodeDD(); Entity rootNodeToBeDeleted = nodesDD.find().add(belongsTo(GeneratorTreeNodeFields.GENERATOR_CONTEXT, savedContext)) .add(isNull(GeneratorTreeNodeFields.PARENT)).setProjection(alias(id(), "id")).setMaxResults(1).uniqueResult(); if (rootNodeToBeDeleted != null) { nodesDD.delete((Long) rootNodeToBeDeleted.getField("id")); } }