Skip to content

Commit

Permalink
Merge pull request #553 from appirio-tech/issue-551
Browse files Browse the repository at this point in the history
#551 allow skipForum in ContestServiceFacadeBean.createSoftwareContest
  • Loading branch information
ajefts authored Dec 21, 2020
2 parents fad372d + 1c2578b commit e2009d9
Showing 1 changed file with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3663,6 +3663,37 @@ public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCo
public SoftwareCompetition createSoftwareContest(TCSubject tcSubject, SoftwareCompetition contest,
long tcDirectProjectId, Date regEndDate, Date multiRoundEndDate, Date endDate)
throws ContestServiceException, PermissionServiceException {
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.debug("createSoftwareContest with information : [tcSubject = " + tcSubject.getUserId()
+ ", tcDirectProjectId =" + tcDirectProjectId + ", multiRoundEndDate = " + multiRoundEndDate + "]");

Expand Down Expand Up @@ -3715,7 +3746,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 +4046,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 +4087,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 Down

0 comments on commit e2009d9

Please sign in to comment.