Skip to content

Commit

Permalink
Merge branch 'master' into feature/powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Aug 31, 2016
2 parents 809b835 + 166e7aa commit 570e43b
Show file tree
Hide file tree
Showing 247 changed files with 8,276 additions and 2,493 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,6 +4,7 @@
.settings
.idea
*.iml
*.log
*.versionsBackup
target
rebel.xml
Expand Down
47 changes: 29 additions & 18 deletions build-system/pom.xml
Expand Up @@ -1169,18 +1169,6 @@
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down Expand Up @@ -1229,11 +1217,18 @@
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<version>2.6</version>
<configuration>
<archive>
<manifestEntries>
Expand All @@ -1253,11 +1248,27 @@
<version>2.4</version> <configuration> <configLocation>http:///svn/coding-rules/CheckStyle-rules.xml</configLocation>
<includeTestSourceDirectory>false</includeTestSourceDirectory> </configuration>
</plugin -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.0.1.v20091125</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.10.v20160621</version>
<configuration>
<systemProperties>
<systemProperty>
<name>org.eclipse.jetty.annotations.maxWait</name>
<value>240</value>
</systemProperty>
</systemProperties>
<webApp>
<contextPath>/midpoint</contextPath>
<!-- <overrideDescriptor>${basedir}/etc/jetty/web.xml</overrideDescriptor> -->
</webApp>
<webAppConfig>
<allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
</webAppConfig>
<jvmArgs>-Xdebug -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n</jvmArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
24 changes: 12 additions & 12 deletions gui/admin-gui/pom.xml
Expand Up @@ -784,22 +784,22 @@
<activeByDefault>true</activeByDefault>
</activation>

<dependencies>
<dependency>
<artifactId>jaxb-impl</artifactId>
<groupId>com.sun.xml.bind</groupId>
<scope>runtime</scope>
<dependencies>
<dependency>
<artifactId>jaxb-impl</artifactId>
<groupId>com.sun.xml.bind</groupId>
<scope>runtime</scope>
</dependency>
<dependency>
<artifactId>jaxb-api</artifactId>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<groupId>javax.xml.bind</groupId>
</dependency>
<dependency>
<artifactId>jaxb-core</artifactId>
<groupId>com.sun.xml.bind</groupId>
<scope>runtime</scope>
</dependency>
</dependencies>
<artifactId>jaxb-core</artifactId>
<groupId>com.sun.xml.bind</groupId>
<scope>runtime</scope>
</dependency>
</dependencies>

</profile>

Expand Down
Expand Up @@ -27,6 +27,8 @@
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;

import com.evolveum.midpoint.common.SystemConfigurationHolder;
import com.evolveum.midpoint.web.page.admin.configuration.*;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.apache.wicket.AttributeModifier;
Expand Down Expand Up @@ -125,15 +127,6 @@
import com.evolveum.midpoint.web.page.admin.certification.PageCertDecisions;
import com.evolveum.midpoint.web.page.admin.certification.PageCertDefinition;
import com.evolveum.midpoint.web.page.admin.certification.PageCertDefinitions;
import com.evolveum.midpoint.web.page.admin.configuration.PageAbout;
import com.evolveum.midpoint.web.page.admin.configuration.PageAccounts;
import com.evolveum.midpoint.web.page.admin.configuration.PageBulkAction;
import com.evolveum.midpoint.web.page.admin.configuration.PageDebugList;
import com.evolveum.midpoint.web.page.admin.configuration.PageDebugView;
import com.evolveum.midpoint.web.page.admin.configuration.PageImportObject;
import com.evolveum.midpoint.web.page.admin.configuration.PageInternals;
import com.evolveum.midpoint.web.page.admin.configuration.PageRepositoryQuery;
import com.evolveum.midpoint.web.page.admin.configuration.PageSystemConfiguration;
import com.evolveum.midpoint.web.page.admin.home.PageDashboard;
import com.evolveum.midpoint.web.page.admin.reports.PageCreatedReports;
import com.evolveum.midpoint.web.page.admin.reports.PageNewReport;
Expand Down Expand Up @@ -185,6 +178,7 @@
* @author semancik
*/
public abstract class PageBase extends WebPage implements ModelServiceLocator {
private static final long serialVersionUID = 1L;

private static final String DOT_CLASS = PageBase.class.getName() + ".";
private static final String OPERATION_LOAD_USER = DOT_CLASS + "loadUser";
Expand Down Expand Up @@ -217,6 +211,15 @@ public abstract class PageBase extends WebPage implements ModelServiceLocator {

private static final Trace LOGGER = TraceManager.getTrace(PageBase.class);

// Strictly speaking following fields should be transient.
// But making them transient is causing problems on some
// JVM version or tomcat configurations (MID-3357).
// It seems to be somehow related to session persistence.
// But honestly I have no idea about the real cause.
// Anyway, setting these fields to non-transient seems to
// fix it. And surprisingly it does not affect the session
// size.

@SpringBean(name = "modelController")
private ScriptingService scriptingService;

Expand Down Expand Up @@ -280,7 +283,7 @@ public PageBase(PageParameters parameters) {

initializeModel();

initLayout();
initLayout();
}

@Override
Expand All @@ -306,7 +309,7 @@ protected Integer load() {
ObjectQuery query = QueryBuilder.queryFor(WorkItemType.class, getPrismContext())
.item(WorkItemType.F_ASSIGNEE_REF).ref(getPrincipal().getOid())
.build();
return modelService.countContainers(WorkItemType.class, query, null, task, task.getResult());
return getModelService().countContainers(WorkItemType.class, query, null, task, task.getResult());
} catch (SchemaException|SecurityViolationException e) {
LoggingUtils.logExceptionAsWarning(LOGGER, "Couldn't load work item count", e);
return null;
Expand Down Expand Up @@ -1263,6 +1266,12 @@ public boolean isMenuActive(WebPage page) {
PageRepositoryQuery.class);
submenu.add(menu);

if (SystemConfigurationHolder.isExperimentalCodeEnabled()) {
menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.evaluateMapping"),
PageEvaluateMapping.class);
submenu.add(menu);
}

menu = new MenuItem(createStringResource("PageAdmin.menu.top.configuration.about"), PageAbout.class);
submenu.add(menu);

Expand Down Expand Up @@ -1360,8 +1369,9 @@ private MainMenuItem createUsersItems() {
}

private void createFocusPageNewEditMenu(List<MenuItem> submenu, String newKey, String editKey,
final Class<? extends PageAdmin> newPageType) {
MenuItem edit = new MenuItem(createStringResource(editKey), newPageType, null, new VisibleEnableBehaviour() {
final Class<? extends PageAdmin> newPageClass) {
MenuItem edit = new MenuItem(createStringResource(editKey), newPageClass, null, new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;

@Override
public boolean isEnabled() {
Expand All @@ -1370,7 +1380,7 @@ public boolean isEnabled() {

@Override
public boolean isVisible() {
if (!getPage().getClass().equals(newPageType)) {
if (!getPage().getClass().equals(newPageClass)) {
return false;
}

Expand All @@ -1386,11 +1396,12 @@ public boolean isVisible() {
}
});
submenu.add(edit);
MenuItem newMenu = new MenuItem(createStringResource(newKey), newPageType) {
MenuItem newMenu = new MenuItem(createStringResource(newKey), newPageClass) {
private static final long serialVersionUID = 1L;

@Override
protected boolean isMenuActive() {
if (!PageBase.this.getPage().getClass().equals(newPageType)) {
if (!PageBase.this.getPage().getClass().equals(newPageClass)) {
return false;
}

Expand All @@ -1411,6 +1422,7 @@ protected boolean isMenuActive() {
private void createFocusPageViewMenu(List<MenuItem> submenu, String viewKey,
final Class<? extends PageBase> newPageType) {
MenuItem view = new MenuItem(createStringResource(viewKey), newPageType, null, new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;

@Override
public boolean isEnabled() {
Expand Down
Expand Up @@ -243,9 +243,12 @@ public final class WebComponentUtil {

static {
storageTableIdMap = new HashMap<>();
storageTableIdMap.put(TableId.PAGE_RESOURCE_ACCOUNTS_PANEL, SessionStorage.KEY_RESOURCE_ACCOUNT_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_ENTITLEMENT_PANEL, SessionStorage.KEY_RESOURCE_ENTITLEMENT_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_GENERIC_PANEL, SessionStorage.KEY_RESOURCE_GENERIC_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_ACCOUNTS_PANEL_REPOSITORY_MODE, SessionStorage.KEY_RESOURCE_ACCOUNT_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_ACCOUNTS_PANEL_RESOURCE_MODE, SessionStorage.KEY_RESOURCE_ACCOUNT_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_ENTITLEMENT_PANEL_REPOSITORY_MODE, SessionStorage.KEY_RESOURCE_ENTITLEMENT_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_ENTITLEMENT_PANEL_RESOURCE_MODE, SessionStorage.KEY_RESOURCE_ENTITLEMENT_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_GENERIC_PANEL_REPOSITORY_MODE, SessionStorage.KEY_RESOURCE_GENERIC_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_GENERIC_PANEL_RESOURCE_MODE, SessionStorage.KEY_RESOURCE_GENERIC_CONTENT + SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT);
storageTableIdMap.put(TableId.PAGE_RESOURCE_OBJECT_CLASS_PANEL, SessionStorage.KEY_RESOURCE_OBJECT_CLASS_CONTENT);

}
Expand Down
Expand Up @@ -244,6 +244,11 @@ public static <T extends ObjectType> PrismObject<T> loadObject(Class<T> type, St
LOGGER.debug("User {} is not authorized to read {} {}",
task.getOwner() != null ? task.getOwner().getName() : null, type.getSimpleName(), oid);
return null;
} catch (ObjectNotFoundException e) {
// Object does not exist. It was deleted in the meanwhile, or not created yet. This could happen quite often.
subResult.recordHandledError(e);
LOGGER.debug("{} {} does not exist", type.getSimpleName(), oid, e);
return null;
} catch (Exception ex) {
subResult.recordFatalError("WebModelUtils.couldntLoadObject", ex);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load object", ex);
Expand Down
Expand Up @@ -20,6 +20,7 @@
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AbstractAjaxBehavior;
import org.apache.wicket.request.IRequestCycle;
Expand All @@ -34,6 +35,7 @@ public abstract class AjaxDownloadBehaviorFromStream extends AbstractAjaxBehavio

private boolean addAntiCache;
private String contentType = "text";
private String fileName = null;

public AjaxDownloadBehaviorFromStream() {
this(true);
Expand Down Expand Up @@ -84,19 +86,30 @@ public void close() throws IOException {
}

};
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(
new ResourceStreamRequestHandler(resourceStream) {
@Override
public void respond(IRequestCycle requestCycle) {
super.respond(requestCycle);
}
}.setContentDisposition(ContentDisposition.ATTACHMENT)
.setCacheDuration(Duration.ONE_SECOND));
ResourceStreamRequestHandler reqHandler = new ResourceStreamRequestHandler(resourceStream) {
@Override
public void respond(IRequestCycle requestCycle) {
super.respond(requestCycle);
}
}.setContentDisposition(ContentDisposition.ATTACHMENT)
.setCacheDuration(Duration.ONE_SECOND);
if (StringUtils.isNotEmpty(getFileName())){
reqHandler.setFileName(getFileName());
}
getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(reqHandler);
}

public void setContentType(String contentType) {
this.contentType = contentType;
}

protected abstract InputStream initStream();

public String getFileName() {
return fileName;
}

public void setFileName(String fileName) {
this.fileName = fileName;
}
}

0 comments on commit 570e43b

Please sign in to comment.