All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.forms.foundation.service.FormsFoundationException Maven / Gradle / Ivy

/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2015 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/

package com.adobe.forms.foundation.service;

import java.text.MessageFormat;
import java.util.ResourceBundle;

/**
 * @author sharoon
 * @date Nov 26, 2015
 * @time 10:13:53 PM
 */
public class FormsFoundationException extends Exception {

	/**
	 *  Serial Version UID
	 */
	private static final long serialVersionUID = 1500623108187528483L;

	private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("formsFoundationErrorMessages");
	
	public static final String UNEXPECTED_ERROR = "AEM-FF-001";
	
	public static final String INVALID_INPUT_PARAMETERS = "AEM-FF-002";
	
	public static final String UNABLE_TO_CURRENT_USER_SESSION = "AEM-FF-003";
	
	public static final String NODE_DOES_NOT_EXISTS = "AEM-FF-004";
	
	public static final String UNABLE_TO_DETERMINE_ASSET_TYPE = "AEM-FF-005";

	public static final String ASSET_ALREADY_EXIST = "AEM-FF-006";

	public static final String MOVE_ASSET_FAILED = "AEM-FF-007";

	public static final String MOVE_UNAUTHORIZED_ACCESS = "AEM-FF-008";
	
	private String errorCode;

	private String unresolvedMessage;

	private Object[] arguments;
	
	private String message;
	
	public FormsFoundationException(String errorCode, Object[] args) {
		this.errorCode = errorCode;
		arguments = args;
		this.unresolvedMessage = resourceBundle.getString(errorCode);
		if (arguments == null) {
			this.message = unresolvedMessage; 
		} else {
			MessageFormat messageFormat = new MessageFormat(unresolvedMessage);
			this.message = messageFormat.format(arguments);
		}
	}
	
	/**
	 * Default Constructor
	 */
	public FormsFoundationException() {
		super();
	}

	/**
	 * @param message
	 * @param cause
	 */
	public FormsFoundationException(String message, Throwable cause) {
		super(message, cause);
	}

	/**
	 * @param cause
	 */
	public FormsFoundationException(Throwable cause) {
		super(cause);
	}

	/**
	 * @param message
	 */
	public FormsFoundationException(String message) {
		super(message);
	}

	@Override
	public String getMessage() {
		if (errorCode != null) {
			return errorCode + ": " + message;
		} else {
			return super.getMessage();
		}
	}

	public String getErrorCode() {
		return errorCode;
	}

	public String getUnresolvedMessage() {
	    return unresolvedMessage;
    }

    public Object[] getMessageArgs() {
        return arguments;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy