use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class TestRefinedSchema method test120DetermineObjectClassObjectClassModel.
@Test
public void test120DetermineObjectClassObjectClassModel() throws Exception {
final String TEST_NAME = "test120DetermineObjectClassObjectClassModel";
TestUtil.displayTestTile(this, TEST_NAME);
OperationResult result = new OperationResult(TestRefinedSchema.class.getName() + "." + TEST_NAME);
importObjectFromFile(TASK_RECONCILE_DUMMY_OBJECTCLASS_FILE);
Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_OBJECTCLASS_OID, result);
display("Task", task);
// WHEN
ObjectClassComplexTypeDefinition objectClass = Utils.determineObjectClass(refinedSchemaModel, task);
// THEN
display("Object class", objectClass);
display("Object class (toString)", objectClass.toString());
deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_OBJECTCLASS_OID);
assertObjectClass(objectClass, RESOURCE_DUMMY_ACCOUNT_OBJECTCLASS_QNAME);
}
use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class ReindexResultHandler method handleObject.
@Override
protected boolean handleObject(PrismObject<ObjectType> object, Task workerTask, OperationResult parentResult) throws CommonException {
OperationResult result = parentResult.createMinorSubresult(CLASS_DOT + "handleObject");
repositoryService.modifyObject(object.asObjectable().getClass(), object.getOid(), new ArrayList<ItemDelta>(), RepoModifyOptions.createExecuteIfNoChanges(), result);
result.computeStatusIfUnknown();
return true;
}
use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class FocusProjectionsTabPanel method initLayout.
private void initLayout(final PageBase page) {
final WebMarkupContainer shadows = new WebMarkupContainer(ID_SHADOWS);
shadows.setOutputMarkupId(true);
add(shadows);
InlineMenu accountMenu = new InlineMenu(ID_SHADOW_MENU, new Model((Serializable) createShadowMenu()));
accountMenu.setVisible(!getObjectWrapper().isReadonly());
shadows.add(accountMenu);
final ListView<FocusSubwrapperDto<ShadowType>> projectionList = new ListView<FocusSubwrapperDto<ShadowType>>(ID_SHADOW_LIST, projectionModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<FocusSubwrapperDto<ShadowType>> item) {
PackageResourceReference packageRef;
final FocusSubwrapperDto<ShadowType> dto = item.getModelObject();
final PropertyModel<ObjectWrapper<F>> objectWrapperModel = new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object");
final Panel shadowPanel;
if (dto.isLoadedOK()) {
packageRef = new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM);
shadowPanel = new PrismObjectPanel<F>(ID_SHADOW, new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object"), packageRef, getMainForm(), getPageBase());
} else {
shadowPanel = new SimpleErrorPanel<ShadowType>(ID_SHADOW, item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onShowMorePerformed(AjaxRequestTarget target) {
OperationResult fetchResult = dto.getResult();
if (fetchResult != null) {
showResult(fetchResult);
target.add(page.getFeedbackPanel());
}
}
};
}
shadowPanel.setOutputMarkupId(true);
shadowPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
FocusSubwrapperDto<ShadowType> shadowWrapperDto = item.getModelObject();
ObjectWrapper<ShadowType> shadowWrapper = shadowWrapperDto.getObject();
return !shadowWrapper.isMinimalized();
}
});
item.add(shadowPanel);
CheckTableHeader<F> shadowHeader = new CheckTableHeader<F>(ID_SHADOW_HEADER, objectWrapperModel) {
private static final long serialVersionUID = 1L;
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
super.onClickPerformed(target);
onExpandCollapse(target, item.getModel());
target.add(shadows);
}
};
if (item.getModel().getObject().getStatus().equals(UserDtoStatus.DELETE)) {
shadowHeader.add(new AttributeModifier("class", "box-header with-border delete"));
}
item.add(shadowHeader);
}
};
AjaxCheckBox accountCheckAll = new AjaxCheckBox(ID_SHADOW_CHECK_ALL, new Model()) {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
for (FocusSubwrapperDto<ShadowType> dto : projectionList.getModelObject()) {
if (dto.isLoadedOK()) {
ObjectWrapper<ShadowType> accModel = dto.getObject();
accModel.setSelected(getModelObject());
}
}
target.add(shadows);
}
};
shadows.add(accountCheckAll);
shadows.add(projectionList);
}
use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class UserMenuPanel method loadModel.
private PasswordQuestionsDto loadModel(PageBase parentPage) {
LOGGER.trace("Loading user for Security Question Page.");
PasswordQuestionsDto dto = new PasswordQuestionsDto();
OperationResult result = new OperationResult(OPERATION_LOAD_USER);
if (parentPage == null) {
parentPage = ((PageBase) getPage());
}
try {
MidPointPrincipal principal = SecurityUtils.getPrincipalUser();
if (principal == null) {
result.recordNotApplicableIfUnknown();
return null;
}
String userOid = principal.getOid();
Task task = parentPage.createSimpleTask(OPERATION_LOAD_USER);
OperationResult subResult = result.createSubresult(OPERATION_LOAD_USER);
Collection options = SelectorOptions.createCollection(UserType.F_JPEG_PHOTO, GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE));
PrismObject<UserType> user = parentPage.getModelService().getObject(UserType.class, userOid, options, task, subResult);
userModel.setObject(user);
jpegPhoto = user == null ? null : (user.asObjectable() == null ? null : user.asObjectable().getJpegPhoto());
dto.setSecurityAnswers(createUsersSecurityQuestionsList(user));
subResult.recordSuccessIfUnknown();
} catch (Exception ex) {
LoggingUtils.logExceptionOnDebugLevel(LOGGER, "Couldn't get user Questions, Probably not set yet", ex);
} finally {
result.recomputeStatus();
isUserModelLoaded = true;
}
return dto;
}
use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.
the class ResourceTasksPanel method initLayout.
private void initLayout(final ListModel<TaskType> tasks) {
final MainObjectListPanel<TaskType> tasksPanel = new MainObjectListPanel<TaskType>(ID_TASKS_TABLE, TaskType.class, TableId.PAGE_RESOURCE_TASKS_PANEL, null, pageBase) {
private static final long serialVersionUID = 1L;
@Override
protected BaseSortableDataProvider<SelectableBean<TaskType>> initProvider() {
return new ListDataProvider2(pageBase, tasks);
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
// TODO Auto-generated method stub
return null;
}
@Override
public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
// TODO Auto-generated method stub
// super.objectDetailsPerformed(target, task);
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
getPageBase().navigateToNext(PageTaskEdit.class, parameters);
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
getPageBase().navigateToNext(PageTaskAdd.class);
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createColumns() {
return ColumnUtils.getDefaultTaskColumns();
}
};
// final ObjectListPanel<TaskType> tasksPanel = new ObjectListPanel<TaskType>(ID_TASKS_TABLE, TaskType.class, pageBase){
//
// @Override
// protected BaseSortableDataProvider<SelectableBean<TaskType>> getProvider() {
// return new ListDataProvider2(pageBase, tasks);
// }
//
// @Override
// public boolean isEditable() {
// return ResourceTasksPanel.this.editable;
// }
//
// @Override
// public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
// // TODO Auto-generated method stub
// super.objectDetailsPerformed(target, task);
// PageParameters parameters = new PageParameters();
// parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
// setResponsePage(new PageTaskEdit(parameters));
// }
// };
// tasksPanel.setEditable(false);
tasksPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_TASK_BOX_CSS_CLASSES);
add(tasksPanel);
AjaxButton runNow = new AjaxButton(ID_RUN_NOW, pageBase.createStringResource("pageTaskEdit.button.runNow")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.runNowPerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(runNow);
AjaxButton resume = new AjaxButton(ID_RESUME, pageBase.createStringResource("pageTaskEdit.button.resume")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.resumePerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(resume);
AjaxButton suspend = new AjaxButton(ID_SUSPEND, pageBase.createStringResource("pageTaskEdit.button.suspend")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<String> oids = createOidList(getTaskListPanel().getSelectedObjects());
if (!oids.isEmpty()) {
OperationResult result = TaskOperationUtils.suspendPerformed(pageBase.getTaskService(), oids);
pageBase.showResult(result);
} else {
noTasksSelected();
}
target.add(pageBase.getFeedbackPanel());
}
};
add(suspend);
}
Aggregations