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:
Nick Burch
2010-08-26 13:56:44 +00:00
parent ce1f57c3b9
commit eb4b8fd94e
5 changed files with 16 additions and 22 deletions

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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)
{

View File

@@ -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
{