Example usage for java.lang IndexOutOfBoundsException getMessage

List of usage examples for java.lang IndexOutOfBoundsException getMessage

Introduction

In this page you can find the example usage for java.lang IndexOutOfBoundsException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.exoplatform.outlook.OutlookServiceImpl.java

/**
 * Fetch query./*from  w  w  w .jav  a2  s.  c o  m*/
 *
 * @param qr the qr
 * @param limit the limit
 * @param res the res
 * @param acceptNode the accept node
 * @throws RepositoryException the repository exception
 * @throws OutlookException the outlook exception
 */
protected void fetchQuery(QueryResult qr, int limit, Set<File> res, Predicate<Node> acceptNode)
        throws RepositoryException, OutlookException {
    SpaceService spaceService = spaceService();
    for (NodeIterator niter = qr.getNodes(); niter.getPosition() < limit && niter.hasNext();) {
        Node node = niter.nextNode();
        try {
            if (acceptNode.test(node)) {
                // detect is it space and then check if space member
                String path = node.getPath();
                Space space;
                if (path.startsWith(SPACES_HOME)) {
                    try {
                        String groupId = path.substring(7, path.indexOf("/", SPACES_HOME.length() + 1));
                        space = spaceService.getSpaceByGroupId(groupId);
                        if (space != null) {
                            Set<String> allMemembers = new HashSet<String>();
                            for (String s : space.getManagers()) {
                                allMemembers.add(s);
                            }
                            for (String s : space.getMembers()) {
                                allMemembers.add(s);
                            }
                            if (!allMemembers.contains(currentUserId())) {
                                // when not a space member - skip this file (but user still may be an owner of it!)
                                limit++;
                                continue;
                            }
                        }
                    } catch (IndexOutOfBoundsException e) {
                        // XXX something not clear with space path, will use portal page path as for Personal
                        // Documents (it works well in PLF 4.3)
                        space = null;
                    }
                } else {
                    space = null;
                }

                UserFile file = new UserFile(node.getParent().getPath(), node);
                if (space != null) {
                    initDocumentLink(SiteType.GROUP, // GROUP
                            space.getGroupId().replace("/", "."), space.getGroupId(), // /spaces/product_team
                            space.getShortName() + "/documents", // product_team/documents
                            file);
                } else {
                    initDocumentLink(SiteType.PORTAL, // PORTAL
                            PERSONAL_DOCUMENTS, "intranet", // intranet
                            "documents", // documents
                            file);
                }
                res.add(file);
            } else {
                limit++;
            }
        } catch (RepositoryException e) {
            LOG.warn("Error read queried node " + e.getMessage() + ". Node skipped: " + node);
            limit++;
        }
    }

}

From source file:com.virtusa.isq.vtaf.runtime.SeleniumTestBase.java

/**
 * Gets the data table iterator./*from  www.  j  a  v  a  2 s.c  o  m*/
 * 
 * @param tableName
 *            the table name
 * @param associatedRows
 *            the associated rows
 * @return the data table iterator
 */
public final List<HashMap<String, String>> getDataTableIterator(final String tableNames,
        final String associatedRows) {

    List<HashMap<String, String>> iteratorList = new ArrayList<HashMap<String, String>>();
    List<DataTable> tableList = new ArrayList<DataTable>();
    List<int[]> rowList = new ArrayList<int[]>();
    String[] rowsPerTableArray = associatedRows.split("\\|");
    String[] tableNamesArray = tableNames.split("\\|");
    int rowsPerTableCounts = rowsPerTableArray.length;
    int tableNamesCount = tableNamesArray.length;
    if (rowsPerTableCounts == tableNamesCount) {
        try {
            for (int i = 0; i < tableNamesCount; i++) {
                DataTable table = getTable(tableNamesArray[i]);
                tableList.add(table);
                rowList.add(getAssociatedRowNumbers(table, rowsPerTableArray[i]));
            }

            for (int i = 0; i < tableNamesCount; i++) {
                int currentInsertRow = 0;
                DataTable dataTable = tableList.get(i);
                int[] reqRows = rowList.get(i);
                String tableName = tableNamesArray[i];
                for (int row : reqRows) {
                    if (iteratorList.size() <= currentInsertRow) {
                        iteratorList.add(new HashMap<String, String>());
                    }
                    HashMap<String, String> currRow = iteratorList.get(currentInsertRow);
                    List<String> columnHeaders = dataTable.getColumns();

                    for (String column : columnHeaders) {
                        currRow.put(tableName.concat("_").concat(column), dataTable.get(row, column));
                    }

                    currentInsertRow++;
                }
            }

        } catch (IndexOutOfBoundsException e) {
            e.printStackTrace();
            String errString = e.getMessage();
            reportresult(true, "DATA TABLE ITERATION :", "FAILED",
                    "Cannot iterate over the data table. Cannot find the row numbers : " + associatedRows
                            + " in data table. " + "Actual Error : " + errString);
            checkTrue(false, true, "Cannot iterate over the data table. Actual Error : " + errString);
        } catch (Exception e) {
            e.printStackTrace();
            String errString = e.getMessage();
            reportresult(true, "DATA TABLE ITERATION :", "FAILED",
                    "Cannot iterate over the data table. Actual Error : " + errString);
            checkTrue(false, true, "Cannot iterate over the data table. Actual Error : " + errString);
        }

    } else {
        reportresult(true, "DATA TABLE ITERATION :", "FAILED",
                "Cannot iterate over the data table. Invalid input data. Actual error : Number of tables passed : "
                        + tableNamesCount + " does not match the associated data rows count : "
                        + rowsPerTableCounts);
        checkTrue(false, true,
                "Cannot iterate over the data table. Invalid input data. Actual error : Number of tables passed : "
                        + tableNamesCount + " does not match the associated data rows count : "
                        + rowsPerTableCounts);
    }
    return iteratorList;

}

From source file:com.tmwsoft.sns.web.action.MainAction.java

private Object verify_eventmembers(HttpServletRequest request, Map<String, Object> sGlobal,
        Map<String, Object> event, String[] uids, String statusString) {
    int supe_uid = (Integer) sGlobal.get("supe_uid");
    int timestamp = (Integer) sGlobal.get("timestamp");
    String supe_username = (String) sGlobal.get("supe_username");
    Map<String, Object> supeUserEvent = (Map<String, Object>) sGlobal.get("supe_userevent");
    if (supeUserEvent == null || (Integer) supeUserEvent.get("status") < 3) {
        return new MessageVO("no_privilege_manage_event_members");
    }/*from w ww. j av  a 2 s  . c  o  m*/
    int eventid = (Integer) supeUserEvent.get("eventid");
    List<Map<String, Object>> query;
    if (event == null || eventid != (Integer) event.get("eventid")) {
        query = dataBaseService.executeQuery("SELECT * FROM sns_event WHERE eventid='" + eventid + "'");
        try {
            event = query.get(0);
        } catch (IndexOutOfBoundsException exception) {
            return new MessageVO(exception.getMessage());
        }
    }
    int status = Common.intval(statusString);
    if (status < -1 || status > 3) {
        return new MessageVO("bad_userevent_status");
    }
    if ((Integer) event.get("verify") == 0 && status == 0) {
        return new MessageVO("event_not_set_verify");
    }
    int eventUid = (Integer) event.get("uid");
    if (status == 3 && supe_uid != eventUid) {
        return new MessageVO("only_creator_can_set_admin");
    }
    List<Integer> newids = new ArrayList<Integer>();
    Map<Integer, Map<String, Object>> userevents = new HashMap<Integer, Map<String, Object>>();
    Map<Integer, String> actions = new HashMap<Integer, String>();
    int num = 0;
    query = dataBaseService.executeQuery(
            "SELECT ue.*, sf.* FROM sns_userevent ue LEFT JOIN sns_spacefield sf ON ue.uid=sf.uid WHERE ue.uid IN ("
                    + Common.sImplode(uids) + ") AND ue.eventid='" + eventid + "'");
    int valueStatus;
    int valueUid;
    for (Map<String, Object> value : query) {
        valueStatus = (Integer) value.get("status");
        valueUid = (Integer) value.get("uid");
        if (valueStatus == status || eventUid == valueUid || valueStatus == 1) {
            continue;
        }
        if (status == 2 || status == 3 || status == 0 || status == -1) {
            newids.add(valueUid);
            userevents.put(valueUid, value);
            if (status == 2) {
                if (valueStatus == 0) {
                    actions.put(valueUid, "set_verify");
                    num += ((Integer) value.get("fellow") + 1);
                } else if (valueStatus == 3) {
                    actions.put(valueUid, "unset_admin");
                }
            } else if (status == 3) {
                actions.put(valueUid, "set_admin");
                if (valueStatus == 0) {
                    num += ((Integer) value.get("fellow") + 1);
                }
            } else if (status == 0) {
                actions.put(valueUid, "unset_verify");
                if (valueStatus >= 2) {
                    num -= ((Integer) value.get("fellow") + 1);
                }
            } else if (status == -1) {
                actions.put(valueUid, "set_delete");
                if (valueStatus >= 2) {
                    num -= ((Integer) value.get("fellow") + 1);
                }
            }
        }
    }
    if (Common.empty(newids))
        return newids;
    int eventLimitnum = (Integer) event.get("limitnum");
    if (eventLimitnum > 0 && (Integer) event.get("membernum") + num > eventLimitnum) {
        return new MessageVO("event_will_full");
    }
    List<String> note_inserts = new ArrayList<String>();
    List<String> feed_inserts = new ArrayList<String>();
    List<Integer> note_ids = new ArrayList<Integer>();
    Map<String, Object> subMap = new HashMap<String, Object>();
    subMap.put("title", event.get("title"));
    subMap.put("eventid", event.get("eventid"));
    subMap.put("uid", event.get("uid"));
    subMap.put("username", event.get("username"));
    Map<String, Object> feedarr = new HashMap<String, Object>();
    feedarr.put("appid", SysConstants.snsConfig.get("SNS_APPID"));
    feedarr.put("icon", "event");
    feedarr.put("uid", "");
    feedarr.put("username", "");
    feedarr.put("dateline", timestamp);
    feedarr.put("title_template", Common.getMessage(request, "cp_event_join"));
    feedarr.put("title_data", subMap);
    feedarr.put("body_template", "");
    feedarr.put("body_data", new HashMap());
    feedarr.put("body_general", "");
    feedarr.put("image_1", "");
    feedarr.put("image_1_link", "");
    feedarr.put("image_2", "");
    feedarr.put("image_2_link", "");
    feedarr.put("image_3", "");
    feedarr.put("image_3_link", "");
    feedarr.put("image_4", "");
    feedarr.put("image_4_link", "");
    feedarr.put("target_ids", "");
    feedarr.put("friend", "friend");
    feedarr = (Map<String, Object>) Common.sStripSlashes(feedarr);
    feedarr.put("title_data", Serializer.serialize(Common.sStripSlashes(feedarr.get("title_data"))));
    feedarr.put("body_data", Serializer.serialize(Common.sStripSlashes(feedarr.get("body_data"))));
    feedarr.put("hash_template",
            Common.md5(feedarr.get("title_template") + "\t" + feedarr.get("body_template")));
    feedarr.put("hash_data", Common.md5(feedarr.get("title_template") + "\t" + feedarr.get("title_data") + "\t"
            + feedarr.get("body_template") + "\t" + feedarr.get("body_data")));
    feedarr = (Map<String, Object>) Common.sAddSlashes(feedarr);
    Map<String, Object> mapInUserevents;
    StringBuilder builder = new StringBuilder();
    for (int id : newids) {
        mapInUserevents = userevents.get(id);
        if (status > 1 && (Integer) mapInUserevents.get("status") == 0) {
            feedarr.put("uid", mapInUserevents.get("uid"));
            feedarr.put("username", mapInUserevents.get("username"));
            builder.append("('");
            builder.append(feedarr.get("appid"));
            builder.append("', 'event', '");
            builder.append(feedarr.get("uid"));
            builder.append("', '");
            builder.append(feedarr.get("username"));
            builder.append("', '");
            builder.append(feedarr.get("dateline"));
            builder.append("', '0', '");
            builder.append(feedarr.get("hash_template"));
            builder.append("', '");
            builder.append(feedarr.get("hash_data"));
            builder.append("', '");
            builder.append(feedarr.get("title_template"));
            builder.append("', '");
            builder.append(feedarr.get("title_data"));
            builder.append("', '");
            builder.append(feedarr.get("body_template"));
            builder.append("', '");
            builder.append(feedarr.get("body_data"));
            builder.append("', '");
            builder.append(feedarr.get("body_general"));
            builder.append("', '");
            builder.append(feedarr.get("image_1"));
            builder.append("', '");
            builder.append(feedarr.get("image_1_link"));
            builder.append("', '");
            builder.append(feedarr.get("image_2"));
            builder.append("', '");
            builder.append(feedarr.get("image_2_link"));
            builder.append("', '");
            builder.append(feedarr.get("image_3"));
            builder.append("', '");
            builder.append(feedarr.get("image_3_link"));
            builder.append("', '");
            builder.append(feedarr.get("image_4"));
            builder.append("', '");
            builder.append(feedarr.get("image_4_link"));
            builder.append("')");
            feed_inserts.add(builder.toString());
            builder.delete(0, builder.length());
        }
        mapInUserevents.put("privacy",
                Common.empty(mapInUserevents.get("privacy")) ? new HashMap<String, Object>()
                        : Serializer.unserialize((String) mapInUserevents.get("privacy")));
        Map<String, Object> tempM = (Map<String, Object>) ((Map<String, Object>) mapInUserevents.get("privacy"))
                .get("filter_note");
        Set<String> filter = Common.empty(tempM) ? new HashSet<String>() : tempM.keySet();
        if (tempM == null) {
            tempM = new HashMap<String, Object>();
        } else {
            tempM.clear();
        }
        tempM.put("type", "eventmemberstatus");
        tempM.put("authorid", supe_uid);
        if (mainService.checkNoteUid(tempM, filter)) {
            note_ids.add(id);
            String actionsValue = actions.get(id);
            actionsValue = actionsValue == null ? "" : actionsValue;
            String note_msg = Common.getMessage(request, "cp_eventmember_" + actionsValue,
                    "zone.action?do=event&id=" + event.get("eventid"), event.get("title"));
            builder.append("('");
            builder.append(id);
            builder.append("', 'eventmemberstatus', '1', '");
            builder.append(supe_uid);
            builder.append("', '");
            builder.append(supe_username);
            builder.append("', '");
            builder.append(Common.addSlashes(note_msg));
            builder.append("', '");
            builder.append(timestamp);
            builder.append("')");
            note_inserts.add(builder.toString());
            builder.delete(0, builder.length());
        }
    }
    if (!Common.empty(note_ids)) {
        dataBaseService.execute(
                "INSERT INTO sns_notification (`uid`, `type`, `new`, `authorid`, `author`, `note`, `dateline`) VALUES "
                        + Common.implode(note_inserts, ","));
        dataBaseService.executeUpdate(
                "UPDATE sns_space SET notenum=notenum+1 WHERE uid IN (" + Common.sImplode(note_ids) + ")");
    }
    if (!Common.empty(feed_inserts)) {
        dataBaseService.execute(
                "INSERT INTO sns_feed (`appid` ,`icon` ,`uid` ,`username` ,`dateline` ,`friend` ,`hash_template` ,`hash_data` ,`title_template` ,`title_data` ,`body_template` ,`body_data` ,`body_general` ,`image_1` ,`image_1_link` ,`image_2` ,`image_2_link` ,`image_3` ,`image_3_link` ,`image_4` ,`image_4_link`)  VALUES "
                        + Common.implode(feed_inserts, ","));
    }
    if (status == -1) {
        dataBaseService.execute("DELETE FROM sns_userevent WHERE uid IN (" + Common.sImplode(newids)
                + ") AND eventid='" + eventid + "'");
    } else {
        dataBaseService.executeUpdate("UPDATE sns_userevent SET status='" + status + "' WHERE uid IN ("
                + Common.sImplode(newids) + ") AND eventid='" + eventid + "'");
    }
    if (num != 0) {
        dataBaseService.executeUpdate(
                "UPDATE sns_event SET membernum = membernum + " + num + " WHERE eventid='" + eventid + "'");
    }
    return newids;
}

From source file:cn.jcenterhome.web.action.CpAction.java

private Object verify_eventmembers(HttpServletRequest request, Map<String, Object> sGlobal,
        Map<String, Object> event, String[] uids, String statusString) {
    int supe_uid = (Integer) sGlobal.get("supe_uid");
    int timestamp = (Integer) sGlobal.get("timestamp");
    String supe_username = (String) sGlobal.get("supe_username");
    Map<String, Object> supeUserEvent = (Map<String, Object>) sGlobal.get("supe_userevent");
    if (supeUserEvent == null || (Integer) supeUserEvent.get("status") < 3) {
        return new MessageVO("no_privilege_manage_event_members");
    }/*  w  w  w .j av  a  2s . c  o  m*/
    int eventid = (Integer) supeUserEvent.get("eventid");
    List<Map<String, Object>> query;
    if (event == null || eventid != (Integer) event.get("eventid")) {
        query = dataBaseService.executeQuery(
                "SELECT * FROM " + JavaCenterHome.getTableName("event") + " WHERE eventid='" + eventid + "'");
        try {
            event = query.get(0);
        } catch (IndexOutOfBoundsException exception) {
            return new MessageVO(exception.getMessage());
        }
    }
    int status = Common.intval(statusString);
    if (status < -1 || status > 3) {
        return new MessageVO("bad_userevent_status");
    }
    if ((Integer) event.get("verify") == 0 && status == 0) {
        return new MessageVO("event_not_set_verify");
    }
    int eventUid = (Integer) event.get("uid");
    if (status == 3 && supe_uid != eventUid) {
        return new MessageVO("only_creator_can_set_admin");
    }
    List<Integer> newids = new ArrayList<Integer>();
    Map<Integer, Map<String, Object>> userevents = new HashMap<Integer, Map<String, Object>>();
    Map<Integer, String> actions = new HashMap<Integer, String>();
    int num = 0;
    query = dataBaseService.executeQuery(
            "SELECT ue.*, sf.* FROM " + JavaCenterHome.getTableName("userevent") + " ue LEFT JOIN "
                    + JavaCenterHome.getTableName("spacefield") + " sf ON ue.uid=sf.uid WHERE ue.uid IN ("
                    + Common.sImplode(uids) + ") AND ue.eventid='" + eventid + "'");
    int valueStatus;
    int valueUid;
    for (Map<String, Object> value : query) {
        valueStatus = (Integer) value.get("status");
        valueUid = (Integer) value.get("uid");
        if (valueStatus == status || eventUid == valueUid || valueStatus == 1) {
            continue;
        }
        if (status == 2 || status == 3 || status == 0 || status == -1) {
            newids.add(valueUid);
            userevents.put(valueUid, value);
            if (status == 2) {
                if (valueStatus == 0) {
                    actions.put(valueUid, "set_verify");
                    num += ((Integer) value.get("fellow") + 1);
                } else if (valueStatus == 3) {
                    actions.put(valueUid, "unset_admin");
                }
            } else if (status == 3) {
                actions.put(valueUid, "set_admin");
                if (valueStatus == 0) {
                    num += ((Integer) value.get("fellow") + 1);
                }
            } else if (status == 0) {
                actions.put(valueUid, "unset_verify");
                if (valueStatus >= 2) {
                    num -= ((Integer) value.get("fellow") + 1);
                }
            } else if (status == -1) {
                actions.put(valueUid, "set_delete");
                if (valueStatus >= 2) {
                    num -= ((Integer) value.get("fellow") + 1);
                }
            }
        }
    }
    if (Common.empty(newids))
        return newids;
    int eventLimitnum = (Integer) event.get("limitnum");
    if (eventLimitnum > 0 && (Integer) event.get("membernum") + num > eventLimitnum) {
        return new MessageVO("event_will_full");
    }
    List<String> note_inserts = new ArrayList<String>();
    List<String> feed_inserts = new ArrayList<String>();
    List<Integer> note_ids = new ArrayList<Integer>();
    Map<String, Object> subMap = new HashMap<String, Object>();
    subMap.put("title", event.get("title"));
    subMap.put("eventid", event.get("eventid"));
    subMap.put("uid", event.get("uid"));
    subMap.put("username", event.get("username"));
    Map<String, Object> feedarr = new HashMap<String, Object>();
    feedarr.put("appid", JavaCenterHome.jchConfig.get("JC_APPID"));
    feedarr.put("icon", "event");
    feedarr.put("uid", "");
    feedarr.put("username", "");
    feedarr.put("dateline", timestamp);
    feedarr.put("title_template", Common.getMessage(request, "cp_event_join"));
    feedarr.put("title_data", subMap);
    feedarr.put("body_template", "");
    feedarr.put("body_data", new HashMap());
    feedarr.put("body_general", "");
    feedarr.put("image_1", "");
    feedarr.put("image_1_link", "");
    feedarr.put("image_2", "");
    feedarr.put("image_2_link", "");
    feedarr.put("image_3", "");
    feedarr.put("image_3_link", "");
    feedarr.put("image_4", "");
    feedarr.put("image_4_link", "");
    feedarr.put("target_ids", "");
    feedarr.put("friend", "friend");
    feedarr = (Map<String, Object>) Common.sStripSlashes(feedarr);
    feedarr.put("title_data", Serializer.serialize(Common.sStripSlashes(feedarr.get("title_data"))));
    feedarr.put("body_data", Serializer.serialize(Common.sStripSlashes(feedarr.get("body_data"))));
    feedarr.put("hash_template",
            Common.md5(feedarr.get("title_template") + "\t" + feedarr.get("body_template")));
    feedarr.put("hash_data", Common.md5(feedarr.get("title_template") + "\t" + feedarr.get("title_data") + "\t"
            + feedarr.get("body_template") + "\t" + feedarr.get("body_data")));
    feedarr = (Map<String, Object>) Common.sAddSlashes(feedarr);
    Map<String, Object> mapInUserevents;
    StringBuilder builder = new StringBuilder();
    for (int id : newids) {
        mapInUserevents = userevents.get(id);
        if (status > 1 && (Integer) mapInUserevents.get("status") == 0) {
            feedarr.put("uid", mapInUserevents.get("uid"));
            feedarr.put("username", mapInUserevents.get("username"));
            builder.append("('");
            builder.append(feedarr.get("appid"));
            builder.append("', 'event', '");
            builder.append(feedarr.get("uid"));
            builder.append("', '");
            builder.append(feedarr.get("username"));
            builder.append("', '");
            builder.append(feedarr.get("dateline"));
            builder.append("', '0', '");
            builder.append(feedarr.get("hash_template"));
            builder.append("', '");
            builder.append(feedarr.get("hash_data"));
            builder.append("', '");
            builder.append(feedarr.get("title_template"));
            builder.append("', '");
            builder.append(feedarr.get("title_data"));
            builder.append("', '");
            builder.append(feedarr.get("body_template"));
            builder.append("', '");
            builder.append(feedarr.get("body_data"));
            builder.append("', '");
            builder.append(feedarr.get("body_general"));
            builder.append("', '");
            builder.append(feedarr.get("image_1"));
            builder.append("', '");
            builder.append(feedarr.get("image_1_link"));
            builder.append("', '");
            builder.append(feedarr.get("image_2"));
            builder.append("', '");
            builder.append(feedarr.get("image_2_link"));
            builder.append("', '");
            builder.append(feedarr.get("image_3"));
            builder.append("', '");
            builder.append(feedarr.get("image_3_link"));
            builder.append("', '");
            builder.append(feedarr.get("image_4"));
            builder.append("', '");
            builder.append(feedarr.get("image_4_link"));
            builder.append("')");
            feed_inserts.add(builder.toString());
            builder.delete(0, builder.length());
        }
        mapInUserevents.put("privacy",
                Common.empty(mapInUserevents.get("privacy")) ? new HashMap<String, Object>()
                        : Serializer.unserialize((String) mapInUserevents.get("privacy")));
        Map<String, Object> tempM = (Map<String, Object>) ((Map<String, Object>) mapInUserevents.get("privacy"))
                .get("filter_note");
        Set<String> filter = Common.empty(tempM) ? new HashSet<String>() : tempM.keySet();
        if (tempM == null) {
            tempM = new HashMap<String, Object>();
        } else {
            tempM.clear();
        }
        tempM.put("type", "eventmemberstatus");
        tempM.put("authorid", supe_uid);
        if (cpService.checkNoteUid(tempM, filter)) {
            note_ids.add(id);
            String actionsValue = actions.get(id);
            actionsValue = actionsValue == null ? "" : actionsValue;
            String note_msg = Common.getMessage(request, "cp_eventmember_" + actionsValue,
                    "space.jsp?do=event&id=" + event.get("eventid"), event.get("title"));
            builder.append("('");
            builder.append(id);
            builder.append("', 'eventmemberstatus', '1', '");
            builder.append(supe_uid);
            builder.append("', '");
            builder.append(supe_username);
            builder.append("', '");
            builder.append(Common.addSlashes(note_msg));
            builder.append("', '");
            builder.append(timestamp);
            builder.append("')");
            note_inserts.add(builder.toString());
            builder.delete(0, builder.length());
        }
    }
    if (!Common.empty(note_ids)) {
        dataBaseService.execute("INSERT INTO " + JavaCenterHome.getTableName("notification")
                + " (`uid`, `type`, `new`, `authorid`, `author`, `note`, `dateline`) VALUES "
                + Common.implode(note_inserts, ","));
        dataBaseService.executeUpdate("UPDATE " + JavaCenterHome.getTableName("space")
                + " SET notenum=notenum+1 WHERE uid IN (" + Common.sImplode(note_ids) + ")");
    }
    if (!Common.empty(feed_inserts)) {
        dataBaseService.execute("INSERT INTO " + JavaCenterHome.getTableName("feed")
                + " (`appid` ,`icon` ,`uid` ,`username` ,`dateline` ,`friend` ,`hash_template` ,`hash_data` ,`title_template` ,`title_data` ,`body_template` ,`body_data` ,`body_general` ,`image_1` ,`image_1_link` ,`image_2` ,`image_2_link` ,`image_3` ,`image_3_link` ,`image_4` ,`image_4_link`)  VALUES "
                + Common.implode(feed_inserts, ","));
    }
    if (status == -1) {
        dataBaseService.execute("DELETE FROM " + JavaCenterHome.getTableName("userevent") + " WHERE uid IN ("
                + Common.sImplode(newids) + ") AND eventid='" + eventid + "'");
    } else {
        dataBaseService.executeUpdate("UPDATE " + JavaCenterHome.getTableName("userevent") + " SET status='"
                + status + "' WHERE uid IN (" + Common.sImplode(newids) + ") AND eventid='" + eventid + "'");
    }
    if (num != 0) {
        dataBaseService.executeUpdate("UPDATE " + JavaCenterHome.getTableName("event")
                + " SET membernum = membernum + " + num + " WHERE eventid='" + eventid + "'");
    }
    return newids;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

/**
 * Create a Report to generate LEPM Order Detail Report
         /* www . jav  a2  s .  c  om*/
 * @param obj   a DTO which consist all the search parameters
 * @return      a ArrayList of dto which consist all the data of reports 
 * @exception   Sql Exception
 *            
 */
public ArrayList<LempOrderDetailsReportDTO> viewLEPMOrderDetailReport(LempOrderDetailsReportDTO objDto)
        throws Exception {
    //   Nagarjuna
    String methodName = "viewLEPMOrderDetailReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end
    ArrayList<LempOrderDetailsReportDTO> objUserList = new ArrayList<LempOrderDetailsReportDTO>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    int countFlag = 0;
    LempOrderDetailsReportDTO objReportsDto = null;
    ArrayList<LempOrderDetailsReportDTO> listSearchDetails = new ArrayList<LempOrderDetailsReportDTO>();

    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlLEPMOrderDetailReport);
        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }
        //[202020]START
        if (objDto.getCopcApproveFromDate() != null && !"".equals(objDto.getCopcApproveFromDate())
                && objDto.getCopcApproveToDate() != null && !"".equals(objDto.getCopcApproveToDate())) {
            proc.setString(2, objDto.getCopcApproveFromDate().trim());
            proc.setString(3, objDto.getCopcApproveToDate().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        //[202020]END
        if (objDto.getVerticalDetails() != null && !"".equals(objDto.getVerticalDetails())) {
            proc.setString(4, objDto.getVerticalDetails().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }

        if (objDto.getFromOrderNo() != 0 && !"".equals(objDto.getFromOrderNo())) {
            proc.setInt(5, objDto.getFromOrderNo());
        } else {
            proc.setNull(5, java.sql.Types.BIGINT);
        }

        if (objDto.getToOrderNo() != 0 && !"".equals(objDto.getToOrderNo())) {
            proc.setInt(6, objDto.getToOrderNo());
        } else {
            proc.setNull(6, java.sql.Types.BIGINT);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(7, pagingSorting.getSortByColumn());// columnName
        proc.setString(8, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(9, pagingSorting.getStartRecordId());// start index
        proc.setInt(10, pagingSorting.getEndRecordId());// end index
        proc.setInt(11, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        rs = proc.executeQuery();

        while (rs.next() != false) {
            objDto = new LempOrderDetailsReportDTO();
            objDto.setPartyName(rs.getString("PARTYNAME"));
            objDto.setOrderNo(rs.getString("ORDERNO"));
            objDto.setCopcApproveDate(rs.getString("COPC_APPROVAL_DATE"));
            if (rs.getString("COPC_APPROVAL_DATE") != null && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                objDto.setCopcApproveDate(
                        (Utility.showDate_Report((rs.getTimestamp("COPC_APPROVAL_DATE")))).toUpperCase());
            }
            objDto.setLogicalCircuitId(rs.getString("LOGICALCKTID"));
            objDto.setServiceId(rs.getInt("SERVICENO"));
            objDto.setQuoteNo(rs.getString("QUOTENO"));
            objDto.setProductName(rs.getString("PRODUCTNAME"));
            objDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            objDto.setPrimarylocation(rs.getString("FROM_SITE"));
            objDto.setSeclocation(rs.getString("TO_SITE"));
            objDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objDto.setChargeAmount_String(rs.getString("CHARGEAMOUNT"));
            objDto.setPrjmngname(rs.getString("PMNAME"));
            objDto.setPrjmgremail(rs.getString("PMEMAIL"));
            objDto.setActmngname(rs.getString("ACTMNAME"));
            objDto.setZoneName(rs.getString("ZONENNAME"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {

                objDto.setCustPoDate((Utility.showDate_Report((rs.getTimestamp("CUSTPODATE")))).toUpperCase());

            }
            objDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objDto.setOrderDate(rs.getString("ORDERDATE"));
            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {

                objDto.setOrderDate((Utility.showDate_Report((rs.getTimestamp("ORDERDATE")))).toUpperCase());

            }
            objDto.setPmApproveDate(rs.getString("PM_APPROVAL_DATE"));
            if (rs.getString("PM_APPROVAL_DATE") != null && !"".equals(rs.getString("PM_APPROVAL_DATE"))) {
                objDto.setPmApproveDate(
                        (Utility.showDate_Report((rs.getTimestamp("PM_APPROVAL_DATE")))).toUpperCase());
            }
            objDto.setAmApproveDate(rs.getString("AM_APPROVAL_DATE"));
            if (rs.getString("AM_APPROVAL_DATE") != null && !"".equals(rs.getString("AM_APPROVAL_DATE"))) {
                objDto.setAmApproveDate(
                        (Utility.showDate_Report((rs.getTimestamp("AM_APPROVAL_DATE")))).toUpperCase());
            }
            objDto.setNio_approve_date(rs.getString("NIO_APPROVAL_DATE"));
            if (rs.getString("NIO_APPROVAL_DATE") != null && !"".equals(rs.getString("NIO_APPROVAL_DATE"))) {
                objDto.setNio_approve_date(
                        (Utility.showDate_Report((rs.getTimestamp("NIO_APPROVAL_DATE")))).toUpperCase());
            }
            objDto.setDemo_infrastartdate(rs.getString("DEMP_INFRA_START_DATE"));
            objDto.setDemo_infra_enddate(rs.getString("DEMO_INFRA_ENDDATE"));
            objDto.setRfs_date(rs.getString("RFS_DATE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {

                objDto.setRfs_date((Utility.showDate_Report((rs.getTimestamp("RFS_DATE")))).toUpperCase());

            }
            objDto.setOrdercategory(rs.getString("ORDERCATEGORY"));
            objDto.setOrderStatus(rs.getString("STATUS"));
            objDto.setLine_desc(rs.getString("LINE_ITEM_DESC"));
            objDto.setLinename(rs.getString("LINENAME"));
            objDto.setSub_linename(rs.getString("ORDER_SUBLINENAME"));
            objDto.setChargeName(rs.getString("CHARGE_NAME"));
            objDto.setChargeinfoID(rs.getString("CHARGEINFOID"));
            objDto.setServiceProductID(rs.getInt("LINENO"));
            objDto.setServiceName(rs.getString("SERVICENAME"));
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setLicCompanyName(rs.getString("LCOMPANYNAME"));
            objDto.setEntity(rs.getString("COMPANYNAME"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setFrequencyName(rs.getString("PAYMENTTERM"));
            objDto.setChargeTypeName(rs.getString("CYCLICNONCYCLIC"));
            if ("NULL".equals(rs.getString("SERVICETYPE"))) {
                objDto.setServiceType("");
            } else {
                objDto.setServiceType(rs.getString("SERVICETYPE"));
            }
            objDto.setUom(rs.getString("UOM"));
            objDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            //Vijay [RPT7052013010] -start. 
            //fetch the only city becoz of the FROM_CITY & TO_CITY has full adDress

            objDto.setFrom_city(rs.getString("FROM_CITY"));
            String frmCity = rs.getString("FROM_CITY");
            try {
                if (frmCity != null) {
                    String[] fcity = frmCity.split("~~");
                    objDto.setFrom_city(fcity[5]);
                }
            } catch (IndexOutOfBoundsException e) {
                //e.printStackTrace();
            }

            objDto.setTo_city(rs.getString("TO_CITY"));
            String toCity = rs.getString("TO_CITY");
            try {
                if (toCity != null) {
                    String[] tcity = toCity.split("~~");
                    objDto.setTo_city(tcity[5]);
                }
            } catch (IndexOutOfBoundsException e) {
                Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
                //e.printStackTrace();
            }
            //Vijay. [RPT7052013010] - end 

            objDto.setOldordertotal(rs.getString("OLD_ORDER_TOTAL"));
            objDto.setOldlineamt(rs.getString("OLD_LINE_AMT"));
            objDto.setOld_contract_period(rs.getString("OLD_CONTRACTPERIOD"));
            objDto.setRatio(rs.getString("RATIO"));
            objDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objDto.setFactory_ckt_id(rs.getString("FACTORY_CKT_ID"));
            objDto.setDistance(rs.getString("DISTANCE"));
            objDto.setAccountManager(rs.getString("ACTMEMAIL"));
            objDto.setCurrencyCode(rs.getString("CURNAME"));
            objDto.setTotalPoAmt(rs.getString("ORDERTOTAL"));
            objDto.setPoAmount(rs.getString("POAMOUNT"));
            objDto.setBisource(rs.getString("BISOURCE"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setDispatchAddress1(rs.getString("DISPATCHADDRESS"));
            objDto.setParent_name(rs.getString("PARENTNAME"));
            //[404040] Start 
            objDto.setOpportunityId((rs.getString("OPPORTUNITYID")));
            //[404040] End 
            //[505050] Start
            objDto.setOnnetOffnet((rs.getString("OFFNET_LABELATTVALUE")));
            objDto.setMedia((rs.getString("MEDIA_LABELATTVALUE")));
            objDto.setServOrderCategory((rs.getString("ORDERCATGRY_LABELATTVALUE")));
            //[505050] End

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);

    }

    catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }
    return listSearchDetails;

}