List of usage examples for org.apache.wicket MarkupContainer getDefaultModel
public final IModel<?> getDefaultModel()
From source file:org.hippoecm.frontend.plugins.jquery.upload.single.BinaryContentEventLogger.java
License:Apache License
/** * Find first component with backing JcrNodeModel and fire an upload event. * * @param component top component in component chain * @param category workflow category e.g. cms * @param type type of workflow e.g. image or resource * @param action name of the workflow action e.g. upload or crop *///from ww w. j av a 2s . co m public static void fireUploadEvent(final MarkupContainer component, final String category, final String type, final String action) { MarkupContainer markupContainer = component; while (markupContainer != null) { IModel<?> model = markupContainer.getDefaultModel(); if (model instanceof JcrNodeModel) { final JcrNodeModel nodeModel = (JcrNodeModel) model; final Node subjectNode = nodeModel.getNode(); try { Session session = subjectNode.getSession(); session.save(); fireBinaryChangedEvent(subjectNode, category, type, action); } catch (RepositoryException e) { log.error("Error saving session", e); } return; } markupContainer = markupContainer.getParent(); } }