Skip to content

Commit

Permalink
Merge branch 'master' into feature/removing-activiti
Browse files Browse the repository at this point in the history
# Conflicts:
#	gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/WorkItemSummaryPanel.java
  • Loading branch information
mederly committed Feb 28, 2019
2 parents 859df22 + 708f9b7 commit 6148229
Show file tree
Hide file tree
Showing 101 changed files with 2,062 additions and 995 deletions.
Expand Up @@ -92,6 +92,9 @@ protected IModel<Boolean> getCheckBoxEnableModel(IModel<SelectableBean<O>> rowMo
@Override
protected ObjectQuery addFilterToContentQuery(ObjectQuery query) {
ObjectQuery queryWithFilters = AbstractPopupTabPanel.this.addFilterToContentQuery(query);
if (queryWithFilters == null){
queryWithFilters = AbstractPopupTabPanel.this.getPageBase().getPrismContext().queryFactory().createQuery();
}
List<ObjectReferenceType> archetypeRefList = getArchetypeRefList();
if (!CollectionUtils.isEmpty(archetypeRefList)){
List<ObjectFilter> archetypeRefFilterList = new ArrayList<>();
Expand All @@ -105,14 +108,16 @@ protected ObjectQuery addFilterToContentQuery(ObjectQuery query) {
archetypeRefFilterList.add(filter);
}
if (!CollectionUtils.isEmpty(archetypeRefFilterList)){
if (queryWithFilters == null){
queryWithFilters = getPrismContext().queryFactory().createQuery();
}
OrFilter archetypeRefOrFilter =
AbstractPopupTabPanel.this.getPageBase().getPrismContext().queryFactory().createOr(archetypeRefFilterList);
queryWithFilters.addFilter(archetypeRefOrFilter);
}
}

ObjectFilter subTypeFilter = getSubtypeFilter();
if (subTypeFilter != null){
queryWithFilters.addFilter(subTypeFilter);
}
return queryWithFilters;
}

Expand Down Expand Up @@ -160,6 +165,10 @@ protected List<ObjectReferenceType> getArchetypeRefList(){
return null;
}

protected ObjectFilter getSubtypeFilter(){
return null;
}

protected boolean isObjectListPanelVisible(){
return true;
}
Expand Down
Expand Up @@ -19,6 +19,7 @@
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.TabbedPanel;
Expand Down Expand Up @@ -201,6 +202,11 @@ protected QName getPredefinedRelation() {
protected List<ObjectReferenceType> getArchetypeRefList(){
return AssignmentPopup.this.getArchetypeRefList();
}

@Override
protected ObjectFilter getSubtypeFilter(){
return AssignmentPopup.this.getSubtypeFilter();
}
};
}

Expand Down Expand Up @@ -246,6 +252,11 @@ protected QName getPredefinedRelation() {
protected List<ObjectReferenceType> getArchetypeRefList(){
return AssignmentPopup.this.getArchetypeRefList();
}

@Override
protected ObjectFilter getSubtypeFilter(){
return AssignmentPopup.this.getSubtypeFilter();
}
};
}

Expand Down Expand Up @@ -345,6 +356,10 @@ protected List<ObjectReferenceType> getArchetypeRefList(){
return null;
}

protected ObjectFilter getSubtypeFilter(){
return null;
}

private boolean isTabVisible(ObjectTypes objectType){
List<ObjectTypes> availableObjectTypesList = getAvailableObjectTypesList();
return availableObjectTypesList == null || availableObjectTypesList.size() == 0 || availableObjectTypesList.contains(objectType);
Expand Down
Expand Up @@ -15,6 +15,7 @@
*/
package com.evolveum.midpoint.gui.api.component;

import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
Expand Down Expand Up @@ -68,6 +69,11 @@ protected List<OrgType> getPreselectedOrgsList(){
protected boolean isInducement(){
return OrgTreeAssignmentPopupTabPanel.this.isInducement();
}

@Override
protected ObjectFilter getSubtypeFilter(){
return OrgTreeAssignmentPopupTabPanel.this.getSubtypeFilter();
}
};
orgTreePanel.setOutputMarkupId(true);
add(orgTreePanel);
Expand Down
Expand Up @@ -73,6 +73,8 @@
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.page.admin.resources.PageResourceWizard;
import com.evolveum.midpoint.web.page.admin.valuePolicy.PageValuePolicy;
import com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType;
Expand Down Expand Up @@ -192,6 +194,7 @@ public final class WebComponentUtil {
private static RelationRegistry staticallyProvidedRelationRegistry;

private static Map<Class<?>, Class<? extends PageBase>> objectDetailsPageMap;
private static Map<Class<?>, Class<? extends PageBase>> createNewObjectPageMap;

static {
objectDetailsPageMap = new HashMap<>();
Expand All @@ -202,6 +205,12 @@ public final class WebComponentUtil {
objectDetailsPageMap.put(ResourceType.class, PageResource.class);
objectDetailsPageMap.put(TaskType.class, PageTaskEdit.class);
objectDetailsPageMap.put(ReportType.class, PageReport.class);
objectDetailsPageMap.put(ValuePolicyType.class, PageValuePolicy.class);
}

static{
createNewObjectPageMap = new HashMap<>();
createNewObjectPageMap.put(ResourceType.class, PageResourceWizard.class);
}

// only pages that support 'advanced search' are currently listed here (TODO: generalize)
Expand Down Expand Up @@ -1970,16 +1979,36 @@ 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;
public static <AHT extends AssignmentHolderType, O extends ObjectType> void initNewObjectWithReference(PageBase pageBase, O targetObject, QName type, Collection<QName> relations) throws SchemaException {
List<ObjectReferenceType> newReferences = new ArrayList<>();
for (QName relation : relations) {
newReferences.add(ObjectTypeUtil.createObjectRef(targetObject, relation));
}
return null;
initNewObjectWithReference(pageBase, type, newReferences);
}

public static <AHT extends AssignmentHolderType> void initNewObjectWithReference(PageBase pageBase, QName type, List<ObjectReferenceType> newReferences) throws SchemaException {
PrismContext prismContext = pageBase.getPrismContext();
PrismObjectDefinition<AHT> def = prismContext.getSchemaRegistry().findObjectDefinitionByType(type);
PrismObject<AHT> obj = def.instantiate();
AHT assignmentHolder = obj.asObjectable();
if (newReferences != null) {
newReferences.stream().forEach(ref -> {
AssignmentType assignment = new AssignmentType();
assignment.setTargetRef(ref);
assignmentHolder.getAssignment().add(assignment);

// Set parentOrgRef in any case. This is not strictly correct.
// The parentOrgRef should be added by the projector. But
// this is needed to successfully pass through security
// TODO: fix MID-3234
if (ref.getType() != null && OrgType.COMPLEX_TYPE.equals(ref.getType())) {
assignmentHolder.getParentOrgRef().add(ref.clone());
}
});
}

WebComponentUtil.dispatchToObjectDetailsPage(obj, true, pageBase);
}

public static String createUserIconTitle(PrismObject<UserType> object) {
Expand Down Expand Up @@ -2304,7 +2333,7 @@ public static void dispatchToObjectDetailsPage(PrismObject obj, Component compon

// shows the actual object that is passed via parameter (not its state in repository)
public static void dispatchToObjectDetailsPage(PrismObject obj, boolean isNewObject, Component component) {
Class newObjectPageClass = getObjectDetailsPage(obj.getCompileTimeClass());
Class newObjectPageClass = isNewObject ? getNewlyCreatedObjectPage(obj.getCompileTimeClass()) : getObjectDetailsPage(obj.getCompileTimeClass());
if (newObjectPageClass == null) {
throw new IllegalArgumentException("Cannot determine details page for "+obj.getCompileTimeClass());
}
Expand Down Expand Up @@ -2378,6 +2407,14 @@ public static Class<? extends PageBase> getObjectDetailsPage(Class<? extends Obj
return objectDetailsPageMap.get(type);
}

public static Class<? extends PageBase> getNewlyCreatedObjectPage(Class<? extends ObjectType> type) {
if (ResourceType.class.equals(type)) {
return createNewObjectPageMap.get(type);
} else {
return objectDetailsPageMap.get(type);
}
}

public static Class<? extends PageBase> getObjectListPage(Class<? extends ObjectType> type) {
return objectListPageMap.get(type);
}
Expand Down
Expand Up @@ -109,6 +109,9 @@ public String getObject() {

private String getDefaultValue() {
C object = model.getObject();
if (object == null){
return "";
}
PrismProperty<?> property;
try {
property = object.asPrismContainerValue().findOrCreateProperty(path);
Expand Down
Expand Up @@ -33,8 +33,11 @@
<span wicket:id="summaryOrganization" class="summary-panel-organization">
</span>
</span>
<span wicket:id="summaryTagBox" class="col-xs-12 col-sm-6 col-md-4 col-lg-3 summary-tag-box" style="max-width: 200px;">
<wicket:child />
<span class="col-xs-12 col-sm-6 col-md-4 col-lg-3 summary-tag-box" style="max-width: 220px;">
<span wicket:id="summaryTagBox" >
<span wicket:id="summaryTag"/>
</span>
<wicket:child />
</span>
</span>
</div>
Expand Down

0 comments on commit 6148229

Please sign in to comment.