public Entity getOrderForTechnology(final ViewDefinitionState state) { DataDefinition orderDD = dataDefinitionService.get(OrdersConstants.PLUGIN_IDENTIFIER, OrdersConstants.MODEL_ORDER); String orderId = null; try { orderId = state.getJsonContext().getString("window.mainTab.technology.orderId"); } catch (JSONException ex) { // throw new RuntimeException(ex); EntityList entities = ((FormComponent) state.getComponentByReference(L_FORM)).getPersistedEntityWithIncludedFormValues().getHasManyField("orders"); if(!entities.isEmpty()){ orderId = String.valueOf(entities.get(0).getId()); } } return orderDD.get(Long.valueOf(orderId)); }
private Entity getOrderWithTechnology(final ViewDefinitionState view) { DataDefinition orderDD = dataDefinitionService.get(OrdersConstants.PLUGIN_IDENTIFIER, OrdersConstants.MODEL_ORDER); String orderId = null; try { orderId = view.getJsonContext().getString("window.mainTab.technology.orderId"); } catch (JSONException ex) { // throw new RuntimeException(ex); EntityList entities = ((FormComponent) view.getComponentByReference("form")) .getPersistedEntityWithIncludedFormValues().getHasManyField("orders"); if (!entities.isEmpty()) { orderId = String.valueOf(entities.get(0).getId()); } } return orderDD.get(Long.valueOf(orderId)); }
private Optional<Entity> getSetProductTechnology(final Long productId) { DataDefinition technologyDD = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGY); Entity masterTechnology = technologyDD.find().add(SearchRestrictions.eq(TechnologyFields.PRODUCT + ".id", productId)) .add(SearchRestrictions.eq(TechnologyFields.MASTER, true)).uniqueResult(); if (masterTechnology != null) { EntityTree operationComponents = masterTechnology.getTreeField(TechnologyFields.OPERATION_COMPONENTS); boolean isSet = operationComponents.getRoot() .getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS).get(0) .getBooleanField(OperationProductOutComponentFields.SET); if (isSet) { return Optional.of(masterTechnology); } } return Optional.empty(); }
if (technology != null) { EntityTree operationComponents = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS); Entity operationProductOutComponent = operationComponents.getRoot().getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS).get(0); boolean isSet = operationProductOutComponent.getBooleanField("set"); if (isSet) { EntityTree operationComponents = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS); Entity operationProductOutComponent = operationComponents.getRoot().getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS).get(0); boolean isSet = operationProductOutComponent.getBooleanField("set"); if (isSet) {
translationService.translate("productionCounting.productionTrackingReport.report.panel.dateAndTime", locale), new SimpleDateFormat(DateUtils.L_DATE_TIME_FORMAT, locale).format(productionTracking .getHasManyField(ProductionTrackingFields.STATE_CHANGES).get(0) .getDateField(ProductionTrackingStateChangeFields.DATE_AND_TIME)), null, FontUtils.getDejavuBold9Dark(), FontUtils.getDejavuBold9Dark(), null); panelTable, translationService.translate("productionCounting.productionTrackingReport.report.panel.worker", locale), productionTracking.getHasManyField(ProductionTrackingFields.STATE_CHANGES).get(0) .getStringField(ProductionTrackingStateChangeFields.WORKER), null, FontUtils.getDejavuBold9Dark(), FontUtils.getDejavuBold9Dark(), null);