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
Kateryna Honchar committed Jun 28, 2022
2 parents 0bc87d3 + 9a28002 commit eb14496
Show file tree
Hide file tree
Showing 139 changed files with 1,780 additions and 1,849 deletions.
1 change: 1 addition & 0 deletions config/sql/native-new/postgres-new-audit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,5 @@ limit 50;
*/

-- Initializing the last change number used in postgres-new-upgrade.sql.
-- This is important to avoid applying any change more than once.
call apply_audit_change(2, $$ SELECT 1 $$, true);
21 changes: 20 additions & 1 deletion config/sql/native-new/postgres-new-upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Current database name is ''%'', schema name is ''%''.', current_database(), curr
END
$$;

-- SCHEMA-COMMIT 4.4: commit 69e8c29b
-- SCHEMA-COMMIT 4.4: commit 20ad200b
-- see: https://github.com/Evolveum/midpoint/blob/20ad200bd10a114fd70d2d131c0d11b5cd920150/config/sql/native-new/postgres-new.sql

-- changes for 4.4.1

Expand Down Expand Up @@ -92,6 +93,7 @@ CREATE INDEX m_message_template_modifyTimestamp_idx ON m_message_template (modif
$aa$);

-- MID-7487 Identity matching
-- We add the new enum value in separate change, because it must be committed before it is used.
call apply_change(4, $aa$
CREATE TYPE CorrelationSituationType AS ENUM ('UNCERTAIN', 'EXISTING_OWNER', 'NO_OWNER', 'ERROR');
$aa$);
Expand All @@ -110,6 +112,23 @@ CREATE INDEX m_shadow_correlationCaseOpenTimestamp_idx ON m_shadow (correlationC
CREATE INDEX m_shadow_correlationCaseCloseTimestamp_idx ON m_shadow (correlationCaseCloseTimestamp);
$aa$);

-- SCHEMA-COMMIT 4.5: commit c5f19c9e

-- changes for 4.6

-- MID-7746
-- We add the new enum value in separate change, because it must be committed before it is used.
call apply_change(6, $aa$
CREATE TYPE AdministrativeAvailabilityStatusType AS ENUM ('MAINTENANCE', 'OPERATIONAL');
$aa$);

call apply_change(7, $aa$
ALTER TABLE m_resource
ADD COLUMN administrativeOperationalStateAdministrativeAvailabilityStatus AdministrativeAvailabilityStatusType;
$aa$);

-- SCHEMA-COMMIT 4.6: commit TODO

-- WRITE CHANGES ABOVE ^^
-- IMPORTANT: update apply_change number at the end of postgres-new.sql
-- to match the number used in the last change here!
8 changes: 7 additions & 1 deletion config/sql/native-new/postgres-new.sql
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ CREATE TYPE AccessCertificationCampaignStateType AS ENUM (

CREATE TYPE ActivationStatusType AS ENUM ('ENABLED', 'DISABLED', 'ARCHIVED');

CREATE TYPE AdministrativeAvailabilityStatusType AS ENUM ('MAINTENANCE', 'OPERATIONAL');

CREATE TYPE AvailabilityStatusType AS ENUM ('DOWN', 'UP', 'BROKEN');

CREATE TYPE CorrelationSituationType AS ENUM ('UNCERTAIN', 'EXISTING_OWNER', 'NO_OWNER', 'ERROR');
Expand Down Expand Up @@ -827,6 +829,9 @@ CREATE TABLE m_resource (
objectType ObjectType GENERATED ALWAYS AS ('RESOURCE') STORED
CHECK (objectType = 'RESOURCE'),
businessAdministrativeState ResourceAdministrativeStateType,
-- administrativeOperationalState/administrativeAvailabilityStatus
administrativeOperationalStateAdministrativeAvailabilityStatus AdministrativeAvailabilityStatusType,
-- operationalState/lastAvailabilityStatus
operationalStateLastAvailabilityStatus AvailabilityStatusType,
connectorRefTargetOid UUID,
connectorRefTargetType ObjectType,
Expand Down Expand Up @@ -1903,4 +1908,5 @@ END $$;
-- endregion

-- Initializing the last change number used in postgres-new-upgrade.sql.
call apply_change(5, $$ SELECT 1 $$, true);
-- This is important to avoid applying any change more than once.
call apply_change(7, $$ SELECT 1 $$, true);
15 changes: 1 addition & 14 deletions dist/javadoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<maven.install.skip>true</maven.install.skip>
<!-- This enables build without -DskipTests option (e.g. full build). -->
<maven.test.skip>true</maven.test.skip>
<!-- Profile for JDK11 sets additional javadocs options for java 11 (which are removed in java 13+). -->
<javadoc.options></javadoc.options>
</properties>

Expand Down Expand Up @@ -75,7 +74,7 @@
<debug>false</debug>

<!--
TODO: Not usable yet, see https://github.com/asciidoctor/asciidoclet/pull/96 for the progress on JDK 11 support.
TODO: Not usable yet, see https://github.com/asciidoctor/asciidoclet/pull/96 for the progress on JDK 11+ support.
Currently fails on:
[ERROR] javadoc: error - invalid flag: -author
Expand Down Expand Up @@ -117,16 +116,4 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>active-on-jdk-11</id>
<activation>
<jdk>11</jdk>
</activation>
<properties>
<javadoc.options>--no-module-directories</javadoc.options>
</properties>
</profile>
</profiles>
</project>
14 changes: 1 addition & 13 deletions dist/midpoint-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

<properties>
<maven.test.skip>true</maven.test.skip>
<!-- Profile for JDK11 sets additional javadocs options for java 11 (which are removed in java 13+). -->
<javadoc.options></javadoc.options>
</properties>

Expand Down Expand Up @@ -93,7 +92,7 @@
<additionalJOption>${javadoc.options}</additionalJOption>

<!--
TODO: Not usable yet, see https://github.com/asciidoctor/asciidoclet/pull/96 for the progress on JDK 11 support.
TODO: Not usable yet, see https://github.com/asciidoctor/asciidoclet/pull/96 for the progress on JDK 11+ support.
Currently fails on:
[ERROR] javadoc: error - invalid flag: -author
Expand Down Expand Up @@ -129,15 +128,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>active-on-jdk-11</id>
<activation>
<jdk>11</jdk>
</activation>
<properties>
<javadoc.options>--no-module-directories</javadoc.options>
</properties>
</profile>
</profiles>
</project>
5 changes: 0 additions & 5 deletions dist/src/main/assembly/dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
<source>../gui/midpoint-jar/target/midpoint.jar</source>
<destName>lib/midpoint.jar</destName>
</file>
<!-- TODO: temporary, will go away during 2022-06 -->
<file>
<source>../gui/midpoint-war/target/midpoint.war</source>
<destName>lib/midpoint.war</destName>
</file>
</files>
<fileSets>
<fileSet>
Expand Down
7 changes: 6 additions & 1 deletion gui/admin-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@
<artifactId>model-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.provisioning</groupId>
<artifactId>provisioning-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.model</groupId>
<artifactId>model-common</artifactId>
Expand Down Expand Up @@ -738,7 +743,7 @@

<!--
We use both main and test classes downstream.
We can't use JAR plugin for main classes, Maven requires different classifier than for
TODO (still true?): We can't use JAR plugin for main classes, Maven requires different classifier than for
the main artifact (which is WAR for admin-gui).
-->
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.evolveum.midpoint.gui.api.factory.wrapper;

import com.evolveum.midpoint.provisioning.api.DiscoveredConfiguration;
import com.evolveum.midpoint.schema.ResourceShadowCoordinates;
import com.evolveum.midpoint.schema.processor.ResourceAssociationDefinition;
import com.evolveum.midpoint.gui.api.prism.ItemStatus;
Expand All @@ -14,12 +15,14 @@
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.DisplayableValue;
import com.evolveum.midpoint.util.annotation.Experimental;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.jetbrains.annotations.NotNull;

import javax.xml.namespace.QName;
import java.util.*;

/**
Expand Down Expand Up @@ -63,6 +66,8 @@ public class WrapperContext {
private GuiObjectDetailsPageType detailsPageTypeConfiguration;
private Collection<VirtualContainersSpecificationType> virtualContainers = new ArrayList<>();

private DiscoveredConfiguration connectorConfigurationSuggestions;

public WrapperContext(Task task, OperationResult result) {
this.task = task;
this.result = result != null ? result : new OperationResult("temporary"); // TODO !!!
Expand Down Expand Up @@ -245,6 +250,14 @@ public void setDetailsPageTypeConfiguration(GuiObjectDetailsPageType detailsPage
this.detailsPageTypeConfiguration = detailsPageTypeConfiguration;
}

public DiscoveredConfiguration getConnectorConfigurationSuggestions() {
return connectorConfigurationSuggestions;
}

public void setConnectorConfigurationSuggestions(DiscoveredConfiguration connectorConfigurationSuggestions) {
this.connectorConfigurationSuggestions = connectorConfigurationSuggestions;
}

public WrapperContext clone() {
WrapperContext ctx = new WrapperContext(task,result);
ctx.setAuthzPhase(authzPhase);
Expand All @@ -261,6 +274,7 @@ public WrapperContext clone() {
ctx.setMetadataItemProcessingSpec(metadataItemProcessingSpec);
ctx.lookupTableCache = lookupTableCache;
ctx.setDetailsPageTypeConfiguration(detailsPageTypeConfiguration);
ctx.setConnectorConfigurationSuggestions(connectorConfigurationSuggestions);
return ctx;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
import com.evolveum.midpoint.gui.impl.prism.wrapper.PrismPropertyValueWrapper;
import com.evolveum.midpoint.prism.PrismProperty;
import com.evolveum.midpoint.prism.PrismPropertyDefinition;
import com.evolveum.midpoint.util.DisplayableValue;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType;

import java.util.Collection;

/**
* @author katka
*
Expand All @@ -19,5 +22,4 @@ public interface PrismPropertyWrapper<T> extends ItemWrapper<PrismProperty<T>, P

String getPredefinedValuesOid();
void setPredefinedValuesOid(String oid);

}
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ public static <T extends Enum> IModel<String> createLocalizedModelForEnum(T valu
}

public static <T extends Enum> IModel<List<T>> createReadonlyModelFromEnum(final Class<T> type) {
return (IModel<List<T>>) () -> {
return () -> {
List<T> list = new ArrayList<>();
Collections.addAll(list, type.getEnumConstants());

Expand Down Expand Up @@ -3150,6 +3150,16 @@ public static void refreshResourceSchema(@NotNull PrismObject<ResourceType> reso
target.add(pageBase.getFeedbackPanel());
}

public static void partialConfigurationTest(@NotNull PrismObject<ResourceType> resource, PageBase pageBase, Task task, OperationResult result) {
try {
pageBase.getModelService().testResourcePartialConfiguration(resource, task, result);
} catch (ObjectNotFoundException | SchemaException | ConfigurationException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Error partial configuration of resource", e);
result.recordFatalError(pageBase.createStringResource("WebComponentUtil.message.partialConfigurationTest.fatalError").getString(), e);
}
result.computeStatus();
}

public static List<QName> getCategoryRelationChoices(AreaCategoryType category, List<RelationDefinitionType> defList) {
List<QName> relationsList = new ArrayList<>();
defList.sort(new Comparator<RelationDefinitionType>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public Collection<? extends DisplayableValue<T>> getAllowedValues() {
return unwrapWrapperModel().getAllowedValues();
}

public Collection<? extends DisplayableValue<T>> getSuggestedValues() {
return unwrapWrapperModel().getSuggestedValues();
}

public boolean hasValueEnumerationRef() {
return unwrapWrapperModel().getValueEnumerationRef() != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.gui.api.component.autocomplete.AutoCompleteTextPanel;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
Expand Down Expand Up @@ -76,6 +79,19 @@ public void setObject(DisplayableValue<T> object) {
return WebComponentUtil.createDropDownChoices(panelCtx.getComponentId(), convertModel, choices, true, panelCtx.getPageBase());
}

Collection<? extends DisplayableValue<T>> suggestedValues = panelCtx.getSuggestedValues();
if (CollectionUtils.isNotEmpty(suggestedValues)) {
Iterator<T> choices = suggestedValues.stream()
.map(disValue -> disValue.getValue())
.collect(Collectors.toCollection(ArrayList::new)).iterator();
return new AutoCompleteTextPanel<>(panelCtx.getComponentId(), panelCtx.getRealValueModel(), panelCtx.getTypeClass(), false) {
@Override
public Iterator<T> getIterator(String input) {
return choices;
}
};
}

return new TextPanel<>(panelCtx.getComponentId(),
panelCtx.getRealValueModel(), panelCtx.getTypeClass(), false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2010-2020 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.factory.wrapper;

import com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext;
import com.evolveum.midpoint.gui.api.prism.ItemStatus;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismPropertyWrapper;
import com.evolveum.midpoint.gui.impl.prism.wrapper.PrismPropertyWrapperImpl;
import com.evolveum.midpoint.prism.*;

import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.DisplayableValue;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorConfigurationType;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.Collection;

/**
* @author lskublik
*/
@Component
public class ConnectorConfigurationPropertyWrapperFactory<T> extends PrismPropertyWrapperFactoryImpl<T> {

@Override
public <C extends Containerable> boolean match(ItemDefinition<?> def, PrismContainerValue<C> parent) {
if (def instanceof PrismPropertyDefinition
&& parent != null
&& parent.getDefinition().getItemName().equivalent(ItemPath.create("configurationProperties"))) {
return true;
}
return false;
}

@PostConstruct
@Override
public void register() {
getRegistry().addToRegistry(this);
}

@Override
public int getOrder() {
return Integer.MAX_VALUE - 1;
}

@Override
protected PrismPropertyWrapper<T> createWrapperInternal(PrismContainerValueWrapper<?> parent, PrismProperty<T> item,
ItemStatus status, WrapperContext wrapperContext) {
if (wrapperContext.getConnectorConfigurationSuggestions() != null) {
wrapperContext.getConnectorConfigurationSuggestions().getDiscoveredProperties().forEach(suggestion -> {
PrismPropertyDefinition<?> suggestionDef = suggestion.getDefinition();
if (suggestionDef.getItemName().equals(item.getDefinition().getItemName())) {
if (suggestionDef.getAllowedValues() != null && !suggestionDef.getAllowedValues().isEmpty()) {
item.getDefinition().toMutable().setAllowedValues((Collection<? extends DisplayableValue<T>>) suggestionDef.getAllowedValues());
}
if (suggestionDef.getSuggestedValues() != null && !suggestionDef.getSuggestedValues().isEmpty()) {
item.getDefinition().toMutable().setSuggestedValues((Collection<? extends DisplayableValue<T>>) suggestionDef.getSuggestedValues());
}
}
});
}
PrismPropertyWrapper<T> propertyWrapper = new PrismPropertyWrapperImpl<>(parent, item, status);
propertyWrapper.setPredefinedValuesOid(getPredefinedValuesOid(item));
return propertyWrapper;
}
}

0 comments on commit eb14496

Please sign in to comment.