package org.xcolab.view.pages.contestmanagement.entities.massactions;

import org.xcolab.client.contest.pojo.Contest;
import org.xcolab.view.pages.contestmanagement.entities.MassActionRequiresConfirmationException;
import org.xcolab.view.pages.contestmanagement.wrappers.ContestOverviewWrapper;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ActiveMassAction extends ContestMassAction {

    public ActiveMassAction() {
        super("Active", "Prior");
    }

    @Override
    void execute(HttpServletRequest request, HttpServletResponse response,
            ContestOverviewWrapper contestOverviewWrapper)
            throws IOException, MassActionRequiresConfirmationException {
        Contest.setContestActive(true);
    }
}

@@ -101,320 +101,96 @@
 est.
-pojo.
 Contest
-;%0Aimport org.xcolab.view.pages.contestmanagement.entities.MassActionRequiresConfirmationException;%0Aimport org.xcolab.view.pages.contestmanagement.wrappers.ContestOverviewWrapper;%0A%0Aimport java.io.IOException;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse
+ClientUtil;%0Aimport org.xcolab.client.contest.pojo.Contest;%0A%0Aimport java.util.List
 ;%0A%0Ap
@@ -243,16 +243,23 @@
 ssAction
+Adapter
  %7B%0A%0A    
@@ -263,57 +263,184 @@
    p
-ublic ActiveMassAction() %7B%0A        super(
+rivate final boolean setActive;%0A%0A    public ActiveMassAction() %7B%0A        this(false);%0A    %7D%0A%0A    public ActiveMassAction(boolean setActive) %7B%0A        super(setActive ? 
 %22Active%22
 , %22P
@@ -435,17 +435,18 @@
 %22Active%22
-,
+ :
  %22Prior%22
@@ -448,16 +448,52 @@
 rior%22);%0A
+        this.setActive = setActive;%0A
     %7D%0A%0A 
@@ -509,16 +509,23 @@
 ide%0A    
+public 
 void exe
@@ -533,65 +533,101 @@
 ute(
-HttpServletRequest requ
+List%3CContest%3E cont
 est
+s
 , 
-HttpServletResponse response,
+boolean actionConfirmed) %7B%0A        for (Contest contest : contests) %7B
 %0A   
@@ -639,128 +639,151 @@
     
-C
+if (c
 ontest
-OverviewWrapper contestOverviewWrapper)%0A            throws IOException, MassActionRequiresConfirmationException %7B
+.getIsSharedContestInForeignColab()) %7B%0A                contest = ContestClientUtil.getContest(contest.getContestPK());%0A            %7D
 %0A   
@@ -787,17 +787,21 @@
         
-C
+    c
 ontest.s
@@ -820,14 +820,60 @@
 ive(
-true);
+setActive);%0A            contest.persist();%0A        %7D
 %0A   

implement ActiveMassAction