GetInputPera return null when declare outside ExecuteBusinessLogic : How to Solve It

1
0
-1

i m creating one custom connector . in this connector i want to use method calling structure. but when i declare variables with get parameter it always return null. i have to declare parameter into ExecutebusinessLogic() but that can't be reference outside that method . so i want to publicly define variable i tried different , but still same : null return . pl do something

code :

package org.mycompany.connector;

import java.util.logging.Logger;

import org.bonitasoft.engine.connector.AbstractConnector;
import org.bonitasoft.engine.connector.ConnectorException;
import org.bonitasoft.engine.connector.ConnectorValidationException;

public class Log_TestImpl extends AbstractConnector {

        Logger logger = Logger.getLogger("org.bonitasoft");
        private Logger LOGGER = Logger.getLogger(this.getClass().getName());
        protected final static String IP1_INPUT_PARAMETER = "ip1";
        protected final static String IP2_INPUT_PARAMETER = "ip2";
        protected final static String IP3_INPUT_PARAMETER = "ip3";
        String s1 = (String) getInputParameter(IP1_INPUT_PARAMETER);
        String s2 = (String) getInputParameter(IP2_INPUT_PARAMETER);
        String s3 = (String) getInputParameter(IP3_INPUT_PARAMETER);

        @Override
        public void validateInputParameters() throws ConnectorValidationException {
                try {
                        getInputParameter(IP1_INPUT_PARAMETER);
                } catch (ClassCastException cce) {
                        throw new ConnectorValidationException("ip1 type is invalid");
                }
                try {
                        getInputParameter(IP2_INPUT_PARAMETER);

                } catch (ClassCastException cce) {
                        throw new ConnectorValidationException("ip2 type is invalid");
                }
                try {
                        getInputParameter(IP3_INPUT_PARAMETER);
                } catch (ClassCastException cce) {
                        throw new ConnectorValidationException("ip3 type is invalid");
                }

        }

        @Override
        protected void executeBusinessLogic() throws ConnectorException {
                // Get access to the connector input parameters
                // getIp1();
                // getIp2();
                // getIp3();

                logger.severe("THIS IS FROM WITH OUT ABSTRACT ");
                logger.severe(s1);
                logger.severe(s2);
                logger.severe(s3);

                // TODO execute your business logic here

                // WARNING : Set the output of the connector execution. If outputs are
                // not set, connector fails
                try {
                        validateInputParameters();
                } catch (ConnectorValidationException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                logger.severe("CALLING LOG PERA");
                logInputParameters();
                logger.severe("BACK TO ORGINAL CLASS IT DONE ");
        }

        private void logInputParameters() {
                logInputParameter(IP1_INPUT_PARAMETER);
                logInputParameter(IP2_INPUT_PARAMETER);
                logInputParameter(IP3_INPUT_PARAMETER);

        }

        private void logInputParameter(String parameterName) {
                LOGGER.severe(parameterName + " "
                                + String.valueOf(getInputParameter(parameterName)));
        }

        @Override
        public void connect() throws ConnectorException {
                // [Optional] Open a connection to remote server

        }

        @Override
        public void disconnect() throws ConnectorException {
                // [Optional] Close connection to remote server

        }

}
No answers yet.
Notifications