@@ -3635,7 +3635,56 @@ private void checkContestBillingAccount(long billingAccountId, long directProjec
3635
3635
public SoftwareCompetition createSoftwareContest (TCSubject tcSubject , SoftwareCompetition contest ,
3636
3636
long tcDirectProjectId , Date multiRoundEndDate , Date endDate )
3637
3637
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 );
3639
3688
}
3640
3689
3641
3690
/**
@@ -3663,8 +3712,41 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
3663
3712
public SoftwareCompetition createSoftwareContest (TCSubject tcSubject , SoftwareCompetition contest ,
3664
3713
long tcDirectProjectId , Date regEndDate , Date multiRoundEndDate , Date endDate )
3665
3714
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 ) + "]" );
3668
3750
3669
3751
try {
3670
3752
ExceptionUtils .checkNull (contest , null , null , "The contest to create is null." );
@@ -3715,7 +3797,7 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
3715
3797
checkBillingProjectCCA (contest );
3716
3798
3717
3799
// update the AssetDTO and update corresponding properties
3718
- createUpdateAssetDTO (tcSubject , contest );
3800
+ createUpdateAssetDTO (tcSubject , contest , skipForum );
3719
3801
3720
3802
com .topcoder .management .resource .Resource [] contestResources = createContestResources (tcSubject , contest ,
3721
3803
billingProjectId , requireApproval );
@@ -4015,10 +4097,11 @@ private boolean shouldAutoCreateBugHuntContest(SoftwareCompetition contest) {
4015
4097
* @param tcSubject TCSubject instance contains the login security info for the
4016
4098
* current user
4017
4099
* @param contest the contest
4100
+ * @param skipForum true if no need to create forum
4018
4101
* @throws EntityNotFoundException if any error occurs
4019
4102
* @throws com.topcoder.catalog.service.PersistenceException if any error occurs
4020
4103
*/
4021
- private void createUpdateAssetDTO (TCSubject tcSubject , SoftwareCompetition contest ) throws EntityNotFoundException ,
4104
+ private void createUpdateAssetDTO (TCSubject tcSubject , SoftwareCompetition contest , boolean skipForum ) throws EntityNotFoundException ,
4022
4105
com .topcoder .catalog .service .PersistenceException , DAOException , ConfigManagerException {
4023
4106
// check if it is going to create development contest
4024
4107
boolean isDevContest = isDevContest (contest );
@@ -4055,7 +4138,7 @@ else if (isDevContest) {
4055
4138
}
4056
4139
long forumId = 0 ;
4057
4140
// create forum
4058
- if (createForum ) {
4141
+ if (createForum && ! skipForum ) {
4059
4142
if (useExistingAsset && assetDTO .getForum () != null ) {
4060
4143
forumId = assetDTO .getForum ().getJiveCategoryId ();
4061
4144
} else {
@@ -4072,6 +4155,8 @@ else if (isDevContest) {
4072
4155
}
4073
4156
}
4074
4157
}
4158
+ } else {
4159
+ logger .info ("Skip forum creation" );
4075
4160
}
4076
4161
4077
4162
// if forum created
0 commit comments