Skip to content

Commit

Permalink
Merge branch 'post-3.7-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Feb 28, 2018
2 parents 6caa740 + 72f79ea commit a44bde9
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
Expand Up @@ -103,7 +103,9 @@ public void checkInputValue(AutoCompleteTextField input, AjaxRequestTarget targe
if (input.getInput() == null || input.getInput().trim().equals("")){
model.setObject(input.getInput());
}
if (getIterator(input.getInput()).hasNext() && getIterator(input.getInput()).next() instanceof String) {
if (!getIterator(input.getInput()).hasNext()) {
updateFeedbackPanel(input, true, target);
} else {
Iterator<String> lookupTableValuesIterator = (Iterator<String>) getIterator(input.getInput());

String value = input.getInput();
Expand Down
Expand Up @@ -408,6 +408,14 @@ public static <T extends ObjectType> IModel<ObjectWrapper<T>> adopt(
return objectWrapperModel;
}

public static void safeResultCleanup(OperationResult result, Trace logger) {
try {
result.cleanupResultDeeply();
} catch (Throwable t) {
LoggingUtils.logUnexpectedException(logger, "Couldn't clean up the operation result", t);
}
}

public enum Channel {
// TODO: move this to schema component
LIVE_SYNC(SchemaConstants.CHANGE_CHANNEL_LIVE_SYNC_URI),
Expand Down
Expand Up @@ -505,6 +505,7 @@ private void executeCampaignStateOperation(AjaxRequestTarget target, String acti
result.computeStatusIfUnknown();
}

WebComponentUtil.safeResultCleanup(result, LOGGER);
showResult(result);
statModel.reset();
campaignModel.reset();
Expand All @@ -513,7 +514,6 @@ private void executeCampaignStateOperation(AjaxRequestTarget target, String acti
target.add(getFeedbackPanel());
}


private ObjectQuery createCaseQuery() {
ObjectQuery query = new ObjectQuery();
return query;
Expand Down
Expand Up @@ -744,6 +744,7 @@ private void startRemediationPerformed(AjaxRequestTarget target,
} finally {
result.computeStatusIfUnknown();
}
WebComponentUtil.safeResultCleanup(result, LOGGER);
showResult(result);
target.add((Component) getCampaignsTable());
target.add(getFeedbackPanel());
Expand All @@ -762,6 +763,7 @@ private void openNextStagePerformed(AjaxRequestTarget target, AccessCertificatio
} finally {
result.computeStatusIfUnknown();
}
WebComponentUtil.safeResultCleanup(result, LOGGER);
showResult(result);
target.add((Component) getCampaignsTable());
target.add(getFeedbackPanel());
Expand All @@ -782,7 +784,7 @@ private void closeCampaignConfirmedPerformed(AjaxRequestTarget target,
} finally {
result.computeStatusIfUnknown();
}

WebComponentUtil.safeResultCleanup(result, LOGGER);
showResult(result);
target.add((Component) getCampaignsTable());
target.add(getFeedbackPanel());
Expand All @@ -802,7 +804,7 @@ private void closeStageConfirmedPerformed(AjaxRequestTarget target, CertCampaign
} finally {
result.computeStatusIfUnknown();
}

WebComponentUtil.safeResultCleanup(result, LOGGER);
showResult(result);
target.add((Component) getCampaignsTable());
target.add(getFeedbackPanel());
Expand Down Expand Up @@ -845,7 +847,7 @@ private void deleteCampaignsPerformed(AjaxRequestTarget target,
Table campaignsTable = getCampaignsTable();
ObjectDataProvider provider = (ObjectDataProvider) campaignsTable.getDataTable().getDataProvider();
provider.clearCache();

WebComponentUtil.safeResultCleanup(result, LOGGER);
showResult(result);
target.add(getFeedbackPanel(), (Component) campaignsTable);
}
Expand Down Expand Up @@ -893,7 +895,7 @@ private void actOnCampaignsPerformed(AjaxRequestTarget target, String operationN
result.recordStatus(OperationResultStatus.SUCCESS,
processed + " campaign(s) have been successfully processed."); // todo i18n
}

WebComponentUtil.safeResultCleanup(result, LOGGER);
showResult(result);
target.add(getFeedbackPanel(), (Component) getCampaignsTable());
}
Expand Down
Expand Up @@ -1474,6 +1474,12 @@ private OperationResult findSimilarSubresult(OperationResult subresult) {
return similar;
}

// experimental/temporary
public void cleanupResultDeeply() {
cleanupResult();
emptyIfNull(subresults).forEach(OperationResult::cleanupResultDeeply);
}

/**
* Removes all the successful minor results. Also checks if the result is roughly consistent
* and complete. (e.g. does not have unknown operation status, etc.)
Expand Down
Expand Up @@ -314,6 +314,18 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="aggregateOutput" type="xsd:boolean" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Whether to aggregate and pass forward the output of expression evaluations that are done
for each object found. (Meaningful only if scriptingExpression is specified.)
Default is true for compatibility reasons. Set to false to optimize memory consumption.
</xsd:documentation>
<xsd:appinfo>
<a:since>3.7.1</a:since>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
Expand Down
Expand Up @@ -44,6 +44,7 @@
import com.evolveum.midpoint.xml.ns._public.model.scripting_3.SearchExpressionType;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.mutable.MutableBoolean;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -137,9 +138,12 @@ public <T extends ObjectType> PipelineData evaluate(SearchExpressionType searchE
}
JAXBElement<?> childExpression = searchExpression.getScriptingExpression();
try {
outputData.addAllFrom(scriptingExpressionEvaluator.evaluateExpression(
PipelineData expressionResult = scriptingExpressionEvaluator.evaluateExpression(
(ScriptingExpressionType) childExpression.getValue(),
PipelineData.create(object.getValue(), item.getVariables()), context, globalResult));
PipelineData.create(object.getValue(), item.getVariables()), context, globalResult);
if (!BooleanUtils.isFalse(searchExpression.isAggregateOutput())) {
outputData.addAllFrom(expressionResult);
}
globalResult.setSummarizeSuccesses(true);
globalResult.summarize();
} catch (ScriptExecutionException e) {
Expand Down

0 comments on commit a44bde9

Please sign in to comment.