@Override protected void performMultiAction(AjaxRequestTarget target, List<ODocument> objects) { super.performMultiAction(target, objects); ODatabaseDocument db = getDatabase(); db.commit(true); db.begin(); DBClosure.sudoConsumer(sudoDb -> sudoDb.getMetadata().reload()); }
public OQueryModelResultsPanel(String id, OQueryModel<ODocument> queryModel) { super(id, queryModel); OClass oClass = queryModel.probeOClass(20); OQueryDataProvider<ODocument> provider = new OQueryDataProvider<>(queryModel); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); List<? extends IColumn<ODocument, String>> columns = oClassIntrospector.getColumnsFor(oClass, true, modeModel); GenericTablePanel<ODocument> tablePanel = new GenericTablePanel<ODocument>("tablePanel", columns, provider, 20); OrienteerDataTable<ODocument, String> table = tablePanel.getDataTable(); table.addCommand(new EditODocumentsCommand(table, modeModel, oClass)); table.addCommand(new SaveODocumentsCommand(table, modeModel)); table.addCommand(new DeleteODocumentCommand(table, oClass)); table.addCommand(new ExportCommand<>(table, new ResourceModel("sql.results"))); add(tablePanel); }
table.addCommand(new SaveODocumentsCommand(table, modeModel).add(securityBehaviour)); table.addCommand(new CopyODocumentCommand(table, linkedClass).add(securityBehaviour)); table.addCommand(new DeleteODocumentCommand(table, linkedClass).add(securityBehaviour)); table.addCommand(new SelectODocumentCommand(table, documentModel, propertyModel).add(securityBehaviour)); table.addCommand(new ReleaseODocumentCommand(table, documentModel, propertyModel).add(securityBehaviour));
@SuppressWarnings("unchecked") public AbstractCalculatedDocumentsWidget(String id, IModel<T> model, IModel<ODocument> widgetDocumentModel) { super(id, model, widgetDocumentModel); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); final String sql = getSql(); GenericTablePanel<ODocument> tablePanel; if(!Strings.isEmpty(sql)) { OQueryDataProvider<ODocument> provider = newDataProvider(sql); OClass expectedClass = getExpectedClass(provider); if(expectedClass!=null) { oClassIntrospector.defineDefaultSorting(provider, expectedClass); List<? extends IColumn<ODocument, String>> columns = oClassIntrospector.getColumnsFor(expectedClass, true, modeModel); tablePanel = new GenericTablePanel<>("tablePanel", columns, provider, 20); OrienteerDataTable<ODocument, String> table = tablePanel.getDataTable(); table.addCommand(new EditODocumentsCommand(table, modeModel, expectedClass)); table.addCommand(new SaveODocumentsCommand(table, modeModel)); table.addCommand(new DeleteODocumentCommand(table, expectedClass)); table.addCommand(new ExportCommand<>(table, getTitleModel())); } else { tablePanel = new GenericTablePanel<>("tablePanel", new ResourceModel("error.class.not.defined")); } } else { tablePanel = new GenericTablePanel<>("tablePanel", new ResourceModel("error.query.not.defined")); } add(tablePanel); }
public ListAllODocumentsWidget(String id, IModel<OClass> model, IModel<ODocument> widgetDocumentModel) { super(id, model, widgetDocumentModel); IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel(); String className = getModelObject().getName(); String sql = "select from " + className; OQueryDataProvider<ODocument> provider = new OQueryDataProvider<>(sql); oClassIntrospector.defineDefaultSorting(provider, getModelObject()); GenericTablePanel<ODocument> tablePanel = new GenericTablePanel<>("tablePanel", oClassIntrospector.getColumnsFor(getModelObject(), true, modeModel), provider, 20); final OrienteerDataTable<ODocument, String> table = tablePanel.getDataTable(); table.getCommandsToolbar().setDefaultModel(getModel()); table.addCommand(new CreateODocumentCommand(table, getModel())); table.addCommand(new EditODocumentsCommand(table, modeModel, getModel())); table.addCommand(new SaveODocumentsCommand(table, modeModel)); table.addCommand(new CopyODocumentCommand(table, getModel())); table.addCommand(new DeleteODocumentCommand(table, getModel())); table.addCommand(new ExportCommand<>(table, new PropertyModel<String>(model, "name"))); add(tablePanel); add(UpdateOnActionPerformedEventBehavior.INSTANCE_ALL_CONTINUE); addCommand(new BookmarkablePageLinkCommand<OClass>(newCommandId(), "command.gotoClass", OClassPage.class) { @Override public PageParameters getPageParameters() { return OClassPage.preparePageParameters(ListAllODocumentsWidget.this.getModelObject(), DisplayMode.VIEW); } }); }