/** * {@inheritDoc} */ @Override public void fileChosen(String name, InputStream in, IActionHandler actionHandler, Map<String, Object> context) { super.fileChosen(name, in, actionHandler, context); actionHandler.execute(action, context); }
/** * {@inheritDoc} */ @Override public void fileChosen(String name, InputStream in, IActionHandler actionHandler, Map<String, Object> context) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { InputStream is = new BufferedInputStream(in); int b; while ((b = is.read()) != -1) { baos.write(b); } baos.flush(); byte[] fileContent = baos.toByteArray(); setActionParameter(fileContent, context); } catch (IOException ex) { throw new ActionException(ex); } finally { try { baos.close(); } catch (IOException ex) { // NO-OP. } } }
/** * {@inheritDoc} */ @Override public void fileChosen(InputStream in, String filePath, IActionHandler actionHandler, Map<String, Object> context) { super.fileChosen(in, filePath, actionHandler, context); actionHandler.execute(action, context); }
/** * {@inheritDoc} */ @Override public void fileChosen(InputStream in, String filePath, IActionHandler actionHandler, Map<String, Object> context) { super.fileChosen(in, filePath, actionHandler, context); if (context.containsKey(ActionContextConstants.ACTION_PARAM)) { Object valueToSet = context.get(ActionContextConstants.ACTION_PARAM); IModelDescriptor modelDescriptor = (IModelDescriptor) context .get(ActionContextConstants.MODEL_DESCRIPTOR); if (modelDescriptor instanceof IStringPropertyDescriptor) { valueToSet = new String((byte[]) valueToSet); } IValueConnector viewConnector = (IValueConnector) context .get(ActionContextConstants.VIEW_CONNECTOR); viewConnector.setConnectorValue(valueToSet); } } }
/** * {@inheritDoc} * * @param name * the name * @param in * the in * @param actionHandler * the action handler * @param context * the context */ @Override public void fileChosen(String name, InputStream in, IActionHandler actionHandler, Map<String, Object> context) { super.fileChosen(name, in, actionHandler, context); if (context.containsKey(ActionContextConstants.ACTION_PARAM)) { String modelPath = getModelPath(context); Object valueToSet = getActionParameter(context); IModelDescriptor modelDescriptor = getModelDescriptor(modelPath, context); if (modelDescriptor instanceof IStringPropertyDescriptor) { valueToSet = new String((byte[]) valueToSet); } IValueConnector modelConnectorConnector = getModelConnector(modelPath, context); modelConnectorConnector.setConnectorValue(valueToSet); } }