Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/upstream/master' into CAS-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrGasparik committed Sep 21, 2015
2 parents b1d7346 + a25d0ab commit 9f2fa6f
Show file tree
Hide file tree
Showing 160 changed files with 5,943 additions and 1,010 deletions.
5 changes: 5 additions & 0 deletions build-system/pom.xml
Expand Up @@ -860,6 +860,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api </artifactId>
<version>1.5.4</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
4 changes: 4 additions & 0 deletions gui/admin-gui/pom.xml
Expand Up @@ -596,6 +596,10 @@
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api </artifactId>
</dependency>

<!-- Uncomment following if you want midpoint to be a part of SSO using CAS server-->
<!-- SSO CAS Client dependencies -->
Expand Down
@@ -0,0 +1,125 @@
/*
* Copyright (c) 2010-2015 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.schema.statistics.GenericStatisticsData;
import com.evolveum.midpoint.schema.statistics.MappingsStatisticsKey;
import com.evolveum.midpoint.schema.statistics.OperationalInformation;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsEntryType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalInformationType;
import org.apache.commons.lang.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* @author Pavol Mederly
*/
public class MappingsLineDto {

public static final String F_OBJECT = "object";
public static final String F_COUNT = "count";
public static final String F_AVERAGE_TIME = "averageTime";
public static final String F_MIN_TIME = "minTime";
public static final String F_MAX_TIME = "maxTime";
public static final String F_TOTAL_TIME = "totalTime";

private String object;
private int count;
private Long minTime;
private Long maxTime;
private long totalTime;

// public MappingsLineDto(String object) {
// this.object = object;
// }

public MappingsLineDto(MappingsStatisticsEntryType entry) {
object = entry.getObject();
count = entry.getCount();
minTime = entry.getMinTime();
maxTime = entry.getMaxTime();
totalTime = entry.getTotalTime();
}

public String getObject() {
return object;
}

public int getCount() {
return count;
}

public Long getAverageTime() {
if (count > 0) {
return totalTime / count;
} else {
return null;
}
}

public Long getMinTime() {
return minTime;
}

public Long getMaxTime() {
return maxTime;
}

public long getTotalTime() {
return totalTime;
}

public static List<MappingsLineDto> extractFromOperationalInformation(OperationalInformation operationalInformation) {
OperationalInformationType operationalInformationType = operationalInformation.getAggregatedValue();
MappingsStatisticsType mappingsStatisticsType = operationalInformationType.getMappingsStatistics();
return extractFromOperationalInformation(mappingsStatisticsType);
}

protected static List<MappingsLineDto> extractFromOperationalInformation(MappingsStatisticsType mappingsStatisticsType) {
List<MappingsLineDto> retval = new ArrayList<>();
if (mappingsStatisticsType == null) {
return retval;
}
for (MappingsStatisticsEntryType entry : mappingsStatisticsType.getEntry()) {
retval.add(new MappingsLineDto(entry));
}
return retval;
}

// private static MappingsLineDto findLineDto(List<MappingsLineDto> list, String object) {
// for (MappingsLineDto lineDto : list) {
// if (StringUtils.equals(lineDto.getObject(), object)) {
// return lineDto;
// }
// }
// return null;
// }
//
// private void setValue(int count, int min, int max, long totalDuration) {
// this.count += count;
// if (minTime == null || min < minTime) {
// minTime = min;
// }
// if (maxTime == null || max > maxTime) {
// maxTime = max;
// }
// totalTime += totalDuration;
// }
}
@@ -0,0 +1,138 @@
/*
* Copyright (c) 2010-2015 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.schema.statistics.GenericStatisticsData;
import com.evolveum.midpoint.schema.statistics.NotificationsStatisticsKey;
import com.evolveum.midpoint.schema.statistics.OperationalInformation;
import com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsEntryType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalInformationType;
import org.apache.commons.lang.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* @author Pavol Mederly
*/
public class NotificationsLineDto {

public static final String F_TRANSPORT = "transport";
public static final String F_COUNT_SUCCESS = "countSuccess";
public static final String F_COUNT_FAILURE = "countFailure";
public static final String F_AVERAGE_TIME = "averageTime";
public static final String F_MIN_TIME = "minTime";
public static final String F_MAX_TIME = "maxTime";
public static final String F_TOTAL_TIME = "totalTime";

private String transport;
private int countSuccess;
private int countFailure;
private Long minTime;
private Long maxTime;
private long totalTime;

public NotificationsLineDto(String transport) {
this.transport = transport;
}

public NotificationsLineDto(NotificationsStatisticsEntryType entry) {
transport = entry.getTransport();
countSuccess = entry.getCountSuccess();
countFailure = entry.getCountFailure();
minTime = entry.getMinTime();
maxTime = entry.getMaxTime();
totalTime = entry.getTotalTime();
}

public Long getAverageTime() {
int count = countSuccess + countFailure;
if (count > 0) {
return totalTime / count;
} else {
return null;
}
}

public String getTransport() {
return transport;
}

public int getCountSuccess() {
return countSuccess;
}

public int getCountFailure() {
return countFailure;
}

public Long getMinTime() {
return minTime;
}

public Long getMaxTime() {
return maxTime;
}

public long getTotalTime() {
return totalTime;
}

public static List<NotificationsLineDto> extractFromOperationalInformation(OperationalInformation operationalInformation) {
OperationalInformationType operationalInformationType = operationalInformation.getAggregatedValue();
NotificationsStatisticsType notificationsStatisticsType = operationalInformationType.getNotificationsStatistics();
return extractFromOperationalInformation(notificationsStatisticsType);
}

protected static List<NotificationsLineDto> extractFromOperationalInformation(NotificationsStatisticsType notificationsStatisticsType) {
List<NotificationsLineDto> retval = new ArrayList<>();
if (notificationsStatisticsType == null) {
return retval;
}

for (NotificationsStatisticsEntryType entry : notificationsStatisticsType.getEntry()) {
retval.add(new NotificationsLineDto(entry));
}
return retval;
}

// private static NotificationsLineDto findLineDto(List<NotificationsLineDto> list, String transport) {
// for (NotificationsLineDto lineDto : list) {
// if (StringUtils.equals(lineDto.getTransport(), transport)) {
// return lineDto;
// }
// }
// return null;
// }
//
// private void setValue(boolean success, int count, long min, long max, long totalDuration) {
// if (success) {
// this.countSuccess += count;
// } else {
// this.countFailure += count;
// }
// if (minTime == null || min < minTime) {
// minTime = min;
// }
// if (maxTime == null || max > maxTime) {
// maxTime = max;
// }
// totalTime += totalDuration;
// }
}
Expand Up @@ -16,6 +16,8 @@

package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.schema.statistics.StatusMessage;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -65,4 +67,5 @@ public boolean allSuccess() {
}
return true;
}

}
Expand Up @@ -31,6 +31,9 @@
<td><span wicket:id="comment"/></td>
</tr>
</table>

<div wicket:id="statistics"/>

<span wicket:id="executionTime"/>
<span wicket:id="logItems">
<span wicket:id="logItem">label</span><br/>
Expand Down
Expand Up @@ -17,19 +17,17 @@
package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.schema.ResourceShadowDiscriminator;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.page.admin.server.dto.OperationResultStatusIcon;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import java.util.List;

Expand All @@ -46,6 +44,7 @@ public class ProgressPanel extends SimplePanel<ProgressDto> {
private static final String ID_ACTIVITY_DESCRIPTION = "description";
private static final String ID_ACTIVITY_STATE = "status";
private static final String ID_ACTIVITY_COMMENT = "comment";
private static final String ID_STATISTICS = "statistics";
private static final String ID_LOG_ITEMS = "logItems";
private static final String ID_LOG_ITEM = "logItem";
private static final String ID_EXECUTION_TIME = "executionTime";
Expand All @@ -54,6 +53,7 @@ public class ProgressPanel extends SimplePanel<ProgressDto> {
private long operationDurationTime; // if >0, operation has finished

private WebMarkupContainer contentsPanel;
private StatisticsPanel statisticsPanel;

public ProgressPanel(String id) {
super(id);
Expand Down Expand Up @@ -159,6 +159,9 @@ private Label createImageLabel(String id, IModel<String> cssClass, IModel<String
};
contentsPanel.add(statusItemsListView);

statisticsPanel = new StatisticsPanel(ID_STATISTICS, new StatisticsDtoModel());
contentsPanel.add(statisticsPanel);

ListView logItemsListView = new ListView(ID_LOG_ITEMS, new AbstractReadOnlyModel<List>() {
@Override
public List getObject() {
Expand Down Expand Up @@ -206,4 +209,16 @@ public void recordExecutionStart() {
public void recordExecutionStop() {
operationDurationTime = System.currentTimeMillis() - operationStartTime;
}

public void setTask(Task task) {
if (statisticsPanel != null && statisticsPanel.getModel() instanceof StatisticsDtoModel) {
((StatisticsDtoModel) statisticsPanel.getModel()).setTask(task);
}
}

public void invalidateCache() {
if (statisticsPanel != null && statisticsPanel.getModel() instanceof StatisticsDtoModel) {
((StatisticsDtoModel) (statisticsPanel.getModel())).invalidateCache();
}
}
}
Expand Up @@ -173,6 +173,7 @@ private void executeChangesAsync(final Collection<ObjectDelta<? extends ObjectTy
startRefreshingProgressPanel(target);
showProgressPanel();

progressPanel.setTask(task);
progressListener = new DefaultGuiProgressListener(parentPage, progressPanel.getModelObject());
Runnable execution = new Runnable() {
@Override
Expand Down Expand Up @@ -223,6 +224,9 @@ private void startRefreshingProgressPanel(AjaxRequestTarget target) {
@Override
protected void onPostProcessTarget(AjaxRequestTarget target) {
super.onPostProcessTarget(target);
if (progressPanel != null) {
progressPanel.invalidateCache();
}
if (asyncOperationResult != null) { // by checking this we know that async operation has been finished
asyncOperationResult.recomputeStatus(); // because we set it to in-progress

Expand Down

0 comments on commit 9f2fa6f

Please sign in to comment.