use of org.alfresco.repo.action.ActionConditionImpl in project alfresco-repository by Alfresco.
the class HasAspectEvaluatorTest method testPass.
@Test
public void testPass() {
this.nodeService.addAspect(this.nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
ActionCondition condition = new ActionConditionImpl(ID, HasAspectEvaluator.NAME, null);
condition.setParameterValue(HasAspectEvaluator.PARAM_ASPECT, ContentModel.ASPECT_VERSIONABLE);
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
}
use of org.alfresco.repo.action.ActionConditionImpl in project alfresco-repository by Alfresco.
the class HasTagEvaluatorTest method testPass.
public void testPass() {
taggingService.addTag(nodeRef, "testTag");
ActionCondition condition = new ActionConditionImpl(ID, HasTagEvaluator.NAME, null);
condition.setParameterValue(HasTagEvaluator.PARAM_TAG, "testTag");
boolean value = this.evaluator.evaluate(condition, this.nodeRef);
assertTrue("Tag should have been set", value);
}
use of org.alfresco.repo.action.ActionConditionImpl in project alfresco-repository by Alfresco.
the class HasTagEvaluatorTest method testFail.
public void testFail() {
ActionCondition condition = new ActionConditionImpl(ID, HasTagEvaluator.NAME, null);
condition.setParameterValue(HasTagEvaluator.PARAM_TAG, "testTag");
boolean value = this.evaluator.evaluate(condition, this.nodeRef);
assertFalse(value);
}
use of org.alfresco.repo.action.ActionConditionImpl in project alfresco-repository by Alfresco.
the class NodeEligibleForRethumbnailingEvaluatorTest method testNodeWithNoFailedThumbnails.
@SuppressWarnings("deprecation")
@Test
public void testNodeWithNoFailedThumbnails() {
// Such a node is always eligible for thumbnailing.
ActionCondition condition = new ActionConditionImpl(GUID.generate(), NodeEligibleForRethumbnailingEvaluator.NAME);
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_THUMBNAIL_DEFINITION_NAME, thumbnailDef1.getLocalName());
// Offset values don't matter here.
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_RETRY_PERIOD, 0L);
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_RETRY_COUNT, failureHandlingOptions.getRetryCount());
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD, 0L);
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD_RETRIES_ENABLED, true);
NodeEligibleForRethumbnailingEvaluator evaluator = (NodeEligibleForRethumbnailingEvaluator) this.applicationContext.getBean(NodeEligibleForRethumbnailingEvaluator.NAME);
assertTrue(evaluator.evaluate(condition, newUnthumbnailedNodeRef));
}
use of org.alfresco.repo.action.ActionConditionImpl in project alfresco-remote-api by Alfresco.
the class RulePut method updateActionConditionFromJson.
protected ActionCondition updateActionConditionFromJson(JSONObject jsonCondition, ActionConditionImpl conditionToUpdate) throws JSONException {
ActionConditionImpl result = null;
if (jsonCondition.has("id")) {
// update exiting object
result = conditionToUpdate;
} else {
// create new onject as id was not sent
result = parseJsonActionCondition(jsonCondition);
return result;
}
if (jsonCondition.has("invertCondition")) {
result.setInvertCondition(jsonCondition.getBoolean("invertCondition"));
}
if (jsonCondition.has("parameterValues")) {
JSONObject jsonParameterValues = jsonCondition.getJSONObject("parameterValues");
result.setParameterValues(parseJsonParameterValues(jsonParameterValues, result.getActionConditionDefinitionName(), false));
}
return result;
}
Aggregations