Skip to content

Commit

Permalink
Merge branch 'master' into feature/schema-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jan 21, 2019
2 parents 6083b7c + e24b964 commit 7929215
Show file tree
Hide file tree
Showing 113 changed files with 3,021 additions and 620 deletions.
Expand Up @@ -23,6 +23,8 @@ public class GuiStyleConstants {

public static final String CLASS_BOX = "box";
public static final String CLASS_BOX_DEFAULT = "box-default";

public static final String CLASS_DASHBOARD_ICON = "fa fa-dashboard";

public static final String CLASS_OBJECT_USER_ICON = "fa fa-user";
public static final String CLASS_OBJECT_USER_ICON_COLORED = CLASS_OBJECT_USER_ICON + " object-user-color";
Expand Down Expand Up @@ -176,7 +178,10 @@ public class GuiStyleConstants {
public static final String CLASS_CREATE_FOCUS = "fa fa-user-plus";

public static final String EVO_CROW_ICON = "fe fe-crown-object";
public static final String EVO_RIGHT_TOP_ARROW_ICON = "fe fe-arrow";
public static final String EVO_ASSIGNMENT_ICON = "fe fe-assignment";
public static final String EVO_ASSIGNMENT_ICON_A_PIECE = "fe fe-assign_horizontal_A_piece";
public static final String EVO_ASSIGNMENT_ICON_B_PIECE = "fe fe-assign_horizontal_B_piece";
public static final String EVO_OFFICER_CAP_ICON = "fe fe-officer-cap-object";
public static final String EVO_ASSIGNMENT_STRAIGHT_THICKER_ICON = "fe fe-assignment-straight-thicker-object";
public static final String EVO_ASSIGNMENT_STRAIGHT_ICON = "fe fe-assignment-straight-object";
Expand All @@ -191,4 +196,8 @@ public class GuiStyleConstants {
public static final String EVO_ROLE_TOP_HAT_ICON = "fe fe-role-top-hat";
public static final String EVO_ASSIGNMENT_THICKER_ICON = "fe assignment-thicker";

public static final String GREEN_COLOR = "color-green";
public static final String YELLOW_COLOR = "color-yellow";
public static final String RED_COLOR = "color-red";

}
Expand Up @@ -15,10 +15,12 @@
*/
package com.evolveum.midpoint.gui.api.component;

import java.io.Serializable;
import java.util.*;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.xml.ns._public.common.common_4.ShadowType;
import com.evolveum.midpoint.web.component.MultifunctionalButton;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -36,11 +38,9 @@
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.model.api.ModelAuthorizationAction;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.AjaxIconButton;
Expand All @@ -55,13 +55,9 @@
/**
* @author katkav
*/
public abstract class MainObjectListPanel<O extends ObjectType> extends ObjectListPanel<O> {
public abstract class MainObjectListPanel<O extends ObjectType, S extends Serializable> extends ObjectListPanel<O> {
private static final long serialVersionUID = 1L;

private static final String ID_REFRESH = "refresh";
private static final String ID_NEW_OBJECT = "newObject";
private static final String ID_IMPORT_OBJECT = "importObject";
private static final String ID_EXPORT_DATA = "exportData";
private static final String ID_BUTTON_BAR = "buttonBar";
private static final String ID_BUTTON_REPEATER = "buttonsRepeater";
private static final String ID_BUTTON = "button";
Expand Down Expand Up @@ -118,7 +114,7 @@ protected boolean isClickable(IModel<SelectableBean<O>> rowModel) {

protected abstract void objectDetailsPerformed(AjaxRequestTarget target, O object);

protected abstract void newObjectPerformed(AjaxRequestTarget target);
protected void newObjectPerformed(AjaxRequestTarget target, S collectionView){}

@Override
protected WebMarkupContainer createTableButtonToolbar(String id) {
Expand All @@ -127,18 +123,50 @@ protected WebMarkupContainer createTableButtonToolbar(String id) {

protected List<Component> createToolbarButtonsList(String buttonId){
List<Component> buttonsList = new ArrayList<>();
AjaxIconButton newObjectIcon = new AjaxIconButton(buttonId, new Model<>(GuiStyleConstants.CLASS_ADD_NEW_OBJECT),
createStringResource("MainObjectListPanel.newObject")) {

// AjaxIconButton newObjectIcon = new AjaxIconButton(buttonId, new Model<>(GuiStyleConstants.CLASS_ADD_NEW_OBJECT),
// createStringResource("MainObjectListPanel.newObject")) {
//
// private static final long serialVersionUID = 1L;
//
// @Override
// public void onClick(AjaxRequestTarget target) {
// newObjectPerformed(target);
// }
// };
// newObjectIcon.add(AttributeAppender.append("class", "btn btn-success btn-sm"));
// buttonsList.add(newObjectIcon);

MultifunctionalButton<S> createNewObjectButton =
new MultifunctionalButton<S>(buttonId){
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
newObjectPerformed(target);
protected List<S> getAdditionalButtonsObjects(){
return getNewObjectInfluencesList();
}

@Override
protected void buttonClickPerformed(AjaxRequestTarget target, S influencingObject){
newObjectPerformed(target, influencingObject);
}

@Override
protected String getDefaultButtonStyle(){
return getNewObjectButtonStyle();
}

@Override
protected String getAdditionalButtonTitle(S buttonObject){
return getNewObjectSpecificTitle(buttonObject);
}

@Override
protected String getAdditionalButtonStyle(S buttonObject){
return getNewObjectSpecificStyle(buttonObject);
}
};
newObjectIcon.add(AttributeAppender.append("class", "btn btn-success btn-sm"));
buttonsList.add(newObjectIcon);
buttonsList.add(createNewObjectButton);


AjaxIconButton refreshIcon = new AjaxIconButton(buttonId, new Model<>(GuiStyleConstants.CLASS_RECONCILE),
createStringResource("MainObjectListPanel.refresh")) {
Expand Down Expand Up @@ -231,11 +259,27 @@ private boolean isRawOrNoFetchOption(Collection<SelectorOptions<GetOperationOpti
return false;
}

protected List<S> getNewObjectInfluencesList(){
return new ArrayList<>();
}

protected String getNewObjectButtonStyle(){
return GuiStyleConstants.CLASS_ADD_NEW_OBJECT;
}

protected String getNewObjectSpecificStyle(S buttonObject){
return "";
}

protected String getNewObjectSpecificTitle(S buttonObject){
return "";
}

private static class ButtonBar extends Fragment {

private static final long serialVersionUID = 1L;

public <O extends ObjectType> ButtonBar(String id, String markupId, MainObjectListPanel<O> markupProvider, List<Component> buttonsList) {
public <O extends ObjectType, S extends Serializable> ButtonBar(String id, String markupId, MainObjectListPanel<O, S> markupProvider, List<Component> buttonsList) {
super(id, markupId, markupProvider);

initLayout(buttonsList);
Expand Down
Expand Up @@ -103,6 +103,8 @@
import com.evolveum.midpoint.web.page.admin.certification.PageCertDefinitions;
import com.evolveum.midpoint.web.page.admin.configuration.*;
import com.evolveum.midpoint.web.page.admin.home.PageDashboard;
import com.evolveum.midpoint.web.page.admin.home.PageDashboardAdmin;
import com.evolveum.midpoint.web.page.admin.home.PageDashboardInfo;
import com.evolveum.midpoint.web.page.admin.reports.*;
import com.evolveum.midpoint.web.page.admin.resources.*;
import com.evolveum.midpoint.web.page.admin.roles.PageRole;
Expand Down Expand Up @@ -1935,11 +1937,14 @@ private void createAdditionalMenu(SideBarMenuItem menu) {
}

private MainMenuItem createHomeItems() {
MainMenuItem item = new MainMenuItem("fa fa-dashboard",
createStringResource("PageAdmin.menu.dashboard"), PageDashboard.class);
MainMenuItem item = new MainMenuItem(GuiStyleConstants.CLASS_DASHBOARD_ICON,
createStringResource("PageAdmin.menu.dashboard"), null);

return item;
}
addMenuItem(item, "PageAdmin.menu.dashboard.info", PageDashboardInfo.class);
addMenuItem(item, "PageAdmin.menu.dashboard.admin", PageDashboardAdmin.class);

return item;
}

private MainMenuItem createUsersItems() {
MainMenuItem item = new MainMenuItem(GuiStyleConstants.CLASS_OBJECT_USER_ICON_COLORED,
Expand Down Expand Up @@ -2495,4 +2500,4 @@ public AsyncWebProcessManager getAsyncWebProcessManager() {
public Locale getLocale() {
return getSession().getLocale();
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2018 Evolveum
* Copyright (c) 2010-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,7 +49,7 @@
import com.evolveum.midpoint.common.refinery.RefinedResourceSchema;
import com.evolveum.midpoint.gui.api.SubscriptionType;
import com.evolveum.midpoint.gui.api.model.ReadOnlyValueModel;
import com.evolveum.midpoint.model.api.ArchetypeInteractionSpecification;
import com.evolveum.midpoint.model.api.AssignmentTargetSpecification;
import com.evolveum.midpoint.model.api.ModelExecuteOptions;
import com.evolveum.midpoint.model.api.ModelInteractionService;
import com.evolveum.midpoint.model.api.RoleSelectionSpecification;
Expand All @@ -72,6 +72,7 @@
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.prism.*;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor;
import com.evolveum.midpoint.xml.ns._public.common.common_4.*;
import com.evolveum.prism.xml.ns._public.query_4.QueryType;
Expand Down Expand Up @@ -1925,6 +1926,18 @@ public static String createShadowIcon(PrismObject<ShadowType> object) {
return GuiStyleConstants.CLASS_SHADOW_ICON_UNKNOWN;
}

public static <AHT extends AssignmentHolderType> AHT createNewObjectWithCollectionRef(Class<AHT> type, PrismContext context,
ObjectReferenceType collectionRef){
if (UserType.class.equals(type) && collectionRef != null && ArchetypeType.COMPLEX_TYPE.equals(collectionRef.getType())){
UserType user = new UserType(context);
AssignmentType assignment = new AssignmentType();
assignment.setTargetRef(collectionRef.clone());
user.getAssignment().add(assignment);
return (AHT) user;
}
return null;
}

public static String createUserIconTitle(PrismObject<UserType> object) {
UserType user = object.asObjectable();

Expand Down Expand Up @@ -2547,7 +2560,7 @@ public static boolean getElementVisibility(UserInterfaceElementVisibilityType vi
}

public static <AR extends AbstractRoleType> IModel<String> createAbstractRoleConfirmationMessage(String actionName,
ColumnMenuAction action, MainObjectListPanel<AR> abstractRoleTable, PageBase pageBase) {
ColumnMenuAction action, MainObjectListPanel<AR, CompiledObjectCollectionView> abstractRoleTable, PageBase pageBase) {
List<AR> selectedRoles = new ArrayList<>();
if (action.getRowModel() == null) {
selectedRoles.addAll(abstractRoleTable.getSelectedObjects());
Expand Down Expand Up @@ -3043,15 +3056,18 @@ public static PrismObject<ResourceType> getConstructionResource(ConstructionType
return WebModelServiceUtils.resolveReferenceNoFetch(resourceRef, pageBase, task, result);
}

public static <O extends ObjectType> ArchetypeInteractionSpecification getArchetypeSpecification(PrismObject<O> object, ModelServiceLocator locator){
public static <O extends ObjectType> ArchetypePolicyType getArchetypeSpecification(PrismObject<O> object, ModelServiceLocator locator){
if (object == null || object.asObjectable() == null){
return null;
}
String objectName = object.asObjectable().getName() != null ? object.asObjectable().getName().getOrig() : "Unknown";
OperationResult result = new OperationResult("loadArchetypeSpecificationFor" + objectName);
ArchetypeInteractionSpecification spec = null;
if (!object.canRepresent(AssignmentHolderType.class)) {
return null;
}
ArchetypePolicyType spec = null;
try {
spec = locator.getModelInteractionService().getInteractionSpecification(object, result);
spec = locator.getModelInteractionService().determineArchetypePolicy((PrismObject<? extends AssignmentHolderType>) object, result);
} catch (SchemaException | ConfigurationException ex){
result.recordPartialError(ex.getLocalizedMessage());
LOGGER.error("Cannot load ArchetypeInteractionSpecification for object ", object, ex.getLocalizedMessage());
Expand Down
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2010-2018 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.gui.impl.component.icon;

/**
* @author skublik
*/
public class CenterIconCssStyle implements LayeredIconCssStyle {

@Override
public String getBasicCssClass() {
return "icon-basic-transparent";
}

@Override
public String getBasicLayerCssClass() {
return "icon-basic-layer";
}

@Override
public String getLayerCssClass() {
return "center-layer";
}

@Override
public String getStrokeLayerCssClass() {
return "center-icon-stroke-layer";
}

}
Expand Up @@ -16,6 +16,7 @@

package com.evolveum.midpoint.gui.impl.component.icon;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Expand All @@ -26,7 +27,9 @@
/**
* @author skublik
*/
public class CompositedIcon {
public class CompositedIcon implements Serializable {

private static final long serialVersionUID = 1L;

private String basicIcon;
private List<String> layerIcons;
Expand Down

0 comments on commit 7929215

Please sign in to comment.