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

Commit

Permalink
Merge pull request #559 from appirio-tech/dev
Browse files Browse the repository at this point in the history
Add skipForum flag
  • Loading branch information
ajefts authored Jan 5, 2021
2 parents 3aa450e + f568ee2 commit 159c47e
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 30 deletions.
2 changes: 1 addition & 1 deletion services/contest_service_facade/build.version
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ component.distfilename=contest_service_facade
component.package=com.topcoder.service.facade.contest
component.packagedir=com/topcoder/service/facade/contest
component.version.major=1
component.version.minor=1
component.version.minor=2
component.version.micro=0
component.version.build=1
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,33 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject,SoftwareCom
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException;


/**
* <p>
* Creates a new <code>SoftwareCompetition</code> in the persistence.
* </p>
* Updated for Version 1.0.1 - BUGR-2185: For development contests, if asset (or component) exists from design
* contests then that is used to create a new contest. Otherwise a new asset is also created. Updated for Version1.5
* the code is refactored by the logic: 1. check the permission 2. update or create the asset 3. set default
* resources 4. create project 5. prepare the return value 6. persist the eligility
* <p>
* Update in v1.5.1: add parameter TCSubject which contains the security info for current user.
* </p>
* @param tcSubject TCSubject instance contains the login security info for the current user
* @param contest the <code>SoftwareCompetition</code> to create as a contest
* @param tcDirectProjectId the TC direct project id. a <code>long</code> providing the ID of a client the new
* competition belongs to.
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
* @param endDate the end date for submission phase. Can be null if to use default.
* @param skipForum true if skip forum creation
* @return the created <code>SoftwareCompetition</code> as a contest
* @throws IllegalArgumentException if the input argument is invalid.
* @throws ContestServiceException if an error occurs when interacting with the service layer.
* @since 1.6.4
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date multiRoundEndDate, Date endDate, boolean skipForum) throws ContestServiceException, PermissionServiceException;

/**
* <p>
* Creates a new <code>SoftwareCompetition</code> in the persistence.
Expand All @@ -614,7 +640,28 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException;


/**
* <p>
* Creates a new <code>SoftwareCompetition</code> in the persistence.
* </p>
*
* @param tcSubject TCSubject instance contains the login security info for the current user
* @param contest the <code>SoftwareCompetition</code> to create as a contest
* @param tcDirectProjectId the TC direct project id. a <code>long</code> providing the ID of a client the new
* competition belongs to.
* @param regEndDate the registration end date
* @param multiRoundEndDate the end date for the multiround phase. No multiround if it's null.
* @param endDate the end date for submission phase. Can be null if to use default.
* @param skipForum true if no need to create the forum
* @return the created <code>SoftwareCompetition</code> as a contest
* @throws IllegalArgumentException if the input argument is invalid.
* @throws ContestServiceException if an error occurs when interacting with the service layer.
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate, boolean skipForum) throws ContestServiceException, PermissionServiceException;


/**
* <p>
* BURG-1716: We need to add a method to get software contest by project id,
Expand Down Expand Up @@ -685,7 +732,7 @@ public SoftwareCompetition updateSoftwareContest(TCSubject tcSubject,
*/
public SoftwareCompetition updateSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date multiRoundEndDate, Date endDate) throws ContestServiceException, PermissionServiceException;

/**
* <p>
* Updates a <code>SoftwareCompetition</code> in the persistence.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3635,7 +3635,56 @@ private void checkContestBillingAccount(long billingAccountId, long directProjec
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date multiRoundEndDate, Date endDate)
throws ContestServiceException, PermissionServiceException {
return createSoftwareContest(tcSubject, contest, tcDirectProjectId, null, null, null);
return createSoftwareContest(tcSubject, contest, tcDirectProjectId, null, null, false);
}

/**
* <p>
* Creates a new <code>SoftwareCompetition</code> in the persistence.
* </p>
* Updated for Version 1.0.1 - BUGR-2185: For development contests, if asset (or
* component) exists from design contests then that is used to create a new
* contest. Otherwise a new asset is also created. Updated for Version1.5 the
* code is refactored by the logic: 1. check the permission 2. update or create
* the asset 3. set default resources 4. create project 5. prepare the return
* value 6. persist the eligility
* <p>
* Update in v1.5.1: add parameter TCSubject which contains the security info
* for current user.
* </p>
*
* <p>
* Update in v1.8.3: Add handling of auto creation of bug hunt for assembly
* competition. If the assembly contest has bugHuntProjectHeader set and the
* properties not empty in bugHuntProjectHeader. A bug hunt contest is
* automatically created. The bug hunt contest will - have copilot inserted as
* reviewer (if exists) - use the start date of approval date as the start date
* and producation date of bug hunt contest. - add a "Bug Race For" link between
* the bug race contest and assembly contest
* </p>
*
* @param tcSubject TCSubject instance contains the login security info
* for the current user
* @param contest the <code>SoftwareCompetition</code> to create as a
* contest
* @param tcDirectProjectId the TC direct project id. a <code>long</code>
* providing the ID of a client the new competition
* belongs to.
* @param multiRoundEndDate the end date for the multiround phase. No multiround
* if it's null.
* @param endDate the end date for submission phase. Can be null if to
* use default.
* @param skipForum true if no need to create the forum
* @return the created <code>SoftwareCompetition</code> as a contest
* @throws IllegalArgumentException if the input argument is invalid.
* @throws ContestServiceException if an error occurs when interacting with the
* service layer.
* @since 1.6.6
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date multiRoundEndDate, Date endDate, boolean skipForum)
throws ContestServiceException, PermissionServiceException {
return createSoftwareContest(tcSubject, contest, tcDirectProjectId, null, null, null, skipForum);
}

/**
Expand Down Expand Up @@ -3663,8 +3712,41 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate)
throws ContestServiceException, PermissionServiceException {
logger.debug("createSoftwareContest with information : [tcSubject = " + tcSubject.getUserId()
+ ", tcDirectProjectId =" + tcDirectProjectId + ", multiRoundEndDate = " + multiRoundEndDate + "]");
return createSoftwareContest(
tcSubject, contest, tcDirectProjectId, regEndDate, multiRoundEndDate, endDate, false);
}

/**
* <p>
* Creates a new <code>SoftwareCompetition</code> in the persistence.
* </p>
*
* @param tcSubject TCSubject instance contains the login security info
* for the current user
* @param contest the <code>SoftwareCompetition</code> to create as a
* contest
* @param tcDirectProjectId the TC direct project id. a <code>long</code>
* providing the ID of a client the new competition
* belongs to.
* @param regEndDate the registration end date
* @param multiRoundEndDate the end date for the multiround phase. No multiround
* if it's null.
* @param endDate the end date for submission phase. Can be null if to
* use default.
* @param skipForum true if no need to create the forum
*
* @return the created <code>SoftwareCompetition</code> as a contest
* @throws IllegalArgumentException if the input argument is invalid.
* @throws ContestServiceException if an error occurs when interacting with the
* service layer.
*/
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate, boolean skipForum)
throws ContestServiceException, PermissionServiceException {
logger.info("createSoftwareContest with information : [tcSubject = " + tcSubject.getUserId()
+ ", tcDirectProjectId =" + tcDirectProjectId
+ ", multiRoundEndDate = " + multiRoundEndDate
+ ", skipForum = " + String.valueOf(skipForum) + "]");

try {
ExceptionUtils.checkNull(contest, null, null, "The contest to create is null.");
Expand Down Expand Up @@ -3715,7 +3797,7 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
checkBillingProjectCCA(contest);

// update the AssetDTO and update corresponding properties
createUpdateAssetDTO(tcSubject, contest);
createUpdateAssetDTO(tcSubject, contest, skipForum);

com.topcoder.management.resource.Resource[] contestResources = createContestResources(tcSubject, contest,
billingProjectId, requireApproval);
Expand Down Expand Up @@ -4015,10 +4097,11 @@ private boolean shouldAutoCreateBugHuntContest(SoftwareCompetition contest) {
* @param tcSubject TCSubject instance contains the login security info for the
* current user
* @param contest the contest
* @param skipForum true if no need to create forum
* @throws EntityNotFoundException if any error occurs
* @throws com.topcoder.catalog.service.PersistenceException if any error occurs
*/
private void createUpdateAssetDTO(TCSubject tcSubject, SoftwareCompetition contest) throws EntityNotFoundException,
private void createUpdateAssetDTO(TCSubject tcSubject, SoftwareCompetition contest, boolean skipForum) throws EntityNotFoundException,
com.topcoder.catalog.service.PersistenceException, DAOException, ConfigManagerException {
// check if it is going to create development contest
boolean isDevContest = isDevContest(contest);
Expand Down Expand Up @@ -4055,7 +4138,7 @@ else if (isDevContest) {
}
long forumId = 0;
// create forum
if (createForum) {
if (createForum && !skipForum) {
if (useExistingAsset && assetDTO.getForum() != null) {
forumId = assetDTO.getForum().getJiveCategoryId();
} else {
Expand All @@ -4072,6 +4155,8 @@ else if (isDevContest) {
}
}
}
} else {
logger.info("Skip forum creation");
}

// if forum created
Expand Down
40 changes: 20 additions & 20 deletions topcoder_global.properties.docker
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
base=/root/direct
libdir=${base}/lib
tcs_libdir=${libdir}/tcs
direct_service_libdir=${libdir}/tcs/ejb
jar_tcs_libdir=${libdir}/tcs
cronos_libdir=${libdir}/tcs
ext_libdir=${libdir}/third_party
jar_ext_libdir==${libdir}/third_party
jboss.home=/data/jboss-4.2.3.GA
jboss_home=${jboss.home}
server.name=default
jboss.config.name=${server.name}
jboss_config_name=${server.name}
jboss_lib=${jboss.home}/server/${server.name}/lib
apache_tcdocs=/mnt/apache/tcdocs
# The svn user, it is optional, then the cached username/password will be used.
# Uncomment and configure these settings if you want to use predefined svn credentials.
#svn.username=xxx
#svn.password=xxx
base=/data
libdir=${base}/lib
tcs_libdir=${libdir}/tcs
direct_service_libdir=${libdir}/tcs/ejb
jar_tcs_libdir=${libdir}/tcs
cronos_libdir=${libdir}/tcs
ext_libdir=${libdir}/third_party
jar_ext_libdir==${libdir}/third_party
jboss.home=/data/jboss-4.2.3.GA
jboss_home=${jboss.home}
server.name=default
jboss.config.name=${server.name}
jboss_config_name=${server.name}
jboss_lib=${jboss.home}/server/${server.name}/lib
apache_tcdocs=/mnt/apache/tcdocs

# The svn user, it is optional, then the cached username/password will be used.
# Uncomment and configure these settings if you want to use predefined svn credentials.
#svn.username=xxx
#svn.password=xxx

0 comments on commit 159c47e

Please sign in to comment.