-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simulation - search by processed object type - search item fixed (was…
… text, now choice)
- Loading branch information
Showing
7 changed files
with
87 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...eum/midpoint/gui/impl/component/search/factory/ProcessedObjectTypeItemWrapperFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2010-2023 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.gui.impl.component.search.factory; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
import com.evolveum.midpoint.gui.impl.component.search.wrapper.ProcessedObjectTypeSearchItemWrapper; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationResultProcessedObjectType; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public class ProcessedObjectTypeItemWrapperFactory extends AbstractSearchItemWrapperFactory<QName, ProcessedObjectTypeSearchItemWrapper> { | ||
|
||
@Override | ||
protected ProcessedObjectTypeSearchItemWrapper createSearchWrapper(SearchItemContext ctx) { | ||
return new ProcessedObjectTypeSearchItemWrapper(); | ||
} | ||
|
||
@Override | ||
public boolean match(SearchItemContext ctx) { | ||
return SimulationResultProcessedObjectType.F_TYPE.equivalent(ctx.getPath()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...veum/midpoint/gui/impl/component/search/wrapper/ProcessedObjectTypeSearchItemWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2010-2023 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.gui.impl.component.search.wrapper; | ||
|
||
import java.util.stream.Collectors; | ||
import javax.xml.namespace.QName; | ||
|
||
import com.evolveum.midpoint.gui.api.page.PageBase; | ||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.prism.PrismContext; | ||
import com.evolveum.midpoint.prism.impl.DisplayableValueImpl; | ||
import com.evolveum.midpoint.prism.query.ObjectFilter; | ||
import com.evolveum.midpoint.schema.expression.VariablesMap; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationResultProcessedObjectType; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public class ProcessedObjectTypeSearchItemWrapper extends ChoicesSearchItemWrapper<QName> { | ||
|
||
public ProcessedObjectTypeSearchItemWrapper() { | ||
super(SimulationResultProcessedObjectType.F_TYPE, | ||
WebComponentUtil.createObjectTypesList().stream() | ||
.map(o -> new DisplayableValueImpl<QName>(o.getTypeQName(), WebComponentUtil.createEnumResourceKey(o))) | ||
.collect(Collectors.toList())); | ||
} | ||
|
||
@Override | ||
public ObjectFilter createFilter(Class type, PageBase pageBase, VariablesMap variables) { | ||
if (getValue().getValue() == null) { | ||
return null; | ||
} | ||
|
||
return PrismContext.get().queryFor(SimulationResultProcessedObjectType.class) | ||
.item(getPath()).eq(getValue().getValue()).buildFilter(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters