-
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.
adding new resource wizard step for discovered connector configuration
- Loading branch information
Showing
46 changed files
with
567 additions
and
256 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
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
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
71 changes: 71 additions & 0 deletions
71
...lveum/midpoint/gui/impl/factory/wrapper/ConnectorConfigurationPropertyWrapperFactory.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,71 @@ | ||
/* | ||
* 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.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; | ||
} | ||
} |
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
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
File renamed without changes.
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
Oops, something went wrong.