use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class DefaultGuiConfigurationCompiler method mergeCollectionViewsWithDefault.
private void mergeCollectionViewsWithDefault(CompiledGuiProfile compiledGuiProfile) {
Collection<Class<?>> classes = collectCollectionClasses();
List<CompiledObjectCollectionView> defaultCollectionViews = compileDefaultCollectionViews(classes);
for (CompiledObjectCollectionView defaultCollectionView : defaultCollectionViews) {
CompiledObjectCollectionView compiledObjectCollectionView = compiledGuiProfile.findObjectCollectionView(defaultCollectionView.getContainerType(), defaultCollectionView.getViewIdentifier());
if (compiledObjectCollectionView == null) {
compiledGuiProfile.getObjectCollectionViews().add(defaultCollectionView);
continue;
}
mergeCollectionViews(compiledObjectCollectionView, defaultCollectionView);
}
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class SearchFactory method getSearchBoxConfiguration.
private static SearchBoxConfigurationType getSearchBoxConfiguration(ModelServiceLocator modelServiceLocator, QName type, String collectionViewName, Search.PanelType panelType) {
OperationResult result = new OperationResult(LOAD_ADMIN_GUI_CONFIGURATION);
try {
CompiledGuiProfile guiConfig = modelServiceLocator.getModelInteractionService().getCompiledGuiProfile(null, result);
CompiledObjectCollectionView view = guiConfig.findObjectCollectionView(type, collectionViewName);
if (view != null) {
if (Search.PanelType.MEMBER_PANEL.equals(panelType) && view.getAdditionalPanels() != null && view.getAdditionalPanels().getMemberPanel() != null) {
return view.getAdditionalPanels().getMemberPanel().getSearchBoxConfiguration();
}
return view.getSearchBoxConfiguration();
}
return null;
} catch (SchemaException | ObjectNotFoundException | CommunicationException | ConfigurationException | SecurityViolationException | ExpressionEvaluationException ex) {
throw new SystemException(ex);
}
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class ContainerableListPanel method compileWidgetCollectionView.
private CompiledObjectCollectionView compileWidgetCollectionView(DashboardWidgetType widget, Task task) {
CollectionRefSpecificationType collectionSpec = widget.getData().getCollection();
try {
@NotNull CompiledObjectCollectionView compiledView = getPageBase().getModelInteractionService().compileObjectCollectionView(collectionSpec, null, task, task.getResult());
if (widget.getPresentation() != null && widget.getPresentation().getView() != null) {
getPageBase().getModelInteractionService().applyView(compiledView, widget.getPresentation().getView());
}
compiledView.setCollection(collectionSpec);
return compiledView;
} catch (SchemaException | CommunicationException | ConfigurationException | SecurityViolationException | ExpressionEvaluationException | ObjectNotFoundException e) {
LOGGER.error("Couldn't compile collection " + collectionSpec, e);
return null;
}
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class PageAssignmentHolderDetails method createTemplatePanel.
private CreateTemplatePanel<AH> createTemplatePanel() {
return new CreateTemplatePanel<>(ID_TEMPLATE) {
@Override
protected Collection<CompiledObjectCollectionView> findAllApplicableArchetypeViews() {
return PageAssignmentHolderDetails.this.findAllApplicableArchetypeViews();
}
@Override
protected QName getType() {
return ObjectTypes.getObjectType(PageAssignmentHolderDetails.this.getType()).getTypeQName();
}
@Override
protected void onTemplateChosePerformed(CompiledObjectCollectionView collectionViews, AjaxRequestTarget target) {
PrismObject<AH> assignmentHolder;
try {
assignmentHolder = getPrismContext().createObject(PageAssignmentHolderDetails.this.getType());
} catch (Throwable e) {
LOGGER.error("Cannot create prism object for {}. Using object from page model.", PageAssignmentHolderDetails.this.getType());
assignmentHolder = getObjectDetailsModels().getObjectWrapperModel().getObject().getObjectOld().clone();
}
List<ObjectReferenceType> archetypeRef = ObjectCollectionViewUtil.getArchetypeReferencesList(collectionViews);
if (archetypeRef != null) {
AssignmentHolderType holder = assignmentHolder.asObjectable();
archetypeRef.forEach(a -> holder.getAssignment().add(ObjectTypeUtil.createAssignmentTo(a, getPrismContext())));
}
reloadObjectDetailsModel(assignmentHolder);
Fragment fragment = createDetailsFragment();
fragment.setOutputMarkupId(true);
PageAssignmentHolderDetails.this.replace(fragment);
target.add(fragment);
}
};
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class ResourceTasksPanel method initLayout.
protected void initLayout() {
final MainObjectListPanel<TaskType> tasksPanel = new MainObjectListPanel<>(ID_TASKS_TABLE, TaskType.class, null) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_RESOURCE_TASKS_PANEL;
}
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> createResourceTasksQuery(), null);
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return null;
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
if (collectionView == null) {
collectionView = getObjectCollectionView();
}
List<ObjectReferenceType> archetypeRef = ObjectCollectionViewUtil.getArchetypeReferencesList(collectionView);
try {
PrismContext prismContext = getPrismContext();
PrismObjectDefinition<TaskType> def = prismContext.getSchemaRegistry().findObjectDefinitionByType(TaskType.COMPLEX_TYPE);
PrismObject<TaskType> obj = def.instantiate();
TaskType newTask = obj.asObjectable();
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(ResourceTasksPanel.this.getObjectWrapper().getOid());
resourceRef.setType(ResourceType.COMPLEX_TYPE);
newTask.setObjectRef(resourceRef);
WebComponentUtil.initNewObjectWithReference(getPageBase(), newTask, archetypeRef);
} catch (SchemaException ex) {
getPageBase().getFeedbackMessages().error(ResourceTasksPanel.this, ex.getUserFriendlyMessage());
target.add(getPageBase().getFeedbackPanel());
}
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createDefaultColumns() {
return ColumnUtils.getDefaultTaskColumns();
}
@Override
protected List<CompiledObjectCollectionView> getNewObjectInfluencesList() {
List<CompiledObjectCollectionView> newObjectInfluencesList = super.getNewObjectInfluencesList();
List<CompiledObjectCollectionView> filteredInfluencesList = new ArrayList<>();
if (newObjectInfluencesList != null) {
newObjectInfluencesList.forEach(influence -> {
if (influence.getCollection() != null && influence.getCollection().getCollectionRef() != null && ArrayUtils.contains(resourceTaskArchetypeOids, influence.getCollection().getCollectionRef().getOid())) {
filteredInfluencesList.add(influence);
}
});
}
return filteredInfluencesList;
}
};
tasksPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_TASK_BOX_CSS_CLASSES);
add(tasksPanel);
AjaxButton runNow = new AjaxButton(ID_RUN_NOW, getPageBase().createStringResource("pageTaskEdit.button.runNow")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedRealObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.runNowPerformed(oids, getPageBase());
getPageBase().showResult(result);
} else {
noTasksSelected();
}
target.add(getPageBase().getFeedbackPanel());
}
};
add(runNow);
AjaxButton resume = new AjaxButton(ID_RESUME, getPageBase().createStringResource("pageTaskEdit.button.resume")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<TaskType> tasks = getTaskListPanel().getSelectedRealObjects();
if (!tasks.isEmpty()) {
OperationResult result = TaskOperationUtils.resumeTasks(tasks, getPageBase());
getPageBase().showResult(result);
} else {
noTasksSelected();
}
target.add(getPageBase().getFeedbackPanel());
}
};
add(resume);
AjaxButton suspend = new AjaxButton(ID_SUSPEND, getPageBase().createStringResource("pageTaskEdit.button.suspend")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<TaskType> tasks = getTaskListPanel().getSelectedRealObjects();
if (!tasks.isEmpty()) {
OperationResult result = TaskOperationUtils.suspendTasks(tasks, getPageBase());
getPageBase().showResult(result);
} else {
noTasksSelected();
}
target.add(getPageBase().getFeedbackPanel());
}
};
add(suspend);
}
Aggregations