Package de.mhus.lib.basics
Class RC
- java.lang.Object
-
- de.mhus.lib.basics.RC
-
public class RC extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intACCEPTEDstatic intACCESS_DENIEDyou are not allowed to access the system, causes the client system to ask for a password, exception for authenticationstatic intBUSYService Unavailable, do not use 403 because it could be repeated, Resource currently not available, lockedstatic intCONFLICTconflict state or wrong state, to many retries, key to remove not found, key already set wrong configuration - if not fixed fast, result is null, duplicate entry, device is not enabled ...static intCREATEDstatic intERRORDefault Error, client errorstatic intFORBIDDENyou are not allowed to access this resource, user and password is given but access ins not granted, exception for authorizationstatic intGONEindicating that the resource requested by the client has been permanently deleted, and that the client should not expect an alternative redirection or forwarding addressstatic intINTERNAL_ERRORInternal Server Error, general server errorstatic intLIMITToo Many Requests, Limit exceededstatic intNOT_FOUNDResource was not found and thats ok - in contrast to CONFLICT - resource should be therestatic intNOT_SUPPORTEDNot Implemented, method or operation not foundstatic intOKstatic intRANGE_MAXstatic intRANGE_MAX_CUSTOMstatic intRANGE_MAX_PROFESSIONALstatic intRANGE_MAX_SUCCESSFULstatic intRANGE_MAX_TECHNICALstatic intRANGE_MIN_CUSTOMstatic intRANGE_MIN_PROFESSIONALstatic intRANGE_MIN_SUCCESSFULstatic intRANGE_MIN_TECHNICALstatic intSYNTAX_ERRORUnsupported Media Type - string instead of int, wrong parameter value type, malformed formatstatic intTEAPOTstatic intTIMEOUTGateway Timeoutstatic intTOO_DEEPLoop Detected, to deep iteration, stack overflowstatic intTOO_LARGEstatic intUSAGEUnprocessable Entity - parameter from client not set, parameter not found, parameter data is nullstatic intWARNINGMiscellaneous persistent warningstatic intWARNING_TEMPORARILYMiscellaneous warning
-
Constructor Summary
Constructors Constructor Description RC()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanRetry(int rc)static ThrowablefindCause(RC.CAUSE causeHandling, Object... in)static intfindReturnCode(RC.CAUSE causeHandling, int rc, Object... in)static booleanisProfessionalError(int rc)permanent error, retry will not fix itstatic booleanisSuccessful(int rc)not an error - should not be used for exceptionsstatic booleanisTechnicalError(int rc)not permanent, could be fixedstatic booleanisWarning(int rc)is successful but a warningstatic intnormalize(int rc)Allow all between 0 - 999, otherwise 400 (ERROR)static StringtoMessage(int rc, IResult cause, String msg, Object[] parameters, int maxSize)static StringtoMessage(int rc, RC.CAUSE causeHandling, String msg, Object[] parameters, int maxSize)static StringtoMessage(int rc, RC.CAUSE causeHandling, String msg, Object[] parameters, int maxSize, IResult cause)static StringtoString(int rc)
-
-
-
Field Detail
-
WARNING_TEMPORARILY
public static final int WARNING_TEMPORARILY
Miscellaneous warning- See Also:
- Constant Field Values
-
OK
public static final int OK
- See Also:
- Constant Field Values
-
CREATED
public static final int CREATED
- See Also:
- Constant Field Values
-
ACCEPTED
public static final int ACCEPTED
- See Also:
- Constant Field Values
-
WARNING
public static final int WARNING
Miscellaneous persistent warning- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR
Default Error, client error- See Also:
- Constant Field Values
-
ACCESS_DENIED
public static final int ACCESS_DENIED
you are not allowed to access the system, causes the client system to ask for a password, exception for authentication- See Also:
- Constant Field Values
-
FORBIDDEN
public static final int FORBIDDEN
you are not allowed to access this resource, user and password is given but access ins not granted, exception for authorization- See Also:
- Constant Field Values
-
NOT_FOUND
public static final int NOT_FOUND
Resource was not found and thats ok - in contrast to CONFLICT - resource should be there- See Also:
- Constant Field Values
-
CONFLICT
public static final int CONFLICT
conflict state or wrong state, to many retries, key to remove not found, key already set wrong configuration - if not fixed fast, result is null, duplicate entry, device is not enabled ... is not writable / read only- See Also:
- Constant Field Values
-
GONE
public static final int GONE
indicating that the resource requested by the client has been permanently deleted, and that the client should not expect an alternative redirection or forwarding address- See Also:
- Constant Field Values
-
TOO_LARGE
public static final int TOO_LARGE
- See Also:
- Constant Field Values
-
SYNTAX_ERROR
public static final int SYNTAX_ERROR
Unsupported Media Type - string instead of int, wrong parameter value type, malformed format- See Also:
- Constant Field Values
-
USAGE
public static final int USAGE
Unprocessable Entity - parameter from client not set, parameter not found, parameter data is null- See Also:
- Constant Field Values
-
LIMIT
public static final int LIMIT
Too Many Requests, Limit exceeded- See Also:
- Constant Field Values
-
TEAPOT
public static final int TEAPOT
- See Also:
- Constant Field Values
-
INTERNAL_ERROR
public static final int INTERNAL_ERROR
Internal Server Error, general server error- See Also:
- Constant Field Values
-
NOT_SUPPORTED
public static final int NOT_SUPPORTED
Not Implemented, method or operation not found- See Also:
- Constant Field Values
-
BUSY
public static final int BUSY
Service Unavailable, do not use 403 because it could be repeated, Resource currently not available, locked- See Also:
- Constant Field Values
-
TIMEOUT
public static final int TIMEOUT
Gateway Timeout- See Also:
- Constant Field Values
-
TOO_DEEP
public static final int TOO_DEEP
Loop Detected, to deep iteration, stack overflow- See Also:
- Constant Field Values
-
RANGE_MIN_SUCCESSFUL
public static final int RANGE_MIN_SUCCESSFUL
- See Also:
- Constant Field Values
-
RANGE_MAX_SUCCESSFUL
public static final int RANGE_MAX_SUCCESSFUL
- See Also:
- Constant Field Values
-
RANGE_MIN_PROFESSIONAL
public static final int RANGE_MIN_PROFESSIONAL
- See Also:
- Constant Field Values
-
RANGE_MAX_PROFESSIONAL
public static final int RANGE_MAX_PROFESSIONAL
- See Also:
- Constant Field Values
-
RANGE_MIN_TECHNICAL
public static final int RANGE_MIN_TECHNICAL
- See Also:
- Constant Field Values
-
RANGE_MAX_TECHNICAL
public static final int RANGE_MAX_TECHNICAL
- See Also:
- Constant Field Values
-
RANGE_MIN_CUSTOM
public static final int RANGE_MIN_CUSTOM
- See Also:
- Constant Field Values
-
RANGE_MAX_CUSTOM
public static final int RANGE_MAX_CUSTOM
- See Also:
- Constant Field Values
-
RANGE_MAX
public static final int RANGE_MAX
- See Also:
- Constant Field Values
-
-
Method Detail
-
toMessage
public static String toMessage(int rc, IResult cause, String msg, Object[] parameters, int maxSize)
-
toMessage
public static String toMessage(int rc, RC.CAUSE causeHandling, String msg, Object[] parameters, int maxSize)
-
toMessage
public static String toMessage(int rc, RC.CAUSE causeHandling, String msg, Object[] parameters, int maxSize, IResult cause)
-
normalize
public static int normalize(int rc)
Allow all between 0 - 999, otherwise 400 (ERROR)- Parameters:
rc-- Returns:
- normalize error code
-
isWarning
public static boolean isWarning(int rc)
is successful but a warning- Parameters:
rc-- Returns:
- true if this kind of error
-
isTechnicalError
public static boolean isTechnicalError(int rc)
not permanent, could be fixed- Parameters:
rc-- Returns:
- true if this kind of error
-
isProfessionalError
public static boolean isProfessionalError(int rc)
permanent error, retry will not fix it- Parameters:
rc-- Returns:
- true if this kind of error
-
isSuccessful
public static boolean isSuccessful(int rc)
not an error - should not be used for exceptions- Parameters:
rc-- Returns:
- true if this kind of error
-
canRetry
public static boolean canRetry(int rc)
-
toString
public static String toString(int rc)
-
-