Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Sep 4, 2020
2 parents 3429244 + e774667 commit 2dc49c5
Show file tree
Hide file tree
Showing 79 changed files with 2,260 additions and 759 deletions.
Expand Up @@ -95,6 +95,13 @@ protected WebMarkupContainer createHeader(String headerId) {
protected void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {
ContainerableListPanel.this.searchPerformed(target);
}

@Override
protected void saveSearch(Search search, AjaxRequestTarget target) {
if (getPageStorage() != null) {
getPageStorage().setSearch(search);
}
}
};
searchPanel.add(new VisibleBehaviour(() -> isSearchVisible()));
return searchPanel;
Expand Down
Expand Up @@ -636,6 +636,14 @@ protected void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {
ObjectListPanel.this.searchPerformed(query, target);
}

@Override
protected void saveSearch(Search search, AjaxRequestTarget target) {
PageStorage storage = getPageStorage(getStorageKey());
if (storage != null) {
storage.setSearch(search);
}
}

};

return searchPanel;
Expand Down Expand Up @@ -823,15 +831,7 @@ private void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {
// }

provider.setQuery(customQuery);
String storageKey = getStorageKey();
if (StringUtils.isNotEmpty(storageKey)) {
PageStorage storage = getPageStorage(storageKey);
if (storage != null) {
storage.setSearch(searchModel.getObject());
storage.setPaging(null);
}
}

saveSearchModel(null);
Table table = getTable();
table.setCurrentPage(null);
target.add((Component) table);
Expand Down
Expand Up @@ -85,7 +85,7 @@ private void initModels(){
if (modelContext != null) {
if (modelContext.getFocusContext() != null) {
addIgnoreNull(primaryDeltas, CloneUtil.clone(modelContext.getFocusContext().getPrimaryDelta()));
addIgnoreNull(secondaryDeltas, CloneUtil.clone(modelContext.getFocusContext().getSecondaryDelta()));
addIgnoreNull(secondaryDeltas, CloneUtil.clone(modelContext.getFocusContext().getSecondaryDelta())); // todo adapt this, see MID-6465
}
for (ModelProjectionContext projCtx : modelContext.getProjectionContexts()) {
addIgnoreNull(primaryDeltas, CloneUtil.clone(projCtx.getPrimaryDelta()));
Expand Down
Expand Up @@ -6,19 +6,25 @@
*/
package com.evolveum.midpoint.web.component.search;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SearchItemType;

import org.apache.commons.lang.Validate;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SearchItemType;

/**
* @author honchar
*/
public class FilterSearchItem extends SearchItem {

private static final long serialVersionUID = 1L;
private static final Trace LOGGER = TraceManager.getTrace(FilterSearchItem.class);

public static final String F_APPLY_FILTER = "applyFilter";

Expand All @@ -42,8 +48,16 @@ public Type getType(){
}

@Override
protected String getTitle(){
return getPredefinedFilter().getFilter() != null ? getPredefinedFilter().getFilter().toString() : "";
protected String getTitle(PageBase pageBase) {
if (getPredefinedFilter() == null || getPredefinedFilter().getFilter() == null) {
return null;
}
try {
return pageBase.getPrismContext().xmlSerializer().serializeRealValue(getPredefinedFilter().getFilter());
} catch (SchemaException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Cannot serialize filter", e);
}
return null;
}

public SearchItemType getPredefinedFilter() {
Expand Down
Expand Up @@ -9,9 +9,10 @@
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div>
<div class="col-md-10" wicket:id="referenceValueTextField"/>
<div class="col-sm-1">
<a wicket:id="editReferenceButton" class="btn btn-xs btn-default dropdown-toggle" style="margin-top: 5px; border: none !important;" data-toggle="dropdown">
<div class="col-md-10 search-item-field" wicket:id="referenceValueTextField"/>
<div class="col-sm-1 search-item-field">
<a wicket:id="editReferenceButton" class="btn btn-xs btn-default dropdown-toggle"
style="margin-top: 5px; border: none !important; margin-left: 15px;" data-toggle="dropdown">
<i class="fa fa-edit fa-lg"/>
</a>
</div>
Expand Down
Expand Up @@ -33,16 +33,25 @@ protected void initLayout() {
searchForm.setOutputMarkupId(true);

SearchPanel search = new SearchPanel(ID_SEARCH, getModel()) {
private static final long serialVersionUID = 1L;

@Override
public void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {
SearchFormPanel.this.searchPerformed(query, target);
}

@Override
protected void saveSearch(Search search, AjaxRequestTarget target) {
SearchFormPanel.this.saveSearch(search, target);
}
};
searchForm.add(search);
}

protected void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {

}

protected void saveSearch(Search search, AjaxRequestTarget target) {
}
}
Expand Up @@ -7,6 +7,8 @@

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

import com.evolveum.midpoint.gui.api.page.PageBase;

import java.io.Serializable;

/**
Expand All @@ -33,7 +35,7 @@ public SearchItem(Search search) {

public abstract Type getType();

protected String getTitle(){
protected String getTitle(PageBase pageBase){
return "";
}

Expand Down
Expand Up @@ -231,7 +231,7 @@ private IModel<String> createTitleModel() {
if (item == null){
return Model.of();
}
return Model.of(item.getTitle());
return Model.of(item.getTitle(getPageBase()));
}

private void deletePerformed(AjaxRequestTarget target) {
Expand Down
Expand Up @@ -571,6 +571,7 @@ private void initPopover() {

ListView properties = new ListView<Property>(ID_PROPERTIES,
new PropertyModel<>(moreDialogModel, MoreDialogDto.F_PROPERTIES)) {
private static final long serialVersionUID = 1L;

@Override
protected void populateItem(final ListItem<Property> item) {
Expand Down Expand Up @@ -740,6 +741,10 @@ void searchPerformed(AjaxRequestTarget target) {

void refreshSearchForm(AjaxRequestTarget target) {
target.add(get(ID_FORM), get(ID_POPOVER));
saveSearch(getModelObject(), target);
}

protected void saveSearch(Search search, AjaxRequestTarget target) {
}

public void searchPerformed(ObjectQuery query, AjaxRequestTarget target) {
Expand Down
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2019 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->

<objectCollection xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
oid="00000000-0000-0000-0001-000000000285">
<name>Audit records</name>
<type>AuditEventRecordType</type>
<filter>
<q:and>
<q:equal>
<q:path>eventStage</q:path>
<q:value>execution</q:value>
</q:equal>
<q:greater>
<q:path>timestamp</q:path>
<expression>
<script>
<code>
calendar = basic.addDuration(basic.currentDateTime(), "-P1D");
return calendar;
</code>
</script>
</expression>
</q:greater>
</q:and>
</filter>
</objectCollection>
Expand Up @@ -7,11 +7,39 @@
-->

<objectCollection xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
oid="00000000-0000-0000-0001-000000000004">
<name>Error audit records</name>
<auditSearch>
<recordQuery>select * from m_audit_event as aer where aer.outcome=3 and aer.eventStage=1</recordQuery>
<domainQuery>select * from m_audit_event as aer where aer.eventStage=1</domainQuery>
<interval>P1D</interval>
</auditSearch>
<type>AuditEventRecordType</type>
<filter>
<q:and>
<q:equal>
<q:path>eventStage</q:path>
<q:value>execution</q:value>
</q:equal>
<q:equal>
<q:path>outcome</q:path>
<q:value>fatal_error</q:value>
</q:equal>
<q:greater>
<q:path>timestamp</q:path>
<expression>
<script>
<code>
calendar = basic.addDuration(basic.currentDateTime(), "-P1D");
return calendar;
</code>
</script>
</expression>
</q:greater>
</q:and>
</filter>
<domain>
<collectionRef oid="00000000-0000-0000-0001-000000000285" type="c:ObjectCollectionType"/>
</domain>
</objectCollection>
Expand Up @@ -7,11 +7,39 @@
-->

<objectCollection xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
oid="00000000-0000-0000-0001-000000000002">
<name>Modification audit records</name>
<type>AuditEventRecordType</type>
<filter>
<q:and>
<q:equal>
<q:path>eventStage</q:path>
<q:value>execution</q:value>
</q:equal>
<q:equal>
<q:path>eventType</q:path>
<q:value>modifyObject</q:value>
</q:equal>
<q:greater>
<q:path>timestamp</q:path>
<expression>
<script>
<code>
calendar = basic.addDuration(basic.currentDateTime(), "-P1D");
return calendar;
</code>
</script>
</expression>
</q:greater>
</q:and>
</filter>
<domain>
<collectionRef oid="00000000-0000-0000-0001-000000000285" type="c:ObjectCollectionType"/>
</domain>
<auditSearch>
<recordQuery>select * from m_audit_event as aer where aer.eventType=2 and aer.eventStage=1</recordQuery>
<domainQuery>select * from m_audit_event as aer where aer.eventStage=1</domainQuery>
<interval>P1D</interval>
</auditSearch>
</objectCollection>
Expand Up @@ -1657,6 +1657,7 @@ th.composited-icon {

.search-item {
display: inline-block;
min-width: 270px;
border-color: #ddd;
border-radius: 3px;
background-color: #f4f4f4;
Expand Down
Expand Up @@ -13,6 +13,7 @@
import com.evolveum.midpoint.prism.path.ItemPath;

import com.evolveum.midpoint.schema.result.OperationResultStatus;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectCollectionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType;

import org.testng.annotations.Test;
Expand Down Expand Up @@ -61,7 +62,7 @@ public void testInitialObjects() throws Exception {
private <O extends ObjectType> void testInitialObject(ObjectValidator validator, StringBuilder errorsSb, File file) throws SchemaException, IOException {
PrismObject<O> object = getPrismContext().parseObject(file);
ValidationResult validationResult = validator.validate(object);
if (validationResult.isEmpty() || isOnlyJasperWarning(validationResult)) {
if (validationResult.isEmpty() || isIgnoredWarning(validationResult)) {
display("Checked "+object+": no warnings");
return;
}
Expand All @@ -76,9 +77,10 @@ private <O extends ObjectType> void testInitialObject(ObjectValidator validator,
}
}

private boolean isOnlyJasperWarning(ValidationResult validationResult) {
private boolean isIgnoredWarning(ValidationResult validationResult) {
for (ValidationItem item : validationResult.getItems()){
if (!item.getItemPath().equivalent(ItemPath.create(ReportType.F_JASPER))
if ((!item.getItemPath().equivalent(ItemPath.create(ReportType.F_JASPER))
&& !item.getItemPath().equivalent(ItemPath.create(ObjectCollectionType.F_AUDIT_SEARCH)))
|| !item.getStatus().equals(OperationResultStatus.WARNING)){
return false;
}
Expand Down
1 change: 1 addition & 0 deletions infra/axiom/src/main/resources/axiom-types.axiom
Expand Up @@ -19,6 +19,7 @@ model axiom-base-types {
type Integer;
type Binary;
type DateTime;
type AnyType;

type QName {
supertype Uri;
Expand Down
Expand Up @@ -228,4 +228,14 @@ default Object getRealValueOrRawType(PrismContext prismContext) {
// Collection<? extends ItemDelta> deltas, boolean ignoreMetadata, boolean isLiteral);

Object find(ItemPath path);

/**
* @return True if the value is transient, so it won't be serialized if serialization
* of transient value is disabled.
*/
@Experimental
boolean isTransient();

@Experimental
void setTransient(boolean value);
}

0 comments on commit 2dc49c5

Please sign in to comment.