use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class PageCertDefinitions method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<AccessCertificationDefinitionType> mainPanel = new MainObjectListPanel<AccessCertificationDefinitionType>(ID_TABLE, AccessCertificationDefinitionType.class, null) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CERT_DEFINITIONS_PANEL;
}
@Override
protected IColumn<SelectableBean<AccessCertificationDefinitionType>, String> createCheckboxColumn() {
return null;
}
@Override
public void objectDetailsPerformed(AjaxRequestTarget target, AccessCertificationDefinitionType service) {
PageCertDefinitions.this.detailsPerformed(target, service);
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageCertDefinitions.this.createInlineMenu();
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
navigateToNext(PageCertDefinition.class);
}
};
mainPanel.setOutputMarkupId(true);
mainPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_CERT_DEF_BOX_CSS_CLASSES);
mainForm.add(mainPanel);
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class WebComponentUtil method isRefreshEnabled.
public static boolean isRefreshEnabled(PageBase pageBase, QName type) {
CompiledGuiProfile cup = pageBase.getCompiledGuiProfile();
if (cup == null) {
return false;
}
List<CompiledObjectCollectionView> views = cup.getObjectCollectionViews();
if (CollectionUtils.isEmpty(views)) {
return false;
}
for (CompiledObjectCollectionView view : views) {
if (QNameUtil.match(type, view.getContainerType())) {
if (view.getRefreshInterval() != null) {
return true;
}
}
}
return false;
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class ContainerableListPanel method getObjectCollectionView.
protected CompiledObjectCollectionView getObjectCollectionView() {
CompiledObjectCollectionView containerPanelCollectionView = getCompiledCollectionViewFromPanelConfiguration();
if (containerPanelCollectionView != null) {
return containerPanelCollectionView;
}
CompiledObjectCollectionView view = getWidgetCollectionView();
if (view != null) {
return view;
}
String collectionName = getCollectionNameParameterValue().toString();
return getPageBase().getCompiledGuiProfile().findObjectCollectionView(WebComponentUtil.containerClassToQName(getPageBase().getPrismContext(), getType()), collectionName);
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class ContainerableListPanel method createSearchModel.
protected LoadableDetachableModel<Search<C>> createSearchModel() {
return new LoadableDetachableModel<>() {
private static final long serialVersionUID = 1L;
@Override
public Search<C> load() {
Search<C> newSearch = createSearch(getType());
Search<C> search = null;
PageStorage storage = getPageStorage();
String searchByName = getSearchByNameParameterValue();
if (storage != null && searchByName == null) {
// do NOT use storage when using name search (e.g. from dashboard)
search = storage.getSearch();
}
if (search == null || (!SearchBoxModeType.ADVANCED.equals(search.getSearchType()) && !search.getAllDefinitions().containsAll(newSearch.getAllDefinitions())) || search.isTypeChanged()) {
search = newSearch;
search.searchWasReload();
}
if (searchByName != null) {
if (SearchBoxModeType.FULLTEXT.equals(search.getSearchType())) {
search.setFullText(searchByName);
} else {
for (PropertySearchItem<String> item : search.getPropertyItems()) {
if (ItemPath.create(ObjectType.F_NAME).equivalent(item.getPath())) {
item.setValue(new SearchValue<>(searchByName));
}
}
}
}
if (isCollectionViewPanel()) {
CompiledObjectCollectionView view = getObjectCollectionView();
search.setCollectionSearchItem(new ObjectCollectionSearchItem(search, view));
search.setCollectionItemVisible(isCollectionViewPanelForWidget());
if (storage != null && view.getPaging() != null) {
ObjectPaging paging = ObjectQueryUtil.convertToObjectPaging(view.getPaging(), getPrismContext());
if (storage.getPaging() == null) {
storage.setPaging(paging);
}
if (getTableId() != null && paging.getMaxSize() != null && !getPageBase().getSessionStorage().getUserProfile().isExistPagingSize(getTableId())) {
getPageBase().getSessionStorage().getUserProfile().setPagingSize(getTableId(), paging.getMaxSize());
}
}
}
if (storage != null) {
storage.setSearch(search);
}
return search;
}
};
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class ContainerableListPanel method createReportPerformed.
protected void createReportPerformed(AjaxRequestTarget target) {
PrismContext prismContext = getPageBase().getPrismContext();
PrismObjectDefinition<ReportType> def = prismContext.getSchemaRegistry().findObjectDefinitionByType(ReportType.COMPLEX_TYPE);
PrismObject<ReportType> obj;
try {
obj = def.instantiate();
} catch (SchemaException e) {
LOGGER.error("Couldn't instantiate new report", e);
getPageBase().error(getString("MainObjectListPanel.message.error.instantiateNewReport"));
target.add(getPageBase().getFeedbackPanel());
return;
}
ReportType report = obj.asObjectable();
ObjectCollectionReportEngineConfigurationType objectCollection = new ObjectCollectionReportEngineConfigurationType();
CompiledObjectCollectionView view = getObjectCollectionView();
CollectionRefSpecificationType collection = new CollectionRefSpecificationType();
objectCollection.setUseOnlyReportView(true);
if (view != null) {
objectCollection.setView(view.toGuiObjectListViewType());
if (view.getCollection() != null && view.getCollection().getCollectionRef() != null) {
if (!QNameUtil.match(view.getCollection().getCollectionRef().getType(), ArchetypeType.COMPLEX_TYPE)) {
collection.setBaseCollectionRef(view.getCollection());
} else {
OperationResult result = new OperationResult(MainObjectListPanel.class.getSimpleName() + "." + "evaluateExpressionsInFilter");
CollectionRefSpecificationType baseCollection = new CollectionRefSpecificationType();
try {
baseCollection.setFilter(getPageBase().getQueryConverter().createSearchFilterType(WebComponentUtil.evaluateExpressionsInFilter(view.getFilter(), result, getPageBase())));
collection.setBaseCollectionRef(baseCollection);
} catch (SchemaException e) {
LOGGER.error("Couldn't create filter for archetype");
getPageBase().error(getString("MainObjectListPanel.message.error.createArchetypeFilter"));
target.add(getPageBase().getFeedbackPanel());
}
}
}
} else {
objectCollection.setView(getDefaultView());
}
SearchFilterType searchFilter = null;
ObjectQuery query = getSearchModel().getObject().createObjectQuery(getPageBase());
if (query != null) {
ObjectFilter filter = query.getFilter();
try {
searchFilter = getPageBase().getPrismContext().getQueryConverter().createSearchFilterType(filter);
} catch (Exception e) {
LOGGER.error("Couldn't create filter from search panel", e);
getPageBase().error(getString("ExportingFilterTabPanel.message.error.serializeFilterFromSearch"));
}
}
if (searchFilter != null) {
collection.setFilter(searchFilter);
} else {
try {
SearchFilterType allFilter = prismContext.getQueryConverter().createSearchFilterType(prismContext.queryFactory().createAll());
collection.setFilter(allFilter);
} catch (SchemaException e) {
LOGGER.error("Couldn't create all filter", e);
getPageBase().error(getString("MainObjectListPanel.message.error.createAllFilter"));
target.add(getPageBase().getFeedbackPanel());
return;
}
}
objectCollection.setCollection(collection);
report.setObjectCollection(objectCollection);
report.getAssignment().add(ObjectTypeUtil.createAssignmentTo(SystemObjectsType.ARCHETYPE_COLLECTION_REPORT.value(), ObjectTypes.ARCHETYPE, prismContext));
report.getArchetypeRef().add(ObjectTypeUtil.createObjectRef(SystemObjectsType.ARCHETYPE_COLLECTION_REPORT.value(), ObjectTypes.ARCHETYPE));
PageReport pageReport = new PageReport(report.asPrismObject());
getPageBase().navigateToNext(pageReport);
}
Aggregations