/** * Returns basic parameter entity id for current user * * @return parameter entity id * */ public Long getParameterId() { return getParameter().getId(); }
private void generateTechnologyNode(Entity node, Entity product, Entity context) { try { Optional<Either<String, TechnologyId>> customizedTechId = Optional.ofNullable(product).flatMap( mainProduct -> Optional.ofNullable(node.getId()).flatMap( nodeId -> customize(nodeId, mainProduct, GeneratorSettings.from(context, parameterService.getParameter()), true))); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn("Cannot perform technology customization due to unexpected error", e); } } }
@Override public boolean checkAutogenealogyRequired() { Entity parameter = parameterService.getParameter(); if (parameter.getField("batchForDoneOrder") == null) { return false; } else { return !"01none".equals(parameter.getStringField("batchForDoneOrder")); } }
@Override public void invoke() { if (parameterService.getParameter().getBooleanField("automaticDeliveriesMinState")) { deliveriesMinStateHelper.createDeliveriesFromMinimalState(); } }
private BatchNumberUniqueness getBatchNumberUniqueness() { Entity parameter = parameterService.getParameter(); String batchNumberUniquenessValue = parameter.getStringField(ParameterFieldsAG.BATCH_NUMBER_UNIQUENESS); return BatchNumberUniqueness.parseString(batchNumberUniquenessValue); }
private Map<Entity, Integer> getWorkstationsFromTechnology(final Entity technology, final Entity productionLine) { Map<Entity, Integer> workstations = new HashMap<Entity, Integer>(); for (Entity operComp : technology.getHasManyField(TechnologyFields.OPERATION_COMPONENTS)) { if (parameterService.getParameter().getBooleanField("workstationsQuantityFromProductionLine")) { workstations.put(operComp, productionLinesService.getWorkstationTypesCount(operComp, productionLine)); } else { workstations.put(operComp, operComp.getIntegerField(TechnologyOperationComponentFields.QUANTITY_OF_WORKSTATIONS)); } } return workstations; }
public void onSave(final DataDefinition orderDD, final Entity order) { if (order.getId() == null) { boolean check = parameterService.getParameter().getBooleanField("includeComponents"); order.setField("includeOrdersForComponent", check); } } }
@Override public String getDeliveryAddressDefaultValue() { Entity parameter = parameterService.getParameter(); if (DefaultAddressType.OTHER.getStringValue().equals(parameter.getStringField(ParameterFieldsD.DEFAULT_ADDRESS))) { return parameter.getStringField(ParameterFieldsD.OTHER_ADDRESS); } else { return generateAddressFromCompany(companyService.getCompany()); } }
private void addColumnForDeliveries(final Map<String, String> columnAttributes) { Entity column = columnExtensionService.addColumn(DeliveriesConstants.PLUGIN_IDENTIFIER, DeliveriesConstants.MODEL_COLUMN_FOR_DELIVERIES, columnAttributes); Entity parameter = parameterService.getParameter(); column.setField("parameter", parameter); column.getDataDefinition().save(column); }
public final void onBeforeRenderPlannedListView(final ViewDefinitionState view) { FieldComponent acceptanceEvents = (FieldComponent) view.getComponentByReference(PlannedEventFields.ACCEPTANCE_EVENTS); acceptanceEvents.setFieldValue(parameterService.getParameter().getBooleanField(ParameterFieldsCMP.ACCEPTANCE_EVENTS)); maintenanceEventContextService.beforeRenderListView(view); }
public void setDefaultValueForTechnologyBatchRequiredField(final DataDefinition dataDefinition, final Entity entity) { if (entity.getId() != null) { return; } if (entity.getField("technologyBatchRequired") != null) { return; } Entity parameter = parameterService.getParameter(); entity.setField("technologyBatchRequired", parameter.getBooleanField("batchNumberRequiredProducts")); } }
private Optional<Entity> getOrderCategoryColor(final String orderCategory) { return Optional.ofNullable(parameterService.getParameter().getHasManyField(ParameterFieldsO.ORDER_CATEGORY_COLORS).find() .add(SearchRestrictions.eq(OrderCategoryColorFields.ORDER_CATEGORY, orderCategory)).setMaxResults(1) .uniqueResult()); }
@RunInPhase(OrderStateChangePhase.LAST) @RunForStateTransition(targetState = OrderStateStringValues.COMPLETED) @After(PHASE_EXECUTION_POINTCUT) public void afterComplete(final StateChangeContext stateChangeContext, final int phase) { if (parameterService.getParameter().getBooleanField(ParameterFieldsO.SET_EFFECTIVE_DATE_TO_ON_COMPLETED)) { stateChangeContext.getOwner().setField(OrderFields.EFFECTIVE_DATE_TO, new Date()); } }
private void addColumnForOrders(final Map<String, String> columnAttributes) { Entity column = columnExtensionService.addColumn(DeliveriesConstants.PLUGIN_IDENTIFIER, DeliveriesConstants.MODEL_COLUMN_FOR_ORDERS, columnAttributes); Entity parameter = parameterService.getParameter(); column.setField("parameter", parameter); column.getDataDefinition().save(column); addColumnForParameterOrders(column); }
public void disabledWorkstationTypesTab(final ViewDefinitionState view) { if (!parameterService.getParameter().getBooleanField("workstationsQuantityFromProductionLine")) { FieldComponent field = (FieldComponent) view .getComponentByReference(ProductionLineFields.QUANTITY_FOR_OTHER_WORKSTATION_TYPES); GridComponent workstationTypeComponentGrid = (GridComponent) view.getComponentByReference("grid"); field.setEnabled(false); workstationTypeComponentGrid.setEditable(false); } }
public void validationOnReceived(final StateChangeContext stateChangeContext) { final List<String> references = Lists.newArrayList(LOCATION); checkRequired(references, stateChangeContext); checkDeliveredQuantity(stateChangeContext); if(parameterService.getParameter().getBooleanField("positivePurchasePrice")) { checkDeliveredPurchasePrices(stateChangeContext); } if (pluginManager.isPluginEnabled("integration") && productSynchronizationService.shouldSynchronize(stateChangeContext)) { checkDeliveredProductsSynchronizationStatus(stateChangeContext); productSynchronizationService.synchronizeProducts(stateChangeContext, false); } }
private Entity addRoot(List<Entity> tree, final Entity belongsToEntity, final String belongsToField) { Entity company = parameterService.getParameter().getBelongsToField(ParameterFields.COMPANY); Entity root = createNode(belongsToEntity, belongsToField, company.getStringField(CompanyFields.NUMBER), company.getStringField(CompanyFields.NAME), FactoryStructureElementType.COMPANY, company.getId()); addChild(tree, root, null); return root; }
public boolean validatesWith(final DataDefinition orderDD, final Entity order) { boolean isValid = true; Entity parameter = parameterService.getParameter(); isValid = isValid && checkOrderDates(orderDD, order); isValid = isValid && checkOrderPlannedQuantity(orderDD, order); isValid = isValid && productService.checkIfProductIsNotRemoved(orderDD, order); isValid = isValid && checkReasonOfStartDateCorrection(parameter, order); isValid = isValid && checkReasonOfEndDateCorrection(parameter, order); isValid = isValid && checkEffectiveDeviation(parameter, order); return isValid; }
public void hideAssignedWorkers(final SearchCriteriaBuilder scb, final FilterValueHolder filterValueHolder) { boolean shouldHideAssignedWorkers = parameterService.getParameter().getBooleanField("hideAssignedStaff"); if (shouldHideAssignedWorkers) { if (filterValueHolder.has(WORKERS_IDS)) { List<Long> ids = filterValueHolder.getListOfLongs(WORKERS_IDS); scb.add(SearchRestrictions.not(SearchRestrictions.in("id", ids))); } } }
@Override public final Entity generateWorkPlanEntity(final List<Entity> orders) { Entity workPlan = getWorkPlanDD().create(); workPlan.setField(WorkPlanFields.NAME, generateNameForWorkPlan()); workPlan.setField(WorkPlanFields.TYPE, WorkPlanType.NO_DISTINCTION.getStringValue()); workPlan.setField(WorkPlanFields.ORDERS, orders); workPlan.setField(WorkPlanFields.GENERATED, false); workPlan.setField(WorkPlanFields.DONT_PRINT_ORDERS_IN_WORK_PLANS, parameterService.getParameter().getField(ParameterFieldsWP.DONT_PRINT_ORDERS_IN_WORK_PLANS)); return workPlan.getDataDefinition().save(workPlan); }