Skip to content

Commit

Permalink
add error reference page to notification
Browse files Browse the repository at this point in the history
  • Loading branch information
croufay committed Nov 10, 2016
1 parent 33f1bd7 commit 6f5e531
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@
import org.restcomm.connect.dao.entities.Notification;
import org.restcomm.connect.commons.dao.Sid;



/**
*
* @author charles.roufay
*/
public class GlobalNotification {


public static int getERROR_NOTIFICATION() {
return ERROR_NOTIFICATION;
}
Expand All @@ -43,22 +40,24 @@ public GlobalNotification(Configuration configuration, DaoManager storage) {
private final DaoManager storage;
private Notification notification = null;
private NotificationsDao notifications = null;
// application data.
// application data.
//private HttpRequestDescriptor request;
//private HttpResponseDescriptor response;
//notifications.addNotification(notification);
private URI uri = URI.create("http://documentation.telestax.com/connect/api/");

public void sendNotification(final int errorWarningCode, final int apiErrorCode, final String errorMessage) {
notification = notification(errorWarningCode, apiErrorCode, errorMessage, uri,"","","");
notification = notification(errorWarningCode, apiErrorCode, errorMessage, uri, "", "", "");
notifications = storage.getNotificationsDao();
notifications.addNotification(notification);
}
protected Notification notification(final int errorWarningCode, final int apiErrorCode,
final String errorMessage,
final URI requestUrl,
final String requestMethod,
final String requestVariables,
final String responseHeaders) {

protected Notification notification(final int errorWarningCode, final int apiErrorCode,
final String errorMessage,
final URI requestUrl,
final String requestMethod,
final String requestVariables,
final String responseHeaders) {

final Notification.Builder builder = Notification.builder();
final Sid sid = Sid.generate(Sid.Type.NOTIFICATION);
Expand All @@ -74,7 +73,9 @@ protected Notification notification(final int errorWarningCode, final int apiErr
buffer.append("/");
}
buffer.append(apiErrorCode).append(".html");
final URI info = URI.create(buffer.toString());
// final URI info = URI.create(buffer.toString());
String uriCreate = "http://documentation.telestax.com/connect/api/error-reference.html";
final URI info = URI.create(uriCreate);
builder.setMoreInfo(info);
builder.setMessageText(errorMessage);
final DateTime now = DateTime.now();
Expand All @@ -90,6 +91,6 @@ protected Notification notification(final int errorWarningCode, final int apiErr
final URI uri = URI.create(buffer.toString());
builder.setUri(uri);
return builder.build();
}
}

}

0 comments on commit 6f5e531

Please sign in to comment.