/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.isup.ISUPMessageImpl#decodeMandatoryVariableBody(byte [], int)
4672
protected void decodeMandatoryVariableBody(ISUPParameterFactory parameterFactory, byte[] parameterBody, int parameterIndex)
            throws ParameterException {
        switch (parameterIndex) {
            case _INDEX_V_RangeAndStatus:
                RangeAndStatus ras = parameterFactory.createRangeAndStatus();
                ((AbstractISUPParameter) ras).decode(parameterBody);
                this.setRangeAndStatus(ras);
                break;
            default:
                throw new ParameterException("Unrecognized parameter index for mandatory variable part, index: "
                        + parameterIndex);

        }

    }
34250
private static JsJmsMessage decodeBytesBody(String body) throws MessageDecodeFailedException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "decodeBytesBody");
        JsJmsBytesMessage result = new JsJmsBytesMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
        if (body != null)
            result.setBytes(HexString.hexToBin(body, 0));
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "decodeBytesBody");
        return result;
    }
290685
protected int decodeMandatoryParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
            throws ParameterException {
        int localIndex = index;
        index += super.decodeMandatoryParameters(parameterFactory, b, index);
        if (b.length - index > 1) {
            CircuitGroupSuperVisionMessageType cgsvmt = parameterFactory.createCircuitGroupSuperVisionMessageType();
            ((AbstractISUPParameter) cgsvmt).decode(new byte[] { b[index] });
            this.setSupervisionType(cgsvmt);
            index++;
            return index - localIndex;
        } else {
            throw new IllegalArgumentException("byte[] must have atleast four octets");
        }
    }
652128
private byte[] getBody(String method) {
        byte[] body = null;
    	String methodsWithInputEntity = HttpMethod.POST.name() + "|" + HttpMethod.PUT.name() + "|" + HttpMethod.DELETE.name();
    	if (method.matches(methodsWithInputEntity)) {
            if (isCompound()) {
                body = Utils.toBytes(getQueryInputEntity());
            }
            else {
                if (metadataJson.containsKey(INPUT_ENTITY)) {
                    JSONable data = (JSONable)commandParams.get(metadataJson.getString(INPUT_ENTITY));
                    if (data != null) {
                        body = Utils.toBytes(data.toJSON());
                    }
                }
            }
        }
        return body;
    }
704422
@Override
    public String getValue(final String variable) throws NotAvailableException {
        try {
            return VariableProcessor.resolveVariables(VariableProcessor.resolveVariable(variable, variableProviderPool), true, variableProviderPool);
        } catch (MultiException ex) {
            throw new NotAvailableException("Variable[" + variable + "]", ex);
        }
    }
1113540
protected int decodeMandatoryParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
            throws ParameterException {

        int localIndex = index;
        index += super.decodeMandatoryParameters(parameterFactory, b, index);
        if (b.length - index > 1) {
            try {
                byte[] eventInformation = new byte[1];
                eventInformation[0] = b[index++];

                EventInformation _ei = parameterFactory.createEventInformation();
                ((AbstractISUPParameter) _ei).decode(eventInformation);
                this.setEventInformation(_ei);
            } catch (Exception e) {
                // AIOOBE or IllegalArg
                throw new ParameterException("Failed to parse EventInformation due to: ", e);
            }

            return index - localIndex;
        } else {
            throw new ParameterException("byte[] must have atleast four octets");
        }
    }
202246
private void encodeBytesBody(StringBuffer result, JsJmsBytesMessage msg) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "encodeBytesBody");
    byte[] body = msg.getBytes();
    if (body != null) {
      result.append('~');
      HexString.binToHex(body, 0, body.length, result);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "encodeBytesBody");
  }
328511
private static int readRawVarint32(ByteBuf buffer) {
        if (!buffer.isReadable()) {
            return 0;
        }
        buffer.markReaderIndex();
        byte tmp = buffer.readByte();
        if (tmp >= 0) {
            return tmp;
        } else {
            int result = tmp & 127;
            if (!buffer.isReadable()) {
                buffer.resetReaderIndex();
                return 0;
            }
            if ((tmp = buffer.readByte()) >= 0) {
                result |= tmp << 7;
            } else {
                result |= (tmp & 127) << 7;
                if (!buffer.isReadable()) {
                    buffer.resetReaderIndex();
                    return 0;
                }
                if ((tmp = buffer.readByte()) >= 0) {
                    result |= tmp << 14;
                } else {
                    result |= (tmp & 127) << 14;
                    if (!buffer.isReadable()) {
                        buffer.resetReaderIndex();
                        return 0;
                    }
                    if ((tmp = buffer.readByte()) >= 0) {
                        result |= tmp << 21;
                    } else {
                        result |= (tmp & 127) << 21;
                        if (!buffer.isReadable()) {
                            buffer.resetReaderIndex();
                            return 0;
                        }
                        result |= (tmp = buffer.readByte()) << 28;
                        if (tmp < 0) {
                            throw new CorruptedFrameException("malformed varint.");
                        }
                    }
                }
            }
            return result;
        }
    }
1237633
Object decodeProperty(MsgDestEncodingUtilsImpl.PropertyInputStream stream) throws JMSException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "decodeProperty", stream);

    // Get the String value in the normal way, then turn it into an Integer
    String temp = (String)super.decodeProperty(stream);
    Integer value = Integer.valueOf(temp);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "decodeProperty", value);
    return value;
  }
1152852
protected void checkJavaSerialization(String variableName, TypedValue value) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) {

      SerializableValue serializableValue = (SerializableValue) value;

      // if Java serialization is prohibited
      if (!serializableValue.isDeserialized()) {

        String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName();
        String requestedDataFormat = serializableValue.getSerializationDataFormat();

        if (requestedDataFormat == null) {
          // check if Java serializer will be used
          final TypedValueSerializer serializerForValue = TypedValueField.getSerializers()
              .findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory());
          if (serializerForValue != null) {
            requestedDataFormat = serializerForValue.getSerializationDataformat();
          }
        }

        if (javaSerializationDataFormat.equals(requestedDataFormat)) {
          throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName);
        }
      }
    }
  }
357247
protected void decodeMandatoryVariableBody(ISUPParameterFactory parameterFactory, byte[] parameterBody, int parameterIndex)
            throws ParameterException {
        switch (parameterIndex) {
            case _INDEX_V_RangeAndStatus:

                RangeAndStatus ras = parameterFactory.createRangeAndStatus();
                ((AbstractISUPParameter) ras).decode(parameterBody);
                this.setRangeAndStatus(ras);
                break;
            case _INDEX_V_CircuitStateIndicator:
                CircuitStateIndicator csi = new CircuitStateIndicatorImpl(parameterBody);
                this.setCircuitStateIndicator(csi);
                break;

            default:
                throw new ParameterException("Unrecognized parameter index for mandatory variable part, index: "
                        + parameterIndex);

        }

    }
438723
protected int decodeMandatoryParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
            throws ParameterException {
        int localIndex = index;
        index += super.decodeMandatoryParameters(parameterFactory, b, index);
        if (b.length - index == 1) {
            byte[] continuityIndicators = new byte[1];
            continuityIndicators[0] = b[index++];

            ContinuityIndicators _ci = parameterFactory.createContinuityIndicators();
            ((AbstractISUPParameter) _ci).decode(continuityIndicators);
            this.setContinuityIndicators(_ci);
        } else {
            throw new ParameterException("byte[] must have exact one octets");
        }

        return index - localIndex;
    }
270170
@Override
    public Map<String, Object> getBodyParameters() {
        HashMap<String, Object> params = new HashMap<String, Object>();
        params.put("count", this.count);
        if (this.targetUserId!=null) {
            params.put("targetUserId", this.targetUserId);
        }
        if (this.userImpact!=null) {
            params.put("userImpact", this.userImpact);
        }
        if (this.filter!=null) {
            params.put("filter", this.filter);
        }
        if (this.booster!=null) {
            params.put("booster", this.booster);
        }
        if (this.allowNonexistent!=null) {
            params.put("allowNonexistent", this.allowNonexistent);
        }
        if (this.cascadeCreate!=null) {
            params.put("cascadeCreate", this.cascadeCreate);
        }
        if (this.scenario!=null) {
            params.put("scenario", this.scenario);
        }
        if (this.returnProperties!=null) {
            params.put("returnProperties", this.returnProperties);
        }
        if (this.includedProperties!=null) {
            params.put("includedProperties", this.includedProperties);
        }
        if (this.diversity!=null) {
            params.put("diversity", this.diversity);
        }
        if (this.minRelevance!=null) {
            params.put("minRelevance", this.minRelevance);
        }
        if (this.rotationRate!=null) {
            params.put("rotationRate", this.rotationRate);
        }
        if (this.rotationTime!=null) {
            params.put("rotationTime", this.rotationTime);
        }
        if (this.expertSettings!=null) {
            params.put("expertSettings", this.expertSettings);
        }
        return params;
    }
119533
protected void decodeOptionalBody(ISUPParameterFactory parameterFactory, byte[] parameterBody, byte parameterCode)
            throws ParameterException {

        switch (parameterCode & 0xFF) {

            case BackwardCallIndicators._PARAMETER_CODE:
                BackwardCallIndicators bci = parameterFactory.createBackwardCallIndicators();
                ((AbstractISUPParameter) bci).decode(parameterBody);
                this.setBackwardCallIndicators(bci);
                break;
            case OptionalBackwardCallIndicators._PARAMETER_CODE:
                OptionalBackwardCallIndicators OBCI = parameterFactory.createOptionalBackwardCallIndicators();
                ((AbstractISUPParameter) OBCI).decode(parameterBody);
                this.setOptionalBackwardCallIndicators(OBCI);
                break;
            case CallReference._PARAMETER_CODE:
                CallReference CR = parameterFactory.createCallReference();
                ((AbstractISUPParameter) CR).decode(parameterBody);
                this.setCallReference(CR);
                break;
            case UserToUserIndicators._PARAMETER_CODE:
                UserToUserIndicators U2UI = parameterFactory.createUserToUserIndicators();
                ((AbstractISUPParameter) U2UI).decode(parameterBody);
                this.setUserToUserIndicators(U2UI);
                break;
            case UserToUserInformation._PARAMETER_CODE:
                UserToUserInformation U2UII = parameterFactory.createUserToUserInformation();
                ((AbstractISUPParameter) U2UII).decode(parameterBody);
                this.setUserToUserInformation(U2UII);
                break;
            case ConnectedNumber._PARAMETER_CODE:
                ConnectedNumber CN = parameterFactory.createConnectedNumber();
                ((AbstractISUPParameter) CN).decode(parameterBody);
                this.setConnectedNumber(CN);
                break;
            case AccessTransport._PARAMETER_CODE:
                AccessTransport AT = parameterFactory.createAccessTransport();
                ((AbstractISUPParameter) AT).decode(parameterBody);
                this.setAccessTransport(AT);
                break;
            case AccessDeliveryInformation._PARAMETER_CODE:
                AccessDeliveryInformation ADI = parameterFactory.createAccessDeliveryInformation();
                ((AbstractISUPParameter) ADI).decode(parameterBody);
                this.setAccessDeliveryInformation(ADI);
                break;
            case GenericNotificationIndicator._PARAMETER_CODE:
                GenericNotificationIndicator GNI = parameterFactory.createGenericNotificationIndicator();
                ((AbstractISUPParameter) GNI).decode(parameterBody);
                this.setGenericNotificationIndicator(GNI);
                break;
            case ParameterCompatibilityInformation._PARAMETER_CODE:
                ParameterCompatibilityInformation PCI = parameterFactory.createParameterCompatibilityInformation();
                ((AbstractISUPParameter) PCI).decode(parameterBody);
                this.setParameterCompatibilityInformation(PCI);
                break;
            case BackwardGVNS._PARAMETER_CODE:
                BackwardGVNS BGVNS = parameterFactory.createBackwardGVNS();
                ((AbstractISUPParameter) BGVNS).decode(parameterBody);
                this.setBackwardGVNS(BGVNS);
                break;
            case CallHistoryInformation._PARAMETER_CODE:
                CallHistoryInformation CHI = parameterFactory.createCallHistoryInformation();
                ((AbstractISUPParameter) CHI).decode(parameterBody);
                this.setCallHistoryInformation(CHI);
                break;
            case GenericNumber._PARAMETER_CODE:
                GenericNumber GN = parameterFactory.createGenericNumber();
                ((AbstractISUPParameter) GN).decode(parameterBody);
                this.setGenericNumber(GN);
                break;
            case TransmissionMediumUsed._PARAMETER_CODE:
                TransmissionMediumUsed TMU = parameterFactory.createTransmissionMediumUsed();
                ((AbstractISUPParameter) TMU).decode(parameterBody);
                this.setTransmissionMediumUsed(TMU);
                break;
            case NetworkSpecificFacility._PARAMETER_CODE:
                NetworkSpecificFacility NSF = parameterFactory.createNetworkSpecificFacility();
                ((AbstractISUPParameter) NSF).decode(parameterBody);
                this.setNetworkSpecificFacility(NSF);
                break;
            case RemoteOperations._PARAMETER_CODE:
                RemoteOperations RO = parameterFactory.createRemoteOperations();
                ((AbstractISUPParameter) RO).decode(parameterBody);
                this.setRemoteOperations(RO);
                break;
            case RedirectionNumber._PARAMETER_CODE:
                RedirectionNumber RN = parameterFactory.createRedirectionNumber();
                ((AbstractISUPParameter) RN).decode(parameterBody);
                this.setRedirectionNumber(RN);
                break;
            case ServiceActivation._PARAMETER_CODE:
                ServiceActivation SA = parameterFactory.createServiceActivation();
                ((AbstractISUPParameter) SA).decode(parameterBody);
                this.setServiceActivation(SA);
                break;
            case EchoControlInformation._PARAMETER_CODE:
                EchoControlInformation ECI = parameterFactory.createEchoControlInformation();
                ((AbstractISUPParameter) ECI).decode(parameterBody);
                this.setEchoControlInformation(ECI);
                break;
            case RedirectionNumberRestriction._PARAMETER_CODE:
                RedirectionNumberRestriction RNR = parameterFactory.createRedirectionNumberRestriction();
                ((AbstractISUPParameter) RNR).decode(parameterBody);
                this.setRedirectionNumberRestriction(RNR);
                break;
            case DisplayInformation._PARAMETER_CODE:
                DisplayInformation DI = parameterFactory.createDisplayInformation();
                ((AbstractISUPParameter) DI).decode(parameterBody);
                this.setDisplayInformation(DI);
                break;
            case ConferenceTreatmentIndicators._PARAMETER_CODE:
                ConferenceTreatmentIndicators CTI = parameterFactory.createConferenceTreatmentIndicators();
                ((AbstractISUPParameter) CTI).decode(parameterBody);
                this.setConferenceTreatmentIndicators(CTI);
                break;
            case ApplicationTransport._PARAMETER_CODE:
                ApplicationTransport ATP = parameterFactory.createApplicationTransport();
                ((AbstractISUPParameter) ATP).decode(parameterBody);
                this.setApplicationTransportParameter(ATP);
                break;
            case PivotRoutingBackwardInformation._PARAMETER_CODE:
                PivotRoutingBackwardInformation PRBI = parameterFactory.createPivotRoutingBackwardInformation();
                ((AbstractISUPParameter) PRBI).decode(parameterBody);
                this.setPivotRoutingBackwardInformation(PRBI);
                break;
            case RedirectStatus._PARAMETER_CODE:
                RedirectStatus RS = parameterFactory.createRedirectStatus();
                ((AbstractISUPParameter) RS).decode(parameterBody);
                this.setRedirectStatus(RS);
                break;
            default:
                throw new ParameterException("Unrecognized parameter code for optional part: " + parameterCode);
        }
    }
959774
public static VariableResolver getUpdateVariableResolver(ServletRequest request,
                                                             ServletResponse response,
                                                             boolean isHandlingPost) {
        Object form = ImplicitObjectUtil.unwrapForm(getActionForm(request));
        return new NetUIUpdateVariableResolver(form, request, response, isHandlingPost);
    }
517638
@Override
  public QueryBuilder<V> withBindVariableValue(String key, V value) {
    valueMap.put(key, value);
    return this;
  }
429440
@Override
	protected void decode(ChannelHandlerContext paramChannelHandlerContext,
			WebSocketFrame paramINBOUND_IN, List<Object> paramList)
			throws Exception {
		if(paramINBOUND_IN instanceof BinaryWebSocketFrame)
		{
			BinaryWebSocketFrame msg=(BinaryWebSocketFrame)paramINBOUND_IN;
			ByteBuf data = msg.content();
			paramList.add(data);
			data.retain();
		}
	}