| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.runtime.common.validation; |
| |
| /** |
| * The status defines the current state of a process. It may be used for |
| * different usecases. For instance for validations, to determine veto before |
| * calling a process, to visualize thrown exceptions,... It is a general |
| * implementation. |
| */ |
| public interface IStatus { |
| |
| /** |
| * A constant for ok status. |
| */ |
| public static final IStatus OK = Status.createOKStatus(); |
| |
| /** |
| * A constant for cancel status. |
| */ |
| public static final IStatus CANCEL = Status.createCancelStatus(); |
| |
| /** |
| * A constant for error status. |
| */ |
| public static final IStatus ERROR = Status.createErrorStatus(); |
| |
| /** |
| * The id of the affected application. |
| */ |
| public static final String PROP_UI_APPLICATION_ID = "application.id"; |
| |
| /** |
| * The id of the field. |
| */ |
| public static final String PROP_FIELD_ID = "field.id"; |
| |
| /** |
| * I18nKey of the field. |
| */ |
| public static final String PROP_FIELD_I18N_KEY = "field.i18nKey"; |
| |
| /** |
| * javax constraint if created by bean validation. |
| */ |
| public static final String PROP_JAVAX_CONSTRAINT = "javax.validation.constraint"; |
| |
| /** |
| * leaf bean if created by bean validation. |
| */ |
| public static final String PROP_JAVAX_LEAF_BEAN = "javax.validation.leafbean"; |
| |
| /** |
| * property path if created by bean validation. |
| */ |
| public static final String PROP_JAVAX_PROPERTY_PATH = "javax.validation.propertypath"; |
| |
| /** |
| * Class that created the message. |
| */ |
| public static final String PROP_CREATOR = "creator"; |
| |
| /** |
| * Returns the id of the status. It is prepared by the pattern |
| * <code>{bundleSymbolicName}.{code}</code>. So every bundle may specify its own codes. |
| * |
| * @return the id |
| */ |
| String getId(); |
| |
| /** |
| * Returns the status code. The code specifies the unique id of a status |
| * message in a bundle. |
| * |
| * @return the code |
| */ |
| String getCode(); |
| |
| /** |
| * Returns symbolic name of the bundle that has created the status. |
| * |
| * @return the bundle symblic name |
| */ |
| String getBundleSymblicName(); |
| |
| /** |
| * Returns the severity of the status. |
| * |
| * @return the severity |
| */ |
| Severity getSeverity(); |
| |
| /** |
| * Returns the message of the status. May be <code>null</code>. |
| * |
| * @return the message |
| */ |
| String getMessage(); |
| |
| /** |
| * Returns the exception of the status. May be <code>null</code>. |
| * |
| * @return the exception |
| */ |
| Exception getException(); |
| |
| /** |
| * Returns true, if the status is {@link Severity#OK} or |
| * {@link Severity#INFO}. |
| * |
| * @return true, if is ok |
| */ |
| boolean isOK(); |
| |
| /** |
| * Returns true, if the status is {@link Severity#INFO}. |
| * |
| * @return true, if is info |
| */ |
| boolean isInfo(); |
| |
| /** |
| * Returns true, if the status is {@link Severity#WARNING}. |
| * |
| * @return true, if is warning |
| */ |
| boolean isWarning(); |
| |
| /** |
| * Returns true, if the status is {@link Severity#ERROR}. |
| * |
| * @return true, if is error |
| */ |
| boolean isError(); |
| |
| /** |
| * Returns true, if the status is {@link Severity#CANCEL}. May be used to |
| * detect a "veto" for a process. |
| * |
| * @return true, if is cancel |
| */ |
| boolean isCancel(); |
| |
| /** |
| * Puts a property into the status. |
| * |
| * @param key |
| * the key |
| * @param value |
| * the value |
| */ |
| void putProperty(String key, Object value); |
| |
| /** |
| * Returns true, if a property exists. |
| * |
| * @param key |
| * the key |
| * @return true, if successful |
| */ |
| boolean containsProperty(String key); |
| |
| /** |
| * Returns the value of the property. |
| * |
| * @param key |
| * the key |
| * @return the property |
| */ |
| Object getProperty(String key); |
| |
| /** |
| * The severity of the status. |
| */ |
| enum Severity { |
| |
| /** The ok. */ |
| OK, |
| /** The info. */ |
| INFO, |
| /** The warning. */ |
| WARNING, |
| /** The error. */ |
| ERROR, |
| /** The cancel. */ |
| CANCEL, |
| /** The critical. */ |
| CRITICAL, |
| /** The systemerror. */ |
| SYSTEMERROR; |
| } |
| } |