mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4162: fixed formatting
This commit is contained in:
@@ -96,6 +96,7 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
|
||||
private static final String MESSAGE_PARTIAL_TEMPLATE = "Processed first {0} records.";
|
||||
private static final String MESSAGE_NO_RECORDS_TO_PROCESS = "There where no records to be processed.";
|
||||
|
||||
|
||||
/** services */
|
||||
private PatchDAO patchDAO;
|
||||
private NodeDAO nodeDAO;
|
||||
@@ -161,7 +162,7 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
|
||||
// get the max node id and the extended security aspect
|
||||
Long maxNodeId = patchDAO.getMaxAdmNodeID();
|
||||
final Pair<Long, QName> recordAspectPair = qnameDAO.getQName(ASPECT_EXTENDED_SECURITY);
|
||||
if (recordAspectPair == null)
|
||||
if(recordAspectPair == null)
|
||||
{
|
||||
model.put(MODEL_STATUS, SUCCESS_STATUS);
|
||||
model.put(MODEL_MESSAGE, MESSAGE_NO_RECORDS_TO_PROCESS);
|
||||
@@ -262,8 +263,10 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
|
||||
try
|
||||
{
|
||||
String mimetype = getContainer().getFormatRegistry().getMimeType(req.getAgent(), format);
|
||||
if (mimetype == null) { throw new WebScriptException(
|
||||
"Web Script format '" + format + "' is not registered"); }
|
||||
if (mimetype == null)
|
||||
{
|
||||
throw new WebScriptException("Web Script format '" + format + "' is not registered");
|
||||
}
|
||||
|
||||
// construct model for script / template
|
||||
Status status = new Status();
|
||||
@@ -362,7 +365,7 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
|
||||
protected Long getMaxToProccessParameter(WebScriptRequest req, final Long batchSize)
|
||||
{
|
||||
String totalToBeProcessedRecordsStr = req.getParameter(TOTAL_NUMBER_TO_PROCESS);
|
||||
// default total number of records to be processed to batch size value
|
||||
//default total number of records to be processed to batch size value
|
||||
Long totalNumberOfRecordsToProcess = batchSize;
|
||||
if (StringUtils.isNotBlank(totalToBeProcessedRecordsStr))
|
||||
{
|
||||
@@ -370,9 +373,9 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
|
||||
{
|
||||
totalNumberOfRecordsToProcess = Long.parseLong(totalToBeProcessedRecordsStr);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
catch(NumberFormatException ex)
|
||||
{
|
||||
// do nothing here, the value will remain 0L in this case
|
||||
//do nothing here, the value will remain 0L in this case
|
||||
}
|
||||
}
|
||||
return totalNumberOfRecordsToProcess;
|
||||
@@ -450,9 +453,9 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
|
||||
final List<NodeRef> processedNodes = new ArrayList<NodeRef>();
|
||||
logger.info(MESSAGE_PROCESSING_BEGIN);
|
||||
// by batch size
|
||||
for (Long i = 0L; i < maxNodeId; i += batchSize)
|
||||
for (Long i = 0L; i < maxNodeId; i+=batchSize)
|
||||
{
|
||||
if (maxRecordsToProcess != 0 && processedNodes.size() >= maxRecordsToProcess)
|
||||
if(maxRecordsToProcess != 0 && processedNodes.size() >= maxRecordsToProcess)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -469,7 +472,7 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
|
||||
// process each one
|
||||
for (Long nodeId : nodeIds)
|
||||
{
|
||||
if (maxRecordsToProcess != 0 && processedNodes.size() >= maxRecordsToProcess)
|
||||
if(maxRecordsToProcess != 0 && processedNodes.size() >= maxRecordsToProcess)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -557,12 +560,12 @@ public class DynamicAuthoritiesGet extends AbstractWebScript implements RecordsM
|
||||
*
|
||||
* @param nodeRef
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@SuppressWarnings({ "unchecked"})
|
||||
protected void processNode(NodeRef nodeRef)
|
||||
{
|
||||
// get the reader/writer data
|
||||
Map<String, Integer> readers = (Map<String, Integer>) nodeService.getProperty(nodeRef, PROP_READERS);
|
||||
Map<String, Integer> writers = (Map<String, Integer>) nodeService.getProperty(nodeRef, PROP_WRITERS);
|
||||
Map<String, Integer> readers = (Map<String, Integer>)nodeService.getProperty(nodeRef, PROP_READERS);
|
||||
Map<String, Integer> writers = (Map<String, Integer>)nodeService.getProperty(nodeRef, PROP_WRITERS);
|
||||
|
||||
// remove extended security aspect
|
||||
nodeService.removeAspect(nodeRef, ASPECT_EXTENDED_SECURITY);
|
||||
|
@@ -172,7 +172,8 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
}
|
||||
|
||||
/**
|
||||
* Given that there are no nodes with the extended security aspect When the action is executed Nothing happens
|
||||
* Given that there are no nodes with the extended security aspect
|
||||
* When the action is executed Nothing happens
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -205,8 +206,11 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
}
|
||||
|
||||
/**
|
||||
* Given that there are records with the extended security aspect When the action is executed Then the aspect is
|
||||
* removed And the dynamic authorities permissions are cleared And extended security is set via the updated API
|
||||
* Given that there are records with the extended security aspect
|
||||
* When the action is executed
|
||||
* Then the aspect is removed
|
||||
* And the dynamic authorities permissions are cleared
|
||||
* And extended security is set via the updated API
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -227,7 +231,6 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
.thenReturn((Serializable) Collections.emptyMap());
|
||||
when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS))
|
||||
.thenReturn((Serializable) Collections.emptyMap());
|
||||
|
||||
});
|
||||
|
||||
// Set up parameters.
|
||||
@@ -251,8 +254,9 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
}
|
||||
|
||||
/**
|
||||
* Given that there are non-records with the extended security aspect When the web script is executed Then the
|
||||
* aspect is removed And the dynamic authorities permissions are cleared
|
||||
* Given that there are non-records with the extended security aspect
|
||||
* When the web script is executed
|
||||
* Then the aspect is removed And the dynamic authorities permissions are cleared
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -273,7 +277,6 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
.thenReturn((Serializable) Collections.emptyMap());
|
||||
when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS))
|
||||
.thenReturn((Serializable) Collections.emptyMap());
|
||||
|
||||
});
|
||||
|
||||
// Set up parameters.
|
||||
@@ -285,6 +288,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
String expectedJSONString = "{\"responsestatus\":\"success\",\"message\":\"Processed 3 records.\"}";
|
||||
assertEquals(mapper.readTree(expectedJSONString), mapper.readTree(actualJSONString));
|
||||
|
||||
|
||||
verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_READERS));
|
||||
verify(mockedNodeService, times(3)).getProperty(any(NodeRef.class), eq(PROP_WRITERS));
|
||||
verify(mockedNodeService, times(3)).removeAspect(any(NodeRef.class), eq(ASPECT_EXTENDED_SECURITY));
|
||||
@@ -361,7 +365,7 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
@Test
|
||||
public void processAllRecordsWhenMaxProcessedRecordsIsZero() throws Exception
|
||||
{
|
||||
List<Long> ids = Stream.of(1l, 2l, 3l, 4l).collect(Collectors.toList());
|
||||
List<Long> ids = Stream.of(1l, 2l, 3l,4l).collect(Collectors.toList());
|
||||
|
||||
when(mockedPatchDAO.getNodesByAspectQNameId(eq(ASPECT_ID), anyLong(), anyLong())).thenReturn(ids)
|
||||
.thenReturn(Collections.emptyList());
|
||||
@@ -374,7 +378,6 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
.thenReturn((Serializable) Collections.emptyMap());
|
||||
when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS))
|
||||
.thenReturn((Serializable) Collections.emptyMap());
|
||||
|
||||
});
|
||||
|
||||
// Set up parameters.
|
||||
@@ -403,7 +406,6 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
.thenReturn((Serializable) Collections.emptyMap());
|
||||
when(mockedNodeService.getProperty(nodeRef, PROP_WRITERS))
|
||||
.thenReturn((Serializable) Collections.emptyMap());
|
||||
|
||||
});
|
||||
|
||||
// Set up parameters.
|
||||
@@ -518,9 +520,10 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
}
|
||||
|
||||
/**
|
||||
* Given I have records that require migration And I am interested in knowning which records are migrated When I run
|
||||
* the migration tool Then I will be returned a CSV file containing the name and node reference of the record
|
||||
* migrated
|
||||
* Given I have records that require migration
|
||||
* And I am interested in knowning which records are migrated
|
||||
* When I run the migration tool
|
||||
* Then I will be returned a CSV file containing the name and node reference of the record migrated
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -558,8 +561,10 @@ public class DynamicAuthoritiesGetUnitTest extends BaseWebScriptUnitTest impleme
|
||||
}
|
||||
|
||||
/**
|
||||
* Given that I have record that require migration And I'm not interested in knowing which records were migrated
|
||||
* When I run the migration tool And I will not be returned a CSV file of details.
|
||||
* Given that I have record that require migration
|
||||
* And I'm not interested in knowing which records were migrated
|
||||
* When I run the migration tool
|
||||
* Then I will not be returned a CSV file of details.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
|
Reference in New Issue
Block a user