Ejemplo n.º 1
0
        public As2Disposition(
            ActionMode actionMode,
            SendingMode sendingMode,
            DispositionType dispositionType,
            DispositionModifier dispositionModifier)
        {
            this.actionMode      = actionMode;
            this.sendingMode     = sendingMode;
            this.DispositionType = dispositionType;

            // Only processed/error or processed/warning is allowed
            if (dispositionType == DispositionType.Processed &&
                (dispositionModifier.Prefix == DispositionModifierPrefix.Failure))
            {
                throw new ArgumentException(
                          "DispositionType 'processed' does not allow a prefix of 'failed'. Only 'error' and 'warning' are allowed");
            }

            this.dispositionModifier = dispositionModifier;
        }
Ejemplo n.º 2
0
        public static As2Disposition valueOf(String s)
        {
            s = (s ?? string.Empty).Trim();
            Match matcher = pattern.Match(s);

            if (!matcher.Success)
            {
                throw new ArgumentException("'" + s + "'" + " does not match pattern for As2Disposition");
            }

            String     actionModeString = matcher.Groups[1].Value;
            ActionMode actionMode       = ActionMode.CreateFromTextValue(actionModeString);

            String      sendingModeString = matcher.Groups[2].Value;
            SendingMode sendingMode       = SendingMode.CreateFromTextValue(sendingModeString);

            String          dispositionTypeString = matcher.Groups[3].Value;
            DispositionType dispositionType       = DispositionType.ValueOf(dispositionTypeString.ToLowerInvariant());

            As2Disposition result;

            if (matcher.Groups[4].Success)
            {
                DispositionModifier dispositionModifier;
                String dispositionModifierPrefixString = matcher.Groups[5].Value;
                String dispositionModifierString       = matcher.Groups[6].Value;
                dispositionModifier = new DispositionModifier(
                    DispositionModifierPrefix.ValueOf(dispositionModifierPrefixString.ToUpperInvariant()),
                    dispositionModifierString);
                result = new As2Disposition(actionMode, sendingMode, dispositionType, dispositionModifier);
            }
            else
            {
                result = new As2Disposition(actionMode, sendingMode, dispositionType);
            }

            return(result);
        }
Ejemplo n.º 3
0
 public As2Disposition(ActionMode actionMode, SendingMode sendingMode, DispositionType dispositionType)
 {
     this.actionMode      = actionMode;
     this.sendingMode     = sendingMode;
     this.DispositionType = dispositionType;
 }