com.port.ocean.shipping.data.VehiclePassedData.java Source code

Java tutorial

Introduction

Here is the source code for com.port.ocean.shipping.data.VehiclePassedData.java

Source

package com.port.ocean.shipping.data;
/**
 * Created by  on 2016/3/24.
 */

import com.port.ocean.shipping.bean.VehiclePassed;

import org.json.JSONArray;
import org.json.JSONObject;
import org.mobile.library.model.data.base.SimpleJsonDataModel;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * ??
 *
 * @author 
 * @version 1.0 2016/3/24
 * @since 1.0
 */
public class VehiclePassedData extends SimpleJsonDataModel {

    /**
     * 
     */
    private String startRow = null;

    /**
     * 
     */
    private String count = null;

    /**
     * ?
     */
    private String licensePlateNumber = null;

    /**
     * id
     */
    private String userId = null;

    /**
     * ?
     */
    private List<VehiclePassed> dataList = null;

    /**
     * 
     *
     * @param startRow 
     */
    public void setStartRow(String startRow) {
        this.startRow = startRow;
    }

    /**
     * ??
     *
     * @param count ???
     */
    public void setCount(String count) {
        this.count = count;
    }

    /**
     * ?
     *
     * @param licensePlateNumber ?
     */
    public void setLicensePlateNumber(String licensePlateNumber) {
        this.licensePlateNumber = licensePlateNumber;
    }

    /**
     * id
     *
     * @param userId id
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }

    /**
     * ??
     *
     * @return ?
     */
    public List<VehiclePassed> getDataList() {
        return dataList;
    }

    @Override
    protected void onExtractData(JSONObject jsonData) throws Exception {
        JSONArray jsonArray = jsonData.getJSONArray(DATA_TAG);

        dataList = new ArrayList<>();
        for (int i = 0; i < jsonArray.length(); i++) {
            JSONArray row = jsonArray.getJSONArray(i);

            if (row.length() > 4) {
                VehiclePassed data = new VehiclePassed();
                data.setLicensePlateNumber(row.getString(0));
                data.setLocation(row.getString(1));
                data.setStorage(row.getString(2));
                data.setAuditTime(row.getString(3));
                data.setAttention("1".equals(row.getString(4)));

                dataList.add(data);
            }
        }
    }

    @Override
    protected void onFillRequestParameters(Map<String, String> dataMap) {
        dataMap.put("StartRow", startRow);
        dataMap.put("Count", count);
        dataMap.put("VehicleNum", licensePlateNumber);
        dataMap.put("CodeUser", userId);
    }
}