Example usage for java.util Date getHours

List of usage examples for java.util Date getHours

Introduction

In this page you can find the example usage for java.util Date getHours.

Prototype

@Deprecated
public int getHours() 

Source Link

Document

Returns the hour represented by this Date object.

Usage

From source file:com.msds.km.controller.BespeakController.java

/**
 * ?/*  ww w.  j  a va 2 s  .  c  om*/
 *
 * @param entity
 * @param request
 * @return
 * @throws Exception 
 */
@RequestMapping(value = "/saveOrUpdateBespeak")
@ResponseBody
public Object saveOrUpdate(BespeakEntity entity, HttpServletRequest request) throws Exception {
    Date date = new Date();

    if (entity.getId() == null || StringUtils.isBlank(entity.getId().toString())) {
        entity.setCreateDate(date);
        entity.setModifyDate(date);
        entity.setState(1);
        bespeakService.addBespeak(entity);

        if (null != entity.getCompanyId()) {
            //[] 2015-08-02 19:00:00 ?A12345?C5 1.5 20042015-08-04 ????
            CompanyEntity company = companyService.findById(entity.getCompanyId());

            //??????
            if (null != company.getContactsPhone() && !"".equals(company.getContactsPhone())
                    && null != entity.getBespeakDate() && !"".equals(entity.getBespeakDate())) {
                MemberModelEntity mm = memberModelService.findById(entity.getMemberModelId());
                StringBuffer sb = new StringBuffer();
                DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String data = format1.format(date);
                int hour = date.getHours();
                String hourString = "?";
                if (hour >= 12) {
                    hourString = "?";
                }
                sb.append(data).append(" ?").append(mm.getRegion())
                        .append(mm.getLicense()).append(",").append(mm.getModelGroupName())
                        .append(",:").append(format.format(entity.getBespeakDate()))
                        .append(hourString).append("?");
                SmsUtil.sendGet(company.getContactsPhone(), appConstants.getSmsUrl(), sb.toString());
            }

            //??
            try {
                JPushManager.getInstance().pushToAlias("??",
                        "c" + String.valueOf(entity.getCompanyId()));
            } catch (Exception e) {
                logger.error("??");
            }

        }
    } else {
        entity.setModifyDate(date);
        bespeakService.update(entity);
    }
    return sendSuccessMessage();
}

From source file:com.krawler.spring.crm.common.crmManagerDAOImpl.java

/**
 * To convert a date and time selected separately by user into corresponding combined datetime
 * from users selected timezone to systems timezone
 *
 * The first step is to keep track of the time difference in order to change the date if required.
 * Two time only objects dtold and dtcmp are created for this purpose.
 *
 * The date passed and the time passed that are in system timezone are formatted without
 * timezone and then parsed into the required timezone and then the time values are set
 * back to the date value sent.//ww  w. j a v  a  2s  .c  o m
 *
 **/
public Date converttz(String timeZoneDiff, Date dt, String time) {
    Calendar cal = Calendar.getInstance();
    try {
        if (timeZoneDiff == null || timeZoneDiff.isEmpty()) {
            timeZoneDiff = "-7:00";
        }
        String val;
        SimpleDateFormat sdf = new SimpleDateFormat("HHmm 'Hrs'");
        Date dtold = sdf.parse("0000 Hrs");
        if (!time.endsWith("Hrs")) {
            sdf = new SimpleDateFormat("hh:mm a");
            dtold = sdf.parse("00:00 AM");
        }
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
        sdf2.setTimeZone(TimeZone.getTimeZone("GMT" + timeZoneDiff)); // Setting the timezone passed

        Date dt1 = sdf.parse(time); // Setting the passed time to the date object in system timezone

        sdf.setTimeZone(TimeZone.getTimeZone("GMT" + timeZoneDiff)); // Setting the timezone passed
        Date dtcmp = sdf.parse(time); // Parsing the time to timezone using passed values
        dt1.setMonth(dt.getMonth()); // Setting the date values sent to the system time only value
        dt1.setDate(dt.getDate());
        dt1.setYear(dt.getYear());
        dt1 = sdf2.parse(sdf1.format(dt1)); // Parsing datetime into required timezone
        dt.setHours(dt1.getHours()); // Setting the time values into the sent date
        dt.setMinutes(dt1.getMinutes());
        dt.setSeconds(0);
        cal.setTime(dt);
        if (dtcmp.compareTo(dtold) < 0) { // Comparing for time value change
            cal.add(Calendar.DATE, -1); //  in order to change the date accordingly
        }
        dtold.setDate(2);
        if (dtcmp.compareTo(dtold) > 0 || dtcmp.compareTo(dtold) == 0) {
            cal.add(Calendar.DATE, 1);
        }

    } catch (ParseException ex) {
        System.out.println(ex);
    } finally {
        return cal.getTime();
    }
}

From source file:org.pentaho.platform.dataaccess.datasource.wizard.service.agile.CsvTransformGeneratorTest.java

public void testGoodTransform() throws Exception {
    IPentahoSession session = new StandaloneSession("test");
    KettleSystemListener.environmentInit(session);
    ModelInfo info = createModel();//from w w w.  ja v  a  2 s.c o  m
    CsvTransformGenerator gen = new CsvTransformGenerator(info, getDatabaseMeta());

    gen.preview(session);

    DataRow rows[] = info.getData();
    assertNotNull(rows);
    assertEquals(235, rows.length);

    Date testDate = new Date();
    testDate.setDate(1);
    testDate.setHours(0);
    testDate.setMinutes(0);
    testDate.setMonth(0);
    testDate.setSeconds(0);
    testDate.setYear(110);

    // test the first row
    // test the data types
    DataRow row = rows[0];
    assertNotNull(row);
    Object cells[] = row.getCells();
    assertNotNull(cells);
    //    assertEquals( 8, cells.length );
    assertTrue(cells[0] instanceof Long);
    assertTrue(cells[1] instanceof Double);
    assertTrue(cells[2] instanceof Long);
    assertTrue(cells[3] instanceof Date);
    assertTrue(cells[4] instanceof String);
    assertTrue(cells[5] instanceof Long);
    assertTrue(cells[6] instanceof Double);
    assertTrue(cells[7] instanceof Boolean);
    // test the values
    assertEquals((long) 3, cells[0]);
    assertEquals(25677.96525, cells[1]);
    assertEquals((long) 1231, cells[2]);
    assertEquals(testDate.getYear(), ((Date) cells[3]).getYear());
    assertEquals(testDate.getMonth(), ((Date) cells[3]).getMonth());
    assertEquals(testDate.getDate(), ((Date) cells[3]).getDate());
    assertEquals(testDate.getHours(), ((Date) cells[3]).getHours());
    //    assertEquals( testDate.getMinutes(), ((Date)cells[3]).getMinutes() ); this fails, a bug in the PDI date parsing?
    assertEquals(testDate.getSeconds(), ((Date) cells[3]).getSeconds());

    //    assertEquals( testDate, cells[3] );
    assertEquals("Afghanistan", cells[4]);
    assertEquals((long) 11, cells[5]);
    assertEquals(111.9090909, cells[6]);
    assertEquals(false, cells[7]);

    // test the second row
    testDate.setDate(2);
    // test the data types
    row = rows[1];
    assertNotNull(row);
    cells = row.getCells();
    assertNotNull(cells);
    assertTrue(cells[0] instanceof Long);
    assertTrue(cells[1] instanceof Double);
    assertTrue(cells[2] instanceof Long);
    assertTrue(cells[3] instanceof Date);
    assertTrue(cells[4] == null);
    assertTrue(cells[5] instanceof Long);
    assertTrue(cells[6] instanceof Double);
    assertTrue(cells[7] instanceof Boolean);
    // test the values
    assertEquals((long) 4, cells[0]);
    assertEquals(24261.81026, cells[1]);
    assertEquals((long) 1663, cells[2]);
    assertEquals(testDate.getYear(), ((Date) cells[3]).getYear());
    assertEquals(testDate.getMonth(), ((Date) cells[3]).getMonth());
    assertEquals(testDate.getDate(), ((Date) cells[3]).getDate());
    assertEquals(testDate.getHours(), ((Date) cells[3]).getHours());
    //    assertEquals( testDate.getMinutes(), ((Date)cells[3]).getMinutes() ); this fails, a bug in the PDI date parsing?
    assertEquals(testDate.getSeconds(), ((Date) cells[3]).getSeconds());

    //    assertEquals( testDate, cells[3] );
    assertEquals(null, cells[4]); // IfNull value does not seem to work
    assertEquals((long) 7, cells[5]);
    assertEquals(237.5714286, cells[6]);
    assertEquals(true, cells[7]);

}

From source file:org.pentaho.platform.dataaccess.datasource.wizard.service.agile.CsvTransformGeneratorIT.java

public void testGoodTransform() throws Exception {
    IPentahoSession session = new StandaloneSession("test");
    KettleSystemListener.environmentInit(session);
    String KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL = System.getProperty("KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL",
            "N");
    ModelInfo info = createModel();/*from  w  ww  .  j  ava  2 s. co m*/
    CsvTransformGenerator gen = new CsvTransformGenerator(info, getDatabaseMeta());

    gen.preview(session);

    DataRow rows[] = info.getData();
    assertNotNull(rows);
    assertEquals(235, rows.length);

    Date testDate = new Date();
    testDate.setDate(1);
    testDate.setHours(0);
    testDate.setMinutes(0);
    testDate.setMonth(0);
    testDate.setSeconds(0);
    testDate.setYear(110);

    // test the first row
    // test the data types
    DataRow row = rows[0];
    assertNotNull(row);
    Object cells[] = row.getCells();
    assertNotNull(cells);
    //    assertEquals( 8, cells.length );
    assertTrue(cells[0] instanceof Long);
    assertTrue(cells[1] instanceof Double);
    assertTrue(cells[2] instanceof Long);
    assertTrue(cells[3] instanceof Date);
    assertTrue(cells[4] instanceof String);
    assertTrue(cells[5] instanceof Long);
    assertTrue(cells[6] instanceof Double);
    assertTrue(cells[7] instanceof Boolean);
    // test the values
    assertEquals((long) 3, cells[0]);
    assertEquals(25677.96525, cells[1]);
    assertEquals((long) 1231, cells[2]);
    assertEquals(testDate.getYear(), ((Date) cells[3]).getYear());
    assertEquals(testDate.getMonth(), ((Date) cells[3]).getMonth());
    assertEquals(testDate.getDate(), ((Date) cells[3]).getDate());
    assertEquals(testDate.getHours(), ((Date) cells[3]).getHours());
    //    assertEquals( testDate.getMinutes(), ((Date)cells[3]).getMinutes() ); this fails, a bug in the PDI date parsing?
    assertEquals(testDate.getSeconds(), ((Date) cells[3]).getSeconds());

    //    assertEquals( testDate, cells[3] );
    assertEquals("Afghanistan", cells[4]);
    assertEquals((long) 11, cells[5]);
    assertEquals(111.9090909, cells[6]);
    assertEquals(false, cells[7]);

    // test the second row
    testDate.setDate(2);
    // test the data types
    row = rows[1];
    assertNotNull(row);
    cells = row.getCells();
    assertNotNull(cells);
    assertTrue(cells[0] instanceof Long);
    assertTrue(cells[1] instanceof Double);
    assertTrue(cells[2] instanceof Long);
    assertTrue(cells[3] instanceof Date);
    if ("Y".equals(KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL)) {
        assertTrue("".equals(cells[4]));
    } else {
        assertTrue(cells[4] == null);
    }
    assertTrue(cells[5] instanceof Long);
    assertTrue(cells[6] instanceof Double);
    assertTrue(cells[7] instanceof Boolean);
    // test the values
    assertEquals((long) 4, cells[0]);
    assertEquals(24261.81026, cells[1]);
    assertEquals((long) 1663, cells[2]);
    assertEquals(testDate.getYear(), ((Date) cells[3]).getYear());
    assertEquals(testDate.getMonth(), ((Date) cells[3]).getMonth());
    assertEquals(testDate.getDate(), ((Date) cells[3]).getDate());
    assertEquals(testDate.getHours(), ((Date) cells[3]).getHours());
    //    assertEquals( testDate.getMinutes(), ((Date)cells[3]).getMinutes() ); this fails, a bug in the PDI date parsing?
    assertEquals(testDate.getSeconds(), ((Date) cells[3]).getSeconds());

    //    assertEquals( testDate, cells[3] );
    if ("Y".equals(KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL)) {
        assertEquals("", cells[4]);
        assertEquals(cells[4], "");
    } else {
        assertEquals(null, cells[4]); // IfNull value does not seem to work
    }

    assertEquals((long) 7, cells[5]);
    assertEquals(237.5714286, cells[6]);
    assertEquals(true, cells[7]);

}

From source file:net.cit.tetrad.resource.SubResource.java

private void setSliderBarDateBytimeUnit(CommonDto dto) throws ParseException {
    String timeUnit = dto.getGraph_period();

    int totalRange = DHTML_TOTAL_RANGE_1MIN;
    int searchRange = DHTML_SEARCH_RANGE_1MIN;

    if (timeUnit != null) {
        if (timeUnit.equals("5")) {
            totalRange = DHTML_TOTAL_RANGE_5MIN;
            searchRange = DHTML_SEARCH_RANGE_5MIN;
        } else if (timeUnit.equals("30")) {
            totalRange = DHTML_TOTAL_RANGE_30MIN;
            searchRange = DHTML_SEARCH_RANGE_30MIN;
        } else if (timeUnit.equals("60")) {
            totalRange = DHTML_TOTAL_RANGE_60MIN;
            searchRange = DHTML_SEARCH_RANGE_60MIN;
        }//from w  w  w  .  j a  v a2 s.  c o  m
    }

    int halfMin = searchRange / 2;
    String inputDate = dto.getSelectDate();
    Date nowDate = new Date();
    Date standardDateObj = DateUtil.plusMinute(nowDate, -(halfMin)); //  (?? )
    Date searchSdateObj = DateUtil.plusMinute(nowDate, -searchRange);
    Date searchEdateObj = nowDate;
    Date totalMinObj = DateUtil.plusHour(nowDate, -totalRange);
    Date totalMaxObj = nowDate;

    // ?   ?
    if ((dto.getMemo() == null || dto.getMemo().isEmpty()) && (inputDate != null && !inputDate.isEmpty())) {
        String fullDate = inputDate + " " + dto.getSelectHour() + ":" + dto.getSelectMin();

        standardDateObj = DateUtil.dateformat(fullDate, "yyyy-MM-dd HH:mm");
        searchSdateObj = DateUtil.plusMinute(standardDateObj, -halfMin);
        searchEdateObj = DateUtil.plusMinute(standardDateObj, halfMin);
        totalMinObj = DateUtil.plusHour(searchEdateObj, -totalRange);
        totalMaxObj = searchEdateObj;
    }

    dto.setSelectDate(DateUtil.getCurrentDate(standardDateObj, "yyyy-MM-dd"));
    dto.setSelectHour(standardDateObj.getHours());
    dto.setSelectMin(standardDateObj.getMinutes());

    dto.setSliderMin(DateUtil.getCurrentDate(totalMinObj, "yyyy-MM-dd HH:mm"));
    dto.setSliderMax(DateUtil.getCurrentDate(totalMaxObj, "yyyy-MM-dd HH:mm"));
    dto.setSdate(DateUtil.getCurrentDate(searchSdateObj, "yyyy-MM-dd HH:mm"));
    dto.setEdate(DateUtil.getCurrentDate(searchEdateObj, "yyyy-MM-dd HH:mm"));
}

From source file:com.cssweb.android.view.TrendView.java

private void repairData() throws JSONException {
    close = quoteData.getDouble("close");
    high = quoteData.getDouble("high");
    low = quoteData.getDouble("low");
    jrkp = quoteData.getDouble("jrkp");

    Date dt = new Date();
    int year = dt.getYear();
    int month = dt.getMonth();
    int day = dt.getDate();
    int hour = dt.getHours();
    int minute = dt.getMinutes();
    JSONArray list = quoteData.getJSONArray("data");
    if (quoteData.getString("quotetime") != null && !quoteData.getString("quotetime").equals("")) {
        year = Integer.parseInt(quoteData.getString("quotetime").substring(0, 4));
        month = Integer.parseInt(quoteData.getString("quotetime").substring(5, 7)) - 1;
        day = Integer.parseInt(quoteData.getString("quotetime").substring(8, 10));
        hour = Integer.parseInt(quoteData.getString("quotetime").substring(11, 13));
        minute = Integer.parseInt(quoteData.getString("quotetime").substring(14, 16));
        dt = new Date(year, month, day, hour, minute);
    }//from w ww  .  j av  a2s.c  o  m
    JSONArray jsonArray = new JSONArray();
    if ("hk".equals(exchange)) {
        this.MINUTES = 300;

        Date dt1 = new Date(year, month, day, 9, 30);
        Date dt2 = new Date(year, month, day, 12, 0);
        Date dt3 = new Date(year, month, day, 13, 31);
        Date dt4 = new Date(year, month, day, 16, 0);

        long hopelen = 0;
        if (dt.getTime() < dt1.getTime()) {
            // 0 ?
            hopelen = 0;
        }
        if (dt.getTime() >= dt1.getTime() && dt.getTime() < dt2.getTime()) {
            hopelen = (dt.getTime() - dt1.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt2.getTime() && dt.getTime() < dt3.getTime()) {
            hopelen = 151;
        }
        if (dt.getTime() >= dt3.getTime() && dt.getTime() < dt4.getTime()) {
            hopelen = 151 + (dt.getTime() - dt3.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt4.getTime()) {
            hopelen = 301;
        }
        //?9.15  9.25 
        if (quoteData.getString("quotetime") == "null" || quoteData.getString("quotetime").equals("")) {
            hopelen = 1;
        }

        String time = "";
        for (int i = 0; i < hopelen; i++) {

            if (i < 151) {
                time = Utils.format(new Date(dt1.getTime() + 1000 * 60 * i));
            }
            if (i >= 151 && i <= 301) {
                time = Utils.format(new Date(dt3.getTime() + 1000 * 60 * (i - 151)));
            }
            Boolean flag = false;

            JSONArray json = new JSONArray();
            for (int j = 0; j < list.length(); j++) {
                if (list.getJSONArray(j).getString(3).equals(time)) {
                    json.put(0, list.getJSONArray(j).getDouble(0));
                    json.put(1, list.getJSONArray(j).getDouble(1));
                    json.put(2, list.getJSONArray(j).getDouble(2));
                    json.put(3, list.getJSONArray(j).getString(3));
                    json.put(4, 1);//??
                    if (i == 0) {
                        json.put(5, list.getJSONArray(j).getDouble(1));//??
                        json.put(6, list.getJSONArray(j).getDouble(2));//??
                    } else {
                        if (jsonArray.getJSONArray(i - 1).getInt(4) == 1) {
                            json.put(5, list.getJSONArray(j).getDouble(1)
                                    - jsonArray.getJSONArray(i - 1).getInt(1));
                            json.put(6, list.getJSONArray(j).getDouble(2)
                                    - jsonArray.getJSONArray(i - 1).getInt(2));
                        } else {
                            json.put(5, 0);
                            json.put(6, 0);
                        }
                    }
                    //json.put(7, (list.getJSONArray(j).getDouble(2)/list.getJSONArray(j).getDouble(1))/100);//?
                    flag = true;
                    break;
                }
            }
            //?
            if (!flag) {
                if (i == 0) {
                    json.put(1, 0);
                    json.put(2, 0);
                    json.put(3, time);
                    json.put(0, quoteData.getDouble("close"));
                } else {
                    json.put(1, jsonArray.getJSONArray(i - 1).getDouble(1));
                    json.put(2, jsonArray.getJSONArray(i - 1).getDouble(2));
                    json.put(3, time);
                    json.put(0, ((JSONArray) jsonArray.get(i - 1)).getDouble(0));
                }
                json.put(4, 0);
                json.put(5, 0);
                json.put(6, 0);
                json.put(7, 0);
            }
            jsonArray.put(json);
        }
    } else if ("cf".equals(exchange)) {
        this.MINUTES = 270;

        Date dt1 = new Date(year, month, day, 9, 15);
        Date dt2 = new Date(year, month, day, 11, 30);
        Date dt3 = new Date(year, month, day, 13, 1);
        Date dt4 = new Date(year, month, day, 15, 15);

        long hopelen = 0;
        if (dt.getTime() < dt1.getTime()) {
            // 0 ?
            hopelen = 0;
        }
        if (dt.getTime() >= dt1.getTime() && dt.getTime() < dt2.getTime()) {
            hopelen = (dt.getTime() - dt1.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt2.getTime() && dt.getTime() < dt3.getTime()) {
            hopelen = 136;
        }
        if (dt.getTime() >= dt3.getTime() && dt.getTime() < dt4.getTime()) {
            hopelen = 136 + (dt.getTime() - dt3.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt4.getTime()) {
            hopelen = 271;
        }
        //?9.15  9.25 
        if (quoteData.getString("quotetime") == "null") {
            hopelen = 0;
        }

        String time = "";
        for (int i = 0; i < hopelen; i++) {

            if (i < 136) {
                time = Utils.format(new Date(dt1.getTime() + 1000 * 60 * i));
            }
            if (i >= 136 && i <= 271) {
                time = Utils.format(new Date(dt3.getTime() + 1000 * 60 * (i - 136)));
            }
            Boolean flag = false;

            JSONArray json = new JSONArray();
            for (int j = 0; j < list.length(); j++) {
                if (list.getJSONArray(j).getString(3).equals(time)) {
                    json.put(0, list.getJSONArray(j).getDouble(0));
                    json.put(1, list.getJSONArray(j).getDouble(1));
                    json.put(2, list.getJSONArray(j).getDouble(2));
                    json.put(3, list.getJSONArray(j).getString(3));
                    json.put(4, 1);//??
                    if (i == 0) {
                        json.put(5, list.getJSONArray(j).getDouble(1));//??
                        json.put(6, list.getJSONArray(j).getDouble(2));//??
                    } else {
                        if (jsonArray.getJSONArray(i - 1).getInt(4) == 1) {
                            json.put(5, list.getJSONArray(j).getDouble(1)
                                    - jsonArray.getJSONArray(i - 1).getInt(1));
                            json.put(6, list.getJSONArray(j).getDouble(2)
                                    - jsonArray.getJSONArray(i - 1).getInt(2));
                        } else {
                            json.put(5, 0);
                            json.put(6, 0);
                        }
                    }
                    //json.put(7, (list.getJSONArray(j).getDouble(2)/list.getJSONArray(j).getDouble(1))/100);//?
                    flag = true;
                    break;
                }
            }
            //?
            if (!flag) {
                if (i == 0) {
                    json.put(1, 0);
                    json.put(2, 0);
                    json.put(3, time);
                    json.put(0, quoteData.getDouble("jrkp"));
                } else {
                    json.put(1, jsonArray.getJSONArray(i - 1).getDouble(1));
                    json.put(2, jsonArray.getJSONArray(i - 1).getDouble(2));
                    json.put(3, time);
                    json.put(0, ((JSONArray) jsonArray.get(i - 1)).getDouble(0));
                }
                json.put(4, 0);
                json.put(5, 0);
                json.put(6, 0);
                json.put(7, 0);
            }
            jsonArray.put(json);
        }
    } else if ("dc".equals(exchange) || "sf".equals(exchange) || "cz".equals(exchange)) {
        this.MINUTES = 225;

        Date dt1 = new Date(year, month, day, 9, 0);
        Date dt2 = new Date(year, month, day, 10, 15);
        Date dt3 = new Date(year, month, day, 10, 31);
        Date dt4 = new Date(year, month, day, 11, 30);
        Date dt5 = new Date(year, month, day, 13, 31);
        Date dt6 = new Date(year, month, day, 15, 0);

        long hopelen = 0;
        if (dt.getTime() < dt1.getTime()) {
            // 0 ?
            hopelen = 0;
        }
        if (dt.getTime() >= dt1.getTime() && dt.getTime() < dt2.getTime()) {
            hopelen = (dt.getTime() - dt1.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt2.getTime() && dt.getTime() < dt3.getTime()) {
            hopelen = 76;
        }
        if (dt.getTime() >= dt3.getTime() && dt.getTime() < dt4.getTime()) {
            hopelen = 76 + (dt.getTime() - dt3.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt4.getTime() && dt.getTime() < dt5.getTime()) {
            hopelen = 136;
        }
        if (dt.getTime() >= dt5.getTime() && dt.getTime() < dt6.getTime()) {
            hopelen = 136 + (dt.getTime() - dt5.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt6.getTime()) {
            hopelen = 226;
        }
        //?9.15  9.25 
        if (quoteData.getString("quotetime") == "null") {
            hopelen = 0;
        }

        String time = "";
        for (int i = 0; i < hopelen; i++) {

            if (i < 76) {
                time = Utils.format(new Date(dt1.getTime() + 1000 * 60 * i));
            }
            if (i >= 76 && i < 136) {
                time = Utils.format(new Date(dt3.getTime() + 1000 * 60 * (i - 76)));
            }
            if (i >= 136 && i <= 226) {
                time = Utils.format(new Date(dt5.getTime() + 1000 * 60 * (i - 136)));
            }
            Boolean flag = false;
            JSONArray json = new JSONArray();
            for (int j = 0; j < list.length(); j++) {
                if (list.getJSONArray(j).getString(3).equals(time)) {
                    json.put(0, list.getJSONArray(j).getDouble(0));
                    json.put(1, list.getJSONArray(j).getDouble(1));
                    json.put(2, list.getJSONArray(j).getDouble(2));
                    json.put(3, list.getJSONArray(j).getString(3));
                    json.put(4, 1);//??
                    if (i == 0) {
                        json.put(5, list.getJSONArray(j).getDouble(1));//??
                        json.put(6, list.getJSONArray(j).getDouble(2));//??
                    } else {
                        if (jsonArray.getJSONArray(i - 1).getInt(4) == 1) {
                            json.put(5, list.getJSONArray(j).getDouble(1)
                                    - jsonArray.getJSONArray(i - 1).getInt(1));
                            json.put(6, list.getJSONArray(j).getDouble(2)
                                    - jsonArray.getJSONArray(i - 1).getInt(2));
                        } else {
                            json.put(5, 0);
                            json.put(6, 0);
                        }
                    }
                    //json.put(7, (list.getJSONArray(j).getDouble(2)/list.getJSONArray(j).getDouble(1))/100);//?
                    flag = true;
                    break;
                }
            }
            //?
            if (!flag) {
                if (i == 0) {
                    json.put(1, 0);
                    json.put(2, 0);
                    json.put(3, time);
                    json.put(0, quoteData.getDouble("jrkp"));
                } else {
                    json.put(1, jsonArray.getJSONArray(i - 1).getDouble(1));
                    json.put(2, jsonArray.getJSONArray(i - 1).getDouble(2));
                    json.put(3, time);
                    json.put(0, ((JSONArray) jsonArray.get(i - 1)).getDouble(0));
                }
                json.put(4, 0);
                json.put(5, 0);
                json.put(6, 0);
                json.put(7, 0);
            }
            jsonArray.put(json);
        }
    } else {
        Date dt1 = new Date(year, month, day, 9, 30);
        Date dt2 = new Date(year, month, day, 11, 30);
        Date dt3 = new Date(year, month, day, 13, 1);
        Date dt4 = new Date(year, month, day, 15, 0);

        long hopelen = 0;
        if (dt.getTime() < dt1.getTime()) {
            // 0 ?
            hopelen = 0;
        }
        if (dt.getTime() >= dt1.getTime() && dt.getTime() < dt2.getTime()) {
            hopelen = (dt.getTime() - dt1.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt2.getTime() && dt.getTime() < dt3.getTime()) {
            hopelen = 121;
        }
        if (dt.getTime() >= dt3.getTime() && dt.getTime() < dt4.getTime()) {
            hopelen = 121 + (dt.getTime() - dt3.getTime()) / 1000 / 60 + 1;
        }
        if (dt.getTime() >= dt4.getTime()) {
            hopelen = 241;
        }
        //?9.15  9.25 
        if (quoteData.getString("quotetime") == "null") {
            hopelen = 0;
        }

        String time = "";
        for (int i = 0; i < hopelen; i++) {

            if (i < 121) {
                time = Utils.format(new Date(dt1.getTime() + 1000 * 60 * i));
            }
            if (i >= 121 && i <= 241) {
                time = Utils.format(new Date(dt3.getTime() + 1000 * 60 * (i - 121)));
            }
            Boolean flag = false;

            JSONArray json = new JSONArray();
            for (int j = 0; j < list.length(); j++) {
                if (list.getJSONArray(j).getString(3).equals(time)) {
                    json.put(0, list.getJSONArray(j).getDouble(0));
                    json.put(1, list.getJSONArray(j).getDouble(1));
                    json.put(2, list.getJSONArray(j).getDouble(2));
                    json.put(3, list.getJSONArray(j).getString(3));
                    json.put(4, 1);//??
                    if (i == 0) {
                        json.put(5, list.getJSONArray(j).getDouble(1));//??
                        json.put(6, list.getJSONArray(j).getDouble(2));//??
                    } else {
                        if (jsonArray.getJSONArray(i - 1).getInt(4) == 1) {
                            json.put(5, list.getJSONArray(j).getDouble(1)
                                    - jsonArray.getJSONArray(i - 1).getInt(1));
                            json.put(6, list.getJSONArray(j).getDouble(2)
                                    - jsonArray.getJSONArray(i - 1).getInt(2));
                        } else {
                            json.put(5, 0);
                            json.put(6, 0);
                        }
                    }
                    //json.put(7, (list.getJSONArray(j).getDouble(2)/list.getJSONArray(j).getDouble(1))/100);//?
                    flag = true;
                    break;
                }
            }
            //?
            if (!flag) {
                if (i == 0) {
                    json.put(1, 0);
                    json.put(2, 0);
                    json.put(3, time);
                    json.put(0, quoteData.getDouble("close"));
                } else {
                    json.put(1, jsonArray.getJSONArray(i - 1).getDouble(1));
                    json.put(2, jsonArray.getJSONArray(i - 1).getDouble(2));
                    json.put(3, time);
                    json.put(0, ((JSONArray) jsonArray.get(i - 1)).getDouble(0));
                }
                json.put(4, 0);
                json.put(5, 0);
                json.put(6, 0);
                json.put(7, 0);
            }
            jsonArray.put(json);
        }
    }
    //Log.i("#########getSecurityType##########", NameRule.getSecurityType(exchange, stockcode)+">>>>>>>>>>>>>>");
    //      if(NameRule.getSecurityType(exchange, stockcode)==15 
    //            || NameRule.getSecurityType(exchange, stockcode)==5
    //            || NameRule.getSecurityType(exchange, stockcode)==35){
    //         quoteArray = null; 
    //         return;
    //      }else{
    //         quoteArray = jsonArray; 
    //      }
    quoteArray = jsonArray;

    actualDataLen = quoteArray.length();
    if (!isTrackStatus)
        isTrackNumber = actualDataLen - 1;//??

    highvolume = TickUtil.gethighVolume(quoteArray);
    highamount = TickUtil.gethighAmount(quoteArray);
    high = Math.max(TickUtil.gethighPrice(quoteArray, quoteArray.length()), close);
    low = Math.min(TickUtil.getlowPrice(quoteArray, quoteArray.length()), close);
    if ("sz399001".equals(exchange + stockcode) || "sh000001".equals(exchange + stockcode)) {
        //??????
        int len = quoteData.getJSONArray("data2").length() - 1;
        high = Math.max(high, TickUtil.gethighPrice(quoteData.getJSONArray("data2"), len));
        low = Math.min(low, TickUtil.getlowPrice(quoteData.getJSONArray("data2"), len));
    }
}

From source file:org.pentaho.di.core.ConstTest.java

@Test
public void testRemoveTimeFromDate() {
    final Date date = Const.removeTimeFromDate(new Date());
    assertEquals(0, date.getHours());
    assertEquals(0, date.getMinutes());/*from  w w w .  j  a  v a 2s  .c  om*/
    assertEquals(0, date.getSeconds());
}

From source file:uk.co.senab.photoview.sample.ViewPagerActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.item1:
        ///* ww  w . j a  v a 2  s  .  c  o  m*/
        //
        //mViewPager.setCurrentItem((new PageProvider().getPageCount()-1));
        // 1. Instantiate an AlertDialog.Builder with its constructor

        String[] pages = new String[850];
        for (int i = 0; i < 850; i++) {
            pages[i] = i + 1 + "";
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(ViewPagerActivity.this);

        // 2. Chain together various setter methods to set the dialog characteristics
        builder.setTitle("Go To Page").setItems(pages, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                mViewPager.setCurrentItem(849 - which);

                // The 'which' argument contains the index position
                // of the selected item
            }
        });

        // 3. Get the AlertDialog from create()
        AlertDialog dialog = builder.create();
        dialog.show();
        return true;
    case R.id.item2:
        //
        //
        //mViewPager.setCurrentItem((new PageProvider().getPageCount()-1));
        // 1. Instantiate an AlertDialog.Builder with its constructor
        AlertDialog.Builder builder2 = new AlertDialog.Builder(ViewPagerActivity.this);

        String[] juz = getResources().getStringArray(R.array.juz);

        // 2. Chain together various setter methods to set the dialog characteristics
        builder2.setTitle("Go To Juz (Parah)").setItems(juz, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                if (which == 0) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 1);

                }
                if (which == 1) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 31);

                }
                if (which == 2) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 59);

                }
                if (which == 3) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 87);

                }
                if (which == 4) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 115);

                }
                if (which == 5) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 143);

                }
                if (which == 6) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 171);

                }
                if (which == 7) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 199);

                }
                if (which == 8) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 227);

                }
                if (which == 9) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 255);

                }
                if (which == 10) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 283);

                }
                if (which == 11) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 311);

                }
                if (which == 12) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 339);

                }
                if (which == 13) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 367);

                }
                if (which == 14) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 395);

                }
                if (which == 15) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 423);

                }
                if (which == 16) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 451);

                }
                if (which == 17) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 479);

                }
                if (which == 18) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 507);

                }
                if (which == 19) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 535);

                }
                if (which == 20) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 561);

                }
                if (which == 21) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 589);

                }
                if (which == 22) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 615);

                }
                if (which == 23) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 643);

                }
                if (which == 24) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 669);

                }
                if (which == 25) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 699);

                }
                if (which == 26) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 729);

                }
                if (which == 27) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 759);

                }
                if (which == 28) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 789);

                }
                if (which == 29) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 821);

                }

                // The 'which' argument contains the index position
                // of the selected item
            }
        });

        // 3. Get the AlertDialog from create()
        AlertDialog dialog2 = builder2.create();
        dialog2.show();
        return true;
    case R.id.item3:
        //
        //
        //mViewPager.setCurrentItem((new PageProvider().getPageCount()-1));
        // 1. Instantiate an AlertDialog.Builder with its constructor
        AlertDialog.Builder builder3 = new AlertDialog.Builder(ViewPagerActivity.this);

        String[] surah = getResources().getStringArray(R.array.surah);

        // 2. Chain together various setter methods to set the dialog characteristics
        builder3.setTitle("Go To Surah").setItems(surah, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                if (which == 0) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(620 - 4);
                }
                if (which == 1) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(620 - 5);
                }
                if (which == 2) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 70);
                }
                if (which == 3) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 108);
                }
                if (which == 4) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 149);
                }
                if (which == 5) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 179);
                }
                if (which == 6) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 211);
                }
                if (which == 7) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 247);
                }
                if (which == 8) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 262);
                }
                if (which == 9) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 290);
                }
                if (which == 10) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 310);
                }
                if (which == 11) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 330);
                }
                if (which == 12) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 348);
                }
                if (which == 13) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 357);
                }
                if (which == 14) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 366);
                }
                if (which == 15) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 374);
                }
                if (which == 16) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 390);
                }
                if (which == 17) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 410);
                }
                if (which == 18) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 427);
                }
                if (which == 19) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 437);
                }
                if (which == 20) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 451);
                }
                if (which == 21) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 464);
                }
                if (which == 22) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 479);
                }
                if (which == 23) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 489);
                }
                if (which == 24) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 503);
                }
                if (which == 25) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 513);
                }
                if (which == 26) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 527);
                }
                if (which == 27) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 539);
                }
                if (which == 28) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 554);
                }
                if (which == 29) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 564);
                }
                if (which == 30) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 573);
                }
                if (which == 31) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 579);
                }
                if (which == 32) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 583);
                }
                if (which == 33) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 597);
                }
                if (which == 34) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 605);
                }
                if (which == 35) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 613);
                }
                if (which == 36) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 620);
                }
                if (which == 37) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 630);
                }
                if (which == 38) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 637);
                }
                if (which == 39) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 649);
                }
                if (which == 40) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 661);
                }
                if (which == 41) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 670);
                }
                if (which == 42) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 679);
                }
                if (which == 43) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 688);
                }
                if (which == 44) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 693);
                }
                if (which == 45) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 699);
                }
                if (which == 46) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 706);
                }
                if (which == 47) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 712);
                }
                if (which == 48) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 718);
                }
                if (which == 49) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 723);
                }
                if (which == 50) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 728);
                }
                if (which == 51) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 731);
                }
                if (which == 52) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 734);
                }
                if (which == 53) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 738);
                }
                if (which == 54) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 742);
                }
                if (which == 55) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 747);
                }
                if (which == 56) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 752);
                }
                if (which == 57) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 759);
                }
                if (which == 58) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 763);
                }
                if (which == 59) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 768);
                }
                if (which == 60) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 772);
                }
                if (which == 61) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 775);
                }
                if (which == 62) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 777);
                }
                if (which == 63) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 779);
                }
                if (which == 64) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 782);
                }
                if (which == 65) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 785);
                }
                if (which == 66) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 789);
                }
                if (which == 67) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 792);
                }
                if (which == 68) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 796);
                }
                if (which == 69) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 799);
                }
                if (which == 70) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 802);
                }
                if (which == 71) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 805);
                }
                if (which == 72) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 808);
                }
                if (which == 73) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 810);
                }
                if (which == 74) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 813);
                }
                if (which == 75) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 815);
                }
                if (which == 76) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 818);
                }
                if (which == 77) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 821);
                }
                if (which == 78) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 822);
                }
                if (which == 79) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 824);
                }
                if (which == 80) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 826);
                }
                if (which == 81) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 827);
                }
                if (which == 82) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 828);
                }
                if (which == 83) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 830);
                }
                if (which == 84) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 831);
                }
                if (which == 85) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 832);
                }
                if (which == 86) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 833);
                }
                if (which == 87) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 834);
                }
                if (which == 88) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 835);
                }
                if (which == 89) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 837);
                }
                if (which == 90) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 838);
                }
                if (which == 91) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 839);
                }
                if (which == 92) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 840);
                }
                if (which == 93) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 840);
                }
                if (which == 94) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 841);
                }
                if (which == 95) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 841);
                }
                if (which == 96) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 842);
                }
                if (which == 97) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 842);
                }
                if (which == 98) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 843);
                }
                if (which == 99) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 844);
                }
                if (which == 100) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 845);
                }
                if (which == 101) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 845);
                }
                if (which == 102) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 846);
                }
                if (which == 103) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 846);
                }
                if (which == 104) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 846);
                }
                if (which == 105) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 847);
                }
                if (which == 106) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 847);
                }
                if (which == 107) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 848);
                }
                if (which == 108) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 848);
                }
                if (which == 109) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 848);
                }
                if (which == 110) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 849);
                }
                if (which == 111) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 849);
                }
                if (which == 112) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 849);
                }
                if (which == 113) {
                    dialog.dismiss();

                    mViewPager.setCurrentItem(850 - 850);
                }

                // The 'which' argument contains the index position
                // of the selected item
            }
        });

        // 3. Get the AlertDialog from create()
        AlertDialog dialog3 = builder3.create();
        dialog3.show();
        return true;
    case R.id.item4:
        Builder builderr = new Builder(this);
        Date cDate = new Date();
        final String fDate = new SimpleDateFormat("MM/dd/yy").format(cDate);
        Date dt = new Date();
        int hours = dt.getHours();
        int minutes = dt.getMinutes();

        SimpleDateFormat sdf = new SimpleDateFormat("hh:mmaa");
        String time1 = sdf.format(dt);

        final EditText input = new EditText(this);
        InputFilter[] FilterArray = new InputFilter[1];
        FilterArray[0] = new InputFilter.LengthFilter(18);
        input.setFilters(FilterArray);

        input.setText(fDate + " " + time1.toLowerCase());
        builderr.setTitle("Bookmark").setMessage("Name your Bookmark").setView(input)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {

                        if (!input.getText().toString().equals(""))
                            saveState(input.getText().toString());
                        else
                            saveState(fDate);
                        setResult(RESULT_OK);
                    }
                }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                    }

                });

        builderr.show();

        return true;
    case R.id.item5:
        Intent i = new Intent(ViewPagerActivity.this, Notepadv3.class);

        startActivity(i);
        return true;
    case R.id.item6:
        try {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:Qazi+Musab")));
        } catch (android.content.ActivityNotFoundException anfe) {
            startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://play.google.com/store/apps/developer?id=Qazi+Musab")));
        }
        return true;
    case R.id.item7:
        String appName2 = "com.qaziconsultancy.13linequran";
        try {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appName2)));
        } catch (android.content.ActivityNotFoundException anfe) {
            startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://play.google.com/store/apps/details?id=" + appName2)));
        }
        return true;
    case R.id.item8:
        mViewPager.setCurrentItem(mViewPager.getCurrentItem() - 1);
        return true;
    case R.id.item9:
        mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1);
        return true;
    case R.id.item10:
        String[] items = new String[9];
        items[0] = "$1";
        items[1] = "$2";
        items[2] = "$3";
        items[3] = "$4";
        items[4] = "$5";
        items[5] = "$10";
        items[6] = "$20";
        items[7] = "$50";
        items[8] = "$100";

        AlertDialog.Builder chooser = new AlertDialog.Builder(ViewPagerActivity.this);
        chooser.setTitle("Contribute").setItems(items, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                switch (which) {
                case 0:
                    contributeOneDollar();
                    break;
                case 1:
                    contributetwoDollars();
                    break;
                case 2:
                    contributeThreeDollars();
                    break;
                case 3:
                    contributeFourDollars();
                    break;
                case 4:
                    contributeFiveDollars();
                    break;
                case 5:
                    contributeTenDollars();
                    break;
                case 6:
                    contributeTwentyDollars();
                    break;
                case 7:
                    contributeFiftyDollars();
                    break;
                case 8:
                    contributeHundredDollars();
                    break;

                }
            }
        });

        // 3. Get the AlertDialog from create()
        AlertDialog myChooser = chooser.create();
        myChooser.show();
        return true;
    default:
        return true;
    }
}

From source file:org.oscarehr.caseload.CaseloadContentAction.java

private JSONArray generateCaseloadDataForDemographics(HttpServletRequest request, HttpServletResponse response,
        String caseloadProv, List<Integer> demoSearchResult) {
    JSONArray entry;//from w ww  .j  a v a2 s . co m
    String buttons;
    JSONArray data = new JSONArray();
    if (demoSearchResult == null || demoSearchResult.size() < 1)
        return data;

    CaseloadDao caseloadDao = (CaseloadDao) SpringUtils.getBean("caseloadDao");

    HttpSession session = request.getSession();
    WebApplicationContext webApplicationContext = WebApplicationContextUtils
            .getRequiredWebApplicationContext(session.getServletContext());
    String roleName$ = (String) session.getAttribute("userrole") + "," + (String) session.getAttribute("user");

    String curUser_no = (String) session.getAttribute("user");
    String userfirstname = (String) session.getAttribute("userfirstname");
    String userlastname = (String) session.getAttribute("userlastname");

    GregorianCalendar cal = new GregorianCalendar();
    int curYear = cal.get(Calendar.YEAR);
    int curMonth = (cal.get(Calendar.MONTH) + 1);
    int curDay = cal.get(Calendar.DAY_OF_MONTH);

    int year = Integer.parseInt(request.getParameter("year"));
    int month = Integer.parseInt(request.getParameter("month"));
    int day = Integer.parseInt(request.getParameter("day"));

    java.util.Date apptime = new java.util.Date();

    OscarProperties oscarProperties = OscarProperties.getInstance();
    boolean bShortcutForm = oscarProperties.getProperty("appt_formview", "").equalsIgnoreCase("on") ? true
            : false;
    String formName = bShortcutForm ? oscarProperties.getProperty("appt_formview_name") : "";
    String formNameShort = formName.length() > 3 ? (formName.substring(0, 2) + ".") : formName;
    String formName2 = bShortcutForm ? oscarProperties.getProperty("appt_formview_name2", "") : "";
    String formName2Short = formName2.length() > 3 ? (formName2.substring(0, 2) + ".") : formName2;
    boolean bShortcutForm2 = bShortcutForm && !formName2.equals("");
    boolean bShortcutIntakeForm = oscarProperties.getProperty("appt_intake_form", "").equalsIgnoreCase("on")
            ? true
            : false;

    String monthDay = String.format("%02d", month) + "-" + String.format("%02d", day);

    String prov = oscarProperties.getProperty("billregion", "").trim().toUpperCase();

    for (Integer result : demoSearchResult) {
        if (result == null)
            continue;
        String demographic_no = result.toString();
        entry = new JSONArray();
        // name
        String demographicQuery = "cl_demographic_query";
        String[] demographicParam = new String[1];
        demographicParam[0] = demographic_no;
        List<Map<String, Object>> demographicResult = caseloadDao.getCaseloadDemographicData(demographicQuery,
                demographicParam);

        String clLastName = demographicResult.get(0).get("last_name").toString();
        String clFirstName = demographicResult.get(0).get("first_name").toString();
        String clFullName = StringEscapeUtils.escapeJavaScript(clLastName + ", " + clFirstName).toUpperCase();
        entry.add(clFullName);

        // add E button to string
        buttons = "";
        if (hasPrivilege("_eChart", roleName$)) {
            String encType = "";
            try {
                encType = URLEncoder.encode("face to face encounter with client", "UTF-8");
            } catch (UnsupportedEncodingException e) {
                MiscUtils.getLogger().error("Couldn't encode string", e);
            }
            String eURL = "../oscarEncounter/IncomingEncounter.do?providerNo=" + curUser_no
                    + "&appointmentNo=0&demographicNo=" + demographic_no + "&curProviderNo=" + caseloadProv
                    + "&reason=&encType=" + encType + "&userName="
                    + URLEncoder.encode(userfirstname + " " + userlastname) + "&curDate=" + curYear + "-"
                    + curMonth + "-" + curDay + "&appointmentDate=" + year + "-" + month + "-" + day
                    + "&startTime=" + apptime.getHours() + ":" + apptime.getMinutes() + "&status=T"
                    + "&apptProvider_no=" + caseloadProv + "&providerview=" + caseloadProv;
            buttons += "<a href='#' onClick=\"popupPage(710, 1024,'../oscarSurveillance/CheckSurveillance.do?demographicNo="
                    + demographic_no + "&proceed=" + URLEncoder.encode(eURL)
                    + "');return false;\" title='Encounter'>E</a> ";
        }

        // add form links to string
        if (hasPrivilege("_billing", roleName$)) {
            buttons += bShortcutForm
                    ? "| <a href=# onClick='popupPage2( \"../form/forwardshortcutname.jsp?formname=" + formName
                            + "&demographic_no=" + demographic_no + "\")' title='form'>" + formNameShort
                            + "</a> "
                    : "";
            buttons += bShortcutForm2
                    ? "| <a href=# onClick='popupPage2( \"../form/forwardshortcutname.jsp?formname=" + formName2
                            + "&demographic_no=" + demographic_no + "\")' title='form'>" + formName2Short
                            + "</a> "
                    : "";
            buttons += (bShortcutIntakeForm)
                    ? "| <a href='#' onClick='popupPage(700, 1024, \"formIntake.jsp?demographic_no="
                            + demographic_no + "\")'>In</a> "
                    : "";
        }

        // add B button to string
        if (hasPrivilege("_billing", roleName$)) {
            buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../billing.do?skipReload=true&billRegion="
                    + URLEncoder.encode(prov) + "&billForm="
                    + URLEncoder.encode(oscarProperties.getProperty("default_view"))
                    + "&hotclick=&appointment_no=0&demographic_name=" + URLEncoder.encode(clLastName) + "%2C"
                    + URLEncoder.encode(clFirstName) + "&demographic_no=" + demographic_no
                    + "&providerview=1&user_no=" + curUser_no + "&apptProvider_no=none&appointment_date=" + year
                    + "-" + month + "-" + day
                    + "&start_time=0:00&bNewForm=1&status=t');return false;\" title='Billing'>B</a> ";
            buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../billing/CA/ON/billinghistory.jsp?demographic_no="
                    + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name="
                    + URLEncoder.encode(clFirstName)
                    + "&orderby=appointment_date&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=10');return false;\" title='Billing'>BHx</a> ";
        }

        // add M button to string
        if (hasPrivilege("_masterLink", roleName$)) {
            buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../demographic/demographiccontrol.jsp?demographic_no="
                    + demographic_no
                    + "&displaymode=edit&dboperation=search_detail');return false;\" title='Master File'>M</a> ";
        }

        // add Rx button to string
        if (isModuleLoaded(request, "TORONTO_RFQ", true)
                && hasPrivilege("_appointment.doctorLink", roleName$)) {
            buttons += "| <a href='#' onClick=\"popupOscarRx(700,1027,'../oscarRx/choosePatient.do?providerNo="
                    + curUser_no + "&demographicNo=" + demographic_no + "');return false;\">Rx</a> ";
        }

        // add Tickler button to string
        buttons += "| <a href='#' onclick=\"popupPage('700', '1000', '../tickler/ticklerAdd.jsp?name="
                + URLEncoder.encode(clLastName) + "%2C" + URLEncoder.encode(clFirstName)
                + "&chart_no=&bFirstDisp=false&demographic_no=" + demographic_no + "&messageID=null&doctor_no="
                + curUser_no + "'); return false;\">T</a> ";

        // add Msg button to string
        buttons += "| <a href='#' onclick=\"popupPage('700', '1000', '../oscarMessenger/SendDemoMessage.do?demographic_no="
                + demographic_no + "'); return false;\">Msg</a> ";

        entry.add(buttons);

        // age
        String clAge = demographicResult.get(0).get("age") != null
                ? demographicResult.get(0).get("age").toString()
                : "";
        String clBDay = demographicResult.get(0).get("month_of_birth").toString() + "-"
                + demographicResult.get(0).get("date_of_birth").toString();
        if (isBirthday(monthDay, clBDay)) {
            clAge += " <img src='../images/cake.gif' height='20' />";
        }
        entry.add(clAge);

        // sex
        String clSex = demographicResult.get(0).get("sex").toString();
        entry.add(clSex);

        // last appt
        String lapptQuery = "cl_last_appt";
        List<Map<String, Object>> lapptResult = caseloadDao.getCaseloadDemographicData(lapptQuery,
                demographicParam);
        if ((!lapptResult.isEmpty()) && lapptResult.get(0).get("max(appointment_date)") != null
                && !lapptResult.get(0).get("max(appointment_date)").toString().equals("")) {
            String clLappt = lapptResult.get(0).get("max(appointment_date)").toString();

            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../demographic/demographiccontrol.jsp?demographic_no="
                            + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name="
                            + URLEncoder.encode(clFirstName)
                            + "&orderby=appttime&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=25'); return false;\">"
                            + clLappt + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // next appt
        String napptQuery = "cl_next_appt";
        List<Map<String, Object>> napptResult = caseloadDao.getCaseloadDemographicData(napptQuery,
                demographicParam);
        if (!napptResult.isEmpty() && napptResult.get(0).get("min(appointment_date)") != null
                && !napptResult.get(0).get("min(appointment_date)").toString().equals("")) {
            String clNappt = napptResult.get(0).get("min(appointment_date)").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../demographic/demographiccontrol.jsp?demographic_no="
                            + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name="
                            + URLEncoder.encode(clFirstName)
                            + "&orderby=appttime&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=25'); return false;\">"
                            + clNappt + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // num appts in last year
        String numApptsQuery = "cl_num_appts";
        List<Map<String, Object>> numApptsResult = caseloadDao.getCaseloadDemographicData(numApptsQuery,
                demographicParam);
        if (!numApptsResult.isEmpty() && numApptsResult.get(0).get("count(*)") != null
                && !numApptsResult.get(0).get("count(*)").toString().equals("")
                && !numApptsResult.get(0).get("count(*)").toString().equals("0")) {
            String clNumAppts = numApptsResult.get(0).get("count(*)").toString();
            entry.add(clNumAppts);
        } else {
            entry.add("&nbsp;");
        }

        // new labs
        String[] userDemoParam = new String[2];
        userDemoParam[0] = curUser_no;
        userDemoParam[1] = demographic_no;
        String newLabQuery = "cl_new_labs";
        List<Map<String, Object>> newLabResult = caseloadDao.getCaseloadDemographicData(newLabQuery,
                userDemoParam);
        if (!newLabResult.isEmpty() && newLabResult.get(0).get("count(*)") != null
                && !newLabResult.get(0).get("count(*)").toString().equals("")
                && !newLabResult.get(0).get("count(*)").toString().equals("0")) {
            String clNewLab = newLabResult.get(0).get("count(*)").toString();

            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../dms/inboxManage.do?method=prepareForIndexPage&providerNo="
                            + curUser_no + "&selectedCategory=CATEGORY_PATIENT_SUB&selectedCategoryPatient="
                            + demographic_no + "&selectedCategoryType=CATEGORY_TYPE_HL7'); return false;\">"
                            + clNewLab + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // new docs
        String newDocQuery = "cl_new_docs";
        List<Map<String, Object>> newDocResult = caseloadDao.getCaseloadDemographicData(newDocQuery,
                userDemoParam);
        if (!newDocResult.isEmpty() && newDocResult.get(0).get("count(*)") != null
                && !newDocResult.get(0).get("count(*)").toString().equals("")
                && !newDocResult.get(0).get("count(*)").toString().equals("0")) {
            String clNewDoc = newDocResult.get(0).get("count(*)").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../dms/inboxManage.do?method=prepareForIndexPage&providerNo="
                            + curUser_no + "&selectedCategory=CATEGORY_PATIENT_SUB&selectedCategoryPatient="
                            + demographic_no + "&selectedCategoryType=CATEGORY_TYPE_DOC'); return false;\">"
                            + clNewDoc + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // new ticklers
        String newTicklerQuery = "cl_new_ticklers";
        List<Map<String, Object>> newTicklerResult = caseloadDao.getCaseloadDemographicData(newTicklerQuery,
                demographicParam);
        if (!newTicklerResult.isEmpty() && newTicklerResult.get(0).get("count(*)") != null
                && !newTicklerResult.get(0).get("count(*)").toString().equals("")
                && !newTicklerResult.get(0).get("count(*)").toString().equals("0")) {
            String clNewTickler = newTicklerResult.get(0).get("count(*)").toString();
            entry.add("<a href='#' onclick=\"popupPage('700', '1000', '../tickler/ticklerDemoMain.jsp?demoview="
                    + demographic_no + "'); return false;\">" + clNewTickler + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // new messages
        String newMsgQuery = "cl_new_msgs";
        List<Map<String, Object>> newMsgResult = caseloadDao.getCaseloadDemographicData(newMsgQuery,
                demographicParam);
        if (!newMsgResult.isEmpty() && newMsgResult.get(0).get("count(*)") != null
                && !newMsgResult.get(0).get("count(*)").toString().equals("")
                && !newMsgResult.get(0).get("count(*)").toString().equals("0")) {
            String clNewMsg = newMsgResult.get(0).get("count(*)").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarMessenger/DisplayDemographicMessages.do?orderby=date&boxType=3&demographic_no="
                            + demographic_no + "&providerNo=" + curUser_no + "&userName="
                            + URLEncoder.encode(userfirstname + " " + userlastname) + "'); return false;\">"
                            + clNewMsg + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // measurements
        String msmtQuery = "cl_measurement";
        String[] msmtParam = new String[2];
        msmtParam[1] = demographic_no;

        // BMI
        msmtParam[0] = "BMI";
        List<Map<String, Object>> msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clBmi = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=BMI'); return false;\">" + clBmi + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // BP
        msmtParam[0] = "BP";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clBp = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=BP'); return false;\">" + clBp + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // WT
        msmtParam[0] = "WT";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clWt = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=WT'); return false;\">" + clWt + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // SMK
        msmtParam[0] = "SMK";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clSmk = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=SMK'); return false;\">" + clSmk + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // A1C
        msmtParam[0] = "A1C";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clA1c = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=A1C'); return false;\">" + clA1c + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // ACR
        msmtParam[0] = "ACR";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clAcr = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=ACR'); return false;\">" + clAcr + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // SCR
        msmtParam[0] = "SCR";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clScr = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=SCR'); return false;\">" + clScr + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // LDL
        msmtParam[0] = "LDL";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clLdl = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=LDL'); return false;\">" + clLdl + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // HDL
        msmtParam[0] = "HDL";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clHdl = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=HDL'); return false;\">" + clHdl + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // TCHD
        msmtParam[0] = "TCHD";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clTchd = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=TCHD'); return false;\">" + clTchd + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // EGFR
        msmtParam[0] = "EGFR";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clEgfr = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=EGFR'); return false;\">" + clEgfr + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        // EYEE
        msmtParam[0] = "EYEE";
        msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam);
        if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null
                && !msmtResult.get(0).get("dataField").toString().equals("")) {
            String clEyee = msmtResult.get(0).get("dataField").toString();
            entry.add(
                    "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo="
                            + demographic_no + "&type=EYEE'); return false;\">" + clEyee + "</a>");
        } else {
            entry.add("&nbsp;");
        }

        data.add(entry);
    }
    return data;
}