Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Aug 9, 2019
2 parents 37981df + ab52664 commit 64cdd2d
Show file tree
Hide file tree
Showing 19 changed files with 161 additions and 84 deletions.
Expand Up @@ -551,8 +551,8 @@ public void populateItem(Item<ICellPopulator<PrismContainerValueWrapper<CaseWork

CaseWorkItemType caseWorkItemType = unwrapRowModel(rowModel);
CaseType caseType = CaseTypeUtil.getCase(caseWorkItemType);
PrismReferenceValue refVal = caseType.getTargetRef().asReferenceValue();
String descriptionValue = refVal.getObject() != null ?
PrismReferenceValue refVal = caseType.getTargetRef() != null ? caseType.getTargetRef().asReferenceValue() : null;
String descriptionValue = refVal != null && refVal.getObject() != null ?
refVal.getObject().asObjectable().getDescription() : "";

c.add(new AttributeAppender("title", descriptionValue));
Expand Down
Expand Up @@ -38,6 +38,8 @@
public class GetOperationOptions extends AbstractOptions implements Serializable, Cloneable, ShortDumpable {
private static final long serialVersionUID = 1L;

public static final GetOperationOptions EMPTY = new GetOperationOptions();

/**
* Specifies whether to return specific items. It is used for optimizations.
* Some requests only needs a subset of items therefore fetching them all is a waste
Expand Down
Expand Up @@ -17637,6 +17637,17 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="shadowMetadataRecording" type="tns:MetadataRecordingStrategyType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
How metadata in shadows should be recorded/updated.
</xsd:documentation>
<xsd:appinfo>
<a:since>4.0</a:since>
<a:displayName>InternalsConfigurationType.shadowMetadataRecording</a:displayName>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="operationExecutionRecording" type="tns:OperationExecutionRecordingStrategyType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -17771,6 +17782,30 @@
</xsd:complexType>
<xsd:element name="operationExecutionRecordingStrategy" type="tns:OperationExecutionRecordingStrategyType" />

<xsd:complexType name="MetadataRecordingStrategyType">
<xsd:annotation>
<xsd:documentation>
How object metadata should be recorded or updated.
EXPERIMENTAL
</xsd:documentation>
<xsd:appinfo>
<a:container/>
<a:since>4.0</a:since>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="skipOnModify" type="xsd:boolean" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Metadata are not updated when modifying an object.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="metadataRecordingStrategy" type="tns:MetadataRecordingStrategyType" />

<xsd:complexType name="ConstraintsCheckingStrategyType">
<xsd:annotation>
<xsd:documentation>
Expand Down
6 changes: 6 additions & 0 deletions model/certification-impl/pom.xml
Expand Up @@ -200,6 +200,12 @@
<version>4.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint</groupId>
<artifactId>midpoint-localization</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions model/model-impl/pom.xml
Expand Up @@ -309,6 +309,12 @@
<!--</dependency>-->

<!-- Test -->
<dependency>
<groupId>com.evolveum.midpoint</groupId>
<artifactId>midpoint-localization</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.evolveum.icf</groupId>
<artifactId>dummy-connector</artifactId>
Expand Down
Expand Up @@ -1501,8 +1501,10 @@ private <T extends ObjectType, F extends ObjectType> void executeModification(Ob
securityEnforcer.authorize(ModelAuthorizationAction.MODIFY.getUrl(),
AuthorizationPhaseType.EXECUTION, AuthorizationParameters.Builder.buildObjectDelta(baseObject, delta), ownerResolver, task, result);

metadataManager.applyMetadataModify(delta, objectContext, objectTypeClass,
clock.currentTimeXMLGregorianCalendar(), task, context, result);
if (shouldApplyModifyMetadata(objectTypeClass, context.getSystemConfigurationType())) {
metadataManager.applyMetadataModify(delta, objectContext, objectTypeClass,
clock.currentTimeXMLGregorianCalendar(), task, context, result);
}

if (delta.isEmpty()) {
// Nothing to do
Expand Down Expand Up @@ -1546,7 +1548,16 @@ private <T extends ObjectType, F extends ObjectType> void executeModification(Ob
}
}


private <T extends ObjectType> boolean shouldApplyModifyMetadata(Class<T> objectTypeClass, SystemConfigurationType config) {
if (!ShadowType.class.equals(objectTypeClass)) {
return true;
} else if (config == null || config.getInternals() == null || config.getInternals().getShadowMetadataRecording() == null) {
return true;
} else {
MetadataRecordingStrategyType recording = config.getInternals().getShadowMetadataRecording();
return !Boolean.TRUE.equals(recording.isSkipOnModify());
}
}

private String addTask(TaskType task, RepoAddOptions addOpt, OperationResult result)
throws ObjectAlreadyExistsException {
Expand Down
Expand Up @@ -249,6 +249,7 @@ public <F extends ObjectType> HookOperationMode run(LensContext<F> context, Task
TracingAppender.terminateCollecting(); // todo reconsider
LevelOverrideTurboFilter.cancelLoggingOverride(); // todo reconsider
}
result.computeStatusIfUnknown();
}
}

Expand Down
Expand Up @@ -598,9 +598,7 @@ private boolean performShadowReconciliation(final PrismObject<ResourceType> reso
query = addQueryFromTaskIfExists(query, localCoordinatorTask);
query = narrowQueryForBucket(query, localCoordinatorTask, workBucket, objectclassDef, opResult);

if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Shadow recon query:\n{}", query.debugDump());
}
LOGGER.trace("Shadow recon query:\n{}", query.debugDumpLazily());

long started = System.currentTimeMillis();

Expand All @@ -626,9 +624,7 @@ private boolean performShadowReconciliation(final PrismObject<ResourceType> reso
}

if (ShadowUtil.isProtected(resourceShadow)) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Skipping recording counter for {} because it is protected", shadow);
}
LOGGER.trace("Skipping recording counter for {} because it is protected", shadow);
return localCoordinatorTask.canRun();
}

Expand Down
6 changes: 6 additions & 0 deletions model/notifications-impl/pom.xml
Expand Up @@ -239,6 +239,12 @@
<version>4.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint</groupId>
<artifactId>midpoint-localization</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions model/workflow-impl/pom.xml
Expand Up @@ -167,6 +167,12 @@
</dependency>

<!-- Test -->
<dependency>
<groupId>com.evolveum.midpoint</groupId>
<artifactId>midpoint-localization</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.infra</groupId>
<artifactId>test-util</artifactId>
Expand Down
Expand Up @@ -533,4 +533,8 @@ <O extends ObjectType, T> ItemComparisonResult compare(Class<O> type, String oid

void shutdown();

/**
* Temporary and quick hack. TODO fix this
*/
SystemConfigurationType getSystemConfiguration();
}
Expand Up @@ -114,7 +114,7 @@ public void checkModify(ProvisioningContext ctx, PrismObject<ShadowType> shadow,
continue;
}
QName attrName = attrDelta.getElementName();
LOGGER.trace("Checking attribue {} definition present in {}", attrName, objectClassDefinition);
LOGGER.trace("Checking attribute {} definition present in {}", attrName, objectClassDefinition);
RefinedAttributeDefinition attrDef = objectClassDefinition.findAttributeDefinition(attrName);
if (attrDef == null) {
throw new SchemaException("Cannot find definition of attribute "+attrName+" in "+objectClassDefinition);
Expand Down
Expand Up @@ -20,16 +20,20 @@
import java.util.List;
import java.util.Set;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.delta.ItemDeltaCollectionsUtil;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.repo.api.SystemConfigurationChangeDispatcher;
import com.evolveum.midpoint.repo.api.SystemConfigurationChangeListener;
import com.evolveum.midpoint.schema.cache.CacheConfigurationManager;
import com.evolveum.midpoint.schema.cache.CacheType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang.Validate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Primary;
Expand Down Expand Up @@ -101,7 +105,7 @@
*/
@Service(value = "provisioningService")
@Primary
public class ProvisioningServiceImpl implements ProvisioningService {
public class ProvisioningServiceImpl implements ProvisioningService, SystemConfigurationChangeListener {

private static final String OPERATION_REFRESH_SHADOW = ProvisioningServiceImpl.class.getName() +".refreshShadow";

Expand All @@ -111,13 +115,16 @@ public class ProvisioningServiceImpl implements ProvisioningService {
@Autowired ProvisioningContextFactory ctxFactory;
@Autowired PrismContext prismContext;
@Autowired CacheConfigurationManager cacheConfigurationManager;
@Autowired private SystemConfigurationChangeDispatcher systemConfigurationChangeDispatcher;

@Autowired(required = true)
@Autowired
@Qualifier("cacheRepositoryService")
private RepositoryService cacheRepositoryService;

private PrismObjectDefinition<ShadowType> resourceObjectShadowDefinition;

private SystemConfigurationType systemConfiguration;

private static final Trace LOGGER = TraceManager.getTrace(ProvisioningServiceImpl.class);

private static final String DETAILS_CONNECTOR_FRAMEWORK_VERSION = "ConnId framework version"; // TODO generalize
Expand Down Expand Up @@ -1255,12 +1262,6 @@ public ProvisioningDiag getProvisioningDiag() {
return provisioningDiag;
}

/*
* (non-Javadoc)
*
* @see
* com.evolveum.midpoint.provisioning.api.ProvisioningService#initialize()
*/
@Override
public void postInit(OperationResult parentResult) {

Expand All @@ -1277,9 +1278,15 @@ public void postInit(OperationResult parentResult) {
result.cleanupResult();
}

@PostConstruct
public void init() {
systemConfigurationChangeDispatcher.registerListener(this);
}

@PreDestroy
public void shutdown() {
connectorManager.shutdown();
systemConfigurationChangeDispatcher.unregisterListener(this);
}

@Override
Expand Down Expand Up @@ -1397,4 +1404,14 @@ public <O extends ObjectType, T> ItemComparisonResult compare(Class<O> type, Str
return comparisonResult;
}

@Override
public boolean update(@Nullable SystemConfigurationType value) {
systemConfiguration = value;
return true;
}

@Override
public SystemConfigurationType getSystemConfiguration() {
return systemConfiguration;
}
}
Expand Up @@ -970,12 +970,9 @@ private String modifyShadowAttempt(ProvisioningContext ctx,
if (shadowManager.isRepositoryOnlyModification(modifications)) {
opState.setExecutionStatus(PendingOperationExecutionStatusType.COMPLETED);
LOGGER.debug("MODIFY {}: repository-only modification", repoShadow);

} else {
if (shouldExecuteResourceOperationDirectly(ctx)) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("MODIFY {}: resource modification, execution starting\n{}", repoShadow, DebugUtil.debugDump(modifications));
}
LOGGER.trace("MODIFY {}: resource modification, execution starting\n{}", repoShadow, DebugUtil.debugDumpLazily(modifications));

ConnectorOperationOptions connOptions = createConnectorOperationOptions(ctx, options, parentResult);

Expand Down
Expand Up @@ -201,8 +201,7 @@ public ProvisioningContext applyAttributesDefinition(ProvisioningContext ctx,
PrismObjectDefinition<ShadowType> objectDefinition = shadow.getDefinition();
PrismContainerDefinition<ShadowAttributesType> origAttrContainerDef = objectDefinition
.findContainerDefinition(ShadowType.F_ATTRIBUTES);
if (origAttrContainerDef == null
|| !(origAttrContainerDef instanceof ResourceAttributeContainerDefinition)) {
if (!(origAttrContainerDef instanceof ResourceAttributeContainerDefinition)) {
PrismObjectDefinition<ShadowType> clonedDefinition = objectDefinition.cloneWithReplacedDefinition(
ShadowType.F_ATTRIBUTES, objectClassDefinition.toResourceAttributeContainerDefinition());
shadow.setDefinition(clonedDefinition);
Expand Down

0 comments on commit 64cdd2d

Please sign in to comment.