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

Commit 02385cf

Browse files
authored
Merge pull request #413 from appirio-tech/dev
Promote to prod - effort hours and a few fixes
2 parents d8964ba + 5371a4b commit 02385cf

File tree

32 files changed

+1421
-1088
lines changed

32 files changed

+1421
-1088
lines changed

Diff for: components/project_management/src/java/main/com/topcoder/management/project/ProjectPropertyType.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,15 @@
6565
* <li>Added {@link #MM_TYPE_KEY}</li>
6666
* </ul>
6767
* </p>
68+
*
69+
* <p>
70+
* Version 1.3.0 (Topcoder - Add effort hours field)
71+
* <ul>
72+
* <li>Add {@link #EFFORT_HOURS_ESTIMATE}</li>
73+
* </ul>
74+
* </p>
6875
* @author tuenm, iamajia, flytoj2ee, tangzx, GreatKevin, TCSCODER
69-
* @version 1.2.9
76+
* @version 1.3.0
7077
* @since 1.0
7178
*/
7279
public class ProjectPropertyType implements Serializable {
@@ -424,6 +431,16 @@ public class ProjectPropertyType implements Serializable {
424431
*/
425432
public static final String MM_TYPE_KEY = "Marathon Match Type";
426433

434+
/**
435+
* Represent "Review Type" key
436+
*/
437+
public static final String REVIEW_TYPE_KEY = "Review Type";
438+
439+
/*
440+
* Represent "Effort Hours Estimate" key
441+
*/
442+
public static final String EFFORT_HOURS_ESTIMATE = "Effort Hours Estimate";
443+
427444
/**
428445
* Represents the id of this instance. Only values greater than zero is
429446
* allowed. This variable is initialized in the constructor and can be

Diff for: components/project_management/src/java/main/com/topcoder/management/project/persistence/AbstractInformixProjectPersistence.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -6188,6 +6188,9 @@ private void createProjectProperties(Long projectId, Project project, Map idValu
61886188
Long key = (Long) entry.getKey();
61896189
String value = (String) entry.getValue();
61906190
value = Encode.forHtml(value);
6191+
6192+
if ("".equals(value)) continue;
6193+
61916194
// insert the project property into database
61926195
Object[] queryArgs = new Object[] {projectId, key,
61936196
value, operator, operator };
@@ -6298,6 +6301,13 @@ private void updateProjectProperties(Project project, Map idValueMap,
62986301

62996302
Long propertyId = (Long) entry.getKey();
63006303

6304+
6305+
Long key = (Long) entry.getKey();
6306+
String value = (String) entry.getValue();
6307+
value = Encode.forHtml(value);
6308+
6309+
if ("".equals(value)) continue;
6310+
63016311
// check if the property in the project object already exists in
63026312
// the database
63036313
if (propertyMap.containsKey(propertyId)) {
@@ -6499,7 +6509,7 @@ private void deleteProjectProperties(Project project, Set<Long> propertyIdSet, C
64996509

65006510
getLogger().log(Level.INFO, new LogMessage(projectId, null,
65016511
"delete records from project_info with projectId:" + projectId));
6502-
6512+
65036513
// delete the properties whose id is in the set
65046514
Helper.doDMLQuery(conn, DELETE_PROJECT_PROPERTIES_SQL
65056515
+ idListBuffer.toString(), new Object[] {projectId});

Diff for: services/client_project_entities_dao/src/java/main/com/topcoder/clients/dao/ejb3/ProjectDAOBean.java

+14-4
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,18 @@
8282
* </p>
8383
*
8484
* <p>
85+
* Version 1.3 (TC - Add effort hours field)
86+
* - Add enable effort hours field for client
87+
* </p>
88+
*
89+
* <p>
8590
* <strong>THREAD SAFETY:</strong> This class is technically mutable since the inherited configuration properties (with
8691
* {@link PersistenceContext}) are set after construction, but the container will not initialize the properties more
8792
* than once for the session beans and the EJB3 container ensure the thread safety in this case.
8893
* </p>
8994
*
9095
* @author Mafy, snow01, flying2hk, TCSDEVELOPER
91-
* @version 1.2
96+
* @version 1.3
9297
*/
9398
@TransactionManagement(TransactionManagementType.CONTAINER)
9499
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@@ -119,7 +124,7 @@ public class ProjectDAOBean extends GenericEJB3DAO<Project, Long> implements
119124
private static final String SELECT_PROJECT = "select p.project_id, p.name, p.po_box_number, p.description, "
120125
+ " p.active, p.sales_tax, p.payment_terms_id, p.modification_user, p.modification_date, "
121126
+ " p.creation_date, p.creation_user, p.is_deleted, "
122-
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name "
127+
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name, c.enable_effort_hours "
123128
+ " from project as p left join client_project as cp on p.project_id = cp.project_id left join client c "
124129
+ " on c.client_id = cp.client_id and (c.is_deleted = 0 or c.is_deleted is null) "
125130
+ " where p.active = 1 and p.start_date <= current and current <= p.end_date ";
@@ -130,7 +135,7 @@ public class ProjectDAOBean extends GenericEJB3DAO<Project, Long> implements
130135
private static final String SELECT_PROJECT_BY_CLIENT_ID = "select p.project_id, p.name, p.po_box_number, p.description, "
131136
+ " p.active, p.sales_tax, p.payment_terms_id, p.modification_user, p.modification_date, "
132137
+ " p.creation_date, p.creation_user, p.is_deleted, "
133-
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name "
138+
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name, c.enable_effort_hours "
134139
+ " from project as p, client_project as cp, client as c "
135140
+ " where p.start_date <= current and current <= p.end_date "
136141
+ " and c.client_id = cp.client_id and (p.is_deleted = 0 or p.is_deleted is null) "
@@ -144,7 +149,7 @@ public class ProjectDAOBean extends GenericEJB3DAO<Project, Long> implements
144149
private static final String SELECT_PROJECT_PREFIX = "select p.project_id, p.name, p.po_box_number, p.description, "
145150
+ " p.active, p.sales_tax, p.payment_terms_id, p.modification_user, p.modification_date, "
146151
+ " p.creation_date, p.creation_user, p.is_deleted, "
147-
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name "
152+
+ " cp.client_id, c.name as client_name, p.is_manual_prize_setting, c.code_name, c.enable_effort_hours "
148153
+ " from project as p, client_project as cp, client as c "
149154
+ " where p.start_date <= current and current <= p.end_date "
150155
+ " and c.client_id = cp.client_id and (p.is_deleted = 0 or p.is_deleted is null) "
@@ -493,6 +498,11 @@ private List<Project> convertQueryToListProjects(Query query) {
493498
client.setCodeName(os[15].toString());
494499
}
495500

501+
if (os[16] != null) {
502+
int enableEffortHours = Integer.parseInt(os[16].toString());
503+
client.setEnableEffortHours(enableEffortHours == 1 ? true : false);
504+
}
505+
496506
result.add(c);
497507

498508
}

Diff for: services/client_project_entities_dao/src/java/main/com/topcoder/clients/model/Client.java

+40
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,27 @@ public class Client extends AuditableEntity {
9393
@Column(name = "payment_term_id")
9494
private long paymentTermsId;
9595

96+
/**
97+
* <p>
98+
* This field represents the 'enableEffortHours' property of the Client.
99+
* </p>
100+
* <p>
101+
* It is default to the default value of this data type when it is not
102+
* assigned.
103+
* </p>
104+
* <p>
105+
* Through corresponding getter/setter methods. It is retrieved from
106+
* Client.enableEffortHours [Client.isEffortHoursEnabled()] and in table
107+
* client.enable_effort_hours.
108+
* </p>
109+
* <p>
110+
* There are no restrictions at this moment. It can take any value.
111+
* OPTIONAL.
112+
* </p>
113+
*/
114+
@Column(name = "enable_effort_hours")
115+
private boolean enableEffortHours;
116+
96117
/**
97118
* <p>
98119
* This field represents the 'clientStatus' property of the Client.
@@ -354,4 +375,23 @@ public Date getStartDate() {
354375
public void setStartDate(Date startDate) {
355376
this.startDate = startDate;
356377
}
378+
379+
/**
380+
* Gets whether this client enabled effort hours.
381+
*
382+
* @return whether this client enabled effort hours.
383+
*/
384+
public boolean isEffortHoursEnabled() {
385+
return this.enableEffortHours;
386+
}
387+
388+
/**
389+
* Sets whether this client enabled effort hours.
390+
*
391+
* @param enableEffortHours
392+
* whether this client enabled effort hours.
393+
*/
394+
public void setEnableEffortHours(boolean enableEffortHours) {
395+
this.enableEffortHours = enableEffortHours;
396+
}
357397
}

Diff for: services/client_project_entities_dao/src/java/tests/com/topcoder/clients/dao/ejb3/TestBase.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ protected Client createClient(long id) {
217217
.createNativeQuery("insert into client "
218218
+ "(client_id, client_status_id, is_deleted, payment_term_id,company_id"
219219
+ ",salestax,start_date,end_date,creation_date,creation_user,modification_date,"
220-
+ "modification_user,code_name) "
221-
+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?)");
220+
+ "modification_user,code_name,enable_effort_hours) "
221+
+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
222222
int idx = 1;
223223
query.setParameter(idx++, client.getId());
224224
query.setParameter(idx++, client.getClientStatus().getId());
@@ -232,7 +232,8 @@ protected Client createClient(long id) {
232232
query.setParameter(idx++, client.getCreateUsername());
233233
query.setParameter(idx++, client.getModifyDate());
234234
query.setParameter(idx++, client.getModifyUsername());
235-
query.setParameter(idx, client.getCodeName());
235+
query.setParameter(idx++, client.getCodeName());
236+
query.setParameter(idx, 1);
236237
query.executeUpdate();
237238

238239
return client;
@@ -265,8 +266,8 @@ protected Client createClient(String name, long id) {
265266
.createNativeQuery("insert into client "
266267
+ "(client_id, client_status_id, is_deleted, payment_term_id,company_id"
267268
+ ",salestax,start_date,end_date,creation_date,creation_user,modification_date,"
268-
+ "modification_user,code_name, name) "
269-
+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?, ?)");
269+
+ "modification_user,code_name, name, enable_effort_hours) "
270+
+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
270271
int idx = 1;
271272
query.setParameter(idx++, client.getId());
272273
query.setParameter(idx++, client.getClientStatus().getId());
@@ -281,7 +282,8 @@ protected Client createClient(String name, long id) {
281282
query.setParameter(idx++, client.getModifyDate());
282283
query.setParameter(idx++, client.getModifyUsername());
283284
query.setParameter(idx++, client.getCodeName());
284-
query.setParameter(idx, client.getName());
285+
query.setParameter(idx++, client.getName());
286+
query.setParameter(idx, 0);
285287
query.executeUpdate();
286288

287289
return client;

Diff for: services/client_project_entities_dao/test_files/Schema.sql

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ creation_user VARCHAR(64),
4646
modification_date DATETIME YEAR TO FRACTION default CURRENT YEAR TO FRACTION,
4747
modification_user VARCHAR(64),
4848
code_name VARCHAR(64),
49-
is_deleted SMALLINT
49+
is_deleted SMALLINT,
50+
enable_effort_hours SMALLINT
5051
);
5152

5253

Diff for: services/client_project_entities_dao/test_files/clientproject-update.sql

+2-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ ALTER TABLE company ADD is_deleted SMALLINT;
8282
-- client
8383
ALTER TABLE client ADD code_name VARCHAR(64);
8484
ALTER TABLE client ADD is_deleted SMALLINT;
85-
ALTER TABLE client ADD is_deleted SMALLINT;
8685
ALTER TABLE client ADD client_status_id INTEGER;
87-
86+
ALTER TABLE client ADD enable_effort_hours SMALLINT;
8887

8988
-- project
9089
ALTER TABLE project ADD project_status_id INTEGER;
@@ -142,4 +141,4 @@ alter table project add constraint foreign key
142141

143142
alter table project add constraint foreign key
144143
(parent_project_id) references project (project_id)
145-
constraint project_parent_project_fk;
144+
constraint project_parent_project_fk;

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

+19-3
Original file line numberDiff line numberDiff line change
@@ -917,9 +917,14 @@
917917
* <li>Add CONTEST_PRIZE_TYPE_ID</li>
918918
* </ul>
919919
*
920+
* Version 3.13 (Topcoder - Add effort hours field):
921+
* <ul>
922+
* <li>Add enable effort hours</li>
923+
* </ul>
924+
*
920925
* @author snow01, pulky, murphydog, waits, BeBetter, hohosky, isv, tangzx, GreatKevin, lmmortal, minhu, GreatKevin, tangzx
921926
* @author isv, GreatKevin, Veve, deedee, TCSCODER, TCSASSEMBLER
922-
* @version 3.12
927+
* @version 3.13
923928
*/
924929
@Stateless
925930
@TransactionManagement(TransactionManagementType.CONTAINER)
@@ -5149,8 +5154,7 @@ public SoftwareCompetition updateSoftwareContest(TCSubject tcSubject, SoftwareCo
51495154
public Set<Long> updatePreRegister(TCSubject tcSubject, SoftwareCompetition contest,
51505155
Set<Long> preRegisterMembers) throws ContestServiceException
51515156
{
5152-
5153-
long forumId;
5157+
long forumId;
51545158
String userRoleId = "";
51555159
String moderatorRoleId = "";
51565160
Forums forum = null;
@@ -5946,6 +5950,18 @@ public SoftwareCompetition getSoftwareContestByProjectId(TCSubject tcSubject, lo
59465950
checkSoftwareContestPermission(tcSubject, projectId, true);
59475951

59485952
FullProjectData fullProjectData = this.projectServices.getFullProjectData(projectId);
5953+
5954+
Boolean effortHoursEnabled = false;
5955+
try {
5956+
effortHoursEnabled = projectService.getClientByProject(fullProjectData.getProjectHeader().getTcDirectProjectId()).isEffortHoursEnabled();
5957+
} catch (PersistenceFault e) {
5958+
effortHoursEnabled = false;
5959+
}
5960+
5961+
if(!effortHoursEnabled) {
5962+
fullProjectData.getProjectHeader().getProperties().remove(ProjectPropertyType.EFFORT_HOURS_ESTIMATE);
5963+
}
5964+
59495965
Long compVersionId = Long.parseLong(fullProjectData.getProjectHeader()
59505966
.getProperty(ProjectPropertyType.EXTERNAL_REFERENCE_ID_PROJECT_PROPERTY_KEY));
59515967
contest.setAssetDTO(this.catalogService.getAssetByVersionId(

Diff for: services/project_services/src/java/main/com/topcoder/project/service/impl/ProjectServicesImpl.java

+17-4
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,20 @@
441441
* </ul>
442442
* </p>
443443
*
444+
* <p>
445+
* Version 2.6 (Topcoder - Add effort hours field)
446+
* <ul>
447+
* <li>Add enable effort hours</li>
448+
* </ul>
449+
* </p>
450+
*
444451
* <strong>Thread Safety:</strong> This class is immutable but operates on non thread safe objects,
445452
* thus making it potentially non thread safe.
446453
* </p>
447454
*
448455
* @author argolite, moonli, pulky
449456
* @author fabrizyo, znyyddf, murphydog, waits, hohosky, isv, lmmortal, GreatKevin, TCSCODER
450-
* @version 2.5
457+
* @version 2.6
451458
* @since 1.0
452459
*/
453460
public class ProjectServicesImpl implements ProjectServices {
@@ -793,6 +800,10 @@ public class ProjectServicesImpl implements ProjectServices {
793800
*/
794801
private static final int BUG_HUNT_PROJECT_CATEGORY_ID = 9;
795802

803+
/**
804+
* Represent internal review type of ProjectPropertyType
805+
*/
806+
private static final String REVIEW_TYPE_INTERNAL = "INTERNAL";
796807

797808
/**
798809
* <p>
@@ -834,7 +845,8 @@ public class ProjectServicesImpl implements ProjectServices {
834845
ProjectPropertyType.REVIEW_FEEDBACK_FLAG_PROJECT_PROPERTY_KEY, ProjectPropertyType.CONTEST_FEE_PERCENTAGE_PROJECT_PROPERTY_KEY,
835846
ProjectPropertyType.ALLOW_MULTIPLE_SUBMISSIONS_PROPERTY_KEY, ProjectPropertyType.COPILOT_COST_PROJECT_PROPERTY_KEY,
836847
ProjectPropertyType.MAXIMUM_SUBMISSIONS_KEY, ProjectPropertyType.VIEWABLE_SUBMISSIONS_FLAG_KEY_STRING,
837-
ProjectPropertyType.ALLOW_STOCK_ART_KEY, ProjectPropertyType.FORUM_TYPE
848+
ProjectPropertyType.ALLOW_STOCK_ART_KEY, ProjectPropertyType.FORUM_TYPE,
849+
ProjectPropertyType.EFFORT_HOURS_ESTIMATE
838850
};
839851

840852
/**
@@ -2105,7 +2117,8 @@ public FullProjectData updateProject(Project projectHeader, String projectHeader
21052117
}
21062118

21072119
if (projectHeader.getProjectCategory().getId() == ProjectCategory.CODE.getId() &&
2108-
projectHeader.getAutoAssignReviewerId() > 0 && p.getPhaseType().getId() == PhaseType.REVIEW_PHASE.getId()) {
2120+
REVIEW_TYPE_INTERNAL.equals(projectHeader.getProperty(ProjectPropertyType.REVIEW_TYPE_KEY)) &&
2121+
p.getPhaseType().getId() == PhaseType.REVIEW_PHASE.getId()) {
21092122
// code with auto assigned review only requires one reviewer.
21102123
p.setAttribute("Reviewer Number", "1");
21112124
} else if (projectHeader.getProjectCategory().getId() == ProjectCategory.CODE.getId() &&
@@ -5176,7 +5189,7 @@ private void setNewPhasesProperties(Project projectHeader,
51765189
projectHeader.getProjectCategory().getId() == ProjectCategory.BUG_HUNT.getId() ||
51775190
projectHeader.getProjectCategory().getProjectType().getId() == ProjectType.STUDIO.getId() ||
51785191
(projectHeader.getProjectCategory().getId() == ProjectCategory.CODE.getId() &&
5179-
projectHeader.getAutoAssignReviewerId() > 0)
5192+
REVIEW_TYPE_INTERNAL.equals(projectHeader.getProperty(ProjectPropertyType.REVIEW_TYPE_KEY)))
51805193
) {
51815194
// 1) copilot posting 2) studio 3) bug hunt 4) code with auto assigned review only requires one reviewer.
51825195
p.setAttribute("Reviewer Number", "1");

Diff for: services/specification_review_service/test_files/insert.sql

+3
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ INSERT INTO id_sequences(name, next_block_start, block_size, exhausted)
501501
insert into project_info_type_lu(project_info_type_id, name, description, create_user, create_date, modify_user, modify_date)
502502
VALUES(44, 'Post-Mortem Required', 'Post-Mortem Required', 'System', CURRENT, 'System', CURRENT);
503503

504+
insert into project_info_type_lu(project_info_type_id, name, description, create_user, create_date, modify_user, modify_date)
505+
VALUES(88, 'Effort Hours Estimate', 'Effort Hours Estimate', 'System', CURRENT, 'System', CURRENT);
506+
504507
INSERT INTO submission_type_lu(submission_type_id, name, description, create_user, create_date, modify_user, modify_date)
505508
VALUES(1, 'Contest Submission', 'The contest submission', 'System', CURRENT, 'System', CURRENT);
506509
INSERT INTO submission_type_lu(submission_type_id, name, description, create_user, create_date, modify_user, modify_date)

0 commit comments

Comments
 (0)