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

public class SubscribeMassAction {}

@@ -68,40 +68,1427 @@
 s;%0A%0A
-public class SubscribeMassAction %7B
+import org.xcolab.client.contest.ContestClientUtil;%0Aimport org.xcolab.client.contest.pojo.Contest;%0Aimport org.xcolab.view.pages.contestmanagement.entities.MassActionRequiresConfirmationException;%0Aimport org.xcolab.view.pages.contestmanagement.utils.ContestMassActionMethods;%0A%0Aimport java.util.List;%0A%0Apublic class SubscribeMassAction extends ContestMassActionAdapter %7B%0A%0A    private Long memberId;%0A    private final boolean isSubscribe;%0A%0A    public SubscribeMassAction(boolean isSubscribe) %7B%0A        super(isSubscribe ? %22Subscribe to activity%22 : %22Unsubscribe from activity%22);%0A        this.isSubscribe = isSubscribe;%0A    %7D%0A%0A    @Override%0A    public void setup(MassActionDataWrapper dataWrapper) %7B%0A        memberId = dataWrapper.getMemberId();%0A    %7D%0A%0A    @Override%0A    public void execute(List%3CContest%3E contests, boolean actionConfirmed)%0A            throws IllegalStateException %7B%0A        if (memberId == null) %7B%0A            throw new IllegalStateException(%22The mass action has not been setup yet.%22);%0A        %7D%0A        for (Contest contest : contests) %7B%0A            if (!contest.getIsSharedContestInForeignColab()) %7B%0A                if (isSubscribe) %7B%0A                    ContestClientUtil.subscribeMemberToContest(contest.getContestPK(), memberId);%0A                %7D else %7B%0A                    ContestClientUtil.unsubscribeMemberFromContest(contest.getContestPK(), memberId);%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A
 %7D%0A

implement subscribe mass action