mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-4348 - More replication job scheduling work
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22021 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -102,15 +102,10 @@ public abstract class AbstractReplicationWebscript extends DeclarativeWebScript
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the schedule related properties, based on the
|
||||
* JSON, and has these persisted as required.
|
||||
*/
|
||||
protected void updateDefinitionScheduling(ReplicationDefinition replicationDefinition, JSONObject json)
|
||||
throws JSONException
|
||||
{
|
||||
|
||||
|
||||
// Now for the scheduling parts
|
||||
|
||||
if(json.has("schedule") && !json.isNull("schedule")) {
|
||||
// Turn on scheduling, if not already enabled
|
||||
replicationService.enableScheduling(replicationDefinition);
|
||||
@@ -119,9 +114,13 @@ public abstract class AbstractReplicationWebscript extends DeclarativeWebScript
|
||||
JSONObject schedule = json.getJSONObject("schedule");
|
||||
|
||||
if(schedule.has("start") && !schedule.isNull("start")) {
|
||||
replicationDefinition.setScheduleStart(
|
||||
ISO8601DateFormat.parse(schedule.getString("start"))
|
||||
);
|
||||
// Look for start:.... or start:{"iso8601":....}
|
||||
String startDate = schedule.getString("start");
|
||||
if(schedule.get("start") instanceof JSONObject) {
|
||||
startDate = schedule.getJSONObject("start").getString("iso8601");
|
||||
}
|
||||
|
||||
replicationDefinition.setScheduleStart( ISO8601DateFormat.parse(startDate) );
|
||||
} else {
|
||||
replicationDefinition.setScheduleStart(null);
|
||||
}
|
||||
@@ -141,9 +140,6 @@ public abstract class AbstractReplicationWebscript extends DeclarativeWebScript
|
||||
} else {
|
||||
replicationDefinition.setScheduleIntervalCount(null);
|
||||
}
|
||||
|
||||
// Ensure the scheduling is saved
|
||||
replicationService.saveReplicationDefinition(replicationDefinition);
|
||||
} else {
|
||||
// Disable scheduling
|
||||
replicationService.disableScheduling(replicationDefinition);
|
||||
|
@@ -85,9 +85,6 @@ public class ReplicationDefinitionPut extends AbstractReplicationWebscript
|
||||
|
||||
// Save the changes
|
||||
replicationService.saveReplicationDefinition(replicationDefinition);
|
||||
|
||||
// Now do the scheduling
|
||||
updateDefinitionScheduling(replicationDefinition, json);
|
||||
}
|
||||
catch (IOException iox)
|
||||
{
|
||||
|
@@ -72,9 +72,6 @@ public class ReplicationDefinitionsPost extends AbstractReplicationWebscript
|
||||
|
||||
// Save the changes
|
||||
replicationService.saveReplicationDefinition(replicationDefinition);
|
||||
|
||||
// Now do the scheduling
|
||||
updateDefinitionScheduling(replicationDefinition, json);
|
||||
}
|
||||
catch (IOException iox)
|
||||
{
|
||||
|
@@ -50,6 +50,8 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
|
||||
/**
|
||||
* Tests for the Replication Webscripts
|
||||
* @author Nick Burch
|
||||
*
|
||||
* TODO - Scheduling parts
|
||||
*/
|
||||
public class ReplicationRestApiTest extends BaseWebScriptTest
|
||||
{
|
||||
|
Reference in New Issue
Block a user