Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
* @author TCSCODER
* @version 1.0
*/

/**
* <p>
* Changes related to v5-groups-api
* </p>
*
* @author dushyantb
* @version 1.1
*/

public class ProjectGroup implements Serializable {
/**
* Represents group id
Expand All @@ -27,6 +37,11 @@ public class ProjectGroup implements Serializable {
* Represents group name
*/
private String name;

/**
* Represent new Id format
*/
private String newId;

/**
* Constructor
Expand Down Expand Up @@ -76,4 +91,20 @@ public String getName() {
public void setName(String name) {
this.name = name;
}

/**
* Getter for {@link #newId}
* @return
*/
public String getNewId() {
return newId;
}

/**
* Setter for {@link #newId}
* @param newId
*/
public void setNewId(String newId) {
this.newId = newId;
}
}
1 change: 1 addition & 0 deletions conf/web/WEB-INF/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@
parent="contestAction" scope="prototype">
<property name="type" value="CONTEST_JSON" />
<property name="timelineInterval" value="1"/>
<property name="userGroupsApiEndpoint" value="@userGroupsApiEndpoint@"/>
<!--
<property name="marathonMatchAnalyticsService" ref="marathonMatchAnalyticsService"/>
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,15 @@
* <li>Add enable effort hours</li>
* </ul>
* </p>
*
* <p>
* Version 1.11 (Topcoder - Integrate Direct with Groups V5)
* <ul>
* <li>Refactor projectGroup to comply with v5</li>
* </ul>
* </p>
*
* @author BeBetter, pvmagacho, GreatKevin, bugbuka, GreatKevin
* @author BeBetter, pvmagacho, GreatKevin, bugbuka, GreatKevin, dushyantb
* @version 1.10
*/
public class CommonAction extends BaseContestFeeAction {
Expand Down Expand Up @@ -575,7 +582,7 @@ public void setCategoryId(long categoryId) {
public String getGroups() {
try {
TCSubject tcSubject = DirectUtils.getTCSubjectFromSession();
Set<ProjectGroup> projectGroups = DirectUtils.getGroups(tcSubject, userGroupsApiEndpoint);
Set<Map<String, String>> projectGroups = DirectUtils.getGroups(tcSubject, userGroupsApiEndpoint);
setResult(projectGroups);
} catch (Throwable e) {
if (getModel() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.topcoder.direct.services.view.util.SessionData;
import com.topcoder.management.deliverable.Submission;
import com.topcoder.management.project.Prize;
import com.topcoder.management.project.ProjectGroup;
import com.topcoder.management.resource.Resource;
import com.topcoder.management.resource.ResourceRole;
import com.topcoder.security.TCSubject;
Expand All @@ -37,13 +38,7 @@

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

/**
* <p>
Expand Down Expand Up @@ -274,6 +269,14 @@
*
* @author fabrizyo, FireIce, isv, morehappiness, GreatKevin, minhu, Veve, Ghost_141, GreatKevin, Veve, GreatKevin, TCSCODER
* @version 3.5
*
* * <p>
* Version 3.6 - Topcoder - Integrate Direct with Groups V5
* - Refactor projectGroup to comply with v5
* </p>
*
* @author fabrizyo, FireIce, isv, morehappiness, GreatKevin, minhu, Veve, Ghost_141, GreatKevin, Veve, GreatKevin, TCSCODER, dushyantb
* @version 3.6
*/
public class GetContestAction extends ContestAction {
/**
Expand Down Expand Up @@ -401,6 +404,11 @@ public class GetContestAction extends ContestAction {
*/
private boolean showSaveChallengeConfirmation;

/**
* Endpoint to group of a user
*/
private String userGroupsApiEndpoint;

/**
* <p>
* Creates a <code>GetContestAction</code> instance.
Expand Down Expand Up @@ -463,8 +471,23 @@ protected void executeAction() throws Exception {
if (DirectUtils.isStudio(softwareCompetition)) {
softwareCompetition.setType(CompetionType.STUDIO);
}
softwareCompetition.getProjectHeader().setGroups(DirectUtils.getGroupIdAndName(
softwareCompetition.getProjectHeader().getGroups()));
List<ProjectGroup> projectGroups = DirectUtils.getGroupIdAndName(
softwareCompetition.getProjectHeader().getGroups());

if (this.type == TYPE.CONTEST_JSON) {
// get v5 id of groups
Set<Map<String, String>> projectGroupUser = DirectUtils.getGroups(DirectUtils.getTCSubjectFromSession(),
userGroupsApiEndpoint);
for (ProjectGroup pg : projectGroups) {
for (Map<String, String> pgu : projectGroupUser) {
if (String.valueOf(pg.getId()).equals(pgu.get("oldId"))) {
pg.setNewId(pgu.get("id"));
break;
}
}
}
}
softwareCompetition.getProjectHeader().setGroups(projectGroups);

setResult(softwareCompetition);
regEndDate = DirectUtils.getDateString(DirectUtils.getRegistrationEndDate(softwareCompetition));
Expand Down Expand Up @@ -974,4 +997,12 @@ public boolean isShowSaveChallengeConfirmation() {
return showSaveChallengeConfirmation;
}

public String getUserGroupsApiEndpoint() {
return userGroupsApiEndpoint;
}

public void setUserGroupsApiEndpoint(String userGroupsApiEndpoint) {
this.userGroupsApiEndpoint = userGroupsApiEndpoint;
}

}
Loading