Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit d7d2cd6

Browse files
authored
Merge pull request #554 from appirio-tech/issue-551
Issue 551 add skipForum flag when creating challenge
2 parents fad372d + d0c91fa commit d7d2cd6

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

services/contest_service_facade/src/java/main/com/topcoder/service/facade/contest/ContestServiceFacade.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,27 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
614614
*/
615615
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
616616
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException;
617-
617+
618+
/**
619+
* <p>
620+
* Creates a new <code>SoftwareCompetition</code> in the persistence.
621+
* </p>
622+
*
623+
* @param tcSubject TCSubject instance contains the login security info for the current user
624+
* @param contest the <code>SoftwareCompetition</code> to create as a contest
625+
* @param tcDirectProjectId the TC direct project id. a <code>long</code> providing the ID of a client the new
626+
* competition belongs to.
627+
* @param regEndDate the registration end date
628+
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
629+
* @param endDate the end date for submission phase. Can be null if to use default.
630+
* @param skipForum true if skip forum creation
631+
* @return the created <code>SoftwareCompetition</code> as a contest
632+
* @throws IllegalArgumentException if the input argument is invalid.
633+
* @throws ContestServiceException if an error occurs when interacting with the service layer.
634+
*/
635+
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
636+
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate, boolean skipForum) throws ContestServiceException, PermissionServiceException;
637+
618638
/**
619639
* <p>
620640
* BURG-1716: We need to add a method to get software contest by project id,

services/contest_service_facade/src/java/main/com/topcoder/service/facade/contest/ejb/ContestServiceFacadeBean.java

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3663,6 +3663,37 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
36633663
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
36643664
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate)
36653665
throws ContestServiceException, PermissionServiceException {
3666+
return createSoftwareContest(
3667+
tcSubject, contest, tcDirectProjectId, regEndDate, multiRoundEndDate, endDate, false);
3668+
}
3669+
3670+
/**
3671+
* <p>
3672+
* Creates a new <code>SoftwareCompetition</code> in the persistence.
3673+
* </p>
3674+
*
3675+
* @param tcSubject TCSubject instance contains the login security info
3676+
* for the current user
3677+
* @param contest the <code>SoftwareCompetition</code> to create as a
3678+
* contest
3679+
* @param tcDirectProjectId the TC direct project id. a <code>long</code>
3680+
* providing the ID of a client the new competition
3681+
* belongs to.
3682+
* @param regEndDate the registration end date
3683+
* @param multiRoundEndDate the end date for the multiround phase. No multiround
3684+
* if it's null.
3685+
* @param endDate the end date for submission phase. Can be null if to
3686+
* use default.
3687+
* @param skipForum true if no need to create the forum
3688+
*
3689+
* @return the created <code>SoftwareCompetition</code> as a contest
3690+
* @throws IllegalArgumentException if the input argument is invalid.
3691+
* @throws ContestServiceException if an error occurs when interacting with the
3692+
* service layer.
3693+
*/
3694+
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
3695+
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate, boolean skipForum)
3696+
throws ContestServiceException, PermissionServiceException {
36663697
logger.debug("createSoftwareContest with information : [tcSubject = " + tcSubject.getUserId()
36673698
+ ", tcDirectProjectId =" + tcDirectProjectId + ", multiRoundEndDate = " + multiRoundEndDate + "]");
36683699

@@ -3715,7 +3746,7 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
37153746
checkBillingProjectCCA(contest);
37163747

37173748
// update the AssetDTO and update corresponding properties
3718-
createUpdateAssetDTO(tcSubject, contest);
3749+
createUpdateAssetDTO(tcSubject, contest, skipForum);
37193750

37203751
com.topcoder.management.resource.Resource[] contestResources = createContestResources(tcSubject, contest,
37213752
billingProjectId, requireApproval);
@@ -4015,10 +4046,11 @@ private boolean shouldAutoCreateBugHuntContest(SoftwareCompetition contest) {
40154046
* @param tcSubject TCSubject instance contains the login security info for the
40164047
* current user
40174048
* @param contest the contest
4049+
* @param skipForum true if no need to create forum
40184050
* @throws EntityNotFoundException if any error occurs
40194051
* @throws com.topcoder.catalog.service.PersistenceException if any error occurs
40204052
*/
4021-
private void createUpdateAssetDTO(TCSubject tcSubject, SoftwareCompetition contest) throws EntityNotFoundException,
4053+
private void createUpdateAssetDTO(TCSubject tcSubject, SoftwareCompetition contest, boolean skipForum) throws EntityNotFoundException,
40224054
com.topcoder.catalog.service.PersistenceException, DAOException, ConfigManagerException {
40234055
// check if it is going to create development contest
40244056
boolean isDevContest = isDevContest(contest);
@@ -4055,7 +4087,7 @@ else if (isDevContest) {
40554087
}
40564088
long forumId = 0;
40574089
// create forum
4058-
if (createForum) {
4090+
if (createForum && !skipForum) {
40594091
if (useExistingAsset && assetDTO.getForum() != null) {
40604092
forumId = assetDTO.getForum().getJiveCategoryId();
40614093
} else {

0 commit comments

Comments
 (0)