|
10 | 10 | import com.topcoder.direct.services.project.milestone.model.SortOrder; |
11 | 11 | import com.topcoder.direct.services.view.action.analytics.longcontest.MarathonMatchHelper; |
12 | 12 | import com.topcoder.direct.services.view.action.analytics.longcontest.services.MarathonMatchAnalyticsService; |
| 13 | +import com.topcoder.direct.services.view.action.setting.ChallengeConfirmationPreferenceAction; |
13 | 14 | import com.topcoder.direct.services.view.dto.cloudvm.VMInstanceData; |
14 | 15 | import com.topcoder.direct.services.view.dto.cloudvm.VMInstanceStatus; |
15 | 16 | import com.topcoder.direct.services.view.dto.contest.ContestCopilotDTO; |
|
30 | 31 | import com.topcoder.service.project.CompetionType; |
31 | 32 | import com.topcoder.service.project.ProjectData; |
32 | 33 | import com.topcoder.service.project.SoftwareCompetition; |
| 34 | +import com.topcoder.shared.util.DBMS; |
| 35 | +import com.topcoder.web.common.RowNotFoundException; |
| 36 | +import com.topcoder.web.ejb.user.UserPreference; |
33 | 37 | import org.apache.struts2.ServletActionContext; |
34 | 38 |
|
35 | 39 | import org.apache.commons.lang.math.NumberUtils; |
|
242 | 246 | * load these data via ajax instead after the page finishes loading. |
243 | 247 | * </p> |
244 | 248 | * |
245 | | - * @author fabrizyo, FireIce, isv, morehappiness, GreatKevin, minhu, Veve, Ghost_141, GreatKevin, Veve |
246 | | - * @version 3.0 |
| 249 | + * <p> |
| 250 | + * Version 3.1 (TopCoder Direct - Draft Challenge Creation/Saving Prompt) |
| 251 | + * <ul> |
| 252 | + * <li>Adds the {@link #showSaveChallengeConfirmation} and its getter</li> |
| 253 | + * <li>Updates {@link #executeAction()} to populate the {@link #showSaveChallengeConfirmation}</li> |
| 254 | + * </ul> |
| 255 | + * </p> |
| 256 | + * |
| 257 | + * @author fabrizyo, FireIce, isv, morehappiness, GreatKevin, minhu, Veve, Ghost_141, GreatKevin, Veve, GreatKevin |
| 258 | + * @version 3.1 |
247 | 259 | */ |
248 | 260 | public class GetContestAction extends ContestAction { |
249 | 261 | /** |
@@ -359,6 +371,13 @@ public class GetContestAction extends ContestAction { |
359 | 371 | */ |
360 | 372 | private int timelineInterval; |
361 | 373 |
|
| 374 | + /** |
| 375 | + * The preference value of whether to show the save challenge confirmation. |
| 376 | + * |
| 377 | + * @since 3.1 |
| 378 | + */ |
| 379 | + private boolean showSaveChallengeConfirmation; |
| 380 | + |
362 | 381 | /** |
363 | 382 | * <p> |
364 | 383 | * Creates a <code>GetContestAction</code> instance. |
@@ -524,6 +543,17 @@ protected void executeAction() throws Exception { |
524 | 543 | billingAccountsForProject.add(billingAccount); |
525 | 544 | } |
526 | 545 |
|
| 546 | + UserPreference userPreference = this.getUserPreferenceHome().create(); |
| 547 | + |
| 548 | + try { |
| 549 | + String value = userPreference.getValue(DirectUtils.getTCSubjectFromSession().getUserId(), |
| 550 | + ChallengeConfirmationPreferenceAction.CHALLENGE_CONFIRMATION_PREFERENCE_ID, |
| 551 | + DBMS.COMMON_OLTP_DATASOURCE_NAME); |
| 552 | + this.showSaveChallengeConfirmation = Boolean.valueOf(value); |
| 553 | + } catch (RowNotFoundException rfe) { |
| 554 | + this.showSaveChallengeConfirmation = true; |
| 555 | + } |
| 556 | + |
527 | 557 | // Set current project context based on selected contest |
528 | 558 | getSessionData().setCurrentProjectContext(contestStats.getContest().getProject()); |
529 | 559 | getSessionData().setCurrentSelectDirectProjectID(contestStats.getContest().getProject().getId()); |
@@ -968,4 +998,14 @@ public static enum TYPE { |
968 | 998 | COPILOT_CONTEST, CONTEST, CONTEST_JSON |
969 | 999 | } |
970 | 1000 |
|
| 1001 | + /** |
| 1002 | + * Gets whether to show the save challenge confirmation. |
| 1003 | + * |
| 1004 | + * @return true if show, false otherwise. |
| 1005 | + * @since 3.1 |
| 1006 | + */ |
| 1007 | + public boolean isShowSaveChallengeConfirmation() { |
| 1008 | + return showSaveChallengeConfirmation; |
| 1009 | + } |
| 1010 | + |
971 | 1011 | } |
0 commit comments