Permalink
Browse files

Add lazy_regen query param to content promotion API calls.

  • Loading branch information...
1 parent 3d1cbc1 commit c9d341f4a6a78f3dc14dd962ae0f84ec2fe222eb @dgoodwin dgoodwin committed Jun 13, 2012
@@ -35,6 +35,7 @@
private PoolManager poolManager;
public static final String ENV = "env_id";
public static final String CONTENT = "content_ids";
+ public static final String LAZY_REGEN = "lazy_regen";
@Inject
public RegenEnvEntitlementCertsJob(PoolManager poolManager) {
@@ -47,7 +48,8 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException {
ENV);
Set<String> contentIds = (Set<String>)
arg0.getJobDetail().getJobDataMap().get(CONTENT);
+ Boolean lazy = arg0.getMergedJobDataMap().getBoolean(LAZY_REGEN);
- this.poolManager.regenerateCertificatesOf(env, contentIds, true);
+ this.poolManager.regenerateCertificatesOf(env, contentIds, lazy);
}
}
@@ -44,6 +44,7 @@
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -162,7 +163,8 @@ public void deleteEnv(@PathParam("env_id") @Verify(Environment.class) String env
@Path("/{env_id}/content")
public JobDetail promoteContent(
@PathParam("env_id") @Verify(Environment.class) String envId,
- List<EnvironmentContent> contentToPromote) {
+ List<EnvironmentContent> contentToPromote,
+ @QueryParam("lazy_regen") @DefaultValue("true") Boolean lazyRegen) {
Environment env = lookupEnvironment(envId);
@@ -179,6 +181,7 @@ public JobDetail promoteContent(
JobDataMap map = new JobDataMap();
map.put(RegenEnvEntitlementCertsJob.ENV, env);
map.put(RegenEnvEntitlementCertsJob.CONTENT, contentIds);
+ map.put(RegenEnvEntitlementCertsJob.LAZY_REGEN, lazyRegen);
JobDetail detail = newJob(RegenEnvEntitlementCertsJob.class)
.withIdentity("regen_entitlement_cert_of_env" + Util.generateUUID())
@@ -211,7 +214,8 @@ public JobDetail promoteContent(
@Path("/{env_id}/content")
public JobDetail demoteContent(
@PathParam("env_id") @Verify(Environment.class) String envId,
- @QueryParam("content") String[] contentIds) {
+ @QueryParam("content") String[] contentIds,
+ @QueryParam("lazy_regen") @DefaultValue("true") Boolean lazyRegen) {
Environment e = lookupEnvironment(envId);
Set<String> demotedContentIds = new HashSet<String>();
@@ -225,6 +229,7 @@ public JobDetail demoteContent(
JobDataMap map = new JobDataMap();
map.put(RegenEnvEntitlementCertsJob.ENV, e);
map.put(RegenEnvEntitlementCertsJob.CONTENT, demotedContentIds);
+ map.put(RegenEnvEntitlementCertsJob.LAZY_REGEN, lazyRegen);
JobDetail detail = newJob(RegenEnvEntitlementCertsJob.class)
.withIdentity("regen_entitlement_cert_of_env" + Util.generateUUID())

0 comments on commit c9d341f

Please sign in to comment.