List of usage examples for java.sql ResultSet getDate
java.sql.Date getDate(String columnLabel) throws SQLException;
ResultSet
object as a java.sql.Date
object in the Java programming language. From source file:edu.harvard.i2b2.workplace.dao.FolderDao.java
private ParameterizedRowMapper<FolderType> getMapper(final String type, final boolean isBlob, final String tableCd, final String dbType) { ParameterizedRowMapper<FolderType> mapper = new ParameterizedRowMapper<FolderType>() { public FolderType mapRow(ResultSet rs, int rowNum) throws SQLException { FolderType child = new FolderType(); //TODO fix this for all/+blob if (tableCd == null) { // child.setHierarchy("\\\\" + rs.getString("c_table_cd")+ rs.getString("c_hierarchy")); child.setIndex("\\\\" + rs.getString("c_table_cd") + "\\" + rs.getString("c_index")); } else { // child.setHierarchy("\\\\" + tableCd + rs.getString("c_hierarchy")); child.setIndex("\\\\" + tableCd + "\\" + rs.getString("c_index")); }/*from w w w. j a v a2 s .c om*/ // log.debug("getMapper: " + child.getIndex()); child.setName(rs.getString("c_name")); child.setProtectedAccess(rs.getString("c_protected_access")); if (!(type.equals("default"))) { child.setUserId(rs.getString("c_user_id")); // child.setHlevel(rs.getInt("c_hlevel")); child.setGroupId(rs.getString("c_group_id")); child.setVisualAttributes(rs.getString("c_visualattributes")); // child.setIndex(rs.getString("c_index")); child.setParentIndex(rs.getString("c_parent_index")); child.setShareId(rs.getString("c_share_id")); // Building tooltip for the response // eg. project name - cname \n tooltip from db String toolTip = rs.getString("c_group_id") + " - " + rs.getString("c_name"); if (rs.getString("c_tooltip") != null && !rs.getString("c_tooltip").isEmpty()) { toolTip = toolTip + "\n" + rs.getString("c_tooltip"); } //child.setTooltip(rs.getString("c_tooltip")); child.setTooltip(toolTip); } if (isBlob == true) { child.setWorkXmlI2B2Type(rs.getString("c_work_xml_i2b2_type")); String c_xml = null; try { if (dbType.equals("POSTGRESQL")) { c_xml = rs.getString("c_work_xml"); } else { c_xml = JDBCUtil.getClobString(rs.getClob("c_work_xml")); } if (c_xml != null) { //c_xml = JDBCUtil.getClobString(xml_clob); if ((c_xml != null) && (c_xml.trim().length() > 0) && (!c_xml.equals("(null)"))) { SAXBuilder parser = new SAXBuilder(); java.io.StringReader xmlStringReader = new java.io.StringReader(c_xml); Element rootElement = null; try { org.jdom.Document metadataDoc = parser.build(xmlStringReader); org.jdom.output.DOMOutputter out = new DOMOutputter(); Document doc = out.output(metadataDoc); rootElement = doc.getDocumentElement(); } catch (JDOMException e) { log.error(e.getMessage()); child.setWorkXml(null); } catch (IOException e1) { log.error(e1.getMessage()); child.setWorkXml(null); } if (rootElement != null) { XmlValueType xml = new XmlValueType(); xml.getAny().add(rootElement); child.setWorkXml(xml); } else { // log.debug("rootElement is null"); child.setWorkXml(null); } } else { // log.debug("work xml is null"); child.setWorkXml(null); } } else { // log.debug("work xml is null"); child.setWorkXml(null); } } catch (Exception e) { log.error(e.getMessage()); child.setWorkXml(null); } try { Clob xml_schema_clob = rs.getClob("c_work_xml_schema"); if (xml_schema_clob != null) { c_xml = JDBCUtil.getClobString(xml_schema_clob); if ((c_xml != null) && (c_xml.trim().length() > 0) && (!c_xml.equals("(null)"))) { SAXBuilder parser = new SAXBuilder(); java.io.StringReader xmlStringReader = new java.io.StringReader(c_xml); Element rootElement = null; try { org.jdom.Document metadataDoc = parser.build(xmlStringReader); org.jdom.output.DOMOutputter out = new DOMOutputter(); Document doc = out.output(metadataDoc); rootElement = doc.getDocumentElement(); } catch (JDOMException e) { log.error(e.getMessage()); child.setWorkXmlSchema(null); } catch (IOException e1) { log.error(e1.getMessage()); child.setWorkXmlSchema(null); } if (rootElement != null) { XmlValueType xml = new XmlValueType(); xml.getAny().add(rootElement); child.setWorkXmlSchema(xml); } else { // log.debug("rootElement is null"); child.setWorkXmlSchema(null); } } else { // log.debug("work xml schema is null"); child.setWorkXmlSchema(null); } } else { // log.debug("work xml schema is null"); child.setWorkXmlSchema(null); } } catch (Exception e) { log.error(e.getMessage()); child.setWorkXmlSchema(null); } } if ((type.equals("all"))) { DTOFactory factory = new DTOFactory(); // make sure date isnt null before converting to XMLGregorianCalendar Date date = rs.getDate("c_entry_date"); if (date == null) child.setEntryDate(null); else child.setEntryDate(factory.getXMLGregorianCalendar(date.getTime())); date = rs.getDate("c_change_date"); if (date == null) child.setChangeDate(null); else child.setChangeDate(factory.getXMLGregorianCalendar(date.getTime())); child.setStatusCd(rs.getString("c_status_cd")); } return child; } }; return mapper; }
From source file:com.flexive.core.storage.genericSQL.GenericHierarchicalStorage.java
/** * Load all detail entries for a content instance * * @param con open and valid(!) connection * @param conNoTX a non-transactional connection (only used if the content contains binary properties) * @param type FxType used/*from ww w.j ava 2 s .c om*/ * @param env FxEnvironment * @param pk primary key of the content data to load * @param requestedVersion the originally requested version (LIVE, MAX or specific version number, needed to resolve references since the pk's version is resolved already) * @return a (root) group containing all data * @throws com.flexive.shared.exceptions.FxLoadException * on errors * @throws SQLException on errors * @throws FxInvalidParameterException on errors * @throws FxDbException on errors */ @SuppressWarnings("unchecked") protected FxGroupData loadDetails(Connection con, Connection conNoTX, FxType type, FxEnvironment env, FxPK pk, int requestedVersion, GroupPositionsProvider groupPositionsProvider) throws FxLoadException, SQLException, FxInvalidParameterException, FxDbException { FxGroupData root; PreparedStatement ps = null; try { root = type.createEmptyData(type.buildXPathPrefix(pk)); // root.removeEmptyEntries(true); // root.compactPositions(true); root.removeNonInternalData(); ps = con.prepareStatement(CONTENT_DATA_LOAD); ps.setLong(1, pk.getId()); ps.setInt(2, pk.getVersion()); ResultSet rs = ps.executeQuery(); String currXPath = null; int currXDepth = 0; FxAssignment currAssignment = null, thisAssignment = null; int currPos = -1; long currLang; long defLang = FxLanguage.SYSTEM_ID; boolean isGroup = true; boolean isMLDef; boolean multiLang = false; String currXMult; FxValue currValue = null; String[] columns = null; List<ServerLocation> server = CacheAdmin.getStreamServers(); //load flat columns FxFlatStorageLoadContainer flatContainer = type.isContainsFlatStorageAssignments() ? FxFlatStorageManager.getInstance().loadContent(this, con, type.getId(), pk, requestedVersion) : null; while (rs != null && rs.next()) { if (thisAssignment == null || thisAssignment.getId() != rs.getLong(3)) { //new data type thisAssignment = env.getAssignment(rs.getLong(3)); } currXMult = rs.getString(4); if (currXPath != null && !currXPath.equals(XPathElement.toXPathMult(thisAssignment.getXPath(), currXMult))) { //add this property if (!isGroup) { currValue.setDefaultLanguage(defLang); if (flatContainer != null) { //add flat entries that are positioned before the current entry FxFlatStorageLoadColumn flatColumn; while ((flatColumn = flatContainer.pop( currXPath.substring(0, currXPath.lastIndexOf('/') + 1), currXDepth, currPos)) != null) { addValue(root, flatColumn.getXPath(), flatColumn.getAssignment(), flatColumn.getPos(), groupPositionsProvider, flatColumn.getValue()); } } } addValue(root, currXPath, currAssignment, currPos, groupPositionsProvider, currValue); currValue = null; defLang = FxLanguage.SYSTEM_ID; } //read next row currPos = rs.getInt(1); currLang = rs.getInt(2); isMLDef = rs.getBoolean(6); isGroup = rs.getBoolean(5); if (currAssignment == null || currAssignment.getId() != thisAssignment.getId()) { currAssignment = thisAssignment; if (!isGroup) columns = getColumns(((FxPropertyAssignment) currAssignment).getProperty()); } currXPath = XPathElement.toXPathMult(currAssignment.getXPath(), currXMult); if (flatContainer != null) { //calculate xdepth currXDepth = 1; for (char c : currXMult.toCharArray()) if (c == ',') currXDepth++; } if (!isGroup) { final FxPropertyAssignment propAssignment = (FxPropertyAssignment) currAssignment; FxDataType dataType = propAssignment.getProperty().getDataType(); if (currValue == null) multiLang = propAssignment.isMultiLang(); switch (dataType) { case Float: if (currValue == null) currValue = new FxFloat(multiLang, currLang, rs.getFloat(columns[0])); else currValue.setTranslation(currLang, rs.getFloat(columns[0])); break; case Double: if (currValue == null) currValue = new FxDouble(multiLang, currLang, rs.getDouble(columns[0])); else currValue.setTranslation(currLang, rs.getDouble(columns[0])); break; case LargeNumber: if (currValue == null) currValue = new FxLargeNumber(multiLang, currLang, rs.getLong(columns[0])); else currValue.setTranslation(currLang, rs.getLong(columns[0])); break; case Number: if (currValue == null) currValue = new FxNumber(multiLang, currLang, rs.getInt(columns[0])); else currValue.setTranslation(currLang, rs.getInt(columns[0])); break; case HTML: if (currValue == null) { currValue = new FxHTML(multiLang, currLang, rs.getString(columns[0])); ((FxHTML) currValue).setTidyHTML(rs.getBoolean(columns[1])); } else currValue.setTranslation(currLang, rs.getString(columns[0])); break; case String1024: case Text: if (currValue == null) { currValue = new FxString(multiLang, currLang, rs.getString(columns[0])); } else currValue.setTranslation(currLang, rs.getString(columns[0])); break; case Boolean: if (currValue == null) currValue = new FxBoolean(multiLang, currLang, rs.getBoolean(columns[0])); else currValue.setTranslation(currLang, rs.getBoolean(columns[0])); break; case Date: if (currValue == null) currValue = new FxDate(multiLang, currLang, rs.getDate(columns[0])); else currValue.setTranslation(currLang, rs.getDate(columns[0])); break; case DateTime: if (currValue == null) currValue = new FxDateTime(multiLang, currLang, new Date(rs.getTimestamp(columns[0]).getTime())); else currValue.setTranslation(currLang, new Date(rs.getTimestamp(columns[0]).getTime())); break; case DateRange: if (currValue == null) currValue = new FxDateRange(multiLang, currLang, new DateRange(rs.getDate(columns[0]), rs.getDate( getColumns(((FxPropertyAssignment) currAssignment).getProperty())[1]))); else currValue.setTranslation(currLang, new DateRange(rs.getDate(columns[0]), rs.getDate( getColumns(((FxPropertyAssignment) currAssignment).getProperty())[1]))); break; case DateTimeRange: if (currValue == null) currValue = new FxDateTimeRange(multiLang, currLang, new DateRange( new Date(rs.getTimestamp(columns[0]).getTime()), new Date(rs.getTimestamp( getColumns(((FxPropertyAssignment) currAssignment).getProperty())[1]) .getTime()))); else currValue.setTranslation(currLang, new DateRange( new Date(rs.getTimestamp(columns[0]).getTime()), new Date(rs.getTimestamp( getColumns(((FxPropertyAssignment) currAssignment).getProperty())[1]) .getTime()))); break; case Binary: BinaryDescriptor desc = binaryStorage.loadBinaryDescriptor(server, conNoTX, rs.getLong(columns[0])); if (currValue == null) currValue = new FxBinary(multiLang, currLang, desc); else currValue.setTranslation(currLang, desc); break; case SelectOne: FxSelectListItem singleItem = env.getSelectListItem(rs.getLong(columns[0])); if (currValue == null) currValue = new FxSelectOne(multiLang, currLang, singleItem); else currValue.setTranslation(currLang, singleItem); break; case SelectMany: long itemId = rs.getLong(columns[0]); FxSelectList list = ((FxPropertyAssignment) currAssignment).getProperty() .getReferencedList(); if (currValue == null) currValue = new FxSelectMany(multiLang, currLang, new SelectMany(list)); FxSelectMany sm = (FxSelectMany) currValue; if (sm.isTranslationEmpty(currLang)) sm.setTranslation(currLang, new SelectMany(list)); if (itemId > 0) sm.getTranslation(currLang).selectItem(list.getItem(itemId)); break; case Reference: if (currValue == null) // currValue = new FxReference(multiLang, currLang, new ReferencedContent(rs.getLong(columns[0]))); currValue = new FxReference(multiLang, currLang, resolveReference(con, requestedVersion, rs.getLong(columns[0]))); else currValue.setTranslation(currLang, resolveReference(con, requestedVersion, rs.getLong(columns[0]))); break; default: throw new FxDbException(LOG, "ex.db.notImplemented.load", dataType.getName()); } if (currValue != null) { int valueData = rs.getInt(getValueDataLoadPos(dataType)); if (rs.wasNull()) currValue.clearValueData(currLang); else currValue.setValueData(currLang, valueData); } if (isMLDef) defLang = currLang; } } // check for empty groups for (Map.Entry<Long, Map<String, Integer>> entry : groupPositionsProvider.getPositions().entrySet()) { final long assignmentId = entry.getKey(); final FxGroupAssignment groupAssignment = (FxGroupAssignment) env.getAssignment(assignmentId); final Set<String> existingMults; final FxGroupData group = root.findGroup(assignmentId); if (group != null) { existingMults = Sets.newHashSet(); for (FxData data : group.getElements()) { existingMults.add(FxArrayUtils.toStringArray(data.getIndices(), ',')); } } else { existingMults = Collections.emptySet(); } for (Map.Entry<String, Integer> position : entry.getValue().entrySet()) { final String xmult = position.getKey(); if (!existingMults.contains(xmult) && groupAssignment.getMultiplicity().isRequired()) { // add (empty) group root.addGroup(XPathElement.toXPathMult(groupAssignment.getXPath(), xmult.replace('/', ',')), groupAssignment, position.getValue(), GROUPS_ONLY_SYS_INTERNAL); } } } if (currValue != null) { if (flatContainer != null) { //add flat entries that are positioned before the current entry FxFlatStorageLoadColumn flatColumn; while ((flatColumn = flatContainer.pop(currXPath.substring(0, currXPath.lastIndexOf('/') + 1), currXDepth, currPos)) != null) { addValue(root, flatColumn.getXPath(), flatColumn.getAssignment(), flatColumn.getPos(), groupPositionsProvider, flatColumn.getValue()); } } //add last property if (!isGroup) currValue.setDefaultLanguage(defLang); addValue(root, currXPath, currAssignment, currPos, groupPositionsProvider, currValue); } else { if (flatContainer == null && isGroup && currAssignment != null) //make sure to add the last assignment if it is a group and no flat storage is enabled addValue(root, currXPath, currAssignment, currPos, groupPositionsProvider, currValue); } if (flatContainer != null) { if (isGroup && currAssignment != null) //if the last value was a group, add it (can only happen when using a flat storage) addValue(root, currXPath, currAssignment, currPos, groupPositionsProvider, currValue); //add remaining flat entries FxFlatStorageLoadColumn flatColumn; while ((flatColumn = flatContainer.pop()) != null) { addValue(root, flatColumn.getXPath(), flatColumn.getAssignment(), flatColumn.getPos(), groupPositionsProvider, flatColumn.getValue()); } } // fix group positions after all groups have been added fixGroupPositions(root, groupPositionsProvider); } catch (FxCreateException e) { throw new FxLoadException(e); } catch (FxNotFoundException e) { throw new FxLoadException(e); } finally { Database.closeObjects(GenericHierarchicalStorage.class, ps); } return root; }
From source file:com.mss.msp.util.DataSourceDataProvider.java
/** * ***************************************************************************** * Date :// w w w . ja v a2s . c o m * * Author : ramakrishna<lankireddy@miraclesoft.com> * * ForUse : setRequirementDetails() method is used to * * ***************************************************************************** */ public RequirementVTO setRequirementDetails(String reqId) { System.out.println( "********************DataSourceDataProvider :: setRequirementDetails Method Start*********************"); Connection connection = null; Statement statement = null; ResultSet resultSet = null; String queryString = ""; String resultStr = ""; RequirementVTO requirementVTO = new RequirementVTO(); try { queryString = "SELECT req_name,req_function_desc,req_st_date,no_of_resources FROM acc_requirements WHERE requirement_id=" + reqId; System.out.println("setRequirementDetails :: query string ------>" + queryString); connection = ConnectionProvider.getInstance().getConnection(); statement = connection.createStatement(); resultSet = statement.executeQuery(queryString); while (resultSet.next()) { requirementVTO.setReqName(resultSet.getString("req_name")); requirementVTO.setReqDesc(resultSet.getString("req_function_desc")); requirementVTO.setReqStartDate(com.mss.msp.util.DateUtility.getInstance() .convertDateToViewInDashformat(resultSet.getDate("req_st_date"))); requirementVTO.setReqResources(resultSet.getString("no_of_resources")); } } catch (Exception sqe) { sqe.printStackTrace(); } finally { try { if (resultSet != null) { resultSet.close(); resultSet = null; } if (statement != null) { statement.close(); statement = null; } if (connection != null) { connection.close(); connection = null; } } catch (SQLException sqle) { sqle.printStackTrace(); } } System.out.println( "********************DataSourceDataProvider :: setRequirementDetails Method End*********************"); return requirementVTO; }
From source file:edu.ku.brc.specify.conversion.GenericDBConversion.java
/** * @param tblWriter//from w w w. j a v a 2 s. c om * @param treeDef * @param isPaleo * @throws SQLException */ public void convertGTP(final TableWriter tblWriter, final GeologicTimePeriodTreeDef treeDef, final boolean isPaleo) throws SQLException { deleteAllRecordsFromTable("geologictimeperiod", BasicSQLUtils.myDestinationServerType); log.info("Converting old geologic time period records"); int count = 0; // create an ID mapper for the geologictimeperiod table IdTableMapper gtpIdMapper = IdMapperMgr.getInstance().addTableMapper("geologictimeperiod", "GeologicTimePeriodID"); Hashtable<Integer, GeologicTimePeriod> oldIdToGTPMap = new Hashtable<Integer, GeologicTimePeriod>(); // String sql = "SELECT g.GeologicTimePeriodID,g.RankCode,g.Name,g.Standard,g.Remarks,g.TimestampModified,g.TimestampCreated,p1.Age as Upper," + // "p1.AgeUncertainty as UpperUncertainty,p2.Age as Lower,p2.AgeUncertainty as LowerUncertainty FROM geologictimeperiod g, " + // "geologictimeboundary p1, geologictimeboundary p2 WHERE g.UpperBoundaryID=p1.GeologicTimeBoundaryID AND " + // "g.LowerBoundaryID=p2.GeologicTimeBoundaryID ORDER BY Lower DESC, RankCode"; String sql = "SELECT g.GeologicTimePeriodID,g.RankCode,g.Name,g.Standard,g.Remarks,g.TimestampModified,g.TimestampCreated,gb1.Age as Upper," + "gb1.AgeUncertainty as UpperUncertainty,gb2.Age as Lower,gb2.AgeUncertainty as LowerUncertainty FROM geologictimeperiod g " + "LEFT OUTER JOIN geologictimeboundary gb1 ON g.UpperBoundaryID = gb1.GeologicTimeBoundaryID " + "LEFT OUTER JOIN geologictimeboundary gb2 ON g.LowerBoundaryID = gb2.GeologicTimeBoundaryID " + "ORDER BY Lower DESC, RankCode"; Statement statement = oldDBConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement.setFetchSize(Integer.MIN_VALUE); ResultSet rs = statement.executeQuery(sql); Session localSession = HibernateUtil.getCurrentSession(); HibernateUtil.beginTransaction(); Vector<GeologicTimePeriod> newItems = new Vector<GeologicTimePeriod>(); GeologicTimePeriod allTime = new GeologicTimePeriod(); allTime.initialize(); allTime.setDefinition(treeDef); GeologicTimePeriodTreeDefItem rootDefItem = treeDef.getDefItemByRank(0); allTime.setDefinitionItem(rootDefItem); allTime.setRankId(0); allTime.setName("Time"); allTime.setFullName("Time"); allTime.setStartPeriod(100000f); allTime.setEndPeriod(0f); allTime.setEndUncertainty(0f); allTime.setTimestampCreated(now); ++count; newItems.add(allTime); ArrayList<GeologicTimePeriod> needsPlaceHolderList = new ArrayList<GeologicTimePeriod>(); boolean needsTbl = true; if (isPaleo) { while (rs.next()) { Integer id = rs.getInt(1); Integer rank = rs.getInt(2) * 100; String name = rs.getString(3); String std = rs.getString(4); String rem = rs.getString(5); Date modTDate = rs.getDate(6); Date creTDate = rs.getDate(7); Timestamp modT = (modTDate != null) ? new Timestamp(modTDate.getTime()) : null; Timestamp creT = (creTDate != null) ? new Timestamp(creTDate.getTime()) : null; Float upper = (Float) rs.getObject(8); Float uError = (Float) rs.getObject(9); Float lower = (Float) rs.getObject(10); Float lError = (Float) rs.getObject(11); if (isEmpty(name)) { if (needsTbl) { tblWriter.startTable(); tblWriter.logHdr("ID", "Rank Name", "Name", "Reason"); needsTbl = false; } tblWriter.log(id.toString(), rank.toString(), name, "Name is null, Name set to 'XXXX'"); log.error("The Name is empty (or null) for GTP ID[" + id + "] Rank[" + rank + "]"); name = "XXXX"; } if (modT == null && creT == null) { creT = now; modT = now; } else if (modT == null && creT != null) { modT = new Timestamp(creT.getTime()); } else if (modT != null && creT == null) { creT = new Timestamp(modT.getTime()); } // else (neither are null, so do nothing) GeologicTimePeriodTreeDefItem defItem = rank != null ? treeDef.getDefItemByRank(rank) : null; GeologicTimePeriod gtp = new GeologicTimePeriod(); gtp.initialize(); gtp.setName(name); gtp.setFullName(name); gtp.setDefinitionItem(defItem); gtp.setRankId(rank); gtp.setDefinition(treeDef); gtp.setStartPeriod(lower); gtp.setStartUncertainty(lError); gtp.setEndPeriod(upper); gtp.setEndUncertainty(uError); gtp.setStandard(std); gtp.setRemarks(rem); gtp.setTimestampCreated(creT); gtp.setTimestampModified(modT); if (lower == null || upper == null || rank == null) { needsPlaceHolderList.add(gtp); log.debug("PlaceHold Old ID: " + id); } else { newItems.add(gtp); } oldIdToGTPMap.put(id, gtp); if (++count % 500 == 0) { log.info(count + " geologic time period records converted"); } } // now we need to fix the parent/pointers for (int i = 0; i < newItems.size(); ++i) { GeologicTimePeriod gtp = newItems.get(i); for (int j = 0; j < newItems.size(); ++j) { GeologicTimePeriod child = newItems.get(j); if (isParentChildPair(gtp, child)) { gtp.addChild(child); } } } if (needsPlaceHolderList.size() > 0) { int rank = 100; for (GeologicTimePeriodTreeDefItem di : treeDef.getTreeDefItems()) { System.out.println(di.getName() + " -> " + di.getRankId()); } GeologicTimePeriodTreeDefItem defItem = treeDef.getDefItemByRank(rank); GeologicTimePeriod gtp = new GeologicTimePeriod(); gtp.initialize(); gtp.setName("Placeholder"); gtp.setFullName("Placeholder"); gtp.setDefinitionItem(defItem); gtp.setRankId(rank); gtp.setDefinition(treeDef); gtp.setStartPeriod(0.0f); gtp.setStartUncertainty(0.0f); gtp.setEndPeriod(0.0f); gtp.setEndUncertainty(0.0f); gtp.setStandard(null); gtp.setRemarks(null); gtp.setTimestampCreated(now); gtp.setTimestampModified(now); allTime.addChild(gtp); rank = 200; defItem = treeDef.getDefItemByRank(rank); for (GeologicTimePeriod gtpPH : needsPlaceHolderList) { gtpPH.setDefinition(treeDef); gtpPH.setDefinitionItem(defItem); gtpPH.setRankId(rank); gtpPH.setStartPeriod(0.0f); gtpPH.setStartUncertainty(0.0f); gtpPH.setEndPeriod(0.0f); gtpPH.setEndUncertainty(0.0f); gtp.addChild(gtpPH); } } TreeHelper.fixFullnameForNodeAndDescendants(allTime); } // fix node number, child node number stuff allTime.setNodeNumber(1); fixNodeNumbersFromRoot(allTime); localSession.save(allTime); HibernateUtil.commitTransaction(); if (shouldCreateMapTables) { // add all of the ID mappings for (Integer oldId : oldIdToGTPMap.keySet()) { if (oldId != null) { GeologicTimePeriod gtp = oldIdToGTPMap.get(oldId); if (gtp != null) { if (gtp.getId() != null) { gtpIdMapper.put(oldId, gtp.getId()); } else { log.debug("GTP id is null: " + gtp.getName()); } } else { log.debug("GTP missing in hash for Old ID: " + oldId); } } else { log.debug("Old ID in Hash is null: " + oldId); } } } // set up geologictimeperiod foreign key mapping for stratigraphy IdMapperMgr.getInstance().mapForeignKey("Stratigraphy", "GeologicTimePeriodID", "GeologicTimePeriod", "GeologicTimePeriodID"); log.info(count + " geologic time period records converted"); if (!needsTbl) { tblWriter.endTable(); } }
From source file:com.mss.msp.util.DataSourceDataProvider.java
/** * ***************************************************************************** * Date ://from w w w . j a v a2s . c om * * Author: * * ForUse : getGridData() method is used * * ***************************************************************************** */ public String getGridData(String query, String flag, String accType) throws ServiceLocatorException { System.out.println( "********************DataSourceDataProvider :: getGridData Method Start*********************"); Connection connection = null; Statement statement = null; ResultSet resultSet = null; String queryString = ""; String resultString = ""; String decryptedSSN = ""; queryString = query; System.out.println("getGridData :: query string ------>" + queryString); String postedDate = ""; try { connection = ConnectionProvider.getInstance().getConnection(); statement = connection.createStatement(); resultSet = statement.executeQuery(queryString); if ("Req".equals(flag)) { if ("AC".equalsIgnoreCase(accType)) { resultString = "Job Id" + "|" + "Jog Title" + "|" + "Positions" + "|" + "Skills Set" + "|" + "Posted Date" + "|" + "Status" + "|" + "No of Submissions" + "^"; } else { resultString = "Job Id" + "|" + "Jog Title" + "|" + "Customer" + "|" + "Skills Set" + "|" + "Posted Date" + "|" + "Status" + "^"; } while (resultSet.next()) { java.util.Date myDate = resultSet.getDate("created_date"); if (myDate != null) { postedDate = com.mss.msp.util.DateUtility.getInstance() .convertDateToViewInDashFormat(myDate); } else { postedDate = "---"; } String status = ""; if (resultSet.getString("req_status").equalsIgnoreCase("O")) { status = "Opened"; } else if (resultSet.getString("req_status").equalsIgnoreCase("R")) { status = "Released"; } else if (resultSet.getString("req_status").equalsIgnoreCase("OR")) { status = "Open for Resume"; } else if (resultSet.getString("req_status").equalsIgnoreCase("C")) { status = "Closed"; } else if (resultSet.getString("req_status").equalsIgnoreCase("F")) { status = "Forecast"; } else if (resultSet.getString("req_status").equalsIgnoreCase("I")) { status = "Inprogess"; } else if (resultSet.getString("req_status").equalsIgnoreCase("H")) { status = "Hold"; } else if (resultSet.getString("req_status").equalsIgnoreCase("W")) { status = "Withdrawn"; } else if (resultSet.getString("req_status").equalsIgnoreCase("S")) { status = "Won"; } else if (resultSet.getString("req_status").equalsIgnoreCase("L")) { status = "Lost"; } if ("AC".equalsIgnoreCase(accType)) { resultString += resultSet.getString("jdid") + "|" + resultSet.getString("req_name") + "|" + resultSet.getString("no_of_resources") + "|" + resultSet.getString("req_skills") + "|" + postedDate + "|" + status + "|" + com.mss.msp.util.DataSourceDataProvider .getInstance().getNoOfSubmisions(resultSet.getInt("requirement_id"), 0) + "^"; } else { resultString += resultSet.getString("jdid") + "|" + resultSet.getString("req_name") + "|" + resultSet.getString("account_name") + "|" + resultSet.getString("req_skills") + "|" + postedDate + "|" + status + "^"; } } } else if ("Sub".equals(flag)) { if ("AC".equalsIgnoreCase(accType)) { resultString = "Vendor" + "|" + "Candidate Name" + "|" + "Submitted Date" + "|" + "SSN No" + "|" + "Skills" + "|" + "Experience" + "|" + "Status" + "|" + "Rate" + "^"; } else { resultString = "Candidate Name" + "|" + "Submitted Date" + "|" + "SSN No" + "|" + "Email" + "|" + "Skills" + "|" + "Experience" + "|" + "Phone Number" + "|" + "Status" + "|" + "Rate" + "^"; } while (resultSet.next()) { if (resultSet.getString("ssn_number") != null && !"".equalsIgnoreCase(resultSet.getString("ssn_number"))) { decryptedSSN = com.mss.msp.util.DataUtility.decrypted(resultSet.getString("ssn_number")); } if ("AC".equalsIgnoreCase(accType)) { resultString += com.mss.msp.util.DataSourceDataProvider.getInstance() .getOrganizationName(resultSet.getInt("created_by_org_id")) + "|" + resultSet.getString("name") + "|" + com.mss.msp.util.DateUtility.getInstance() .convertDateToViewInDashFormat(resultSet.getDate("created_date")) + "|" + decryptedSSN + "|" + resultSet.getString("consultant_skills") + "|" + resultSet.getString("experience") + "|" + resultSet.getString("status") + "|" + resultSet.getString("rate_salary") + "/Hr^"; } else { resultString += resultSet.getString("name") + "|" + com.mss.msp.util.DateUtility.getInstance() .convertDateToViewInDashFormat(resultSet.getDate("created_date")) + "|" + decryptedSSN + "|" + resultSet.getString("email1") + "|" + resultSet.getString("consultant_skills") + "|" + resultSet.getString("experience") + "|" + resultSet.getString("phone1") + "|" + resultSet.getString("status") + "|" + resultSet.getString("rate_salary") + "/Hr^"; } } } else { resultString = "Name" + "|" + "E-Mail" + "|" + "Experience" + "|" + "Skill Set" + "|" + "Rate/Salary" + "|" + "Phone Number" + "|" + "Status" + "^"; while (resultSet.next()) { resultString += resultSet.getString("name") + "|" + resultSet.getString("email1") + "|" + resultSet.getString("experience") + "|" + resultSet.getString("consultant_skills") + "|" + resultSet.getString("rate_salary") + "|" + resultSet.getString("phone1") + "|" + resultSet.getString("cur_status") + "|" + "^"; } } } catch (SQLException ex) { ex.printStackTrace(); } finally { try { // resultSet Object Checking if it's null then close and set // null if (resultSet != null) { resultSet.close(); resultSet = null; } if (statement != null) { statement.close(); statement = null; } if (connection != null) { connection.close(); connection = null; } } catch (SQLException ex) { throw new ServiceLocatorException(ex); } } System.out.println( "********************DataSourceDataProvider :: getGridData Method End*********************"); return resultString; }
From source file:com.ibm.ioes.dao.ReportsDao_Usage.java
public ArrayList<CustomerBaseReportsDTO> viewCustomerBaseReport(CustomerBaseReportsDTO objDto) { // Nagarjuna String methodName = "viewCustomerBaseReport", className = this.getClass().getName(), msg = ""; boolean logToFile = true, logToConsole = true; //end Nagarjuna Connection connection = null; CallableStatement proc = null; ResultSet rs = null; int recordCount = 0; ArrayList<CustomerBaseReportsDTO> listSearchDetails = new ArrayList<CustomerBaseReportsDTO>(); CustomerBaseReportsDTO objReportsDto = null; Utility utility = new Utility(); Date tempDate = null;/*from w ww. ja v a 2s . c o m*/ try { connection = DbConnection.getReportsConnectionObject(); proc = connection.prepareCall(sqlGetCustomerbaseReport); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); if (objDto.getCrmAccountNoString() != null && !"".equals(objDto.getCrmAccountNoString())) { proc.setString(1, objDto.getCrmAccountNoString().trim()); } else { proc.setNull(1, java.sql.Types.VARCHAR); } PagingSorting pagingSorting = objDto.getPagingSorting(); pagingSorting.sync();// To calculate start index and Enc Index proc.setString(2, pagingSorting.getSortByColumn());// columnName proc.setString(3, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order proc.setInt(4, pagingSorting.getStartRecordId());// start index proc.setInt(5, pagingSorting.getEndRecordId());// end index proc.setInt(6, (pagingSorting.isPagingToBeDone() ? 1 : 0)); if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) { SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); Date dateStr = formatter.parse(objDto.getFromDate()); String formattedDate = formatter.format(dateStr); Date date1 = formatter.parse(formattedDate); formatter = new SimpleDateFormat("MM-dd-yyyy"); formattedDate = formatter.format(date1); proc.setString(7, formattedDate); } else { proc.setNull(7, java.sql.Types.VARCHAR); } if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) { SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy"); Date dateStr1 = formatter1.parse(objDto.getToDate()); String formattedDate1 = formatter1.format(dateStr1); Date date2 = formatter1.parse(formattedDate1); formatter1 = new SimpleDateFormat("MM-dd-yyyy"); formattedDate1 = formatter1.format(date2); proc.setString(8, formattedDate1); } else { proc.setNull(8, java.sql.Types.VARCHAR); } rs = proc.executeQuery(); while (rs.next()) { objReportsDto = new CustomerBaseReportsDTO(); replaceSeperator("BILLING_LOCATION", rs.getString("BILLING_ADDRESS")); objReportsDto.setFxSiId(rs.getString("FX_SI_ID")); objReportsDto.setFx_external_acc_id(rs.getString("FX_ACCOUNT_EXTERNAL_ID")); tempDate = rs.getDate("SERVICEACTIVEDT"); if (tempDate != null) { objReportsDto.setActiveDate(utility.showDate_Report(tempDate).toUpperCase()); } objReportsDto.setInActiveDate(rs.getString("DISCONNECTION_DATE")); if (!(rs.getString("DISCONNECTION_DATE") == null || rs.getString("DISCONNECTION_DATE") == "")) { objReportsDto.setInActiveDate( (utility.showDate_Report(new Date(rs.getTimestamp("DISCONNECTION_DATE").getTime()))) .toUpperCase()); } objReportsDto.setOrderNo((rs.getString("ORDERNO"))); objReportsDto.setCrmACcountNO(rs.getString("CRMACCOUNTNO")); objReportsDto.setAccountno(rs.getString("INTERNAL_ID")); objReportsDto.setAccountSegment(rs.getString("ACCOUNT_SEGMENT")); objReportsDto.setParent_name(rs.getString("PARENT_ID")); objReportsDto.setBillingFormatName(VAR_BILL_FNAME); objReportsDto.setBillCompany(rs.getString("BILL_COMPANY")); objReportsDto.setBillingAddress(VAR_BILL_ADDRESS1); objReportsDto.setBilling_address2(VAR_BILL_ADDRESS2); objReportsDto.setBilling_address(VAR_BILL_ADDRESS3); objReportsDto.setBillCity(VAR_BCP_CITY_NAME); objReportsDto.setBillState(VAR_BCP_STATE_NAME); objReportsDto.setAccountManager(rs.getString("ACCOUNT_MANAGER_NAME")); objReportsDto.setAcmgrEmail(rs.getString("ACCOUNT_MANAGER_EMAILID")); objReportsDto.setAccountMgrPhoneNo(rs.getString("ACCOUNT_MANAGER_PHONENO")); objReportsDto.setContact1_Phone(VAR_BILL_PHONE); objReportsDto.setContact2_Phone(rs.getString("CONTACT2_PHONE")); objReportsDto.setBillZip(VAR_BCP_PIN); objReportsDto.setOrder_type(rs.getString("ORDER_TYPE")); objReportsDto.setContactName(VAR_BILL_CON_PER_NAME); objReportsDto.setContactPersonEmail(VAR_EMAIL_ID); objReportsDto.setChairPersonName(rs.getString("CHAIRPERSON_NAME")); objReportsDto.setChairPersonPhone(rs.getString("CHAIRPERSON_PHONE")); objReportsDto.setChairPersonEmail(rs.getString("CHAIRPERSON_EMAIL")); objReportsDto.setComponentName(rs.getString("COMPONENT_NAME")); objReportsDto.setComponentActiveDate(rs.getString("COMP_ACTIVE_DATE")); if (!(rs.getString("COMP_ACTIVE_DATE") == null || rs.getString("COMP_ACTIVE_DATE") == "")) { objReportsDto.setComponentActiveDate( (utility.showDate_Report(sdf.parse(rs.getString("COMP_ACTIVE_DATE")))).toUpperCase()); } objReportsDto.setBusinessSegment(rs.getString("BUSINESS_SEGMENT")); if ((rs.getString("CONFIG_ID")) != null && !"".equals(rs.getString("CONFIG_ID")) && (rs.getString("ENTITYID")) != null && !"".equals(rs.getString("ENTITYID"))) { String tBillPeriod = fnGetUsageReportBIllPeriod(rs.getString("CONFIG_ID"), rs.getString("ENTITYID")); objReportsDto.setBill_period(tBillPeriod); } objReportsDto.setFrequencyName(rs.getString("BILL_FREQUENCY")); objReportsDto.setProductName(rs.getString("PRODUCT")); if (pagingSorting.isPagingToBeDone()) { recordCount = rs.getInt("FULL_REC_COUNT"); } listSearchDetails.add(objReportsDto); } pagingSorting.setRecordCount(recordCount); } catch (Exception ex) { //ex.printStackTrace(); Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna } finally { try { DbConnection.closeResultset(rs); DbConnection.closeCallableStatement(proc); DbConnection.freeConnection(connection); } catch (Exception e) { // TODO Auto-generated catch block //e.printStackTrace(); Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna } } return listSearchDetails; }
From source file:com.ibm.ioes.dao.ReportsDao_Usage.java
public ArrayList<RestPendingLineReportDTO> viewRestPendingLineReport(RestPendingLineReportDTO objDto) { // Nagarjuna String methodName = "viewRestPendingLineReport", className = this.getClass().getName(), msg = ""; boolean logToFile = true, logToConsole = true; //end Nagarjuna Connection connection = null; CallableStatement proc = null; ResultSet rs = null; int recordCount = 0; ArrayList<RestPendingLineReportDTO> listSearchDetails = new ArrayList<RestPendingLineReportDTO>(); RestPendingLineReportDTO objReportsDto = null; Utility utility = new Utility(); DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Date tempDate = null;/*from w w w . j a v a 2 s. c o m*/ try { connection = DbConnection.getReportsConnectionObject(); proc = connection.prepareCall(sqlGetRestPendingLineReports); if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) { proc.setString(1, objDto.getFromDate().trim()); } else { proc.setNull(1, java.sql.Types.VARCHAR); } if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) { proc.setString(2, objDto.getToDate().trim()); } else { proc.setNull(2, java.sql.Types.VARCHAR); } if (objDto.getServiceName() != null && !"".equals(objDto.getServiceName())) { proc.setString(3, objDto.getServiceName().trim()); } else { proc.setNull(3, java.sql.Types.VARCHAR); } if (objDto.getSubChangeTypeName() != null && !"".equals(objDto.getSubChangeTypeName())) { proc.setString(4, objDto.getSubChangeTypeName().trim()); } else { proc.setNull(4, java.sql.Types.VARCHAR); } if (objDto.getVerticalDetails() != null && !"".equals(objDto.getVerticalDetails())) { proc.setString(5, objDto.getVerticalDetails().trim()); } else { proc.setNull(5, java.sql.Types.VARCHAR); } PagingSorting pagingSorting = objDto.getPagingSorting(); pagingSorting.sync();// To calculate start index and Enc Index proc.setString(6, pagingSorting.getSortByColumn());// columnName proc.setString(7, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order proc.setInt(8, pagingSorting.getStartRecordId());// start index proc.setInt(9, pagingSorting.getEndRecordId());// end index proc.setInt(10, (pagingSorting.isPagingToBeDone() ? 1 : 0)); // index proc.setInt(11, objDto.getIsUsage()); rs = proc.executeQuery(); while (rs.next()) { objReportsDto = new RestPendingLineReportDTO(); objReportsDto.setAccountID(rs.getInt("CUSTACCOUNTID")); objReportsDto.setPartyName(rs.getString("PARTYNAME")); objReportsDto.setPartyNo(rs.getInt("PARTY_NO")); objReportsDto.setOrderDate(rs.getString("ORDERDATE")); tempDate = rs.getDate("ORDERDATE"); objReportsDto.setOrderDate(rs.getString("ORDERDATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setOrderDate((utility.showDate_Report(tempDate)).toUpperCase()); } /* objReportsDto.setPoDate(rs.getString("PODATE")); if (rs.getString("PODATE") != null && !"".equals(rs.getString("PODATE"))) { Date date=df.parse(objReportsDto.getPoDate()); objReportsDto.setPoDate((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("PODATE"); objReportsDto.setPoDate(rs.getString("PODATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setPoDate((utility.showDate_Report(tempDate)).toUpperCase()); } /*objReportsDto.setCustPoDate(rs.getString("CUSTPODATE")); if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) { Date date=df.parse(objReportsDto.getCustPoDate()); objReportsDto.setCustPoDate((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("CUSTPODATE"); objReportsDto.setCustPoDate(rs.getString("CUSTPODATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setCustPoDate((utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setRate_code(rs.getString("RATECODE")); objReportsDto.setLast_mile_media(rs.getString("LAST_MILE_MEDIA")); objReportsDto.setLast_mile_remarks(rs.getString("LAST_MILE_REMARKS")); objReportsDto.setLink_type(rs.getString("LINK_TYPE")); objReportsDto.setIndicative_value(rs.getString("INDICATIVE_VALUE")); objReportsDto.setUom(rs.getString("UOM")); objReportsDto.setLast_mile_provider(rs.getString("LAST_MILE_PROVIDER")); objReportsDto.setBillingMode(rs.getString("BILLINGMODE")); objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER")); objReportsDto.setPoNumber(rs.getInt("PONUMBER")); //objReportsDto.setPrimarylocation(rs.getString("PRIMARYLOCATION")); setBlank(); replaceSeperator("PRIMARYLOCATION", rs.getString("PRIMARYLOCATION")); objReportsDto.setPrimarylocation(VAR_PRIMARYLOCATION); //objReportsDto.setSeclocation(rs.getString("SECONDARYLOCATION")); replaceSeperator("SECONDARYLOCATION", rs.getString("SECONDARYLOCATION")); objReportsDto.setSeclocation(VAR_SECONDARYLOCATION); /*objReportsDto.setRfs_date(rs.getString("SERVICE_RFS_DATE")); if (rs.getString("SERVICE_RFS_DATE") != null && !"".equals(rs.getString("SERVICE_RFS_DATE"))) { Date date=df.parse(objReportsDto.getRfs_date()); objReportsDto.setRfs_date((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("SERVICE_RFS_DATE"); objReportsDto.setRfs_date(rs.getString("SERVICE_RFS_DATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setRfs_date((utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setProductName(rs.getString("PRODUCTNAME")); objReportsDto.setSubProductName(rs.getString("SUBPRODUCTNAME")); objReportsDto.setMocn_no(rs.getString("MOCN_NO")); objReportsDto.setBillingLevelNo(rs.getLong("BILLING_LEVEL_NO")); objReportsDto.setLogicalCircuitId(rs.getString("CUSTOMER_LOGICAL_SI_NO")); objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO")); objReportsDto.setServiceName(rs.getString("SERVICENAME")); objReportsDto.setCkt_id(rs.getString("CKTID")); objReportsDto.setBillingLevel(rs.getString("BILLING_LEVELNAME")); objReportsDto.setDemoType(rs.getString("Demo_Type")); objReportsDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH")); objReportsDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM")); objReportsDto.setDistance(rs.getString("DISTANCE")); objReportsDto.setStageName(rs.getString("ORDERSTAGE")); objReportsDto.setOrder_type(rs.getString("ORDERTYPE")); objReportsDto.setOrdersubtype(rs.getString("ORDERSUBTYPE")); objReportsDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS")); objReportsDto.setCurrencyName(rs.getString("CURRENCYNAME")); objReportsDto.setEntity(rs.getString("ENTITYNAME")); objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME")); objReportsDto.setBillingFormatName(rs.getString("BILLING_FORMATNAME")); objReportsDto.setLcompanyname(rs.getString("LCOMPANYNAME")); objReportsDto.setTaxation(rs.getString("TAXATIONVALUE")); objReportsDto.setOrderNumber(rs.getInt("ORDERNO")); objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD")); objReportsDto.setTotalAmountIncludingCurrent(rs.getDouble("TOTALPOAMOUNT")); objReportsDto.setParty_id(rs.getInt("PARTY_ID")); objReportsDto.setCrmAccountNo(rs.getInt("CRMACCOUNTNO")); objReportsDto.setM6cktid(rs.getString("M6_PRODUCT_ID")); objReportsDto.setCust_total_poamt(rs.getDouble("CUST_TOT_PO_AMT")); if (objDto.getIsUsage() == 1) { objReportsDto.setCancelBy(rs.getString("CANCEL_BY")); //objReportsDto.setCanceldate(rs.getString("CANCELDATE")); tempDate = rs.getDate("CANCEL_DATE"); if (tempDate != null) { objReportsDto.setCanceldate((Utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setCreditPeriodName(rs.getString("CREDIT_PERIODNAME")); objReportsDto.setM6_prod_id(rs.getString("CHILDSPECID")); objReportsDto.setServiceId(rs.getInt("SERVICE_NO")); objReportsDto.setServiceproductid(rs.getInt("Order_Line_Id")); objReportsDto.setLinename(rs.getString("SERVICEDETDESCRIPTION")); objReportsDto.setCancelServiceReason(rs.getString("CANCEL_RESION")); ComponentsDto dto = new ComponentsDto(); objReportsDto.setRegionName(rs.getString("REGION")); objReportsDto.setAccountManager(rs.getString("ACCOUNTMANAGER")); objReportsDto.setProjectManager(rs.getString("PROJECTMANAGER")); objReportsDto.setCopcapprovaldate(rs.getString("COPC_APPROVED_DATE")); if (rs.getString("COPC_APPROVED_DATE") != null && !"".equals(rs.getString("COPC_APPROVED_DATE"))) { objReportsDto.setCopcapprovaldate( (Utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVED_DATE").getTime()))) .toUpperCase()); } /*objReportsDto.setPoReceiveDate(rs.getString("PORECEIVEDATE")); if (rs.getString("PORECEIVEDATE") != null && !"".equals(rs.getString("PORECEIVEDATE"))) { Date date=df.parse(objReportsDto.getPoReceiveDate()); objReportsDto.setPoReceiveDate((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("PORECEIVEDATE"); objReportsDto.setPoReceiveDate(rs.getString("PORECEIVEDATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setPoReceiveDate((utility.showDate_Report(tempDate)).toUpperCase()); } //objReportsDto.setBilling_address(rs.getString("BILLING_ADDRESS")); replaceSeperator("BILLING_LOCATION", rs.getString("BILLING_ADDRESS")); objReportsDto.setBilling_address(VAR_BILLING_ADDRESS); objReportsDto.setLineno(rs.getInt("Order_Line_Id")); objReportsDto.setLocation_from(rs.getString("FROM_ADDRESS")); objReportsDto.setLocation_to(rs.getString("TO_ADDRESS")); objReportsDto.setServiceStage(rs.getString("SERVICE_STAGE")); objReportsDto.setChild_act_no(rs.getString("Child_Account_Number")); objReportsDto.setCrm_productname(rs.getString("SERVICEDETDESCRIPTION")); objReportsDto.setComponentInfoID(rs.getInt("COMPONENTINFOID")); dto.setComponentStatus(rs.getString("COMPONENT_STATUS")); objReportsDto.setComponentID(rs.getInt("COMPONENT_ID")); objReportsDto.setComponentName(rs.getString("COMPONENT_NAME")); objReportsDto.setPackageID(rs.getInt("PACKAGE_ID")); objReportsDto.setPackageName(rs.getString("PACKAGE_NAME")); objReportsDto.setFx_internal_acc_id(rs.getLong("INTERNAL_ID")); dto.setComponentInstanceID(rs.getString("COMPONENT_INST_ID")); dto.setComponentType(rs.getString("COMPONENT_TYPE")); dto.setComponentAmount(rs.getDouble("COMP_AMOUNT")); dto.setFxTokenNo(rs.getString("START_COMPONENT_TOKEN_NO")); dto.setStartDate(rs.getString("SYSTEM_START_DATE")); if (rs.getString("SYSTEM_START_DATE") != null && !"".equalsIgnoreCase(rs.getString("SYSTEM_START_DATE"))) { Date date = df.parse(dto.getStartDate()); dto.setStartDate((Utility.showDate_Report(date)).toUpperCase()); } dto.setFxStartStatus(rs.getString("SYSTEM_START_STATUS")); dto.setEndFxStatus(rs.getString("SYSTEM_END_STATUS")); //dto.setComponentFXStatus(rs.getString("FX_STATUS")); // <!--GlobalDataBillingEfficiency BFR5 --> objReportsDto.setTaxExcemption_Reason(rs.getString("TAXEXCEMPTION_REASON")); objReportsDto.setComponentDto(dto); } else { objReportsDto.setCreditPeriod(rs.getInt("CREDITPERIOD")); objReportsDto.setLb_service_id(rs.getString("LB_SERVICE_LIST_ID")); objReportsDto.setServiceproductid(rs.getInt("SERVICEPRODUCTID")); objReportsDto.setServiceId(rs.getInt("SERVICEID")); objReportsDto.setPoAmountSum(rs.getLong("ORDERAMOUNT")); objReportsDto.setRegionName(rs.getString("REGIONNAME")); objReportsDto.setCancelServiceReason(rs.getString("CANCELREASON")); objReportsDto.setChild_act_no(rs.getString("CHILD_AC_NO")); objReportsDto.setBisource(rs.getString("BISOURCE")); objReportsDto.setServiceStage(rs.getString("SERVICESTAGE")); objReportsDto.setLocation_from(rs.getString("FROM_LOCATION")); objReportsDto.setLocation_to(rs.getString("TO_LOCATION")); objReportsDto.setLinename(rs.getString("LINENAME")); objReportsDto.setCrm_productname(rs.getString("CRMPRODUCTNAME")); objReportsDto.setAccountID(rs.getInt("CUSTACCOUNTID")); objReportsDto.setAccountManager(rs.getString("ACTMNAME")); objReportsDto.setProjectManager(rs.getString("PMNAME")); objReportsDto.setAmapprovaldate(rs.getString("AM_APPROVAL_DATE")); if (rs.getString("AM_APPROVAL_DATE") != null && !"".equals(rs.getString("AM_APPROVAL_DATE"))) { objReportsDto.setAmapprovaldate( (Utility.showDate_Report(new Date(rs.getTimestamp("AM_APPROVAL_DATE").getTime()))) .toUpperCase()); } objReportsDto.setPmapprovaldate(rs.getString("PM_APPROVAL_DATE")); if (rs.getString("PM_APPROVAL_DATE") != null && !"".equals(rs.getString("PM_APPROVAL_DATE"))) { objReportsDto.setPmapprovaldate( (Utility.showDate_Report(new Date(rs.getTimestamp("PM_APPROVAL_DATE").getTime()))) .toUpperCase()); } objReportsDto.setCopcapprovaldate(rs.getString("COPC_APPROVAL_DATE")); if (rs.getString("COPC_APPROVAL_DATE") != null && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) { objReportsDto.setCopcApproveDate( (Utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime()))) .toUpperCase()); } objReportsDto.setOrderDate(rs.getString("ORDERCREATEDATE")); if (rs.getString("ORDERCREATEDATE") != null && !"".equals(rs.getString("ORDERCREATEDATE"))) { Date date = df.parse(objReportsDto.getOrderDate()); objReportsDto.setOrderDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setPoReceiveDate(rs.getString("CUSTPORECDATE")); if (rs.getString("CUSTPORECDATE") != null && !"".equals(rs.getString("CUSTPORECDATE"))) { Date date = df.parse(objReportsDto.getPoReceiveDate()); objReportsDto.setPoReceiveDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setChargeEndDate(rs.getString("CHARGE_START_DATE")); if (rs.getString("CHARGE_START_DATE") != null && !"".equals(rs.getString("CHARGE_START_DATE"))) { Date date = df.parse(objReportsDto.getChargeEndDate()); objReportsDto.setChargeEndDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setLineno(rs.getInt("LINEITEMNO")); objReportsDto.setOpms_act_id(rs.getString("OPMS_ACT_ID")); objReportsDto.setAddress1(rs.getString("ADDRESS")); objReportsDto.setCancelflag(rs.getString("CANCELBY")); objReportsDto.setBilling_address(rs.getString("BILLING_LOCATION")); objReportsDto.setCanceldate(rs.getString("CANCELDATE")); objReportsDto.setDispatchAddress1(rs.getString("DISPATCHADDRESS")); objReportsDto.setHardware_flag(rs.getString("HARDWARE_FLAG")); objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPEID")); objReportsDto.setCharge_status(rs.getString("CHARGES_STATUS")); objReportsDto.setFormAvailable(rs.getString("FORM_C_AVAILABLE")); objReportsDto.setChargeName(rs.getString("CHARGE_NAME")); objReportsDto.setFx_status(rs.getString("FX_STATUS")); objReportsDto.setFx_sd_status(rs.getString("Fx_St_Chg_Status")); objReportsDto.setFx_ed_status(rs.getString("Fx_Ed_Chg_Status")); objReportsDto.setChild_ac_fxstatus(rs.getString("Child_Account_FX_Sataus")); objReportsDto.setFrequencyName(rs.getString("FREQUENCY")); objReportsDto.setHardwaretypeName(rs.getString("HARDWARETYPENAME")); objReportsDto.setTokenno(rs.getString("TOKENNO")); objReportsDto.setSaleNature(rs.getString("SALENATURENAME")); objReportsDto.setSaleType(rs.getString("SALETYPENAME")); objReportsDto.setRatio(rs.getString("RATIO")); objReportsDto.setAnnitation(rs.getString("ANNOTATION")); objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE")); objReportsDto.setStorename(rs.getString("STORENAME")); objReportsDto.setBill_period(rs.getString("BILL_PERIOD")); if ((rs.getString("CONFIG_ID")) != null && !"".equals(rs.getString("CONFIG_ID")) && (rs.getString("ENTITYID")) != null && !"".equals(rs.getString("ENTITYID"))) { String tBillPeriod = fnGetUsageReportBIllPeriod(rs.getString("CONFIG_ID"), rs.getString("ENTITYID")); objReportsDto.setBill_period(tBillPeriod); } objReportsDto.setChargeAmount(rs.getDouble("INV_AMT")); objReportsDto.setLineamt(rs.getLong("LINEITEMAMOUNT")); objReportsDto.setBusiness_serial_no(rs.getString("BUSINESS_SERIAL_NO")); objReportsDto.setLb_pk_charge_id(rs.getString("LB_PK_CHARGE_ID")); objReportsDto.setChargeinfoID(rs.getString("PK_CHARGE_ID")); objReportsDto.setAnnual_rate(rs.getInt("ANNUAL_RATE")); // <!--GlobalDataBillingEfficiency BFR5 --> objReportsDto.setTaxExcemption_Reason(rs.getString("TAXEXCEMPTION_REASON")); } //[005] Start objReportsDto.setInstallationFromCity(rs.getString("INSTALLATION_FROM_CITY")); objReportsDto.setInstallationToCity(rs.getString("INSTALLATION_TO_CITY")); objReportsDto.setInstallationFromState(rs.getString("INSTALLATION_FROM_STATE")); objReportsDto.setInstallationToState(rs.getString("INSTALLATION_TO_STATE")); objReportsDto.setBillingContactName(rs.getString("BILLING_CONTACT_NAME")); objReportsDto.setBillingContactNumber(rs.getString("BILLING_CONTACT_NUMBER")); objReportsDto.setBillingEmailId(rs.getString("BILLING_EMAIL_ID")); //[005] End //[006] Start objReportsDto.setStandardReason(rs.getString("STANDARDREASON")); //[006] End if (pagingSorting.isPagingToBeDone()) { recordCount = rs.getInt("FULL_REC_COUNT"); } listSearchDetails.add(objReportsDto); } pagingSorting.setRecordCount(recordCount); } catch (Exception ex) { Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna //ex.printStackTrace(); } finally { try { DbConnection.closeResultset(rs); DbConnection.closeCallableStatement(proc); DbConnection.freeConnection(connection); } catch (Exception e) { // TODO Auto-generated catch block //e.printStackTrace(); Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna } } return listSearchDetails; }
From source file:com.ibm.ioes.dao.ReportsDao_Usage.java
public ArrayList<StartChargeNotPushedInFXDTO> viewStartChargeNotPushedInFx(StartChargeNotPushedInFXDTO objDto) { //Nagarjuna//from w ww . j ava 2 s. co m String methodName = "viewStartChargeNotPushedInFx", className = this.getClass().getName(), msg = ""; boolean logToFile = true, logToConsole = true; //end Nagarjuna Connection connection = null; CallableStatement proc = null; ResultSet rs = null; ArrayList<StartChargeNotPushedInFXDTO> listSearchDetails = new ArrayList<StartChargeNotPushedInFXDTO>(); StartChargeNotPushedInFXDTO objReportsDto = null; int recordCount = 0; Utility utility = new Utility(); DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Date tempDate = null; Timestamp ts = null; try { connection = DbConnection.getReportsConnectionObject(); proc = connection.prepareCall(sqlGetStartChargeNotPushedInFx); if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) { proc.setString(1, objDto.getOrderType().trim()); } else { proc.setNull(1, java.sql.Types.VARCHAR); } if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) { proc.setString(2, objDto.getFromDate().trim()); } else { proc.setNull(2, java.sql.Types.VARCHAR); } if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) { proc.setString(3, objDto.getToDate().trim()); } else { proc.setNull(3, java.sql.Types.VARCHAR); } if (objDto.getFromOrderNo() != 0 && !"".equals(objDto.getFromOrderNo())) { proc.setInt(4, objDto.getFromOrderNo()); } else { proc.setNull(4, java.sql.Types.BIGINT); } if (objDto.getToOrderNo() != 0 && !"".equals(objDto.getToOrderNo())) { proc.setInt(5, objDto.getToOrderNo()); } else { proc.setNull(5, java.sql.Types.BIGINT); } if (objDto.getVerticalDetails() != null && !"".equals(objDto.getVerticalDetails())) { proc.setString(6, objDto.getVerticalDetails().trim()); } else { proc.setNull(6, java.sql.Types.VARCHAR); } 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)); // index proc.setInt(12, objDto.getIsUsage()); rs = proc.executeQuery(); while (rs.next()) { objReportsDto = new StartChargeNotPushedInFXDTO(); objReportsDto.setLogicalSINumber(rs.getInt("LOGICAL_SI_NO")); objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO")); objReportsDto.setServiceName(rs.getString("SERVICENAME")); objReportsDto.setServiceDetDescription(rs.getString("SERVICEDETDESCRIPTION")); //objReportsDto.setContractStartDate(rs.getString("CONTRACTSTARTDATE")); tempDate = rs.getDate("CONTRACTSTARTDATE"); objReportsDto.setContractStartDate(rs.getString("CONTRACTSTARTDATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setContractStartDate((utility.showDate_Report(tempDate)).toUpperCase()); } //objReportsDto.setContractEndDate(rs.getString("CONTRACTENDDATE")); tempDate = rs.getDate("CONTRACTENDDATE"); objReportsDto.setContractEndDate(rs.getString("CONTRACTENDDATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setContractEndDate((utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setCrmAccountNoString(rs.getString("CRMACCOUNTNO")); objReportsDto.setCreditPeriodName(rs.getString("CREDITPERIOD")); objReportsDto.setCurrencyName(rs.getString("CURRENCYNAME")); objReportsDto.setEntity(rs.getString("ENTITYNAME")); objReportsDto.setBillingMode(rs.getString("BILLINGMODE")); objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME")); objReportsDto.setBillingFormatName(rs.getString("BILLING_FORMATNAME")); objReportsDto.setLcompanyname(rs.getString("LCOMPANYNAME")); objReportsDto.setTaxation(rs.getString("TAXATIONVALUE")); objReportsDto.setPenaltyClause(rs.getString("PENALTYCLAUSE")); objReportsDto.setBillingLevel(rs.getString("BILLINGLEVEL")); objReportsDto.setBillingLevelNo(rs.getLong("BILLING_LEVEL_NO")); objReportsDto.setBillingLevelName(rs.getString("BILLING_LEVELNAME")); //objReportsDto.setPrimaryLocation(rs.getString("PRIMARYLOCATION")); //objReportsDto.setSecondaryLocation(rs.getString("SECONDARYLOCATION")); setBlank(); replaceSeperator("PRIMARYLOCATION", rs.getString("PRIMARYLOCATION")); objReportsDto.setPrimaryLocation(VAR_PRIMARYLOCATION); replaceSeperator("SECONDARYLOCATION", rs.getString("SECONDARYLOCATION")); objReportsDto.setSecondaryLocation(VAR_SECONDARYLOCATION); objReportsDto.setPonum(rs.getLong("PONUMBER")); /*objReportsDto.setPoDate(rs.getString("PODATE")); if (rs.getString("PODATE") != null && !"".equals(rs.getString("PODATE"))) { Date date=df.parse(objReportsDto.getPoDate()); objReportsDto.setPoDate((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("PODATE"); objReportsDto.setPoDate(rs.getString("PODATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setPoDate((utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setParty_no(rs.getInt("Party_NO")); objReportsDto.setPartyName(rs.getString("PARTYNAME")); objReportsDto.setBilling_Trigger_Flag(rs.getString("Billing_Trigger_Flag")); objReportsDto.setLOC_Date(rs.getString("Pm_Prov_Date")); if (rs.getString("Pm_Prov_Date") != null && !"".equals(rs.getString("Pm_Prov_Date"))) { String s1 = rs.getString("Pm_Prov_Date"); String s3 = s1.substring(0, 7); String s4 = s1.substring(9, 11); String s5 = s3.concat(s4); objReportsDto.setPmApproveDate(s5); } objReportsDto.setLocDate(rs.getString("LOCDATE")); if (rs.getString("LOCDATE") != null && !"".equals(rs.getString("LOCDATE"))) { Date date = df.parse(objReportsDto.getLocDate()); objReportsDto.setLocDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setBillingTriggerDate(rs.getString("BILLINGTRIGGERDATE")); if (rs.getString("BILLINGTRIGGERDATE") != null && !"".equals(rs.getString("BILLINGTRIGGERDATE"))) { Date date = df.parse(objReportsDto.getBillingTriggerDate()); objReportsDto.setBillingTriggerDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setChallenno(rs.getString("CHALLEN_NO")); objReportsDto.setChallendate(rs.getString("CHALLEN_DATE")); if (rs.getString("CHALLEN_DATE") != null && !"".equals(rs.getString("CHALLEN_DATE"))) { //Date date=df.parse(objReportsDto.getChallendate()); objReportsDto.setChallendate(rs.getString("CHALLEN_DATE")); } objReportsDto.setFx_external_acc_id(rs.getString("Child_Account_Number")); objReportsDto.setChildAccountFXSataus(rs.getString("Child_Account_FX_Sataus")); /*objReportsDto.setOrderDate(rs.getString("ORDERDATE")); if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) { Date date=df.parse(objReportsDto.getOrderDate()); objReportsDto.setOrderDate((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("ORDERDATE"); objReportsDto.setOrderDate(rs.getString("ORDERDATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setOrderDate((utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setOrderApproveDate(rs.getString("ORDER_APPROVED_DATE"));//Copc date tempDate = rs.getDate("ORDER_APPROVED_DATE"); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setOrderApproveDate((utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setCopcApproveDate(rs.getString("COPC_APPROVED_DATE")); ts = rs.getTimestamp("COPC_APPROVED_DATE"); if (ts != null) { tempDate = new Date(ts.getTime()); objReportsDto.setCopcApproveDate((utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setOrderType(rs.getString("ORDERTYPE")); // --Order Type Id // --Service Order Type // ''SERVICE ORDER TYPE DESC'' AS SERVICE_ORDER_TYPE_DESC, // "TST3"."TASK_END_DATE" as "COPC_APPROVED_DATE", // --TPOSERVICEDETAILS.BILLINGTRIGGERDATE as BILLINGTRIGGER_CREATE_DATE, // --Cust Logical Si ( Duplicate column) // --Charge Type Id objReportsDto.setServiceStage(rs.getString("SERVICE_STAGE")); objReportsDto.setAccountManager(rs.getString("ACCOUNTMANAGER")); objReportsDto.setProjectManager(rs.getString("PROJECTMANAGER")); // --"TPOMASTER"."ORDERDATE" ORDERCREATION DATE /*objReportsDto.setRfsDate(rs.getString("SERVICE_RFS_DATE")); if (rs.getString("SERVICE_RFS_DATE") != null && !"".equals(rs.getString("SERVICE_RFS_DATE"))) { Date date=df.parse(objReportsDto.getRfsDate()); objReportsDto.setRfsDate((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("SERVICE_RFS_DATE"); objReportsDto.setRfsDate(rs.getString("SERVICE_RFS_DATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setRfsDate((utility.showDate_Report(tempDate)).toUpperCase()); } /*objReportsDto.setPoRecieveDate(rs.getString("PORECEIVEDATE")); if (rs.getString("PORECEIVEDATE") != null && !"".equals(rs.getString("PORECEIVEDATE"))) { Date date=df.parse(objReportsDto.getPoRecieveDate()); objReportsDto.setPoRecieveDate((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("PORECEIVEDATE"); objReportsDto.setPoRecieveDate(rs.getString("PORECEIVEDATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setPoRecieveDate((utility.showDate_Report(tempDate)).toUpperCase()); } //--Fx Status Ed objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER")); /*objReportsDto.setCustPoDate(rs.getString("CUSTPODATE")); if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) { Date date=df.parse(objReportsDto.getCustPoDate()); objReportsDto.setCustPoDate((Utility.showDate_Report(date)).toUpperCase()); }*/ tempDate = rs.getDate("CUSTPODATE"); objReportsDto.setCustPoDate(rs.getString("CUSTPODATE")); if (tempDate != null && !"".equals(tempDate)) { objReportsDto.setCustPoDate((utility.showDate_Report(tempDate)).toUpperCase()); } objReportsDto.setLOC_No(rs.getString("LOCNO")); //objReportsDto.setBillingAddress(rs.getString("BILLING_ADDRESS")); replaceSeperator("BILLING_LOCATION", rs.getString("BILLING_ADDRESS")); objReportsDto.setBillingAddress(VAR_BILLING_ADDRESS); objReportsDto.setFxSiId(rs.getString("FX_SI_ID")); objReportsDto.setCancelBy(rs.getString("CANCEL_BY")); objReportsDto.setCanceldate(rs.getString("CANCEL_DATE")); objReportsDto.setCancelReason(rs.getString("CANCEL_RESION")); objReportsDto.setOpms_Account_Id(rs.getString("Opms_Account_Id")); objReportsDto.setRegionName(rs.getString("REGION")); objReportsDto.setBandwaidth(rs.getString("BANDWIDTH")); objReportsDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS")); objReportsDto.setToLocation(rs.getString("FROM_ADDRESS")); objReportsDto.setFromLocation(rs.getString("TO_ADDRESS")); objReportsDto.setColl_Manager(rs.getString("COLL_MANAGER")); objReportsDto.setColl_Manager_Mail(rs.getString("COLL_MANAGER_MAIL")); objReportsDto.setColl_Manager_Phone(rs.getString("COLL_MANAGER_PHONE")); objReportsDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH")); objReportsDto.setOrder_type(rs.getString("DEMO_TYPE")); objReportsDto.setTotalPoAmt(rs.getString("TOTALPOAMOUNT")); //--CRM ORDER ID objReportsDto.setOrderNumber(rs.getInt("ORDERNO")); //--Charge Hdr Id objReportsDto.setOrderLineNumber(rs.getInt("Order_Line_Id")); objReportsDto.setServiceId(rs.getInt("SERVICE_NO")); // --Installment Rate //--Trai Rate //--Discount objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD")); objReportsDto.setCommitmentPeriod(rs.getInt("COMMITMENTPERIOD")); objReportsDto.setNoticePeriod(rs.getInt("NOTICEPERIOD")); //--Principal Amt // --Intrest Rate // --Period In Month objReportsDto.setPoAmount(rs.getString("CUST_TOT_PO_AMT")); // --party Id // --Cust Account id // --M6 Product Id // --M6 Order Id // --Ib Order Line Id // --Ib Service List Id // --Ib Pk Charges Id // --Fx Sno // --Fx Sno Ed // --Cust Tot Po Amt // --M6 Order No // --Business Serial No // --Bus Serial // --Advance // Meenakshi : Changes for Usage if (objDto.getIsUsage() == 1) { objReportsDto.setComponentInfoID(rs.getInt("COMPONENTINFOID")); objReportsDto.setComponentID(rs.getInt("COMPONENT_ID")); objReportsDto.setComponentName(rs.getString("COMPONENT_NAME")); objReportsDto.setPackageID(rs.getInt("PACKAGE_ID")); objReportsDto.setPackageName(rs.getString("PACKAGE_NAME")); objReportsDto.setCreditPeriodName(rs.getString("CREDIT_PERIODNAME")); objReportsDto.setServiceOrderType(rs.getString("SERVICE_ORDER_TYPE_DESC")); objReportsDto.setM6OrderNo(rs.getInt("M6ORDERNO")); objReportsDto.setCancelServiceReason(rs.getString("CANCEL_SERVICE_REASON")); objReportsDto.setCancelBy(rs.getString("CANCELBY")); objReportsDto.setCanceldate(rs.getString("CANCELDATE")); objReportsDto.setOrderStage(rs.getString("ORDERSTAGE")); ComponentsDto dto = new ComponentsDto(); dto.setComponentStatus(rs.getString("COMPONENT_STATUS")); dto.setStartLogic(rs.getString("COMPONENT_START_LOGIC")); dto.setStartDate(rs.getString("SYSTEM_START_DATE")); if (rs.getString("SYSTEM_START_DATE") != null && !"".equals(rs.getString("SYSTEM_START_DATE"))) { Date date = df.parse(dto.getStartDate()); dto.setStartDate((Utility.showDate_Report(date)).toUpperCase()); } dto.setEndLogic(rs.getString("COMPONENT_END_LOGIC")); dto.setEnd_date(rs.getString("SYSTEM_END_DATE")); if (rs.getString("SYSTEM_END_DATE") != null && !"".equals(rs.getString("SYSTEM_END_DATE"))) { Date date = df.parse(dto.getEnd_date()); dto.setEnd_date((Utility.showDate_Report(date)).toUpperCase()); } dto.setFxTokenNo(rs.getString("START_COMPONENT_TOKEN_NO")); dto.setFxStartStatus(rs.getString("SYSTEM_START_STATUS")); dto.setEndFxStatus(rs.getString("SYSTEM_END_STATUS")); dto.setEndTokenNo(rs.getString("END_COMPONENT_TOKEN_NO")); //dto.setComponentFXStatus(rs.getString("FX_STATUS")); objReportsDto.setStartDateDays(rs.getInt("COMP_START_DAYS")); objReportsDto.setStartDateMonth(rs.getInt("COMP_START_MONTHS")); objReportsDto.setEndDateDays(rs.getInt("COMP_END_DAYS")); objReportsDto.setEndDateMonth(rs.getInt("COMP_END_MONTHS")); objReportsDto.setSourcePartyID(rs.getLong("PARTY_ID")); objReportsDto.setAccountID(rs.getInt("CUSTACCOUNTID")); objReportsDto.setFx_internal_acc_id(rs.getLong("INTERNAL_ID")); dto.setComponentInstanceID(rs.getString("COMPONENT_INST_ID")); dto.setComponentType(rs.getString("COMPONENT_TYPE")); dto.setComponentAmount(rs.getDouble("COMP_AMOUNT")); ///dto.setEndTokenNo(rs.getString("")); //END_COMPONENT_TOKEN_NO objReportsDto.setComponentDto(dto); } else { objReportsDto.setOrderStage(rs.getString("STAGE")); objReportsDto.setTokenNoEd(rs.getString("CSTATE_END_DETAILS_FX_TOKEN_NO"));//--Token No Ed objReportsDto.setHardwareFlag(rs.getString("HARDWARE_FLAG")); objReportsDto.setWarrantyStartDate(rs.getString("WARRENTY_START_DATE")); if (rs.getString("WARRENTY_START_DATE") != null && !"".equals(rs.getString("WARRENTY_START_DATE"))) { Date date = df.parse(objReportsDto.getWarrantyStartDate()); objReportsDto.setWarrantyStartDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setWarrantyEndDate(rs.getString("WARRENTY_END_DATE")); if (rs.getString("WARRENTY_END_DATE") != null && !"".equals(rs.getString("WARRENTY_END_DATE"))) { Date date = df.parse(objReportsDto.getWarrantyEndDate()); objReportsDto.setWarrantyEndDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setExtSuportEndDate(rs.getString("EXT_SUPPORT_END_DATE")); if (rs.getString("EXT_SUPPORT_END_DATE") != null && !"".equals(rs.getString("EXT_SUPPORT_END_DATE"))) { Date date = df.parse(objReportsDto.getExtSuportEndDate()); objReportsDto.setExtSuportEndDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setFxStatus(rs.getString("CSTATE_START_DETAILS_FX_STATUS"));//FX_STATUS objReportsDto.setTokenNO(rs.getString("CSTATE_START_DETAILS_FX_TOKEN_NO"));//Token_No objReportsDto.setHardwaretypeName(rs.getString("HARDWARETYPENAME")); objReportsDto.setFormAvailable(rs.getString("FORM_C_AVAILABLE")); objReportsDto.setSaleNature(rs.getString("SALENATURE")); objReportsDto.setSaleType(rs.getString("SALETYPE")); objReportsDto.setDispatchAddressName(rs.getString("DISPATCHADDNAME")); objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE")); objReportsDto.setFrequencyName(rs.getString("FREQUENCY")); objReportsDto.setChargeName(rs.getString("CHARGE_NAME")); objReportsDto.setBillPeriod(rs.getString("BILL_PERIOD")); objReportsDto.setDnd_Dispatch_But_Not_Delivered(rs.getString("Dnd_Dispatch_But_Not_Delivered")); objReportsDto.setDnd_Dispatch_And_Delivered(rs.getString("Dnd_Dispatch_And_Delivered")); objReportsDto.setDnd_Disp_Del_Not_Installed(rs.getString("Ddni_Disp_Del_Not_Installed")); objReportsDto.setDnd_Disp_Delivered_Installed(rs.getString("Ddni_Disp_Delivered_Installed")); objReportsDto.setStartDateLogic(rs.getString("STARTDATELOGIC")); objReportsDto.setEndDateLogic(rs.getString("ENDDATELOGIC")); objReportsDto.setStartDate(rs.getString("START_DATE")); if (rs.getString("START_DATE") != null && !"".equals(rs.getString("START_DATE"))) { Date date = df.parse(objReportsDto.getStartDate()); objReportsDto.setStartDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setEndDate(rs.getString("END_DATE")); if (rs.getString("END_DATE") != null && !"".equals(rs.getString("END_DATE"))) { Date date = df.parse(objReportsDto.getEndDate()); objReportsDto.setEndDate((Utility.showDate_Report(date)).toUpperCase()); } objReportsDto.setChargeAnnotation(rs.getString("ANNOTATION")); objReportsDto.setFx_St_Chg_Status(rs.getString("CSTATE_FX_CHARGE_START_STATUS"));//Fx_St_Chg_Status objReportsDto.setFx_Ed_Chg_Status(rs.getString("CSTATE_FX_CHARGE_END_STATUS"));//Fx_Ed_Chg_Status objReportsDto.setCharge_status(rs.getString("CHARGES_STATUS")); objReportsDto.setChargeAmount_String(rs.getString("INV_AMT")); objReportsDto.setLineItemAmount(rs.getString("LINEITEMAMOUNT")); objReportsDto.setStartDateDays(rs.getInt("START_DATE_DAYS")); objReportsDto.setStartDateMonth(rs.getInt("START_DATE_MONTH")); objReportsDto.setEndDateDays(rs.getInt("END_DATE_DAYS")); objReportsDto.setEndDateMonth(rs.getInt("END_DATE_MONTH")); objReportsDto.setAnnual_rate(rs.getDouble("ANNUAL_RATE")); } /// End if (pagingSorting.isPagingToBeDone()) { recordCount = rs.getInt("FULL_REC_COUNT"); } listSearchDetails.add(objReportsDto); } pagingSorting.setRecordCount(recordCount); } catch (Exception ex) { //ex.printStackTrace(); Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna } finally { try { DbConnection.closeResultset(rs); DbConnection.closeCallableStatement(proc); DbConnection.freeConnection(connection); } catch (Exception e) { // TODO Auto-generated catch block //e.printStackTrace(); Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna } } return listSearchDetails; }
From source file:com.mss.msp.util.DataSourceDataProvider.java
/** * ***************************************************************************** * Date ://from ww w. j a v a 2 s . co m * * Author : ramakrishna<lankireddy@miraclesoft.com> * * ForUse : getMailIdsOfConAndEmp() method is used to * * ***************************************************************************** */ public void getMailIdsOfConAndEmp(RecruitmentAction recruitmentAction) { System.out.println( "********************DataSourceDataProvider :: getMailIdsOfConAndEmp Method Start*********************"); Connection connection = null; Statement statement = null; ResultSet resultSet = null; String queryString = ""; String resultString = ""; String resultStr = ""; try { queryString = "SELECT cd.job_title,CONCAT(c.first_name,'.',c.last_name)AS NAME,c.email1 AS conEmail," + "u.email1 AS empEmail,cd.consultant_skills,ct.scheduled_date,ct.scheduled_time," + "ct.forwarded_by,ar.req_name,ct.forwarded_to_name,ct.review_type,ct.interview_lacation,usr.email1 AS empEmail2 " + "FROM users c " + "LEFT OUTER JOIN con_techreview ct ON(ct.consultant_id=c.usr_id) " + "LEFT OUTER JOIN users u ON(u.usr_id=ct.forwarded_to) " + "LEFT OUTER JOIN users usr ON(usr.usr_id=ct.forwarded_to1)" + "LEFT OUTER JOIN usr_details cd ON(cd.usr_id=c.usr_id) " + "LEFT OUTER JOIN acc_requirements ar ON(ar.requirement_id=ct.req_id)" + "WHERE ct.consultant_id=" + recruitmentAction.getConsult_id() + " " + "AND ct.req_id=" + recruitmentAction.getRequirementId() + " " + "AND ct.review_type='" + recruitmentAction.getInterviewType() + "'"; System.out.println("getMailIdsOfConAndEmp :: query string ------>" + queryString); connection = ConnectionProvider.getInstance().getConnection(); statement = connection.createStatement(); resultSet = statement.executeQuery(queryString); while (resultSet.next()) { recruitmentAction.setEmpEmail2(resultSet.getString("empEmail2")); recruitmentAction.setInterviewType(resultSet.getString("review_type")); recruitmentAction.setInterviewLocation(resultSet.getString("interview_lacation")); recruitmentAction.setForwardedToName(resultSet.getString("forwarded_to_name")); recruitmentAction.setReqName(resultSet.getString("req_name")); recruitmentAction.setConsult_jobTitle(resultSet.getString("job_title")); recruitmentAction.setConsult_name(resultSet.getString("NAME")); recruitmentAction.setConEmail(resultSet.getString("conEmail")); recruitmentAction.setEmpEmail(resultSet.getString("empEmail")); recruitmentAction.setConSkills(resultSet.getString("consultant_skills")); if (resultSet.getDate("scheduled_date") != null) { recruitmentAction.setReviewDate(com.mss.msp.util.DateUtility.getInstance() .convertDateYMDtoMDY(resultSet.getString("scheduled_date"))); } else { recruitmentAction.setReviewDate(""); } recruitmentAction .setForwardedByName(this.getFnameandLnamebyStringId(resultSet.getString("forwarded_by"))); } if (null != resultString && resultString.length() > 0) { int endIndex = resultString.lastIndexOf(","); if (endIndex != -1) { resultStr = resultString.substring(0, endIndex); // not // forgot // to // put // check // if(endIndex // != // -1) } } } catch (Exception sqe) { sqe.printStackTrace(); } finally { try { if (resultSet != null) { resultSet.close(); resultSet = null; } if (statement != null) { statement.close(); statement = null; } if (connection != null) { connection.close(); connection = null; } } catch (SQLException sqle) { sqle.printStackTrace(); } } System.out.println( "********************DataSourceDataProvider :: getMailIdsOfConAndEmp Method End*********************"); }
From source file:com.l2jfree.gameserver.gameobjects.L2Player.java
private final void restoreCreationDate() { Connection con = null;// w w w. jav a 2s . c o m try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement(GET_CREATION_DATE); ps.setInt(1, getObjectId()); ResultSet rs = ps.executeQuery(); rs.next(); _lastClaim = rs.getInt("lastClaim"); _createdOn = Calendar.getInstance(); _createdOn.setTimeInMillis(rs.getDate("birthDate").getTime()); rs.close(); ps.close(); } catch (Exception e) { _log.error("Could not load character creation date!", e); _lastClaim = Calendar.getInstance().get(Calendar.YEAR); _createdOn = Calendar.getInstance(); } finally { L2DatabaseFactory.close(con); } }