Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
9bc3f3f
change in UI for cynja
Jun 19, 2015
f51ef0b
Revert "change in UI for cynja"
Jun 19, 2015
15b2391
new changes in UI for cynja
Jun 19, 2015
730404c
Fixed for display of list of errors returned by API.
kvats Jun 19, 2015
4d5bf07
Fixed for display of list of errors returned by API.
kvats Jun 22, 2015
1a67bd5
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
kvats Jun 22, 2015
a7cc505
some UI changes
Jun 22, 2015
09a9c56
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
Jun 22, 2015
84638f6
change as per Les suggested in UI
Jun 23, 2015
5e16ab9
Added code to show client sepecific error messages using properties f…
kvats Jun 25, 2015
5c34a10
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
kvats Jun 25, 2015
13c124e
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
kvats Jun 25, 2015
aa7f23e
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
kvats Jun 25, 2015
782430b
changes as per les suggestion in UI
Jun 25, 2015
b00325b
Fixed issue in display of list of errors.
kvats Jun 26, 2015
754c8a3
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
kvats Jun 26, 2015
ac4e82c
new changes in UI
Jun 26, 2015
18aa707
change required in css as per safari
Jun 29, 2015
9b2781f
change for error message in login
Jul 1, 2015
1110c73
Added code to capture user's feedback and send a mail for the same.
kvats Jul 3, 2015
0c54ae3
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
kvats Jul 3, 2015
29680ba
change for international number issue
Jul 4, 2015
9aca4f7
Merge branch 'cynja-deployment' into common-changes
kvats Jul 5, 2015
39f9f2d
Merge branch 'common-changes' into cynja-deployment
kvats Jul 5, 2015
f382c5b
change for contact us
Jul 6, 2015
e6de4df
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
Jul 6, 2015
e3a8b98
changes for contact us
Jul 6, 2015
081ed04
changes for contact us
kvats Jul 6, 2015
6860e45
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
kvats Jul 6, 2015
7586235
changes for forgot password
Jul 6, 2015
3183bb9
Fixed the Rest endpoint URI for forgot password.
kvats Jul 7, 2015
bfd6194
Merge pull request #4 from kvats/common-changes
kvats Jul 7, 2015
84002f7
changes for international phn number issue
Jul 7, 2015
4cd817b
changes as per Les on Trello
Jul 8, 2015
5501090
Fixed for contact us feedback email functionality.
kvats Jul 9, 2015
984e58a
changes for Trello changes as per Les
Jul 9, 2015
a7746aa
Fixed for contact us feedback email functionality.
kvats Jul 9, 2015
804b0c9
Merge branch 'cynja-deployment' of https://github.com/kvats/personal-…
kvats Jul 9, 2015
8874e5b
changes for working:Bugs in Trello
Jul 10, 2015
93ff410
changes for working:Bugs in Trello
Jul 10, 2015
f724927
changes for making datepicker top part as a button
Jul 10, 2015
8863602
changes for making datepicker top part as a button
Jul 10, 2015
4833969
change for button color in change password screen
Jul 13, 2015
a5a0ca1
change to show menu look of forgot password
Jul 16, 2015
6fd79c6
changes for regex on password field
Sep 8, 2015
7e0aded
changes in forgot password field validation
Sep 10, 2015
3b92d2b
changes for regex on password field
Sep 10, 2015
f029227
changes for password validation
Sep 14, 2015
7f81d51
changes for 2 parent support demo pages
Sep 16, 2015
d80929f
changes in 2 parent support for providing email in two step as per Les
Sep 18, 2015
a17059c
change in message text for 2 parent cloud exist
Sep 21, 2015
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 @@ -42,6 +42,7 @@ public class UIRestPathConstants {
public static final String CSP_CLOUD_NAME = "cspCloudName";
public static final String CLOUD_NAME = "cloudName";
public static final String PRODUCT_NAME = "productName";
public static final String EMAIL = "email";

public static final String BASE_URI_NAME_AVAILABILITY_API = PATH_WITH_CURRENT_API_VERSION
+ "/clouds/personalClouds/{cloudName}/available";
Expand Down Expand Up @@ -76,7 +77,8 @@ public class UIRestPathConstants {

public static final String PERSONAL_CLOUD_CHANGE_PASSWORD_URI = REGISTER_PERSONAL_CLOUD_URI
+ "/{cloudName}/changePassword";

public static final String PERSONAL_CLOUD_PROV_FEEDBACK_URI = PATH_WITH_CURRENT_API_VERSION
+ "/feedback";
public static final String GET_DEPENDENTS_URI = REGISTER_PERSONAL_CLOUD_URI + "/{cloudName}/dependents";

public static final String NAME_AVAILABILITY_API = PATH_WITH_CURRENT_API_VERSION
Expand All @@ -89,10 +91,10 @@ public class UIRestPathConstants {
public static final String GET_DEPENDENTS_API = PATH_WITH_CURRENT_API_VERSION
+ "/csp/{0}/clouds/personalClouds/{1}/dependents";
public static final String PERSONAL_CLOUD_FORGOT_PASSWORD_API = PATH_WITH_CURRENT_API_VERSION
+ "/csp/{0}/clouds/personalCloud/{1}/forgotPassword";
+ "/csp/{0}/clouds/personalClouds/{1}/forgotPassword";

public static final String PERSONAL_CLOUD_RESET_PASSWORD_API = PATH_WITH_CURRENT_API_VERSION
+ "/csp/{0}/clouds/personalCloud/{1}/resetPassword";
+ "/csp/{0}/clouds/personalClouds/{1}/resetPassword";
public static final String PERSONAL_CLOUD_AUTH_API = PATH_WITH_CURRENT_API_VERSION
+ "/csp/{0}/clouds/personalClouds/{1}/authenticate";
public static final String PAYMENT_API = PATH_WITH_CURRENT_API_VERSION + "/products/{0}/payments";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ of this software and associated documentation files (the "Software"), to deal
package biz.neustar.pc.ui.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.FormParam;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -40,16 +40,20 @@ of this software and associated documentation files (the "Software"), to deal
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import biz.neustar.pc.ui.constants.UIRestPathConstants;
import biz.neustar.pc.ui.exception.PCloudErrorsUIException;
import biz.neustar.pc.ui.exception.PCloudUIException;
import biz.neustar.pc.ui.manager.impl.PCloudResponse;
import biz.neustar.pc.ui.manager.impl.PersonalCloudManager;
import biz.neustar.pcloud.rest.constants.ProductNames;
import biz.neustar.pcloud.rest.dto.CloudInfo;
import biz.neustar.pcloud.rest.dto.CloudValidation;
import biz.neustar.pcloud.rest.dto.DependentList;
import biz.neustar.pcloud.rest.dto.FeedbackInfo;
import biz.neustar.pcloud.rest.dto.PCloudError;
import biz.neustar.pcloud.rest.dto.PaymentInfo;
import biz.neustar.pcloud.rest.dto.PaymentResponse;
import biz.neustar.pcloud.rest.dto.Synonym;
Expand Down Expand Up @@ -164,15 +168,43 @@ PCloudResponse processChangePassword(
return personalCloudManagerImpl.changePassword(cspCloudName, cloudName, cloudValidation);

}

@RequestMapping(value = UIRestPathConstants.PERSONAL_CLOUD_PROV_FEEDBACK_URI, method = RequestMethod.POST)
public @ResponseBody
PCloudResponse processFeedback(@RequestBody final FeedbackInfo feedbackInfo) {
return personalCloudManagerImpl.processFeedback(feedbackInfo);

}

@SuppressWarnings("unchecked")
@ExceptionHandler(PCloudUIException.class)
public @ResponseBody String handleUltraException(PCloudUIException exception, HttpServletRequest request, HttpServletResponse response) throws IOException {
public @ResponseBody
String handleException(PCloudUIException exception, HttpServletRequest request, HttpServletResponse response)
throws IOException {
response.setStatus(exception.getStatusCode());

JSONArray errors = new JSONArray();
JSONObject error = new JSONObject();
error.put("errorCode", exception.getErrorCode());
error.put("errorMessage", exception.getErrorMessage());
LOGGER.error("Error : {}", exception.getLocalizedMessage(), exception);
return error.toJSONString();
error.put("errorCode", exception.getErrorCode());
error.put("errorMessage", exception.getErrorMessage());
errors.add(error);
LOGGER.debug("Errors : {}", exception.getLocalizedMessage(), exception);
return errors.toJSONString();
}

@SuppressWarnings("unchecked")
@ExceptionHandler(PCloudErrorsUIException.class)
public @ResponseBody
String handleUIException(PCloudErrorsUIException exception, HttpServletRequest request, HttpServletResponse response)
throws IOException {
response.setStatus(exception.getStatusCode());
JSONArray errors = new JSONArray();
for (PCloudError pCloudError : exception.getErrors()) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("errorCode", pCloudError.getErrorCode());
jsonObject.put("errorMessage", pCloudError.getErrorMessage());
errors.add(jsonObject);
}
LOGGER.debug("Errors : {}", errors, exception);
return errors.toJSONString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package biz.neustar.pc.ui.exception;

import java.util.List;

import biz.neustar.pc.ui.utils.PCloudErrorUtil;
import biz.neustar.pcloud.rest.dto.PCloudError;

public class PCloudErrorsUIException extends RuntimeException {

/**
*
*/
private static final long serialVersionUID = 1L;

private List<PCloudError> errors;
private int statusCode;

public List<PCloudError> getErrors() {
if (errors != null) {
for (PCloudError pCloudError : errors) {
pCloudError.setErrorMessage(PCloudErrorUtil.getProperty(Integer.toString(pCloudError.getErrorCode())));
}
}
return errors;
}

public void setErrors(List<PCloudError> errors) {
this.errors = errors;
}

public int getStatusCode() {
return statusCode;
}

public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}

public PCloudErrorsUIException(List<PCloudError> errors, int statusCode) {
super();
this.errors = errors;
this.statusCode = statusCode;
}

@Override
public String toString() {
return "PCloudErrorsUIException [errors=" + errors + ", statusCode=" + statusCode + "]";
}

}
78 changes: 45 additions & 33 deletions src/main/java/biz/neustar/pc/ui/exception/PCloudUIException.java
Original file line number Diff line number Diff line change
@@ -1,53 +1,65 @@
package biz.neustar.pc.ui.exception;

public class PCloudUIException extends RuntimeException{
import biz.neustar.pc.ui.utils.PCloudErrorUtil;

/**
public class PCloudUIException extends RuntimeException {

/**
*
*/
private static final long serialVersionUID = 1L;
int errorCode;
String errorMessage;
int statusCode;
/**
int statusCode;

/**
* @return the errorCode
*/
public int getErrorCode() {
return errorCode;
}

/**
* @param errorCode the errorCode to set
* @param errorCode
* the errorCode to set
*/
public void setErrorCode(int errorCode) {
this.errorCode = errorCode;
}

public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public int getStatusCode() {
return statusCode;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
public PCloudUIException(int errorCode, String errorMessage, int statusCode) {
super();
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.statusCode = statusCode;
}
public PCloudUIException(String errorMessage) {
super();
this.errorMessage = errorMessage;
}
@Override
public String toString() {
return "PCloudUIException [errorCode="+errorCode+",errorMessage=" + errorMessage
+ ", statusCode=" + statusCode + "]";
}

return PCloudErrorUtil.getProperty(Integer.toString(errorCode));

}

public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}

public int getStatusCode() {
return statusCode;
}

public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}

public PCloudUIException(int errorCode, String errorMessage, int statusCode) {
super();
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.statusCode = statusCode;
}

public PCloudUIException(String errorMessage) {
super();
this.errorMessage = errorMessage;
}

@Override
public String toString() {
return "PCloudUIException [errorCode=" + errorCode + ",errorMessage=" + errorMessage + ", statusCode="
+ statusCode + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ of this software and associated documentation files (the "Software"), to deal
import biz.neustar.pcloud.rest.dto.CloudInfo;
import biz.neustar.pcloud.rest.dto.CloudValidation;
import biz.neustar.pcloud.rest.dto.DependentList;
import biz.neustar.pcloud.rest.dto.FeedbackInfo;
import biz.neustar.pcloud.rest.dto.PaymentInfo;
import biz.neustar.pcloud.rest.dto.PaymentResponse;
import biz.neustar.pcloud.rest.dto.Synonym;
Expand Down Expand Up @@ -58,4 +59,6 @@ public interface PersonalCloudManager {
public abstract PaymentResponse processPayment(ProductNames productName, PaymentInfo paymentInfo);

public abstract PCloudResponse changePassword(String cspCloudName, String cloudName, CloudValidation cloudValidation);

public abstract PCloudResponse processFeedback(FeedbackInfo feedbackInfo);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,30 @@ of this software and associated documentation files (the "Software"), to deal

import java.io.IOException;
import java.text.MessageFormat;
import java.util.List;

import org.apache.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import biz.neustar.pc.ui.constants.UIRestPathConstants;
import biz.neustar.pc.ui.exception.PCloudErrorsUIException;
import biz.neustar.pc.ui.exception.PCloudUIException;
import biz.neustar.pcloud.PCRestClient;
import biz.neustar.pcloud.ResponseData;
import biz.neustar.pcloud.rest.constants.ProductNames;
import biz.neustar.pcloud.rest.dto.CloudInfo;
import biz.neustar.pcloud.rest.dto.CloudValidation;
import biz.neustar.pcloud.rest.dto.DependentList;
import biz.neustar.pcloud.rest.dto.FeedbackInfo;
import biz.neustar.pcloud.rest.dto.PCloudError;
import biz.neustar.pcloud.rest.dto.PaymentInfo;
import biz.neustar.pcloud.rest.dto.PaymentResponse;
import biz.neustar.pcloud.rest.dto.Synonym;
import biz.neustar.pcloud.rest.dto.SynonymInfo;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.sun.jersey.api.representation.Form;

/**
Expand All @@ -56,9 +60,10 @@ public class PersonalCloudManagerImpl implements PersonalCloudManager {
*
*/
private PCRestClient pcRestClient;

public PersonalCloudManagerImpl(PCRestClient pcRestClient) {
private String feedbackEmail;
public PersonalCloudManagerImpl(PCRestClient pcRestClient, String feedbackEmail) {
this.pcRestClient = pcRestClient;
this.feedbackEmail = feedbackEmail;
}

/*
Expand Down Expand Up @@ -212,23 +217,30 @@ public <Entity> Entity handleException(ResponseData responsedata, Class<Entity>
error = new ObjectMapper().readValue(responsedata.getBody(), PCloudError.class);
throw new PCloudUIException(error.getErrorCode(), error.getErrorMessage(), responsedata.getStatus());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOGGER.error("Might be list of errors :");
List<PCloudError> errors;
try {
errors = new ObjectMapper().readValue(responsedata.getBody(), TypeFactory.defaultInstance()
.constructCollectionType(List.class, PCloudError.class));
throw new PCloudErrorsUIException(errors, responsedata.getStatus());
} catch (IOException e1) {
LOGGER.error("Error while parsing response data for error condition", e1);
}
}

} else {

try {

entity = entityType.cast(new ObjectMapper().readValue(responsedata.getBody(), entityType));

} catch (Exception e) {
LOGGER.info("inside exception");
e.printStackTrace();
LOGGER.error("Error while parsing response data for success", e);
}

}
return entity;
}

@Override
public PCloudResponse processFeedback(FeedbackInfo feedbackInfo) {
feedbackInfo.setToEmail(feedbackEmail);
return handleException(pcRestClient.post(UIRestPathConstants.PERSONAL_CLOUD_PROV_FEEDBACK_URI, feedbackInfo),
PCloudResponse.class);
}
}
Loading