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

Commit 159c47e

Browse files
authored
Merge pull request #559 from appirio-tech/dev
Add skipForum flag
2 parents 3aa450e + f568ee2 commit 159c47e

File tree

4 files changed

+162
-30
lines changed

4 files changed

+162
-30
lines changed

services/contest_service_facade/build.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ component.distfilename=contest_service_facade
44
component.package=com.topcoder.service.facade.contest
55
component.packagedir=com/topcoder/service/facade/contest
66
component.version.major=1
7-
component.version.minor=1
7+
component.version.minor=2
88
component.version.micro=0
99
component.version.build=1

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

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,33 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject,SoftwareCom
595595
*/
596596
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
597597
long tcDirectProjectId, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException;
598-
598+
599+
/**
600+
* <p>
601+
* Creates a new <code>SoftwareCompetition</code> in the persistence.
602+
* </p>
603+
* Updated for Version 1.0.1 - BUGR-2185: For development contests, if asset (or component) exists from design
604+
* contests then that is used to create a new contest. Otherwise a new asset is also created. Updated for Version1.5
605+
* the code is refactored by the logic: 1. check the permission 2. update or create the asset 3. set default
606+
* resources 4. create project 5. prepare the return value 6. persist the eligility
607+
* <p>
608+
* Update in v1.5.1: add parameter TCSubject which contains the security info for current user.
609+
* </p>
610+
* @param tcSubject TCSubject instance contains the login security info for the current user
611+
* @param contest the <code>SoftwareCompetition</code> to create as a contest
612+
* @param tcDirectProjectId the TC direct project id. a <code>long</code> providing the ID of a client the new
613+
* competition belongs to.
614+
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
615+
* @param endDate the end date for submission phase. Can be null if to use default.
616+
* @param skipForum true if skip forum creation
617+
* @return the created <code>SoftwareCompetition</code> as a contest
618+
* @throws IllegalArgumentException if the input argument is invalid.
619+
* @throws ContestServiceException if an error occurs when interacting with the service layer.
620+
* @since 1.6.4
621+
*/
622+
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
623+
long tcDirectProjectId, Date multiRoundEndDate, Date endDate, boolean skipForum) throws ContestServiceException, PermissionServiceException;
624+
599625
/**
600626
* <p>
601627
* Creates a new <code>SoftwareCompetition</code> in the persistence.
@@ -614,7 +640,28 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
614640
*/
615641
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
616642
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException;
617-
643+
644+
/**
645+
* <p>
646+
* Creates a new <code>SoftwareCompetition</code> in the persistence.
647+
* </p>
648+
*
649+
* @param tcSubject TCSubject instance contains the login security info for the current user
650+
* @param contest the <code>SoftwareCompetition</code> to create as a contest
651+
* @param tcDirectProjectId the TC direct project id. a <code>long</code> providing the ID of a client the new
652+
* competition belongs to.
653+
* @param regEndDate the registration end date
654+
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
655+
* @param endDate the end date for submission phase. Can be null if to use default.
656+
* @param skipForum true if no need to create the forum
657+
* @return the created <code>SoftwareCompetition</code> as a contest
658+
* @throws IllegalArgumentException if the input argument is invalid.
659+
* @throws ContestServiceException if an error occurs when interacting with the service layer.
660+
*/
661+
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
662+
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate, boolean skipForum) throws ContestServiceException, PermissionServiceException;
663+
664+
618665
/**
619666
* <p>
620667
* BURG-1716: We need to add a method to get software contest by project id,
@@ -685,7 +732,7 @@ public SoftwareCompetition updateSoftwareContest(TCSubject tcSubject,
685732
*/
686733
public SoftwareCompetition updateSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
687734
long tcDirectProjectId, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException;
688-
735+
689736
/**
690737
* <p>
691738
* Updates a <code>SoftwareCompetition</code> in the persistence.

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

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

topcoder_global.properties.docker

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
base=/root/direct
2-
libdir=${base}/lib
3-
tcs_libdir=${libdir}/tcs
4-
direct_service_libdir=${libdir}/tcs/ejb
5-
jar_tcs_libdir=${libdir}/tcs
6-
cronos_libdir=${libdir}/tcs
7-
ext_libdir=${libdir}/third_party
8-
jar_ext_libdir==${libdir}/third_party
9-
jboss.home=/data/jboss-4.2.3.GA
10-
jboss_home=${jboss.home}
11-
server.name=default
12-
jboss.config.name=${server.name}
13-
jboss_config_name=${server.name}
14-
jboss_lib=${jboss.home}/server/${server.name}/lib
15-
apache_tcdocs=/mnt/apache/tcdocs
16-
17-
# The svn user, it is optional, then the cached username/password will be used.
18-
# Uncomment and configure these settings if you want to use predefined svn credentials.
19-
#svn.username=xxx
20-
#svn.password=xxx
1+
base=/data
2+
libdir=${base}/lib
3+
tcs_libdir=${libdir}/tcs
4+
direct_service_libdir=${libdir}/tcs/ejb
5+
jar_tcs_libdir=${libdir}/tcs
6+
cronos_libdir=${libdir}/tcs
7+
ext_libdir=${libdir}/third_party
8+
jar_ext_libdir==${libdir}/third_party
9+
jboss.home=/data/jboss-4.2.3.GA
10+
jboss_home=${jboss.home}
11+
server.name=default
12+
jboss.config.name=${server.name}
13+
jboss_config_name=${server.name}
14+
jboss_lib=${jboss.home}/server/${server.name}/lib
15+
apache_tcdocs=/mnt/apache/tcdocs
16+
17+
# The svn user, it is optional, then the cached username/password will be used.
18+
# Uncomment and configure these settings if you want to use predefined svn credentials.
19+
#svn.username=xxx
20+
#svn.password=xxx

0 commit comments

Comments
 (0)