Search in sources :

Example 1 with OutOfBoundsAcsJCompletion

use of alma.ACSErrTypeCommon.wrappers.OutOfBoundsAcsJCompletion in project ACS by ACS-Community.

the class RWCommonComparablePropertyImpl method setSync.

/*********************** [ RW<type> helpers ] ***********************/
/**
	 * @see alma.ACSErr.Completion alma.ACS.RW<type>Operations#set_sync(<type>)
	 */
protected Completion setSync(Object value) throws AcsJException {
    try {
        // check limits
        if (value instanceof Comparable) {
            Comparable c = (Comparable) value;
            if (c.compareTo(minValue) < 0 || c.compareTo(maxValue) > 0) {
                OutOfBoundsAcsJCompletion compl = new OutOfBoundsAcsJCompletion();
                compl.setMinValue(minValue.toString());
                compl.setMaxValue(maxValue.toString());
                compl.setRequestedValue(value.toString());
                return compl.toCorbaCompletion();
            }
        }
        CompletionHolder completionHolder = CompletionUtil.createCompletionHolder();
        dataAccess.set(value, completionHolder);
        // generate no-error completion, if not generated
        if (completionHolder.value == null)
            completionHolder.value = CompletionUtil.generateNoErrorCompletion();
        return completionHolder.value;
    } catch (AcsJException acsex) {
        throw new AcsJCouldntPerformActionEx("Failed to set value.", acsex);
    }
}
Also used : AcsJCouldntPerformActionEx(alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx) AcsJException(alma.acs.exceptions.AcsJException) CompletionHolder(alma.ACSErr.CompletionHolder) OutOfBoundsAcsJCompletion(alma.ACSErrTypeCommon.wrappers.OutOfBoundsAcsJCompletion)

Aggregations

CompletionHolder (alma.ACSErr.CompletionHolder)1 AcsJCouldntPerformActionEx (alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx)1 OutOfBoundsAcsJCompletion (alma.ACSErrTypeCommon.wrappers.OutOfBoundsAcsJCompletion)1 AcsJException (alma.acs.exceptions.AcsJException)1