Skip to content

Commit

Permalink
Resource -> schema handling menu item (MID-7479)
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Jan 12, 2022
1 parent 96c7ddc commit b5e2553
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class ObjectDetailsModels<O extends ObjectType> implements Serializable {
private LoadableDetachableModel<PrismObject<O>> prismObjectModel;

private LoadableModel<PrismObjectWrapper<O>> objectWrapperModel;
private LoadableDetachableModel<GuiObjectDetailsPageType> detailsPageConfigurationModel;
private LoadableModel<GuiObjectDetailsPageType> detailsPageConfigurationModel;

private LoadableDetachableModel<O> summaryModel;

Expand Down Expand Up @@ -81,7 +81,7 @@ protected PrismObjectWrapper<O> load() {
}
};

detailsPageConfigurationModel = new LoadableDetachableModel<>() {
detailsPageConfigurationModel = new LoadableModel<>(false) {
@Override
protected GuiObjectDetailsPageType load() {
return loadDetailsPageConfiguration(null).clone();
Expand Down Expand Up @@ -313,7 +313,7 @@ protected PrismObject<O> getPrismObject() {
return getObjectWrapper().getObject();
}

public LoadableDetachableModel<GuiObjectDetailsPageType> getObjectDetailsPageConfiguration() {
public LoadableModel<GuiObjectDetailsPageType> getObjectDetailsPageConfiguration() {
return detailsPageConfigurationModel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@

import java.util.List;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationTypeType;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

import com.evolveum.midpoint.gui.api.prism.ItemStatus;
import com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel;
import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels;
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.statistics.ConnectorOperationalStatus;
import com.evolveum.midpoint.task.api.Task;
Expand All @@ -31,6 +26,7 @@
import com.evolveum.midpoint.web.application.PanelInstance;
import com.evolveum.midpoint.web.application.PanelType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationTypeType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;

/**
Expand Down Expand Up @@ -86,22 +82,22 @@ public List<ConnectorOperationalStatus> getObject() {
}
};

ListView<ConnectorOperationalStatus> listview = new ListView<ConnectorOperationalStatus>(ID_CONNECTOR_LIST, statsModel) {
ListView<ConnectorOperationalStatus> listview = new ListView<>(ID_CONNECTOR_LIST, statsModel) {
private static final long serialVersionUID = 1L;

protected void populateItem(ListItem<ConnectorOperationalStatus> item) {
item.add(new Label("label", item.getModel()));
// item.add(new Label("label", item.getModel()));
IModel<ConnectorOperationalStatus> statModel = item.getModel();
item.add(createLabel(statModel, ID_CONNECTOR_NAME, ConnectorOperationalStatus.F_CONNECTOR_NAME));
item.add(createLabel(statModel, ID_CONNECOTR_CLASS, ConnectorOperationalStatus.F_CONNECTOR_CLASS_NAME));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_SIZE, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_SIZE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MAX_SIZE, ConnectorOperationalStatus.F_POOL_CONFIG_MAX_SIZE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_IDLE, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_IDLE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MAX_IDLE, ConnectorOperationalStatus.F_POOL_CONFIG_MAX_IDLE));
item.add(createLabel(statModel, ID_POOL_CONFIG_WAIT_TIMEOUT, ConnectorOperationalStatus.F_POOL_CONFIG_WAIT_TIMEOUT));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME));
item.add(createLabel(statModel, ID_POOL_STATUS_NUM_IDLE, ConnectorOperationalStatus.F_POOL_STATUS_NUM_IDLE));
item.add(createLabel(statModel, ID_POOL_STATUS_NUM_ACTIVE, ConnectorOperationalStatus.F_POOL_STATUS_NUM_ACTIVE));
item.add(createLabel(statModel, ID_CONNECTOR_NAME, ConnectorOperationalStatus.F_CONNECTOR_NAME));
item.add(createLabel(statModel, ID_CONNECOTR_CLASS, ConnectorOperationalStatus.F_CONNECTOR_CLASS_NAME));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_SIZE, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_SIZE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MAX_SIZE, ConnectorOperationalStatus.F_POOL_CONFIG_MAX_SIZE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_IDLE, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_IDLE));
item.add(createLabel(statModel, ID_POOL_CONFIG_MAX_IDLE, ConnectorOperationalStatus.F_POOL_CONFIG_MAX_IDLE));
item.add(createLabel(statModel, ID_POOL_CONFIG_WAIT_TIMEOUT, ConnectorOperationalStatus.F_POOL_CONFIG_WAIT_TIMEOUT));
item.add(createLabel(statModel, ID_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME, ConnectorOperationalStatus.F_POOL_CONFIG_MIN_EVICTABLE_IDLE_TIME));
item.add(createLabel(statModel, ID_POOL_STATUS_NUM_IDLE, ConnectorOperationalStatus.F_POOL_STATUS_NUM_IDLE));
item.add(createLabel(statModel, ID_POOL_STATUS_NUM_ACTIVE, ConnectorOperationalStatus.F_POOL_STATUS_NUM_ACTIVE));

}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@

import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

import com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
Expand Down Expand Up @@ -145,7 +147,7 @@ public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerVal

detailsPanel.setIdentifier("schemaHandlingDetails");
DisplayType displayType = new DisplayType();
displayType.setLabel(new PolyStringType(objectTypeDef.getNewValue().asContainerable().getDisplayName()));
displayType.setLabel(getObjectTypeDisplayName(objectTypeDef.getNewValue().asContainerable()));
detailsPanel.setDisplay(displayType);

getPageBase().getSessionStorage().setObjectDetailsStorage("details" + parent.getType().getSimpleName(), detailsPanel);
Expand All @@ -159,6 +161,18 @@ public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerVal
form.add(objectTypesPanel);
}

private PolyStringType getObjectTypeDisplayName(ResourceObjectTypeDefinitionType resourceObjectTypeDefinitionType) {
String displayName = resourceObjectTypeDefinitionType.getDisplayName();
if (StringUtils.isNotBlank(displayName)) {
return new PolyStringType(displayName);
}
PolyStringType polyStringType = new PolyStringType();
PolyStringTranslationType translationType = new PolyStringTranslationType();
translationType.setKey("feedbackMessagePanel.message.undefined");
polyStringType.setTranslation(translationType);
return polyStringType;
}

private MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType> getMultivalueContainerListPanel(){
return ((MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType>) get(getPageBase().createComponentPath(ID_FORM, ID_TABLE)));
}
Expand Down

0 comments on commit b5e2553

Please sign in to comment.