Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/task-part-r…
Browse files Browse the repository at this point in the history
…estructuring
  • Loading branch information
mederly committed Jun 3, 2021
2 parents 8afb3b8 + 470f35f commit 3eeaa76
Show file tree
Hide file tree
Showing 44 changed files with 3,910 additions and 435 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
/*
* Copyright (c) 2010-2019 Evolveum and contributors
* Copyright (C) 2010-2021 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.web.application;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.function.Consumer;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -62,6 +56,7 @@ public final class DescriptorLoader implements DebugDumpable {
"com.evolveum.midpoint.web.component.prism.show"
};

// All could be final, but then Checkstyle complains about lower-case, although these are not constants.
private static Map<String, DisplayableValue<String>[]> actions = new HashMap<>();
private static List<String> permitAllUrls = new ArrayList<>();
private static List<String> loginPages = new ArrayList<>();
Expand Down Expand Up @@ -94,18 +89,16 @@ public void loadData(MidPointApplication application) {
}
} catch (InstantiationException | IllegalAccessException e) {
LOGGER.error("Error scanning packages for pages: {}", e.getMessage(), e);
throw new SystemException("Error scanning packages for pages: "+e.getMessage(), e);
throw new SystemException("Error scanning packages for pages: " + e.getMessage(), e);
}



}

private void scanPackagesForPages(MidPointApplication application)
throws InstantiationException, IllegalAccessException {

for (String pac : PACKAGES_TO_SCAN) {
LOGGER.debug("Scanning package package {} for page annotations", pac);
LOGGER.debug("Scanning package {} for page annotations", pac);

Set<Class<?>> classes = ClassPathUtil.listClasses(pac);
for (Class<?> clazz : classes) {
Expand All @@ -126,7 +119,7 @@ private void scanPackagesForPages(MidPointApplication application)

private void loadActions(PageDescriptor descriptor) {

if(descriptor.loginPage()) {
if (descriptor.loginPage()) {
foreachUrl(descriptor, url -> loginPages.add(url));
}

Expand Down Expand Up @@ -154,13 +147,11 @@ private void loadActions(PageDescriptor descriptor) {

//add http://.../..#guiAll authorization only for displayable pages, not for pages used for development..
if (canAccess) {

// actions.add(new AuthorizationActionValue(AuthorizationConstants.AUTZ_GUI_ALL_LABEL, AuthorizationConstants.AUTZ_GUI_ALL_DESCRIPTION));
actions.add(new AuthorizationActionValue(AuthorizationConstants.AUTZ_GUI_ALL_URL,
AuthorizationConstants.AUTZ_GUI_ALL_LABEL, AuthorizationConstants.AUTZ_GUI_ALL_DESCRIPTION));
}

foreachUrl(descriptor, url -> this.actions.put(url, actions.toArray(new DisplayableValue[actions.size()])));
foreachUrl(descriptor, url -> DescriptorLoader.actions.put(url, actions.toArray(new DisplayableValue[actions.size()])));
}

private void foreachUrl(PageDescriptor descriptor, Consumer<String> urlConsumer) {
Expand Down
14 changes: 7 additions & 7 deletions gui/admin-gui/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2017 Evolveum and contributors
~ Copyright (C) 2010-2021 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
Expand All @@ -10,7 +10,7 @@

<if condition='"true".equals(property("midpoint.logging.alt.enabled"))'>
<then>
<include resource="logback-alt.xml" />
<include resource="logback-alt.xml"/>
</then>
</if>

Expand Down Expand Up @@ -60,16 +60,16 @@
<logger name="org.hibernate.engine.jdbc.batch.internal.BatchingBatch" level="OFF"/>
<logger name="org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl" level="WARN"/>

<!-- MID-6512:
JAXPParser only logs configuration exception it - is causing (it proactivelly tries to
disable secure entity processing), but works fine even if exception is thrown.
<!-- MID-6512:
JAXPParser only logs configuration exception it is causing. It proactively tries to
disable secure entity processing, but works fine even if exception is thrown.
Behaviour is hardcoded, and can not be prevented, so we mute it off in logs to not cause
unnecessary concern.
-->
<logger name="com.sun.xml.xsom.parser.JAXPParser" level="OFF" />
<logger name="com.sun.xml.xsom.parser.JAXPParser" level="OFF"/>

<logger name="PROFILING" level="INFO"/>
<logger name="com.evolveum.midpoint" level="INFO" />
<logger name="com.evolveum.midpoint" level="INFO"/>
<logger name="com.evolveum.midpoint.web.util.MidPointProfilingServletFilter" level="TRACE">
<appender-ref ref="MIDPOINT_PROFILE_LOG"/>
</logger>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2020 Evolveum and contributors
* Copyright (C) 2010-2021 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand Down Expand Up @@ -61,6 +61,13 @@ public static void configure(LoggingConfigurationType config, String version,
return;
}

if (java.util.Objects.equals(currentlyUsedVersion, version)) {
LOGGER.debug("Skipped logging configuration because the same version {}"
+ " is already configured", version);
res.recordNotApplicableIfUnknown();
return;
}

if (currentlyUsedVersion != null) {
LOGGER.info("Applying logging configuration (currently applied version: {}, new version: {})", currentlyUsedVersion, version);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
package com.evolveum.midpoint.common.refinery.deleg;

import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.common.refinery.PropertyLimitations;
import com.evolveum.midpoint.common.refinery.RefinedAttributeDefinition;
import com.evolveum.midpoint.prism.ComplexTypeDefinition;
import com.evolveum.midpoint.prism.ItemDefinition;
import com.evolveum.midpoint.prism.ItemProcessing;
import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition;
import com.evolveum.midpoint.schema.processor.deleg.AttributeDefinitionDelegator;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AttributeFetchStrategyType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AttributeStorageStrategyType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LayerType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType;

public interface RefinedAttributeDefinitionDelegator<T> extends AttributeDefinitionDelegator<T>, RefinedAttributeDefinition<T> {

@Override
RefinedAttributeDefinition<T> delegate();

@Override
default boolean isTolerant() {
return delegate().isTolerant();
}

@Override
default Boolean isSecondaryIdentifierOverride() {
return delegate().isSecondaryIdentifierOverride();
}

@Override
default boolean canAdd(LayerType layer) {
return delegate().canAdd(layer);
}

@Override
default boolean canRead(LayerType layer) {
return delegate().canRead(layer);
}

@Override
default boolean canModify(LayerType layer) {
return delegate().canModify(layer);
}

@Override
default boolean isIgnored(LayerType layer) {
return delegate().isIgnored(layer);
}

@Override
default ItemProcessing getProcessing(LayerType layer) {
return delegate().getProcessing(layer);
}

@Override
default String getDescription() {
return delegate().getDescription();
}

@Override
default ResourceAttributeDefinition<T> getAttributeDefinition() {
return delegate().getAttributeDefinition();
}

@Override
default MappingType getOutboundMappingType() {
return delegate().getOutboundMappingType();
}

@Override
default boolean hasOutboundMapping() {
return delegate().hasOutboundMapping();
}

@Override
default List<MappingType> getInboundMappingTypes() {
return delegate().getInboundMappingTypes();
}

@Override
default int getMaxOccurs(LayerType layer) {
return delegate().getMaxOccurs(layer);
}

@Override
default int getMinOccurs(LayerType layer) {
return delegate().getMinOccurs(layer);
}

@Override
default boolean isOptional(LayerType layer) {
return delegate().isOptional(layer);
}

@Override
default boolean isMandatory(LayerType layer) {
return delegate().isMandatory(layer);
}

@Override
default boolean isMultiValue(LayerType layer) {
return delegate().isMultiValue(layer);
}

@Override
default boolean isSingleValue(LayerType layer) {
return delegate().isSingleValue(layer);
}

@Override
default boolean isExclusiveStrong() {
return delegate().isExclusiveStrong();
}

@Override
default PropertyLimitations getLimitations(LayerType layer) {
return delegate().getLimitations(layer);
}

@Override
default AttributeFetchStrategyType getFetchStrategy() {
return delegate().getFetchStrategy();
}

@Override
default AttributeStorageStrategyType getStorageStrategy() {
return delegate().getStorageStrategy();
}

@Override
default List<String> getTolerantValuePattern() {
return delegate().getTolerantValuePattern();
}

@Override
default List<String> getIntolerantValuePattern() {
return delegate().getIntolerantValuePattern();
}

@Override
default boolean isVolatilityTrigger() {
return delegate().isVolatilityTrigger();
}

@Override
default String debugDump(int indent, LayerType layer) {
return delegate().debugDump(indent, layer);
}

@Override
default Integer getModificationPriority() {
return delegate().getModificationPriority();
}

@Override
default Boolean getReadReplaceMode() {
return delegate().getReadReplaceMode();
}

@Override
default boolean isDisplayNameAttribute() {
return delegate().isDisplayNameAttribute();
}

@Override
RefinedAttributeDefinition<T> deepClone(Map<QName, ComplexTypeDefinition> ctdMap,
Map<QName, ComplexTypeDefinition> onThisPath, Consumer<ItemDefinition> postCloneAction);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* @author mederly
*/
public interface ItemDefinition<I extends Item> extends Definition {
public interface ItemDefinition<I extends Item> extends Definition, PrismItemAccessDefinition {

@NotNull
ItemName getItemName();
Expand Down Expand Up @@ -71,45 +71,6 @@ default boolean isMultiValue() {
*/
boolean isDynamic();

/**
* Returns true if this item can be read (displayed).
* In case of containers this flag is, strictly speaking, not applicable. Container is an
* empty shell. What matters is access to individual sub-item. However, for containers this
* value has a "hint" meaning. It means that the container itself contains something that is
* readable. Which can be used as a hint by the presentation to display container label or block.
* This usually happens if the container contains at least one readable item.
* This does NOT mean that also all the container items can be displayed. The sub-item permissions
* are controlled by similar properties on the items. This property only applies to the container
* itself: the "shell" of the container.
* <p>
* Note: It was considered to use a different meaning for this flag - a meaning that would allow
* canRead()=false containers to have readable items. However, this was found not to be very useful.
* Therefore the "something readable inside" meaning was confirmed instead.
*/
boolean canRead();

/**
* Returns true if this item can be modified (updated).
* In case of containers this means that the container itself should be displayed in modification forms
* E.g. that the container label or block should be displayed. This usually happens if the container
* contains at least one modifiable item.
* This does NOT mean that also all the container items can be modified. The sub-item permissions
* are controlled by similar properties on the items. This property only applies to the container
* itself: the "shell" of the container.
*/
boolean canModify();

/**
* Returns true if this item can be added: it can be part of an object that is created.
* In case of containers this means that the container itself should be displayed in creation forms
* E.g. that the container label or block should be displayed. This usually happens if the container
* contains at least one createable item.
* This does NOT mean that also all the container items can be created. The sub-item permissions
* are controlled by similar properties on the items. This property only applies to the container
* itself: the "shell" of the container.
*/
boolean canAdd();

/**
* Returns the name of an element this one can be substituted for (e.g. c:user -&gt; c:object,
* s:pipeline -&gt; s:expression, etc). EXPERIMENTAL
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.evolveum.midpoint.prism;


public interface ItemDefinitionTransformer {

<I extends ItemDefinition<?>> I transformItem(ComplexTypeDefinition parentDef, I currentDef);

<T extends TypeDefinition> T applyValue(ComplexTypeDefinition parentDef, ItemDefinition<?> itemDef, T valueDef);


public interface TransformableItem {

void transformDefinition(ComplexTypeDefinition parentDef, ItemDefinitionTransformer transformer);

}

public interface TransformableValue {

void transformDefinition(ComplexTypeDefinition parentDef, ItemDefinition<?> itemDef, ItemDefinitionTransformer transformation);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ <IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> I findOr
@Override
PrismContainer<C> cloneComplex(CloneStrategy strategy);

@Deprecated
PrismContainerDefinition<C> deepCloneDefinition(boolean ultraDeep, Consumer<ItemDefinition> postCloneAction);

@Override
Expand Down

0 comments on commit 3eeaa76

Please sign in to comment.