Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/hibernate5
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Dec 9, 2017
2 parents 25da5b7 + 58bd0cb commit 83ca7f0
Show file tree
Hide file tree
Showing 24 changed files with 78 additions and 53 deletions.
Expand Up @@ -173,10 +173,11 @@ public ObjectQuery getQuery() {
};

List<IColumn<ContainerValueWrapper<AssignmentType>, String>> columns = initBasicColumns();
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_UNASSIGN_ACTION_URI)) {
columns.add(new InlineMenuButtonColumn<ContainerValueWrapper<AssignmentType>>(getAssignmentMenuActions(), 2, getPageBase()));
}
ContainerWrapper<AssignmentType> cwat = getModelObject();
columns.add(new InlineMenuButtonColumn<ContainerValueWrapper<AssignmentType>>(getAssignmentMenuActions(), 2, getPageBase()));
if (cwat != null){

}
BoxedTablePanel<ContainerValueWrapper<AssignmentType>> assignmentTable = new BoxedTablePanel<ContainerValueWrapper<AssignmentType>>(ID_ASSIGNMENTS_TABLE,
assignmentsProvider, columns, getTableId(), getItemsPerPage()) {
private static final long serialVersionUID = 1L;
Expand Down
Expand Up @@ -754,12 +754,15 @@ public boolean containsMultivalueContainer(){
return false;
}

public List<QName> getChildMultivalueContainersPaths(){
public List<QName> getChildMultivalueContainersToBeAdded(){
List<QName> pathList = new ArrayList<>();
for (ItemWrapper wrapper : getItems()) {
if (!(wrapper instanceof ContainerWrapper)) {
continue;
}
if (!((ContainerWrapper<C>)wrapper).getItemDefinition().canAdd()){
continue;
}
if (!((ContainerWrapper<C>) wrapper).getItemDefinition().isSingleValue() &&
canReadAndModify(((ContainerWrapper<C>) wrapper).getItemDefinition())){
pathList.add(((ContainerWrapper<C>) wrapper).getName());
Expand Down
Expand Up @@ -2,21 +2,14 @@

import java.util.List;

import com.evolveum.midpoint.prism.PrismContainer;
import com.evolveum.midpoint.prism.PrismContainerValue;
import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectAssociationType;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
Expand Down Expand Up @@ -163,7 +156,8 @@ public boolean isOn() {
@Override
public boolean isVisible(){
return getModelObject().containsMultivalueContainer() && getModelObject().getContainer() != null
&& getModelObject().getContainer().isAddContainerButtonVisible();
&& getModelObject().getContainer().isAddContainerButtonVisible()
&& getModelObject().getDefinition().canModify();
}
});
add(addChildContainerButton);
Expand All @@ -180,7 +174,7 @@ public boolean isVisible(){
childContainersSelectorPanel.setOutputMarkupId(true);
add(childContainersSelectorPanel);

List<QName> pathsList = getModelObject().getChildMultivalueContainersPaths();
List<QName> pathsList = getModelObject().getChildMultivalueContainersToBeAdded();
DropDownChoicePanel multivalueContainersList = new DropDownChoicePanel<QName>(ID_CHILD_CONTAINERS_LIST,
Model.of(pathsList.size() > 0 ? pathsList.get(0) : null), Model.ofList(pathsList),
new IChoiceRenderer<QName>() {
Expand Down
Expand Up @@ -737,7 +737,7 @@ private void deleteCampaignsPerformed(AjaxRequestTarget target,
result.recomputeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS,
"The campaign(s) have been successfully deleted.");
"The campaign(s) have been successfully deleted."); // todo i18n
}

Table campaignsTable = getCampaignsTable();
Expand Down Expand Up @@ -789,7 +789,7 @@ private void actOnCampaignsPerformed(AjaxRequestTarget target, String operationN
result.recomputeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS,
processed + " campaign(s) have been successfully processed.");
processed + " campaign(s) have been successfully processed."); // todo i18n
}

showResult(result);
Expand Down
Expand Up @@ -248,7 +248,7 @@ private void deleteDefinitionPerformed(AjaxRequestTarget target, AccessCertifica

result.computeStatusIfUnknown();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "The definition has been successfully deleted.");
result.recordStatus(OperationResultStatus.SUCCESS, "The definition has been successfully deleted."); // todo i18n
}

getDefinitionsTable().clearCache();
Expand Down
Expand Up @@ -134,7 +134,7 @@ private void startPerformed(AjaxRequestTarget target) {
//noinspection ConstantConditions
getScriptingService().evaluateExpressionInBackground((ScriptingExpressionType) parsed, task, result);
}
result.recordStatus(OperationResultStatus.IN_PROGRESS, task.getName() + " has been successfully submitted to execution");
result.recordStatus(OperationResultStatus.IN_PROGRESS, task.getName() + " has been successfully submitted to execution"); // todo 18n
} catch (SchemaException | SecurityViolationException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException | ConfigurationException e) {
result.recordFatalError("Couldn't submit bulk action to execution", e);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't submit bulk action to execution", e);
Expand Down
Expand Up @@ -275,7 +275,7 @@ private void deleteHostConfirmedPerformed(AjaxRequestTarget target) {
result.recomputeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS,
"The resource(s) have been successfully deleted.");
"The resource(s) have been successfully deleted."); // todo i18n
}

BaseSortableDataProvider provider = (BaseSortableDataProvider) hostTable.getDataTable()
Expand Down
Expand Up @@ -418,7 +418,7 @@ private void deleteResourceConfirmedPerformed(AjaxRequestTarget target) {
result.recomputeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS,
"The resource(s) have been successfully deleted.");
"The resource(s) have been successfully deleted."); // todo i18n
}

getResourceTable().clearCache();
Expand Down
Expand Up @@ -1117,9 +1117,9 @@ private void suspendTasksPerformed(AjaxRequestTarget target, List<String> oidLis
result.computeStatus();
if (result.isSuccess()) {
if (suspended) {
result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully suspended.");
result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully suspended."); // todo i18n
} else {
result.recordWarning("Task(s) suspension has been successfully requested; please check for its completion using task list.");
result.recordWarning("Task(s) suspension has been successfully requested; please check for its completion using task list."); // todo i18n
}
}
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | ExpressionEvaluationException | RuntimeException | CommunicationException | ConfigurationException e) {
Expand Down Expand Up @@ -1183,10 +1183,10 @@ private void scheduleTasksPerformed(AjaxRequestTarget target, List<String> oids)
getTaskService().scheduleTasksNow(oids, opTask, result);
result.computeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully scheduled.");
result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully scheduled."); // todo i18n
}
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | ExpressionEvaluationException | RuntimeException | CommunicationException | ConfigurationException e) {
result.recordFatalError("Couldn't schedule the task(s)", e);
result.recordFatalError("Couldn't schedule the task(s)", e); // todo i18n
}
showResult(result);

Expand Down Expand Up @@ -1221,9 +1221,11 @@ private void stopSchedulersAndTasksPerformed(AjaxRequestTarget target, List<Stri
result.computeStatus();
if (result.isSuccess()) {
if (suspended) {
// todo i18n
result.recordStatus(OperationResultStatus.SUCCESS, "Selected node scheduler(s) have been " +
"successfully stopped, including tasks that were running on them.");
} else {
// todo i18n
result.recordWarning("Selected node scheduler(s) have been successfully paused; however, " +
"some of the tasks they were executing are still running on them. Please check " +
"their completion using task list.");
Expand Down Expand Up @@ -1259,7 +1261,7 @@ private void startSchedulersPerformed(AjaxRequestTarget target, List<String> ide
getTaskService().startSchedulers(identifiers, opTask, result);
result.computeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "Selected node scheduler(s) have been successfully started.");
result.recordStatus(OperationResultStatus.SUCCESS, "Selected node scheduler(s) have been successfully started."); // todo i18n
}
} catch (SecurityViolationException | ObjectNotFoundException | SchemaException | ExpressionEvaluationException | RuntimeException | CommunicationException | ConfigurationException e) {
result.recordFatalError("Couldn't start the scheduler(s)", e);
Expand Down Expand Up @@ -1291,10 +1293,10 @@ private void stopSchedulersPerformed(AjaxRequestTarget target, List<String> iden
getTaskService().stopSchedulers(identifiers, opTask, result);
result.computeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "Selected node scheduler(s) have been successfully stopped.");
result.recordStatus(OperationResultStatus.SUCCESS, "Selected node scheduler(s) have been successfully stopped."); // todo i18n
}
} catch (SecurityViolationException | ObjectNotFoundException | SchemaException | ExpressionEvaluationException | RuntimeException | CommunicationException | ConfigurationException e) {
result.recordFatalError("Couldn't stop the scheduler(s)", e);
result.recordFatalError("Couldn't stop the scheduler(s)", e); // todo i18n
}
showResult(result);

Expand Down Expand Up @@ -1332,7 +1334,7 @@ private void deleteNodesPerformed(AjaxRequestTarget target, List<NodeDto> nodes)

result.computeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "Selected node(s) have been successfully deleted.");
result.recordStatus(OperationResultStatus.SUCCESS, "Selected node(s) have been successfully deleted."); // todo i18n
}
showResult(result);

Expand Down Expand Up @@ -1367,8 +1369,9 @@ private void deactivateServiceThreadsPerformed(AjaxRequestTarget target) {
result.computeStatus();
if (result.isSuccess()) {
if (stopped) {
result.recordStatus(OperationResultStatus.SUCCESS, "Service threads on local node have been successfully deactivated.");
result.recordStatus(OperationResultStatus.SUCCESS, "Service threads on local node have been successfully deactivated."); // todo i18n
} else {
// todo i18n
result.recordWarning("Deactivation of service threads on local node have been successfully requested; however, some of the tasks are still running. Please check their completion using task list.");
}
}
Expand All @@ -1389,10 +1392,10 @@ private void reactivateServiceThreadsPerformed(AjaxRequestTarget target) {
getTaskService().reactivateServiceThreads(opTask, result);
result.computeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "Service threads on local node have been successfully reactivated.");
result.recordStatus(OperationResultStatus.SUCCESS, "Service threads on local node have been successfully reactivated."); // todo i18n
}
} catch (RuntimeException | SchemaException | SecurityViolationException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException | ConfigurationException e) {
result.recordFatalError("Couldn't reactivate service threads on local node", e);
result.recordFatalError("Couldn't reactivate service threads on local node", e); // todo i18n
}
showResult(result);

Expand Down Expand Up @@ -1543,10 +1546,10 @@ private void deleteTaskConfirmedPerformed(AjaxRequestTarget target, TaskDto task
getTaskService().suspendAndDeleteTasks(TaskDto.getOids(taskDtoList), WAIT_FOR_TASK_STOP, true, opTask, result);
result.computeStatus();
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully deleted.");
result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully deleted."); // todo i18n
}
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | ExpressionEvaluationException | RuntimeException | CommunicationException | ConfigurationException e) {
result.recordFatalError("Couldn't delete the task(s)", e);
result.recordFatalError("Couldn't delete the task(s)", e); // todo i18n
}
showResult(result);

Expand Down
Expand Up @@ -189,7 +189,7 @@ private void stopProcessInstancesPerformed(AjaxRequestTarget target) {
}

if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "Selected process instance(s) have been successfully stopped.");
result.recordStatus(OperationResultStatus.SUCCESS, "Selected process instance(s) have been successfully stopped."); // todo i18n
}

showResult(result);
Expand Down Expand Up @@ -229,7 +229,7 @@ private void deleteProcessInstancesPerformed(AjaxRequestTarget target) {
}

if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "Selected process instance(s) have been successfully deleted.");
result.recordStatus(OperationResultStatus.SUCCESS, "Selected process instance(s) have been successfully deleted."); // todo i18n
}

showResult(result);
Expand Down
Expand Up @@ -219,7 +219,8 @@ private void approveOrRejectWorkItemsPerformed(AjaxRequestTarget target, boolean
}

if (mainResult.isSuccess()) {
mainResult.recordStatus(OperationResultStatus.SUCCESS, "The work item(s) have been successfully " + (approve ? "approved." : "rejected."));
mainResult.recordStatus(OperationResultStatus.SUCCESS,
createStringResource(approve ? "pageWorkItems.message.success.approved" : "pageWorkItems.message.success.rejected").getString());
}

showResult(mainResult);
Expand Down Expand Up @@ -262,7 +263,8 @@ private void claimWorkItemsPerformed(AjaxRequestTarget target) {
}

if (mainResult.isSuccess()) {
mainResult.recordStatus(OperationResultStatus.SUCCESS, "The work item(s) have been successfully claimed.");
mainResult.recordStatus(OperationResultStatus.SUCCESS,
createStringResource("pageWorkItems.message.success.claimed").getString());
}

showResult(mainResult);
Expand Down Expand Up @@ -299,7 +301,8 @@ private void releaseWorkItemsPerformed(AjaxRequestTarget target) {
warn(getString("pageWorkItems.message.noItemToBeReleased"));
} else {
if (mainResult.isSuccess()) {
mainResult.recordStatus(OperationResultStatus.SUCCESS, applicable + " work item(s) have been successfully released.");
mainResult.recordStatus(OperationResultStatus.SUCCESS,
createStringResource("pageWorkItems.message.success.released", applicable).getString());
}
showResult(mainResult);
}
Expand Down
Expand Up @@ -304,7 +304,7 @@ protected void onSavePerformed(AjaxRequestTarget target) {
boolean isCorrectPassword = getModelInteractionService().checkPassword(user.getOid(), oldPassword,
checkPasswordTask, checkPasswordResult);
if (!isCorrectPassword) {
warn(getString("PageSelfCredentials.incorrectOldPassword"));
error(getString("PageSelfCredentials.incorrectOldPassword"));
target.add(getFeedbackPanel());
return;
}
Expand Down
Expand Up @@ -48,9 +48,9 @@ public static OperationResult suspendPerformed(TaskService taskService, Collecti
result.computeStatus();
if (result.isSuccess()) {
if (suspended) {
result.recordStatus(OperationResultStatus.SUCCESS, "The task have been successfully suspended.");
result.recordStatus(OperationResultStatus.SUCCESS, "The task have been successfully suspended."); // todo i18n
} else {
result.recordWarning("Task suspension has been successfully requested; please check for its completion using task list.");
result.recordWarning("Task suspension has been successfully requested; please check for its completion using task list."); // todo i18n
}
}
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | ExpressionEvaluationException | RuntimeException | CommunicationException | ConfigurationException e) {
Expand All @@ -69,7 +69,7 @@ public static OperationResult resumePerformed(TaskService taskService, List<Stri
result.computeStatus();

if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "The task has been successfully resumed.");
result.recordStatus(OperationResultStatus.SUCCESS, "The task has been successfully resumed."); // todo i18n
}
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | ExpressionEvaluationException | RuntimeException | CommunicationException | ConfigurationException e) {
result.recordFatalError("Couldn't resume the task", e);
Expand All @@ -86,7 +86,7 @@ public static OperationResult runNowPerformed(TaskService taskService, List<Stri
result.computeStatus();

if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "The task has been successfully scheduled to run.");
result.recordStatus(OperationResultStatus.SUCCESS, "The task has been successfully scheduled to run."); // todo i18n
}
} catch (ObjectNotFoundException | SchemaException | SecurityViolationException | ExpressionEvaluationException | RuntimeException | CommunicationException | ConfigurationException e) {
result.recordFatalError("Couldn't schedule the task", e);
Expand Down

0 comments on commit 83ca7f0

Please sign in to comment.