Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/detaching
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Mar 17, 2022
2 parents e8d37dc + 8107556 commit cc6220f
Show file tree
Hide file tree
Showing 60 changed files with 1,024 additions and 464 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,20 @@ protected boolean getContainerReadability(ItemWrapper<?, ?> wrapper) {

private ItemVisibility getContainerVisibility(ItemWrapper<?, ?> wrapper) {
if (wrapper instanceof PrismContainerWrapper) {
if (((PrismContainerWrapper) wrapper).isVirtual()) {
PrismContainerWrapper pcw = (PrismContainerWrapper) wrapper;
if (pcw.isVirtual()) {
return ItemVisibility.AUTO;
}

ItemPath path = pcw.getPath();
if (path != null ) {
path = path.namedSegmentsOnly();

if (path.startsWith(ItemPath.create(AssignmentHolderType.F_ASSIGNMENT, AssignmentType.F_EXTENSION))) {
return ItemVisibility.AUTO;
}
}

return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,33 @@ public void register() {
return wrapper.getParent() instanceof ProfilingClassLoggerContainerValueWrapperImpl && wrapper.getItemName().equals(ClassLoggerConfigurationType.F_LEVEL);
}

//FIXME model
@Override
protected InputPanel getPanel(PrismPropertyPanelContext<LoggingLevelType> panelCtx) {
DropDownChoicePanel<ProfilingLevel> dropDownProfilingLevel = new DropDownChoicePanel<>(panelCtx.getComponentId(), new Model<ProfilingLevel>() {
DropDownChoicePanel<ProfilingLevel> dropDownProfilingLevel = new DropDownChoicePanel<>(panelCtx.getComponentId(), new ProfilingLevelModel(panelCtx),
WebComponentUtil.createReadonlyModelFromEnum(ProfilingLevel.class), new EnumChoiceRenderer<>(), true);

private static final long serialVersionUID = 1L;
return dropDownProfilingLevel;
}

@Override
public ProfilingLevel getObject() {
return ProfilingLevel.fromLoggerLevelType(panelCtx.getRealValueModel().getObject());
}
private static class ProfilingLevelModel extends Model<ProfilingLevel> {

@Override
public void setObject(ProfilingLevel object) {
super.setObject(object);
panelCtx.getRealValueModel().setObject(ProfilingLevel.toLoggerLevelType(object));
}
private static final long serialVersionUID = 1L;

}, WebComponentUtil.createReadonlyModelFromEnum(ProfilingLevel.class), new EnumChoiceRenderer<>(), true);
private PrismPropertyPanelContext<LoggingLevelType> panelCtx;

return dropDownProfilingLevel;
public ProfilingLevelModel(PrismPropertyPanelContext<LoggingLevelType> panelCtx) {
this.panelCtx = panelCtx;
}

@Override
public ProfilingLevel getObject() {
return ProfilingLevel.fromLoggerLevelType(panelCtx.getRealValueModel().getObject());
}

@Override
public void setObject(ProfilingLevel object) {
super.setObject(object);
panelCtx.getRealValueModel().setObject(ProfilingLevel.toLoggerLevelType(object));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,13 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="activityEvent">
<xsd:annotation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="ACTIVITY_EVENT"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="customEvent">
<xsd:annotation>
<xsd:appinfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public ScriptExpression createScriptExpression(
//cache cleanup method

String language = getLanguage(expressionType);
ScriptExpression expression = new ScriptExpression(getEvaluator(language, shortDesc), expressionType);
ScriptEvaluator evaluator = getEvaluator(language, shortDesc);
ScriptExpression expression = new ScriptExpression(evaluator, expressionType);
expression.setPrismContext(prismContext);
expression.setOutputDefinition(outputDefinition);
expression.setObjectResolver(objectResolver);
Expand All @@ -137,7 +138,11 @@ public ScriptExpression createScriptExpression(
// the duality of Expression and ScriptExpression ... maybe the ScriptExpression is unnecessary abstraction
// and it should be removed.
expression.setExpressionProfile(expressionProfile);
expression.setScriptExpressionProfile(processScriptExpressionProfile(expressionProfile, language, shortDesc));
expression.setScriptExpressionProfile(
processScriptExpressionProfile(
expressionProfile,
evaluator.getLanguageUrl(), // We need "normalized" language URI here
shortDesc));

return expression;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.util.MiscSchemaUtil;
import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.midpoint.util.exception.ConfigurationException;

import org.apache.commons.collections4.CollectionUtils;
Expand Down Expand Up @@ -105,9 +106,58 @@ private <DP extends GuiObjectDetailsPageType> DP mergeDetailsPages(DP defaultPag
SummaryPanelSpecificationType mergedSummaryPanel = mergeSummaryPanels(mergedDetailsPage.getSummaryPanel(), compiledPageType.getSummaryPanel());
mergedDetailsPage.setSummaryPanel(mergedSummaryPanel);

if (compiledPageType.getSaveMethod() != null) {
mergedDetailsPage.saveMethod(compiledPageType.getSaveMethod());
}

if (mergedDetailsPage.getForms() == null) {
mergedDetailsPage.forms(compiledPageType.getForms());
} else if (compiledPageType.getForms() != null) {
mergeFormObject(mergedDetailsPage.getForms(), compiledPageType.getForms());
}

if (mergedDetailsPage.getRoleRelation() == null) {
mergedDetailsPage.roleRelation(mergedDetailsPage.getRoleRelation());
} else if (mergedDetailsPage.getRoleRelation() != null) {
mergeRoleRelation(mergedDetailsPage.getRoleRelation(), mergedDetailsPage.getRoleRelation());
}

return mergedDetailsPage;
}

private static void mergeRoleRelation(RoleRelationObjectSpecificationType currentRoleRelation, RoleRelationObjectSpecificationType newRoleRelation) {
if (newRoleRelation.getObjectRelation() != null) {
currentRoleRelation.objectRelation(newRoleRelation.getObjectRelation());
}

if (!newRoleRelation.getSubjectRelation().isEmpty()) {
newRoleRelation.getSubjectRelation().forEach(
newSubject -> currentRoleRelation.getSubjectRelation().removeIf(
currentSubject -> QNameUtil.match(currentSubject, newSubject)
)
);
currentRoleRelation.getSubjectRelation().addAll(newRoleRelation.getSubjectRelation());
}

if (newRoleRelation.isIncludeMembers() != null) {
currentRoleRelation.includeMembers(newRoleRelation.isIncludeMembers());
}

if (newRoleRelation.isIncludeReferenceRole() != null) {
currentRoleRelation.includeReferenceRole(newRoleRelation.isIncludeReferenceRole());
}
}

private static void mergeFormObject(ObjectFormType currentForm, ObjectFormType newForm) {
if (newForm.getFormSpecification() != null) {
currentForm.formSpecification(newForm.getFormSpecification());
}

if (newForm.isIncludeDefaultForms() != null) {
currentForm.includeDefaultForms(newForm.isIncludeDefaultForms());
}
}

private SummaryPanelSpecificationType mergeSummaryPanels(SummaryPanelSpecificationType defaultSummary, SummaryPanelSpecificationType compiledSummary) {
if (compiledSummary == null) {
return defaultSummary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.model.api.AdminGuiConfigurationMergeManager;
import com.evolveum.midpoint.model.api.authentication.*;
import com.evolveum.midpoint.schema.*;

Expand Down Expand Up @@ -75,6 +77,8 @@ public class GuiProfileCompiler {

@Autowired private GuiProfileCompilerRegistry guiProfileCompilerRegistry;

@Autowired private AdminGuiConfigurationMergeManager adminGuiConfigurationMergeManager;

public void compileFocusProfile(GuiProfiledPrincipal principal, PrismObject<SystemConfigurationType> systemConfiguration, AuthorizationTransformer authorizationTransformer, Task task, OperationResult result)
throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException,
ExpressionEvaluationException, ObjectNotFoundException {
Expand Down Expand Up @@ -434,8 +438,18 @@ private void joinShadowDetails(GuiObjectDetailsSetType objectDetailsSet, GuiShad
}

private void joinObjectDetails(GuiObjectDetailsSetType objectDetailsSet, GuiObjectDetailsPageType newObjectDetails) {
objectDetailsSet.getObjectDetailsPage().removeIf(currentDetails -> isTheSameObjectType(currentDetails, newObjectDetails));
objectDetailsSet.getObjectDetailsPage().add(newObjectDetails.clone());
AtomicBoolean merged = new AtomicBoolean(false);
objectDetailsSet.getObjectDetailsPage().forEach(currentDetails -> {
if(isTheSameObjectType(currentDetails, newObjectDetails)){
objectDetailsSet.getObjectDetailsPage().remove(currentDetails);
objectDetailsSet.getObjectDetailsPage().add(
adminGuiConfigurationMergeManager.mergeObjectDetailsPageConfiguration(currentDetails, newObjectDetails));
merged.set(true);
}
});
if (!merged.get()) {
objectDetailsSet.getObjectDetailsPage().add(newObjectDetails.clone());
}
}

private boolean isTheSameObjectType(AbstractObjectTypeConfigurationType oldConf, AbstractObjectTypeConfigurationType newConf) {
Expand Down

0 comments on commit cc6220f

Please sign in to comment.