本文整理匯總了Java中org.alfresco.repo.action.ActionConditionImpl類的典型用法代碼示例。如果您正苦於以下問題:Java ActionConditionImpl類的具體用法?Java ActionConditionImpl怎麽用?Java ActionConditionImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ActionConditionImpl類屬於org.alfresco.repo.action包,在下文中一共展示了ActionConditionImpl類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testNodeWithNoFailedThumbnails
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
@SuppressWarnings("deprecation")
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));
}
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:19,代碼來源:NodeEligibleForRethumbnailingEvaluatorTest.java
示例2: testContentPropertyComparisons
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
public void testContentPropertyComparisons()
{
ActionConditionImpl condition = new ActionConditionImpl(GUID.generate(), ComparePropertyValueEvaluator.NAME);
// What happens if you do this and the node has no content set yet !!
// Add some content to the node reference
ContentWriter contentWriter = this.contentService.getWriter(this.nodeRef, ContentModel.PROP_CONTENT, true);
contentWriter.setEncoding("UTF-8");
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
contentWriter.putContent("This is some test content.");
// Test matching the mimetype
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, MimetypeMap.MIMETYPE_TEXT_PLAIN);
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, MimetypeMap.MIMETYPE_HTML);
assertFalse(this.evaluator.evaluate(condition, this.nodeRef));
}
示例3: parseJsonActionCondition
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
protected ActionConditionImpl parseJsonActionCondition(JSONObject jsonActionCondition) throws JSONException
{
String id = jsonActionCondition.has("id") ? jsonActionCondition.getString("id") : GUID.generate();
ActionConditionImpl result = new ActionConditionImpl(id, jsonActionCondition.getString("conditionDefinitionName"));
if (jsonActionCondition.has("invertCondition"))
{
result.setInvertCondition(jsonActionCondition.getBoolean("invertCondition"));
}
if (jsonActionCondition.has("parameterValues"))
{
JSONObject jsonParameterValues = jsonActionCondition.getJSONObject("parameterValues");
result.setParameterValues(parseJsonParameterValues(jsonParameterValues, result.getActionConditionDefinitionName(), false));
}
return result;
}
示例4: testTempFileNames
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
/**
* Test some combinations of test file names that had been failing
*/
public void testTempFileNames()
{
ActionConditionImpl condition = new ActionConditionImpl(GUID.generate(), ComparePropertyValueEvaluator.NAME);
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_PROPERTY, PROP_TEXT);
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "~*.doc");
this.nodeService.setProperty(this.nodeRef, PROP_TEXT, "~1234.doc");
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
}
示例5: testContentPropertyComparisons
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
public void testContentPropertyComparisons()
{
ActionConditionImpl condition = new ActionConditionImpl(GUID.generate(), ComparePropertyValueEvaluator.NAME);
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_PROPERTY, ContentModel.PROP_CONTENT);
// What happens if you do this and the node has no content set yet !!
// Add some content to the node reference
ContentWriter contentWriter = this.contentService.getWriter(this.nodeRef, ContentModel.PROP_CONTENT, true);
contentWriter.setEncoding("UTF-8");
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
contentWriter.putContent("This is some test content.");
// Test matching the mimetype
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_CONTENT_PROPERTY, ContentPropertyName.MIME_TYPE.toString());
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, MimetypeMap.MIMETYPE_TEXT_PLAIN);
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, MimetypeMap.MIMETYPE_HTML);
assertFalse(this.evaluator.evaluate(condition, this.nodeRef));
// Test matching the encoding
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_CONTENT_PROPERTY, ContentPropertyName.ENCODING.toString());
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "UTF-8");
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "UTF-16");
assertFalse(this.evaluator.evaluate(condition, this.nodeRef));
// Test comparision to the size of the content
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_CONTENT_PROPERTY, ContentPropertyName.SIZE.toString());
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_OPERATION, ComparePropertyValueOperation.LESS_THAN.toString());
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, 50);
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, 2);
assertFalse(this.evaluator.evaluate(condition, this.nodeRef));
}
示例6: testMultiValuedPropertyComparisons
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
public void testMultiValuedPropertyComparisons()
{
ActionConditionImpl condition = new ActionConditionImpl(GUID.generate(), ComparePropertyValueEvaluator.NAME);
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_PROPERTY, PROP_MULTI_VALUE);
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_OPERATION, ComparePropertyValueOperation.CONTAINS.toString());
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "Document");
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
condition.setParameterValue(ComparePropertyValueEvaluator.PARAM_VALUE, "bobbins");
assertFalse(this.evaluator.evaluate(condition, this.nodeRef));
}
示例7: testMandatoryParamsMissing
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
public void testMandatoryParamsMissing()
{
ActionCondition condition = new ActionConditionImpl(ID, HasAspectEvaluator.NAME, null);
try
{
this.evaluator.evaluate(condition, this.nodeRef);
fail("The fact that a mandatory parameter has not been set should have been detected.");
}
catch (Throwable exception)
{
// Do nothing since this is correct
}
}
示例8: testPass
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
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));
}
示例9: testPass
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
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);
}
示例10: testFail
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
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);
}
示例11: testMandatoryParamsMissing
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
public void testMandatoryParamsMissing()
{
ActionCondition condition = new ActionConditionImpl(ID, IsSubTypeEvaluator.NAME, null);
try
{
this.evaluator.evaluate(condition, this.nodeRef);
fail("The fact that a mandatory parameter has not been set should have been detected.");
}
catch (Throwable exception)
{
// Do nothing since this is correct
}
}
示例12: testPass
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
public void testPass()
{
ActionCondition condition = new ActionConditionImpl(ID, IsSubTypeEvaluator.NAME, null);
condition.setParameterValue(IsSubTypeEvaluator.PARAM_TYPE, ContentModel.TYPE_CONTENT);
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
condition.setParameterValue(IsSubTypeEvaluator.PARAM_TYPE, ContentModel.TYPE_CMOBJECT);
assertTrue(this.evaluator.evaluate(condition, this.nodeRef));
}
示例13: updateActionConditionFromJson
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
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;
}
示例14: testNodeWithFailedThumbnails
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
public void testNodeWithFailedThumbnails()
{
// A "non-difficult" node is one which is not yet known to be difficult to thumbnail.
// In other words it is one which has previously failed to thumbnail, but which has not yet
// hit the retryCount limit for initial retries.
NodeEligibleForRethumbnailingEvaluator evaluator =
(NodeEligibleForRethumbnailingEvaluator)this.applicationContext.getBean(NodeEligibleForRethumbnailingEvaluator.NAME);
// Evaluate the thumbnail definition which has failed.
//
// 1. A node that has failed once - and more recently than the limit.
ActionCondition condition = new ActionConditionImpl(GUID.generate(), NodeEligibleForRethumbnailingEvaluator.NAME);
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_THUMBNAIL_DEFINITION_NAME, thumbnailDef1.getLocalName());
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_RETRY_PERIOD,
failureHandlingOptions.getRetryPeriod() * 1000);
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_RETRY_COUNT,
failureHandlingOptions.getRetryCount());
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD,
failureHandlingOptions.getQuietPeriod() * 1000);
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD_RETRIES_ENABLED, true);
assertFalse(evaluator.evaluate(condition, recentlyFailedNodeRef));
// 2. A node that has failed once - but longer ago than the lower limit.
Map<String, FailedThumbnailInfo> failures = thumbnailService.getFailedThumbnails(recentlyFailedNodeRef);
assertFalse(failures.isEmpty());
final FailedThumbnailInfo failedThumbnailInfo = failures.get(thumbnailDef1.getLocalName());
final long timeBeforeTheLimit = new Date().getTime() - (failureHandlingOptions.getRetryPeriod() * 1000l) - 5000l;
nodeService.setProperty(failedThumbnailInfo.getFailedThumbnailNode(), ContentModel.PROP_FAILED_THUMBNAIL_TIME, timeBeforeTheLimit);
assertTrue(evaluator.evaluate(condition, recentlyFailedNodeRef));
// 3. If the same node had failed retryCount times, it would not be eligible.
// At this point it would be a "difficult" document.
nodeService.setProperty(failedThumbnailInfo.getFailedThumbnailNode(), ContentModel.PROP_FAILURE_COUNT, failureHandlingOptions.getRetryCount());
assertFalse(evaluator.evaluate(condition, recentlyFailedNodeRef));
// 4. If it had failed retryCount times, but its last failure time was more than
// quietPeriod seconds ago, then it would be eligible.
final long timeBeforeTheLongLimit = new Date().getTime() - (failureHandlingOptions.getQuietPeriod() * 1000l) - 5000l;
nodeService.setProperty(failedThumbnailInfo.getFailedThumbnailNode(), ContentModel.PROP_FAILED_THUMBNAIL_TIME, timeBeforeTheLongLimit);
assertTrue(evaluator.evaluate(condition, recentlyFailedNodeRef));
// 5. Unless the retries during the quiet period are disabled...
condition.setParameterValue(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD_RETRIES_ENABLED, false);
assertFalse(evaluator.evaluate(condition, recentlyFailedNodeRef));
}
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:56,代碼來源:NodeEligibleForRethumbnailingEvaluatorTest.java
示例15: testFail
import org.alfresco.repo.action.ActionConditionImpl; //導入依賴的package包/類
public void testFail()
{
ActionCondition condition = new ActionConditionImpl(ID, HasAspectEvaluator.NAME, null);
condition.setParameterValue(HasAspectEvaluator.PARAM_ASPECT, ContentModel.ASPECT_VERSIONABLE);
assertFalse(this.evaluator.evaluate(condition, this.nodeRef));
}