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

Commit 33089f4

Browse files
committed
Fix New User issue with enterprise dashboard
1 parent dc43b81 commit 33089f4

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

src/java/main/com/topcoder/direct/services/view/form/enterpriseDashboard/EnterpriseDashboardFilterForm.java

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2012 - 2013 TopCoder Inc., All Rights Reserved.
2+
* Copyright (C) 2012 - 2014 TopCoder Inc., All Rights Reserved.
33
*/
44
package com.topcoder.direct.services.view.form.enterpriseDashboard;
55

@@ -18,30 +18,38 @@
1818
* </ol>
1919
* </p>
2020
*
21-
* @author TCSASSEMBLER
22-
* @version 1.1
21+
* <p>
22+
* Version 1.2 (TopCoder Direct - New User Issue with Enterprise Dashboard)
23+
* <ul>
24+
* <li>Change the setter of clientId, directProjectId, projectStatusId and projectFilterId to use
25+
* string. Change the getter to parse the long ID from string, if invalid, use negative value</li>
26+
* </ul>
27+
* </p>
28+
*
29+
* @author Veve
30+
* @version 1.2
2331
*/
2432
public class EnterpriseDashboardFilterForm implements Serializable {
2533

2634
/**
2735
* The client id.
2836
*/
29-
private long clientId;
37+
private String clientId;
3038

3139
/**
3240
* The direct project id.
3341
*/
34-
private long directProjectId;
42+
private String directProjectId;
3543

3644
/**
3745
* The project status id.
3846
*/
39-
private long projectStatusId;
47+
private String projectStatusId;
4048

4149
/**
4250
* The project filter id.
4351
*/
44-
private long projectFilterId;
52+
private String projectFilterId;
4553

4654
/**
4755
* The project filter value.
@@ -74,21 +82,41 @@ public class EnterpriseDashboardFilterForm implements Serializable {
7482
*/
7583
private String zoom;
7684

85+
86+
/**
87+
* Gets the long id from the string value. If string value is invalid, return -1 (negative value)
88+
*
89+
* @param str the str value to check
90+
* @return the parsed long id.
91+
* @since 1.2
92+
*/
93+
private static long getIdFromString(String str) {
94+
if(str == null || str.trim().length() == 0) {
95+
return -1;
96+
} else {
97+
try {
98+
return Long.parseLong(str);
99+
} catch (NumberFormatException e) {
100+
return -1;
101+
}
102+
}
103+
}
104+
77105
/**
78106
* Gets the id of the client.
79107
*
80108
* @return the id of the client.
81109
*/
82110
public long getClientId() {
83-
return clientId;
111+
return getIdFromString(this.clientId);
84112
}
85113

86114
/**
87115
* Sets the id of the client.
88116
*
89117
* @param clientId the id of the client.
90118
*/
91-
public void setClientId(long clientId) {
119+
public void setClientId(String clientId) {
92120
this.clientId = clientId;
93121
}
94122

@@ -98,15 +126,15 @@ public void setClientId(long clientId) {
98126
* @return the direct project id.
99127
*/
100128
public long getDirectProjectId() {
101-
return directProjectId;
129+
return getIdFromString(this.directProjectId);
102130
}
103131

104132
/**
105133
* Sets the direct project id.
106134
*
107135
* @param directProjectId the direct project id.
108136
*/
109-
public void setDirectProjectId(long directProjectId) {
137+
public void setDirectProjectId(String directProjectId) {
110138
this.directProjectId = directProjectId;
111139
}
112140

@@ -116,15 +144,15 @@ public void setDirectProjectId(long directProjectId) {
116144
* @return the project status id.
117145
*/
118146
public long getProjectStatusId() {
119-
return projectStatusId;
147+
return getIdFromString(this.projectStatusId);
120148
}
121149

122150
/**
123151
* Sets the project status id.
124152
*
125153
* @param projectStatusId the project status id.
126154
*/
127-
public void setProjectStatusId(long projectStatusId) {
155+
public void setProjectStatusId(String projectStatusId) {
128156
this.projectStatusId = projectStatusId;
129157
}
130158

@@ -134,15 +162,15 @@ public void setProjectStatusId(long projectStatusId) {
134162
* @return the project filter metadata key id.
135163
*/
136164
public long getProjectFilterId() {
137-
return projectFilterId;
165+
return getIdFromString(this.projectFilterId);
138166
}
139167

140168
/**
141169
* Sets the project filter metadata key id.
142170
*
143171
* @param projectFilterId the project filter metadata key id.
144172
*/
145-
public void setProjectFilterId(long projectFilterId) {
173+
public void setProjectFilterId(String projectFilterId) {
146174
this.projectFilterId = projectFilterId;
147175
}
148176

0 commit comments

Comments
 (0)