@@ -3635,7 +3635,56 @@ private void checkContestBillingAccount(long billingAccountId, long directProjec
36353635 public SoftwareCompetition createSoftwareContest (TCSubject tcSubject , SoftwareCompetition contest ,
36363636 long tcDirectProjectId , Date multiRoundEndDate , Date endDate )
36373637 throws ContestServiceException , PermissionServiceException {
3638- return createSoftwareContest (tcSubject , contest , tcDirectProjectId , null , null , null );
3638+ return createSoftwareContest (tcSubject , contest , tcDirectProjectId , null , null , false );
3639+ }
3640+
3641+ /**
3642+ * <p>
3643+ * Creates a new <code>SoftwareCompetition</code> in the persistence.
3644+ * </p>
3645+ * Updated for Version 1.0.1 - BUGR-2185: For development contests, if asset (or
3646+ * component) exists from design contests then that is used to create a new
3647+ * contest. Otherwise a new asset is also created. Updated for Version1.5 the
3648+ * code is refactored by the logic: 1. check the permission 2. update or create
3649+ * the asset 3. set default resources 4. create project 5. prepare the return
3650+ * value 6. persist the eligility
3651+ * <p>
3652+ * Update in v1.5.1: add parameter TCSubject which contains the security info
3653+ * for current user.
3654+ * </p>
3655+ *
3656+ * <p>
3657+ * Update in v1.8.3: Add handling of auto creation of bug hunt for assembly
3658+ * competition. If the assembly contest has bugHuntProjectHeader set and the
3659+ * properties not empty in bugHuntProjectHeader. A bug hunt contest is
3660+ * automatically created. The bug hunt contest will - have copilot inserted as
3661+ * reviewer (if exists) - use the start date of approval date as the start date
3662+ * and producation date of bug hunt contest. - add a "Bug Race For" link between
3663+ * the bug race contest and assembly contest
3664+ * </p>
3665+ *
3666+ * @param tcSubject TCSubject instance contains the login security info
3667+ * for the current user
3668+ * @param contest the <code>SoftwareCompetition</code> to create as a
3669+ * contest
3670+ * @param tcDirectProjectId the TC direct project id. a <code>long</code>
3671+ * providing the ID of a client the new competition
3672+ * belongs to.
3673+ * @param multiRoundEndDate the end date for the multiround phase. No multiround
3674+ * if it's null.
3675+ * @param endDate the end date for submission phase. Can be null if to
3676+ * use default.
3677+ * @param skipForum true if no need to create the forum
3678+ * @return the created <code>SoftwareCompetition</code> as a contest
3679+ * @throws IllegalArgumentException if the input argument is invalid.
3680+ * @throws ContestServiceException if an error occurs when interacting with the
3681+ * service layer.
3682+ * @since 1.6.6
3683+ */
3684+ public SoftwareCompetition createSoftwareContest (TCSubject tcSubject , SoftwareCompetition contest ,
3685+ long tcDirectProjectId , Date multiRoundEndDate , Date endDate , boolean skipForum )
3686+ throws ContestServiceException , PermissionServiceException {
3687+ return createSoftwareContest (tcSubject , contest , tcDirectProjectId , null , null , null , skipForum );
36393688 }
36403689
36413690 /**
@@ -3663,8 +3712,41 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
36633712 public SoftwareCompetition createSoftwareContest (TCSubject tcSubject , SoftwareCompetition contest ,
36643713 long tcDirectProjectId , Date regEndDate , Date multiRoundEndDate , Date endDate )
36653714 throws ContestServiceException , PermissionServiceException {
3666- logger .debug ("createSoftwareContest with information : [tcSubject = " + tcSubject .getUserId ()
3667- + ", tcDirectProjectId =" + tcDirectProjectId + ", multiRoundEndDate = " + multiRoundEndDate + "]" );
3715+ return createSoftwareContest (
3716+ tcSubject , contest , tcDirectProjectId , regEndDate , multiRoundEndDate , endDate , false );
3717+ }
3718+
3719+ /**
3720+ * <p>
3721+ * Creates a new <code>SoftwareCompetition</code> in the persistence.
3722+ * </p>
3723+ *
3724+ * @param tcSubject TCSubject instance contains the login security info
3725+ * for the current user
3726+ * @param contest the <code>SoftwareCompetition</code> to create as a
3727+ * contest
3728+ * @param tcDirectProjectId the TC direct project id. a <code>long</code>
3729+ * providing the ID of a client the new competition
3730+ * belongs to.
3731+ * @param regEndDate the registration end date
3732+ * @param multiRoundEndDate the end date for the multiround phase. No multiround
3733+ * if it's null.
3734+ * @param endDate the end date for submission phase. Can be null if to
3735+ * use default.
3736+ * @param skipForum true if no need to create the forum
3737+ *
3738+ * @return the created <code>SoftwareCompetition</code> as a contest
3739+ * @throws IllegalArgumentException if the input argument is invalid.
3740+ * @throws ContestServiceException if an error occurs when interacting with the
3741+ * service layer.
3742+ */
3743+ public SoftwareCompetition createSoftwareContest (TCSubject tcSubject , SoftwareCompetition contest ,
3744+ long tcDirectProjectId , Date regEndDate , Date multiRoundEndDate , Date endDate , boolean skipForum )
3745+ throws ContestServiceException , PermissionServiceException {
3746+ logger .info ("createSoftwareContest with information : [tcSubject = " + tcSubject .getUserId ()
3747+ + ", tcDirectProjectId =" + tcDirectProjectId
3748+ + ", multiRoundEndDate = " + multiRoundEndDate
3749+ + ", skipForum = " + String .valueOf (skipForum ) + "]" );
36683750
36693751 try {
36703752 ExceptionUtils .checkNull (contest , null , null , "The contest to create is null." );
@@ -3715,7 +3797,7 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
37153797 checkBillingProjectCCA (contest );
37163798
37173799 // update the AssetDTO and update corresponding properties
3718- createUpdateAssetDTO (tcSubject , contest );
3800+ createUpdateAssetDTO (tcSubject , contest , skipForum );
37193801
37203802 com .topcoder .management .resource .Resource [] contestResources = createContestResources (tcSubject , contest ,
37213803 billingProjectId , requireApproval );
@@ -4015,10 +4097,11 @@ private boolean shouldAutoCreateBugHuntContest(SoftwareCompetition contest) {
40154097 * @param tcSubject TCSubject instance contains the login security info for the
40164098 * current user
40174099 * @param contest the contest
4100+ * @param skipForum true if no need to create forum
40184101 * @throws EntityNotFoundException if any error occurs
40194102 * @throws com.topcoder.catalog.service.PersistenceException if any error occurs
40204103 */
4021- private void createUpdateAssetDTO (TCSubject tcSubject , SoftwareCompetition contest ) throws EntityNotFoundException ,
4104+ private void createUpdateAssetDTO (TCSubject tcSubject , SoftwareCompetition contest , boolean skipForum ) throws EntityNotFoundException ,
40224105 com .topcoder .catalog .service .PersistenceException , DAOException , ConfigManagerException {
40234106 // check if it is going to create development contest
40244107 boolean isDevContest = isDevContest (contest );
@@ -4055,7 +4138,7 @@ else if (isDevContest) {
40554138 }
40564139 long forumId = 0 ;
40574140 // create forum
4058- if (createForum ) {
4141+ if (createForum && ! skipForum ) {
40594142 if (useExistingAsset && assetDTO .getForum () != null ) {
40604143 forumId = assetDTO .getForum ().getJiveCategoryId ();
40614144 } else {
@@ -4072,6 +4155,8 @@ else if (isDevContest) {
40724155 }
40734156 }
40744157 }
4158+ } else {
4159+ logger .info ("Skip forum creation" );
40754160 }
40764161
40774162 // if forum created
0 commit comments