Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/support-4.4' into s…
Browse files Browse the repository at this point in the history
…upport-4.4
  • Loading branch information
skublik committed Mar 7, 2022
2 parents df7135a + 5f7f6c7 commit 74d9d46
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 138 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
import java.util.*;

@PanelType(name = "members")
@PanelInstances(instances = {
@PanelInstances(value = {
@PanelInstance(identifier = "roleMembers",
applicableForType = RoleType.class,
applicableForOperation = OperationTypeType.MODIFY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.List;

@PanelType(name = "archetypeMembers")
@PanelInstances(instances = {
@PanelInstances(value = {
@PanelInstance(identifier = "archetypeMembers",
applicableForType = ArchetypeType.class,
applicableForOperation = OperationTypeType.MODIFY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

@PanelType(name = "basic", defaultContainerPath = "empty")
@PanelInstances(instances = {
@PanelInstances(value = {
@PanelInstance(identifier = "basic",
applicableForType = AssignmentHolderType.class,
excludeTypes = { TaskType.class, ResourceType.class },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,38 @@
package com.evolveum.midpoint.gui.impl.page.admin.focus.component;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;

import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper;
import com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.FocusDetailsModels;
import com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.path.ItemName;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.application.PanelInstance;
import com.evolveum.midpoint.web.application.PanelType;
import com.evolveum.midpoint.web.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;

@PanelType(name = "activation")
@PanelInstance(identifier = "activation",
@PanelInstance(
identifier = "activation",
applicableForType = FocusType.class,
display = @PanelDisplay(label = "ActivationType.title", icon = GuiStyleConstants.CLASS_LIFECYCLE_ICON, order = 40))
display = @PanelDisplay(
label = "ActivationType.title",
icon = GuiStyleConstants.CLASS_LIFECYCLE_ICON,
order = 40
),
containerPath = "activation",
type = "ActivationType",
expanded = true
)
public class FocusActivationPanel<F extends FocusType, FDM extends FocusDetailsModels<F>> extends AbstractObjectMainPanel<F, FDM> {

private static final long serialVersionUID = 1L;

private static final Trace LOGGER = TraceManager.getTrace(FocusActivationPanel.class);

private static final String ID_PANEL = "panel";

private static final String DOT_CLASS = FocusActivationPanel.class.getName() + ".";
Expand All @@ -43,10 +49,11 @@ public FocusActivationPanel(String id, FDM model, ContainerPanelConfigurationTyp

@Override
protected void initLayout() {
// path is defined via PanelInstance -> an therefore via panelConfiguration (virtual container)
SingleContainerPanel panel =
new SingleContainerPanel<>(ID_PANEL,
PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), FocusType.F_ACTIVATION),
PasswordType.COMPLEX_TYPE);
PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.EMPTY_PATH),
getPanelConfiguration());
add(panel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,38 @@
package com.evolveum.midpoint.gui.impl.page.admin.focus.component;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper;
import com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.FocusDetailsModels;
import com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.path.ItemName;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.application.PanelInstance;
import com.evolveum.midpoint.web.application.PanelType;
import com.evolveum.midpoint.web.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.model.IModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;

@PanelType(name = "password")
@PanelInstance(identifier = "password",
@PanelInstance(
identifier = "password",
applicableForType = FocusType.class,
display = @PanelDisplay(label = "prismPropertyPanel.name.credentials.password", icon = GuiStyleConstants.CLASS_PASSWORD_ICON, order = 50))
display = @PanelDisplay(
label = "prismPropertyPanel.name.credentials.password",
icon = GuiStyleConstants.CLASS_PASSWORD_ICON,
order = 50
),
containerPath = "credentials/password",
type = "PasswordType",
expanded = true
)
public class FocusPasswordPanel<F extends FocusType, FDM extends FocusDetailsModels<F>> extends AbstractObjectMainPanel<F, FDM> {

private static final long serialVersionUID = 1L;

private static final Trace LOGGER = TraceManager.getTrace(FocusPasswordPanel.class);

private static final String ID_PANEL = "panel";

private static final String DOT_CLASS = FocusPasswordPanel.class.getName() + ".";
Expand All @@ -42,10 +49,11 @@ public FocusPasswordPanel(String id, FDM model, ContainerPanelConfigurationType

@Override
protected void initLayout() {
// path is defined via PanelInstance -> an therefore via panelConfiguration (virtual container)
SingleContainerPanel panel =
new SingleContainerPanel<>(ID_PANEL,
PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.create(FocusType.F_CREDENTIALS, CredentialsType.F_PASSWORD)),
PasswordType.COMPLEX_TYPE);
PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.EMPTY_PATH),
getPanelConfiguration());
add(panel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.jetbrains.annotations.NotNull;

@PanelType(name = "orgMembers")
@PanelInstances(instances = {
@PanelInstances(value = {
@PanelInstance(identifier = "orgMembers", applicableForType = OrgType.class,
applicableForOperation = OperationTypeType.MODIFY,
display = @PanelDisplay(label = "pageRole.members", icon = GuiStyleConstants.CLASS_GROUP_ICON, order = 60)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
import com.evolveum.midpoint.web.page.admin.users.dto.UserDtoStatus;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractFormItemType;

import org.apache.commons.lang3.reflect.FieldUtils;
import org.jetbrains.annotations.NotNull;

import javax.xml.namespace.QName;
import java.lang.reflect.Field;

/**
* Class for misc GUI util methods (impl).
*
Expand Down Expand Up @@ -82,4 +88,11 @@ public static <C extends Containerable> String getObjectStatus(Object object) {
return null;
}

public static <C extends Containerable> QName getContainerableTypeName(@NotNull Class<C> containerable) throws IllegalAccessException, NoSuchFieldException {
Field field = FieldUtils.getField(containerable, "COMPLEX_TYPE");
if (field == null) {
throw new NoSuchFieldException("Field COMPLEX_TYPE not found in " + containerable.getName());
}
return (QName) field.get(containerable);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@
*/
package com.evolveum.midpoint.web.application;

import com.evolveum.midpoint.gui.api.prism.ItemStatus;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationTypeType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;

import org.apache.wicket.markup.html.panel.Panel;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collection;
import java.util.List;

@Retention(RetentionPolicy.RUNTIME)
public @interface PanelInstance {
Expand All @@ -29,13 +25,13 @@
/**
* The type for which the panel is applicable for.
*/
Class<? extends ObjectType> applicableForType() default ObjectType.class;
Class<? extends Containerable> applicableForType() default Containerable.class;

/**
* Defined the type of the operation when the panel is visible. Default behavior is
* that the panel is visible for both - ADD new object and MODIFY object.
*/
OperationTypeType[] applicableForOperation() default {OperationTypeType.ADD, OperationTypeType.MODIFY};
OperationTypeType[] applicableForOperation() default { OperationTypeType.ADD, OperationTypeType.MODIFY };

/**
* Defined where in the hierarchy of the details menu will be displayed link to the panel.
Expand All @@ -51,10 +47,18 @@
boolean defaultPanel() default false;

//probably should be removed
Class<? extends ObjectType>[] excludeTypes() default { };
Class<? extends Containerable>[] excludeTypes() default {};

/**
* Defined display parameters for the panels, such as an icon, label, display oreder...
*/
PanelDisplay display();

String containerPath() default "";

String[] hiddenContainers() default {};

String type() default "";

boolean expanded() default false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface PanelInstances {

PanelInstance[] instances() default {};
PanelInstance[] value() default {};
}

0 comments on commit 74d9d46

Please sign in to comment.