Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jul 24, 2018
2 parents aa80717 + 9703a97 commit 70a9b90
Show file tree
Hide file tree
Showing 167 changed files with 6,357 additions and 3,260 deletions.
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,42 @@
MidPoint is open to contributions. Any contribution is appreciated whether it is documentation update, localization, bugfix or a new feature. Anyone can start experimenting with midPoint code without the need to ask for any privileges or access to our source code repository. Git distributed development model allows this to be done easily. This pages describes how to do it. It describes how to create and contribute a simple bugfix and also how to cooperate with the midPoint team in a longer run.

Communication
=============

Communication with core midPoint development team is crucial for any successful participation in midPoint development. There are several methods to communicate with the core team:
* [Mailing lists](https://wiki.evolveum.com/display/midPoint/Mailing+Lists) are general-purpose communication mechanisms for midPoint community. All mailing lists are public. Almost any conversation is allowed on mailing lists as long as it is kept reasonable and polite. This includes conversation regarding development topics. However, the nature of a mailing list can make the conversation somehow slow and inflexible.
* [Bug-tracking System](https://wiki.evolveum.com/display/midPoint/Bug-tracking+System) is open to anyone to search, open a bug report or participate on existing bug reports.
* [Development chat room](https://wiki.evolveum.com/display/midPoint/Development+Chat) on gitter can be used as a faster communication channel. The room is public. However, the room is limited to development conversations. It is OK to discuss your contribution, planned contribution, development idea, localization, documentation updates and similar topics on this chat. However, the chat room is not supposed to be a replacement for subscription and support.
* There are other private communication channels available for midPoint subscribers - and platform subscribers in particular. Please contact Evolveum for the details.

Git
===

Evolveum maintains midPoint repository on GitHub:

[https://github.com/Evolveum/midpoint](https://github.com/Evolveum/midpoint)

This is the primary midPoint repository. GitHub users may use this repository to submit a contribution. This is the easiest way how individual developers can contribute to midPoint. Simply fork midPoint project on github, make the changes and when finished create a pull request. Please see github documentation for the details.

Tips and Best Practice
======================
* Do not submit each individual commit unless the commit itself is a complete contribution. If your contribution is divided into several commits (which is perfectly fine) then send all the commits together so the maintainer can apply and test them together.
* If you have many commits but you want only to show them as one in the final midPoint history you might want to squash these commits to one. You can use git interactive rebasing to do this. (git rebase -i, the Git book provides more details)
* Provide a meaningful commit message. If the commit message is longer than a single line provide a short summary of the message in the first line and then provide more details in subsequent lines. Most git tools display just the first line of the commit message therefore the developers should be able to get an idea about the commit just from the first line.
* If there is an "issue" created in our bug-tracking system it is recommended to include issue identifier in the commit message.
* You may want to create a topic branch for larger contributions.
* There is no code ownership principle. Not in the midPoint development team and we do not provide that to the contributions as well. All code "belongs" to every developer and anyone has the "right" to modify any code. The only thing that we care about is the quality of the modification, not its origin. Therefore feel free to modify any code and fix bugs anywhere in the midPoint core or in any of the contributions. Just please make sure you know what you are doing. If you are not you are free to discuss that on midpoint-dev mailing list. If you contribute a code be prepared that others may modify it. If you do not want others to "ruin" you code then do not contribute it.
* MidPoint core team is trying to be quite careful about the state of the master branch in main midPoint repository. We try very hard not to break the build and we are also careful about passing tests and overall code quality. But this is software development and we are only human beings. Therefore it may happen that we break something occasionally. Therefore it is good idea to check the state of the source code before pulling from the main midPoint repository. The easiest way to do this is by looking at our continuous integration system. If it is mostly green then it is probably OK to pull changes. If it is too red it is better to postpone the pull for a while.
* Also write tests (e.g. integration tests) not just the main code. If you are fixing a bug try to write a test for the bug first and fix the bug second. For larger pieces of functionality try to create a fair amount of test code. Submit the tests as part of your contribution. You write the tests for your own good. As there is no code ownership anyone might (unintentionally) break your code. If you have good tests for the code the problem will be detected soon after the modification while it is still easy to fix. If you have no tests then you code will break without anyone noticing it for quite a long time. This will cause that your contribution might "corrode" over time and it may even be removed from the main code if its quality drops too low.
* For more details about contributing using git please see the "Distributed Git - Contributing to a Project" chapter of the Git book. In fact the whole book is more than worth reading.

Licence and Credit
==================
MidPoint is developed under Apache Licence. By submitting your contribution to the main midPoint repository you agree to the terms of the Licence and you contribute your work under this licence. There is no other contributor agreement and we do not ask for copyright assignment. All work is licensed under the Apache licence. That's the only rule. We are very strict about maintaining midPoint open source character and therefore we will not accept any contribution under a different licence (using publicly available third-party open source libraries is OK as long as they are available under any compatible OSI-approved licence - except for hard copyleft licenses such as GPL). Each new contributed file must have appropriate header declaring licensing under Apache Licence otherwise the contribution might be refused.

Git maintains the commit meta-data of the original commit. And this is what will be recorded in the history trail of main midPoint repository. Therefore the original contributor will be recorded in each commit. Apart from this the contributors are free to add their names to the appropriate place in the file header (e.g. Java @author annotation) if they feel their contribution is big enough to justify it.

Development Guidelines
======================

See [Development Guidelines](https://wiki.evolveum.com/display/midPoint/Development+Guidelines)
Expand Up @@ -37,6 +37,8 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* Created by honchar.
Expand All @@ -48,8 +50,8 @@ public abstract class AbstractAssignmentPopupTabPanel<O extends ObjectType> exte
private static final String DOT_CLASS = AbstractAssignmentPopupTabPanel.class.getName();

public AbstractAssignmentPopupTabPanel(String id, ObjectTypes type){
super(id, type);
super(id);
}

protected abstract List<AssignmentType> getSelectedAssignmentsList();
protected abstract Map<String, AssignmentType> getSelectedAssignmentsMap();
}
Expand Up @@ -15,6 +15,7 @@
-->

<wicket:panel xmlns:wicket="http://wicket.apache.org">
<div wicket:id="objectListPanel" />
<wicket:child />
<div wicket:id="objectListPanel" />
<div wicket:id="parametersPanel" />
</wicket:panel>
Expand Up @@ -15,12 +15,16 @@
*/
package com.evolveum.midpoint.gui.api.component;

import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

Expand All @@ -34,25 +38,30 @@ public abstract class AbstractPopupTabPanel<O extends ObjectType> extends BasePa
private static final long serialVersionUID = 1L;

private static final String ID_OBJECT_LIST_PANEL = "objectListPanel";
protected static final String ID_PARAMETERS_PANEL = "parametersPanel";
protected static final String ID_PARAMETERS_PANEL_FRAGMENT = "parametersPanelFragment";

protected ObjectTypes type;
protected List<O> preSelectedObjects = new ArrayList<>();

public AbstractPopupTabPanel(String id, ObjectTypes type){
public AbstractPopupTabPanel(String id){
super(id);
this.type = type;
// this.selectedObjects = selectedObjects;
}

@Override
protected void onInitialize(){
super.onInitialize();
setOutputMarkupId(true);
add(initObjectListPanel());
initParametersPanel();

Fragment parametersPanelFragment = new Fragment(ID_PARAMETERS_PANEL, ID_PARAMETERS_PANEL_FRAGMENT, this);
parametersPanelFragment.setOutputMarkupId(true);

initParametersPanel(parametersPanelFragment);
add(parametersPanelFragment);
}

private PopupObjectListPanel initObjectListPanel(){
PopupObjectListPanel<O> listPanel = new PopupObjectListPanel<O>(ID_OBJECT_LIST_PANEL, (Class)type.getClassDefinition(),
protected Component initObjectListPanel(){
PopupObjectListPanel<O> listPanel = new PopupObjectListPanel<O>(ID_OBJECT_LIST_PANEL, (Class)getObjectType().getClassDefinition(),
null, true, getPageBase(), getPreselectedObjects()) {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -87,22 +96,22 @@ public boolean isVisible(){
return listPanel;
}

protected abstract void initParametersPanel();
protected abstract void initParametersPanel(Fragment parametersPanel);

protected List<O> getPreselectedObjects(){
return preSelectedObjects;
}

protected List<O> getSelectedObjectsList(){
PopupObjectListPanel objectListPanel = getObjectListPanel();
PopupObjectListPanel objectListPanel = (PopupObjectListPanel)getObjectListPanel();
if (objectListPanel == null){
return new ArrayList();
}
return objectListPanel.getSelectedObjects();
}

protected PopupObjectListPanel getObjectListPanel(){
return (PopupObjectListPanel)get(ID_OBJECT_LIST_PANEL);
protected Component getObjectListPanel(){
return get(ID_OBJECT_LIST_PANEL);
}

protected void onSelectionPerformed(AjaxRequestTarget target){}
Expand All @@ -119,4 +128,5 @@ protected boolean isObjectListPanelVisible(){
return true;
}

protected abstract ObjectTypes getObjectType();
}
@@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2010-2017 Evolveum
~ 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.
Expand Down
@@ -1,3 +1,18 @@
/*
* 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.api.component;

import com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab;
Expand All @@ -14,9 +29,10 @@
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.protocol.http.ClientProperties;
import org.apache.wicket.protocol.http.WebSession;

import java.util.ArrayList;
import java.util.List;
import java.util.*;

/**
* Created by honchar.
Expand Down Expand Up @@ -68,26 +84,22 @@ public void onClick(AjaxRequestTarget target) {

@Override
public void onClick(AjaxRequestTarget target) {
List<AssignmentType> newAssignmentsList = new ArrayList<>();
List<AssignmentType> newOrgTypeAssignmentsList = new ArrayList<>();
Map<String, AssignmentType> selectedAssignmentsMap = new HashMap<>();

tabs.forEach(panelTab -> {
WebMarkupContainer assignmentPanel = ((CountablePanelTab)panelTab).getPanel();
if (assignmentPanel == null){
return;
}
if (assignmentPanel instanceof OrgTypeAssignmentPopupTabPanel){
if (newOrgTypeAssignmentsList.isEmpty()) {
newOrgTypeAssignmentsList.addAll(((AbstractAssignmentPopupTabPanel) assignmentPanel).getSelectedAssignmentsList());
return;
} else {
return;
}
}
newAssignmentsList.addAll(((AbstractAssignmentPopupTabPanel)assignmentPanel).getSelectedAssignmentsList());

(((AbstractAssignmentPopupTabPanel) assignmentPanel).getSelectedAssignmentsMap()).forEach((k, v) ->
selectedAssignmentsMap.putIfAbsent((String)k, (AssignmentType) v));


});
newAssignmentsList.addAll(newOrgTypeAssignmentsList);
addPerformed(target, newAssignmentsList);
List assignments = new ArrayList<>();
assignments.addAll(Arrays.asList(selectedAssignmentsMap.values().toArray()));
addPerformed(target, assignments);
}
};
addButton.setOutputMarkupId(true);
Expand All @@ -113,6 +125,11 @@ public WebMarkupContainer createPanel(String panelId) {
protected void onSelectionPerformed(AjaxRequestTarget target){
tabLabelPanelUpdate(target);
}

@Override
protected ObjectTypes getObjectType(){
return ObjectTypes.ROLE;
}
};
}

Expand All @@ -129,14 +146,19 @@ public String getCount() {

@Override
public WebMarkupContainer createPanel(String panelId) {
return new OrgTypeAssignmentPopupTabPanel(panelId, false){
return new FocusTypeAssignmentPopupTabPanel(panelId, ObjectTypes.ORG){
private static final long serialVersionUID = 1L;

@Override
protected void onSelectionPerformed(AjaxRequestTarget target){
tabLabelPanelUpdate(target);
}

@Override
protected ObjectTypes getObjectType(){
return ObjectTypes.ORG;
}

@Override
protected List<OrgType> getPreselectedObjects(){
return selectedOrgsList;
Expand All @@ -158,7 +180,7 @@ public String getCount() {

@Override
public WebMarkupContainer createPanel(String panelId) {
return new OrgTypeAssignmentPopupTabPanel(panelId, true){
return new OrgTreeAssignmentPopupTabPanel(panelId){
private static final long serialVersionUID = 1L;

@Override
Expand Down Expand Up @@ -189,6 +211,11 @@ public WebMarkupContainer createPanel(String panelId) {
return new FocusTypeAssignmentPopupTabPanel(panelId, ObjectTypes.SERVICE){
private static final long serialVersionUID = 1L;

@Override
protected ObjectTypes getObjectType(){
return ObjectTypes.SERVICE;
}

@Override
protected void onSelectionPerformed(AjaxRequestTarget target){
tabLabelPanelUpdate(target);
Expand Down Expand Up @@ -250,11 +277,21 @@ protected void addPerformed(AjaxRequestTarget target, List newAssignmentsList) {
}

public int getWidth(){
return 900;
return 80;
}

public int getHeight(){
return 1200;
return 80;
}

@Override
public String getWidthUnit(){
return "%";
}

@Override
public String getHeightUnit(){
return "%";
}

public StringResourceModel getTitle(){
Expand Down

0 comments on commit 70a9b90

Please sign in to comment.