2022

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
/** Method to read a list of customers in MsNav Takes in a variable arguments* of CustomerFilter as input and returns a list of Customer objects */
     public List<Customer> readCustomer(CustomerFilter filter) throws Exception {//Read operation}
Inside a reader method, data is fetched using a relevant SOAP call with the necessary filter applied and the data fetched from the SOAP call is wrapped into the dbsync compatible output wrapper class
           try {
                // Modified by Sambit to check for null for the filter object
                if (null != filter) {
                     for (Field field : CustomerFilter.class.getFields()) {
                           CustomerCardFilter cusCardFilter = null;
                           Object value = getFieldValue(field, filter);
                           if (value != null
                                     && !((String) value).trim().equalsIgnoreCase("")) {
                                cusCardFilter = new CustomerCardFilter();
                                String fldName = field.getName().substring(
                                           field.getName().lastIndexOf(".") + 1);
                                // CustomerCardFields.valueOf(CustomerCardFields.NO.toString());
                                //System.out.println(CustomerCardFields.NO.toString());
                                cusCardFilter.setField(CustomerCardFields.valueOf(fldName.toUpperCase()));
                                cusCardFilter.setCriteria((String) value);
                                custCardFilterList.add(cusCardFilter);
                           }
                     }//for}//if(null != filter)
                // if there are more elements to read or it is the first read
                if (repositionKey == null || hasMoreElements()) {
                     CustomerCardList cList = null;
                     if (repositionKey == null) {
                           cList = customerCardPort.readMultiple(custCardFilterList,"", batchSize);
                     } else {
                           cList = customerCardPort.readMultiple(custCardFilterList,repositionKey, batchSize);
                     }
                     int cCount = cList.getCustomerCard().size();
                     for (int i = 0; i < cCount; i++) {
                           CustomerCard cusCard = (CustomerCard) cList.getCustomerCard().get(i);
                          /** Customer cusw = new Customer();
                          * cusw.setCustomerCard(cusCard);*/
                           // Customer cusw =
                          // (Customer)ClassConverter.convertToClass(cusCard,// Customer.class);
                           Customer cusw = Customer.createCustomer(cusCard);
                           customers.add(cusw);
                     }
                     if (customers.size() == batchSize) {
                           // Get the last element in the list of customers to get the
                           // repositionkey
                           Customer cusw = customers.get(batchSize - 1);
                           repositionKey = cusw.getKey();
                     } else {
                           repositionKey = "-1";
                     }
               }
           } catch (Exception e) {
                e.printStackTrace();
                log.log(Level.SEVERE, "Error while reading customers from MSNAV", e);
                throw e;
           }
           return customers;

14. Deployment Process 

The AppCode is bundled into a zip file and is deployed as a zip file into the environment specified in the appcode-deploy.xml file. The environment name is specified in the “environment” attribute.

Code Block

 <property name = “environment” value = “sandbox” />