/** {@inheritDoc} */ public void doReturnFromFlow(ModelAndView model, int subFlowId, Long entityId) { if (entityId != null) { Hazard hazard = ((HazardForm) model.getModel().get("form")).getEntity(); switch (subFlowId) { case TYPE_SUBFLOW_ID: { hazard.setType(EntityWithIdHelper.createEntity(Type.class, entityId)); break; } case LABSUPPLY_SUBFLOW_ID: { hazard.setLabSupply(EntityWithIdHelper.createEntity(LabSupply.class, entityId)); break; } case HAZARDCONTAINER_SUBFLOW_ID: { hazard.setContainer(EntityWithIdHelper.createEntity(Container.class, entityId)); break; } default: { throw new IllegalArgumentException("Wrong subFlowId"); } } } }