/** * Refines the controller with an Hibernate backend controller. * <p> * {@inheritDoc} */ @Override protected HibernateBackendController getBackendController( Map<String, Object> context) { return (HibernateBackendController) super.getBackendController(context); } }
/** * {@inheritDoc} */ @Override protected HibernateBackendController getController(Map<String, Object> context) { return (HibernateBackendController) super.getController(context); }
private void warnBadFrontendAccess(Map<String, Object> context) { if (isBadFrontendAccessChecked() && !context.containsKey(WARN_BAD_ACCESS_DISABLED)) { LOG.warn( "Access to frontend context detected from a backend action which is strongly discouraged. " + "{} should use either the action parameter or a specific variable.", getClass().getName()); } }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { getBackendController(context).purgeCompletedExecutors(); return super.execute(actionHandler, context); } }
/** * {@inheritDoc} */ @Override protected IValueConnector getViewConnector(int[] viewPath, Map<String, Object> context) { warnBadFrontendAccess(context); return super.getViewConnector(viewPath, context); }
/** * Constructs a new {@code BackendAction} instance. */ public BackendAction() { setBadFrontendAccessChecked(true); }
/** * Refined to return a collection descriptor. * <p> * {@inheritDoc} */ @Override protected ICollectionDescriptorProvider<?> getModelDescriptor(Map<String, Object> context) { IModelDescriptor modelDescriptor = super.getModelDescriptor(context); if (modelDescriptor instanceof ICollectionDescriptorProvider<?>) { return (ICollectionDescriptorProvider<?>) modelDescriptor; } return (ICollectionDescriptorProvider<?>) getModelConnector(context).getModelDescriptor(); }
/** * refined to return a collection connector. * <p> * {@inheritDoc} */ @Override protected ICollectionConnector getModelConnector(Map<String, Object> context) { IValueConnector connector = super.getModelConnector(getViewPath(), context); // for handling table editing connectors... while (connector != null && !(connector instanceof ICollectionConnector)) { connector = connector.getParentConnector(); } return (ICollectionConnector) connector; }
/** * Executes the action script using the script handler. * <p> * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { scriptHandler.execute((IScript) getActionParameter(context), context); return super.execute(actionHandler, context); }
/** * {@inheritDoc} */ @Override protected <T> IView<T> getView(int[] viewPath, Map<String, Object> context) { warnBadFrontendAccess(context); return super.getView(viewPath, context); }
@Override public boolean execute(IActionHandler actionHandler, Map<String, Object> innerContext) { AbstractBackendController completedController = (AbstractBackendController) innerContext.get( COMPLETED_CONTROLLER_KEY); AbstractBackendController mainController = (AbstractBackendController) getBackendController(innerContext); mainController.merge(completedController.getRecordedUowMergedEntitiesAndClear(), EMergeMode.MERGE_LAZY); return super.execute(actionHandler, innerContext); } }, mergeContext);
/** * Gets the entityFactory. * * @param context * the action context. * @return the entityFactory. */ protected IEntityFactory getEntityFactory(Map<String, Object> context) { return getController(context).getEntityFactory(); }
/** * Gets the frontend controller out of the action context. * * @param context * the action context. * @return the frontend controller. */ @Override protected IBackendController getController(Map<String, Object> context) { return getBackendController(context); }
completionContext); actionHandler.executeLater(completionAction, completionContext); return super.execute(actionHandler, context);
/** * Gets the accessorFactory. * * @param context * the action context. * @return the accessorFactory. */ protected IAccessorFactory getAccessorFactory(Map<String, Object> context) { return getController(context).getAccessorFactory(); }
/** * Resets the model connector value to null. * <p> * {@inheritDoc} * * @param actionHandler * the action handler * @param context * the context * @return the boolean */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { getModelConnector(getModelPath(context), context).setConnectorValue(null); return super.execute(actionHandler, context); }
/** * Gets the current application session. * * @param context * the action context. * @return the current application session. */ protected IApplicationSession getApplicationSession( Map<String, Object> context) { return getController(context).getApplicationSession(); }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { IValueConnector modelConnector = getModelConnector(context); if (modelConnector == null) { return false; } Object clone = cloneElement(modelConnector.getConnectorValue(), context); setActionParameter(clone, context); return super.execute(actionHandler, context); }
/** * Gets the transactionTemplate. * * @param context * the action context. * @return the transactionTemplate. */ protected TransactionTemplate getTransactionTemplate( Map<String, Object> context) { return getController(context).getTransactionTemplate(); }
/** * Retrieves the master and its managed collection from the model connector * then removes selected details from the managed collection. * <p/> * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { IValueConnector modelConnector = getModelConnector(context); if (modelConnector == null) { return false; } try { IComponent componentToDelete = modelConnector.getConnectorValue(); cleanRelationshipsOnDeletion(componentToDelete, context, true); cleanRelationshipsOnDeletion(componentToDelete, context, false); } catch (IllegalAccessException | NoSuchMethodException ex) { throw new ActionException(ex); } catch (InvocationTargetException ex) { if (ex.getCause() instanceof RuntimeException) { throw (RuntimeException) ex.getCause(); } throw new ActionException(ex.getCause()); } return super.execute(actionHandler, context); } }