mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
105991: Merged 5.0.N (5.0.3) to HEAD-BUG-FIX (5.1/Cloud) 105915: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.3) 105898: MNT-13901 TransformationOptions Timeout Can Not Easily Be Set - Fix "TransformationOptionPair.setMax(long max) and TransformationOptionPair.setLimit(long limit) so that they don't clear the other half of the pair when the value being set is < 0 (unset). - Unit tests added - Added comments about how the 'transformer' code builds up limits to include defaults. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@106013 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -179,6 +179,8 @@ public class TransformerConfigLimits extends TransformerPropertyNameExtractor
|
|||||||
int origLevel = getLevel(transformerName, sourceMimetype);
|
int origLevel = getLevel(transformerName, sourceMimetype);
|
||||||
|
|
||||||
TransformationOptionLimits limits = new TransformationOptionLimits();
|
TransformationOptionLimits limits = new TransformationOptionLimits();
|
||||||
|
// Start at the most general limits and then override with more specific values so that
|
||||||
|
// defaults from the most general get used if there is not something more specific.
|
||||||
for (int level=0; level<origLevel; level++)
|
for (int level=0; level<origLevel; level++)
|
||||||
{
|
{
|
||||||
TransformationOptionLimits defaultLimits =
|
TransformationOptionLimits defaultLimits =
|
||||||
|
@@ -78,8 +78,16 @@ public class TransformationOptionLimits implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defaults values that are set in this object into the
|
* <b>This method overrides rather than defaults values into the supplied limits</b> (as the
|
||||||
* supplied limits.
|
* name might suggest), but because of the order in which it is called, this results in the
|
||||||
|
* correct defaults being set.
|
||||||
|
* <p>
|
||||||
|
* A call to this method overrides any values in the supplied limits parameter with those
|
||||||
|
* in this Object. The supplied limits parameter is being gradually built up by initially
|
||||||
|
* setting the most general limits and then more specific values for each level. As a result
|
||||||
|
* 'default' values from the more general levels will still exist at the end if more specific
|
||||||
|
* ones have not been supplied.
|
||||||
|
*
|
||||||
* @param limits to be set
|
* @param limits to be set
|
||||||
*/
|
*/
|
||||||
public void defaultTo(TransformationOptionLimits limits)
|
public void defaultTo(TransformationOptionLimits limits)
|
||||||
|
@@ -92,8 +92,11 @@ public class TransformationOptionPair implements Serializable
|
|||||||
private void setMax(long max)
|
private void setMax(long max)
|
||||||
{
|
{
|
||||||
this.max = max;
|
this.max = max;
|
||||||
|
if (max >= 0)
|
||||||
|
{
|
||||||
this.limit = -1;
|
this.limit = -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public long getLimit()
|
public long getLimit()
|
||||||
{
|
{
|
||||||
@@ -111,8 +114,11 @@ public class TransformationOptionPair implements Serializable
|
|||||||
|
|
||||||
private void setLimit(long limit)
|
private void setLimit(long limit)
|
||||||
{
|
{
|
||||||
this.max = -1;
|
|
||||||
this.limit = limit;
|
this.limit = limit;
|
||||||
|
if (limit >= 0)
|
||||||
|
{
|
||||||
|
this.max = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getValue()
|
public long getValue()
|
||||||
@@ -139,8 +145,16 @@ public class TransformationOptionPair implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defaults values that are set in this pair into the
|
* <b>This method overrides rather than defaults values into the supplied pair</b> (as the
|
||||||
* supplied pair.
|
* name might suggest), but because of the order in which it is called, this results in the
|
||||||
|
* correct defaults being set.
|
||||||
|
* <p>
|
||||||
|
* A call to this method overrides any values in the supplied pair parameter with those
|
||||||
|
* in this Object. The supplied pair parameter is being gradually built up by initially
|
||||||
|
* setting the most general values and then more specific values for each level. As a result
|
||||||
|
* 'default' values from the more general levels will still exist at the end if more specific
|
||||||
|
* ones have not been supplied.
|
||||||
|
*
|
||||||
* @param pair to be set
|
* @param pair to be set
|
||||||
*/
|
*/
|
||||||
public void defaultTo(TransformationOptionPair pair)
|
public void defaultTo(TransformationOptionPair pair)
|
||||||
|
@@ -131,6 +131,26 @@ public class TransformationOptionPairTest
|
|||||||
assertEquals("Getter did not return set value", value, actual);
|
assertEquals("Getter did not return set value", value, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetMaxClearLimit() throws Exception
|
||||||
|
{
|
||||||
|
long value = 1234;
|
||||||
|
pair.setMax(value, null);
|
||||||
|
pair.setLimit(-1, null);
|
||||||
|
long actual = pair.getMax();
|
||||||
|
assertEquals("Getter did not return set value", value, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetLimitClearMax() throws Exception
|
||||||
|
{
|
||||||
|
long value = 1234;
|
||||||
|
pair.setLimit(value, null);
|
||||||
|
pair.setMax(-1, null);
|
||||||
|
long actual = pair.getLimit();
|
||||||
|
assertEquals("Getter did not return set value", value, actual);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetClearSet() throws Exception
|
public void testSetClearSet() throws Exception
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user