Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed May 23, 2016
2 parents eddaca6 + 93719f1 commit 535393c
Show file tree
Hide file tree
Showing 52 changed files with 898 additions and 371 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Expand Up @@ -10,7 +10,11 @@ cache:
- $HOME/.m2

before_install:
- "export MAVEN_OPTS='-Xmx2g -XX:MaxPermSize=256m'"
- wget https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
- unzip -qq apache-maven-3.3.9-bin.zip
- export M2_HOME=$PWD/apache-maven-3.3.9
- export PATH=$M2_HOME/bin:$PATH
- export MAVEN_OPTS='-Xmx2g -XX:MaxPermSize=256m'

# custom script is used so build and tests are done in one mvn command, separating it (as Travis does by default) leads to problem with ConnId (notably DummyResource)
# travis_wait is used for integration tests workround as default Travis settings kills build if no message is printed to stdout for 10 mins
Expand Down
Expand Up @@ -311,7 +311,7 @@ private String createCountString(IPageable pageable) {

if (count > 0) {
if (count == Integer.MAX_VALUE) {
return PageBase.createStringResourceStatic(PagingFooter.this, "CountToolbar.lable",
return PageBase.createStringResourceStatic(PagingFooter.this, "CountToolbar.label.unknownCount",
new Object[] { from, to }).getString();
}

Expand Down
Expand Up @@ -17,6 +17,7 @@
package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.schema.ResourceShadowDiscriminator;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
Expand Down Expand Up @@ -230,12 +231,8 @@ protected void onError(AjaxRequestTarget target,
createStringResource("pageAdminFocus.button.back")) {

@Override
protected void onSubmit(AjaxRequestTarget target,
org.apache.wicket.markup.html.form.Form<?> form) {
Page page = getPage();
if (page != null && page instanceof PageAdminObjectDetails){
setResponsePage(((PageAdminObjectDetails) page).getDefaultBackPage());
}
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
backPerformed(target);
}

@Override
Expand All @@ -249,6 +246,11 @@ protected void onError(AjaxRequestTarget target,

}

protected void backPerformed(AjaxRequestTarget target) {
PageBase page = getPageBase();
page.redirectBack();
}

// Note: do not setVisible(false) on the progress panel itself - it will disable AJAX refresh functionality attached to it.
// Use the following two methods instead.

Expand Down
Expand Up @@ -126,6 +126,7 @@ public Date getObject() {
}

BoxedTablePanel<WorkItemDto> workItemsTable = new BoxedTablePanel<>(ID_WORK_ITEMS_TABLE, provider, columns, tableId, pageSize);
workItemsTable.setAdditionalBoxCssClasses("without-box-header-top-border");
add(workItemsTable);
}

Expand Down
Expand Up @@ -624,8 +624,6 @@ protected void performAdditionalValidation(PrismObject<O> object,

}

public abstract PageBase getDefaultBackPage();

public List<ObjectFormType> getObjectFormTypes() {
Task task = createSimpleTask(OPERATION_LOAD_GUI_CONFIGURATION);
OperationResult result = task.getResult();
Expand Down
Expand Up @@ -52,16 +52,25 @@ public AsyncDashboardPanel(String id, IModel<String> title, String icon, String
this(id, title, icon, new Model(), boxCssClasses);
}

public AsyncDashboardPanel(String id, IModel<String> title, String icon, String boxCssClasses, boolean noPadding) {
this(id, title, icon, new Model(), Duration.seconds(DEFAULT_TIMER_DURATION),boxCssClasses, noPadding);
}

public AsyncDashboardPanel(String id, IModel<String> title, String icon, IModel<V> callableParameterModel,
String boxCssClasses) {
this(id, title, icon, callableParameterModel, Duration.seconds(DEFAULT_TIMER_DURATION), boxCssClasses);
}

public AsyncDashboardPanel(String id, IModel<String> title, String icon, IModel<V> callableParameterModel,
Duration durationSecs, String boxCssClasses) {
this(id, title, icon, callableParameterModel, Duration.seconds(DEFAULT_TIMER_DURATION), boxCssClasses, false);
}

public AsyncDashboardPanel(String id, IModel<String> title, String icon, IModel<V> callableParameterModel,
Duration durationSecs, String boxCssClasses, boolean noPadding) {
super(id, callableParameterModel, durationSecs);

initLayout();
initLayout(noPadding);

WebMarkupContainer dashboardTitle = (WebMarkupContainer) get(
createComponentPath(ID_DASHBOARD_PARENT, ID_DASHBOARD_TITLE));
Expand All @@ -80,7 +89,7 @@ public AsyncDashboardPanel(String id, IModel<String> title, String icon, IModel<
dashboardTitle.add(iconI);
}

private void initLayout() {
private void initLayout(boolean noPadding) {
WebMarkupContainer dashboardParent = new WebMarkupContainer(ID_DASHBOARD_PARENT);
add(dashboardParent);

Expand All @@ -93,6 +102,10 @@ private void initLayout() {
WebMarkupContainer dashboardContent = new WebMarkupContainer(ID_DASHBOARD_CONTENT);
dashboardParent.add(dashboardContent);

if (noPadding) {
dashboardContent.add(AttributeAppender.append("class", "no-padding"));
}

dashboardContent.add(new Label(ID_CONTENT));

WebMarkupContainer preloaderContainer = new WebMarkupContainer(ID_PRELOADER_CONTAINER);
Expand Down
Expand Up @@ -22,6 +22,8 @@

import javax.xml.namespace.QName;

import com.evolveum.midpoint.web.component.dialog.ConfirmationPanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
Expand Down Expand Up @@ -105,14 +107,6 @@
import com.evolveum.midpoint.web.page.admin.users.PageUser;
import com.evolveum.midpoint.web.session.UserProfileStorage.TableId;
import com.evolveum.midpoint.web.util.OnePageParameterEncoder;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

/**
* Implementation classes : ResourceContentResourcePanel,
Expand Down Expand Up @@ -897,16 +891,8 @@ protected void importResourceObject(ShadowType selected, AjaxRequestTarget targe

// TODO: as a task?
protected void deleteResourceObjectPerformed(ShadowType selected, AjaxRequestTarget target) {
List<ShadowType> selectedShadow = null;
if (selected != null) {
selectedShadow = new ArrayList<>();
selectedShadow.add(selected);
} else {
selectedShadow = getTable().getSelectedObjects();
}

OperationResult result = new OperationResult(OPERATION_DELETE_OBJECT);
Task task = pageBase.createSimpleTask(OPERATION_DELETE_OBJECT);
final List<ShadowType> selectedShadow = getSelectedShadowsList(selected);
final OperationResult result = new OperationResult(OPERATION_DELETE_OBJECT);

if (selectedShadow == null || selectedShadow.isEmpty()) {
result.recordWarning("Nothing selected to delete");
Expand All @@ -915,43 +901,72 @@ protected void deleteResourceObjectPerformed(ShadowType selected, AjaxRequestTar
return;
}

ModelExecuteOptions opts = createModelOptions();
ConfirmationPanel dialog = new ConfirmationPanel(((PageBase)getPage()).getMainPopupBodyId(),
createDeleteConfirmString(selected, "pageContentAccounts.message.deleteConfirmation",
"pageContentAccounts.message.deleteConfirmationSingle")){
@Override
public void yesPerformed(AjaxRequestTarget target) {
((PageBase)getPage()).hideMainPopup(target);
deleteAccountConfirmedPerformed(target, result, selectedShadow);
}
};
((PageBase)getPage()).showMainPopup(dialog, target);

for (ShadowType shadow : selectedShadow) {
try {
ObjectDelta<ShadowType> deleteDelta = ObjectDelta.createDeleteDelta(ShadowType.class,
shadow.getOid(), getPageBase().getPrismContext());
getPageBase().getModelService().executeChanges(
WebComponentUtil.createDeltaCollection(deleteDelta), opts, task, result);
} catch (ObjectAlreadyExistsException | ObjectNotFoundException | SchemaException
| ExpressionEvaluationException | CommunicationException | ConfigurationException
| PolicyViolationException | SecurityViolationException e) {
result.recordPartialError("Could not delete object " + shadow, e);
LOGGER.error("Could not delete {}, using option {}", shadow, opts, e);
continue;
}
}

result.computeStatusIfUnknown();
getPageBase().showResult(result);
getTable().refreshTable(null, target);
target.add(getPageBase().getFeedbackPanel());

}

protected abstract ModelExecuteOptions createModelOptions();
private void deleteAccountConfirmedPerformed(AjaxRequestTarget target, OperationResult result, List<ShadowType> selected){
Task task = pageBase.createSimpleTask(OPERATION_DELETE_OBJECT);
ModelExecuteOptions opts = createModelOptions();

for (ShadowType shadow : selected) {
try {
ObjectDelta<ShadowType> deleteDelta = ObjectDelta.createDeleteDelta(ShadowType.class,
shadow.getOid(), getPageBase().getPrismContext());
getPageBase().getModelService().executeChanges(
WebComponentUtil.createDeltaCollection(deleteDelta), opts, task, result);
} catch (ObjectAlreadyExistsException | ObjectNotFoundException | SchemaException
| ExpressionEvaluationException | CommunicationException | ConfigurationException
| PolicyViolationException | SecurityViolationException e) {
result.recordPartialError("Could not delete object " + shadow, e);
LOGGER.error("Could not delete {}, using option {}", shadow, opts, e);
continue;
}
}

result.computeStatusIfUnknown();
getPageBase().showResult(result);
getTable().refreshTable(null, target);
target.add(getPageBase().getFeedbackPanel());


}

private IModel<String> createDeleteConfirmString(final ShadowType selected, final String oneDeleteKey, final String moreDeleteKey) {
return new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
List<ShadowType> selectedShadow = getSelectedShadowsList(selected);
switch (selectedShadow.size()) {
case 1:
Object first = selectedShadow.get(0);
String name = WebComponentUtil.getName(((ShadowType) first));
return getPageBase().createStringResource(oneDeleteKey, name).getString();
default:
return getPageBase().createStringResource(moreDeleteKey, selectedShadow.size()).getString();
}
}
};
}

protected abstract ModelExecuteOptions createModelOptions();

protected void updateResourceObjectStatusPerformed(ShadowType selected, AjaxRequestTarget target,
boolean enabled) {
List<ShadowType> selectedShadow = null;
if (selected != null) {
selectedShadow = new ArrayList<>();
selectedShadow.add(selected);
} else {
selectedShadow = getTable().getSelectedObjects();
}
List<ShadowType> selectedShadow = getSelectedShadowsList(selected);

OperationResult result = new OperationResult(OPERATION_UPDATE_STATUS);
OperationResult result = new OperationResult(OPERATION_UPDATE_STATUS);
Task task = pageBase.createSimpleTask(OPERATION_UPDATE_STATUS);

if (selectedShadow == null || selectedShadow.isEmpty()) {
Expand Down Expand Up @@ -1003,13 +1018,7 @@ private MainObjectListPanel<ShadowType> getTable() {
private void changeOwner(ShadowType selected, AjaxRequestTarget target, FocusType ownerToChange,
Operation operation) {

List<ShadowType> selectedShadow = null;
if (selected != null) {
selectedShadow = new ArrayList<>();
selectedShadow.add(selected);
} else {
selectedShadow = getTable().getSelectedObjects();
}
List<ShadowType> selectedShadow = getSelectedShadowsList(selected);

Collection<? extends ItemDelta> modifications = new ArrayList<>();

Expand Down Expand Up @@ -1097,6 +1106,17 @@ private void changeOwnerInternal(String ownerOid, Collection<? extends ItemDelta
target.add(ResourceContentPanel.this);
}

private List<ShadowType> getSelectedShadowsList(ShadowType shadow){
List<ShadowType> selectedShadow = null;
if (shadow != null) {
selectedShadow = new ArrayList<>();
selectedShadow.add(shadow);
} else {
selectedShadow = getTable().getSelectedObjects();
}
return selectedShadow;
}

protected abstract SelectorOptions<GetOperationOptions> addAdditionalOptions();

protected abstract boolean isUseObjectCounting();
Expand Down
Expand Up @@ -186,9 +186,4 @@ protected FocusSummaryPanel<RoleType> createSummaryPanel() {
protected AbstractObjectMainPanel<RoleType> createMainPanel(String id) {
return new RoleMainPanel(id, getObjectModel(), getAssignmentsModel(), getProjectionModel(), getInducementsModel(), this);
}

@Override
public PageBase getDefaultBackPage() {
return new PageRoles(false);
}
}
Expand Up @@ -63,9 +63,4 @@ protected AbstractObjectMainPanel<ServiceType> createMainPanel(String id) {
return new AbstractRoleMainPanel<ServiceType>(id, getObjectModel(), getAssignmentsModel(), getProjectionModel(), getInducementsModel(), this);
}

@Override
public PageBase getDefaultBackPage() {
return new PageServices();
}

}
Expand Up @@ -162,10 +162,4 @@ protected FocusSummaryPanel<OrgType> createSummaryPanel() {
protected AbstractObjectMainPanel<OrgType> createMainPanel(String id) {
return new AbstractRoleMainPanel<OrgType>(id, getObjectModel(), getAssignmentsModel(), getProjectionModel(), getInducementsModel(), this);
}

@Override
public PageBase getDefaultBackPage() {
return new PageOrgTree();
}

}
Expand Up @@ -115,10 +115,4 @@ protected Class getCompileTimeClass() {
protected AbstractObjectMainPanel<UserType> createMainPanel(String id) {
return new FocusMainPanel<UserType>(id, getObjectModel(), getAssignmentsModel(), getProjectionModel(), this);
}

@Override
public PageBase getDefaultBackPage() {
return new PageUsers();
}

}
Expand Up @@ -65,10 +65,15 @@ public ProcessInstancesPanel(String id, ISortableDataProvider<ProcessInstanceDto
}

private void initLayout(UserProfileStorage.TableId tableId, int pageSize, View view, final IModel<String> currentInstanceIdModel) {
BoxedTablePanel<ProcessInstanceDto> table = new BoxedTablePanel<ProcessInstanceDto>(ID_REQUESTS_TABLE, provider, initColumns(view), tableId, pageSize) {
BoxedTablePanel<ProcessInstanceDto> table = new BoxedTablePanel<ProcessInstanceDto>(
ID_REQUESTS_TABLE, provider, initColumns(view), tableId, pageSize) {

@Override
protected Item<ProcessInstanceDto> customizeNewRowItem(Item<ProcessInstanceDto> item, final IModel<ProcessInstanceDto> rowModel) {
protected Item<ProcessInstanceDto> customizeNewRowItem(Item<ProcessInstanceDto> item,
final IModel<ProcessInstanceDto> rowModel) {

item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

@Override
public String getObject() {
if (currentInstanceIdModel == null || currentInstanceIdModel.getObject() == null) {
Expand All @@ -86,6 +91,7 @@ public String getObject() {
}
};
table.setOutputMarkupId(true);
table.setAdditionalBoxCssClasses("without-box-header-top-border");
add(table);
}

Expand Down
Expand Up @@ -25,7 +25,7 @@
<div class="col-md-offset-2 col-md-8 col-lg-offset-4 col-lg-4">
<div class="panel panel-default" style="margin-top: 120px;">
<div class="panel-body">
<form method="post" class="form-horizontal">
<form method="post" class="form-horizontal" action="spring_security_login">
<div class="form-group">
<label class="col-md-4 col-lg-4 control-label">
<wicket:message key="PageLogin.username"/>
Expand Down
Expand Up @@ -24,7 +24,6 @@
<div wicket:id="linksPanel"/>
</div>
<div class="col-md-6">

<div wicket:id="workItemsPanel"/>
</div>
</div>
Expand Down

0 comments on commit 535393c

Please sign in to comment.