public OClassSecurityWidget(String id, IModel<OClass> model, IModel<ODocument> widgetDocumentModel) { super(id, model, widgetDocumentModel); List<IColumn<ORole, String>> sColumns = new ArrayList<IColumn<ORole,String>>(); OClass oRoleClass = OrientDbWebSession.get().getDatabase().getMetadata().getSchema().getClass("ORole"); sColumns.add(new AbstractColumn<ORole, String>(new OClassNamingModel(oRoleClass), "name") { @Override public void populateItem(Item<ICellPopulator<ORole>> cellItem, String componentId, IModel<ORole> rowModel) { cellItem.add(new LinkViewPanel(componentId, new PropertyModel<ODocument>(rowModel, "document"))); } }); sColumns.add(new SecurityRightsColumn(OrientPermission.EXECUTE)); sColumns.add(new SecurityRightsColumn(OrientPermission.CREATE)); sColumns.add(new SecurityRightsColumn(OrientPermission.READ)); sColumns.add(new SecurityRightsColumn(OrientPermission.UPDATE)); sColumns.add(new SecurityRightsColumn(OrientPermission.DELETE)); OQueryDataProvider<ORole> sProvider = new OQueryDataProvider<ORole>("select from ORole", ORole.class); sProvider.setSort("name", SortOrder.ASCENDING); GenericTablePanel<ORole> tablePanel = new GenericTablePanel<ORole>("tablePanel", sColumns, sProvider ,20); OSecurityHelper.secureComponent(tablePanel, OSecurityHelper.requireOClass("ORole", Component.ENABLE, OrientPermission.UPDATE)); OrienteerDataTable<ORole, String> sTable = tablePanel.getDataTable(); Command<ORole> saveCommand = new AbstractSaveCommand<ORole>(sTable, null); sTable.addCommand(saveCommand); sTable.setCaptionModel(new ResourceModel("class.security")); add(tablePanel); add(DisableIfPrototypeBehavior.INSTANCE, UpdateOnActionPerformedEventBehavior.INSTANCE_ALL_CONTINUE); }
public OClusterSecurityWidget(String id, IModel<OCluster> model, IModel<ODocument> widgetDocumentModel) { super(id, model, widgetDocumentModel); List<IColumn<ORole, String>> sColumns = new ArrayList<IColumn<ORole,String>>(); OClass oRoleClass = OrientDbWebSession.get().getDatabase().getMetadata().getSchema().getClass("ORole"); sColumns.add(new AbstractColumn<ORole, String>(new OClassNamingModel(oRoleClass), "name") { @Override public void populateItem(Item<ICellPopulator<ORole>> cellItem, String componentId, IModel<ORole> rowModel) { cellItem.add(new LinkViewPanel(componentId, new PropertyModel<ODocument>(rowModel, "document"))); } }); sColumns.add(new SecurityRightsColumn(OrientPermission.CREATE)); sColumns.add(new SecurityRightsColumn(OrientPermission.READ)); sColumns.add(new SecurityRightsColumn(OrientPermission.UPDATE)); sColumns.add(new SecurityRightsColumn(OrientPermission.DELETE)); OQueryDataProvider<ORole> sProvider = new OQueryDataProvider<ORole>("select from ORole", ORole.class); sProvider.setSort("name", SortOrder.ASCENDING); GenericTablePanel<ORole> tablePanel = new GenericTablePanel<ORole>("tablePanel", sColumns, sProvider ,20); OSecurityHelper.secureComponent(tablePanel, OSecurityHelper.requireOClass("ORole", Component.ENABLE, OrientPermission.UPDATE)); OrienteerDataTable<ORole, String> sTable = tablePanel.getDataTable(); Command<ORole> saveCommand = new AbstractSaveCommand<ORole>(sTable, null); sTable.addCommand(saveCommand); sTable.setCaptionModel(new ResourceModel("cluster.security")); add(tablePanel); add(DisableIfPrototypeBehavior.INSTANCE, UpdateOnActionPerformedEventBehavior.INSTANCE_ALL_CONTINUE); }
tablePanel.add(new SecurityBehavior(model, Component.ENABLE, OrientPermission.UPDATE)); OrienteerDataTable<String, String> sTable = tablePanel.getDataTable(); sTable.addCommand(new AbstractSaveCommand<String>(sTable, null));