private void insertPoint(Timestamp timestamp, Object value) throws Throwable { String sql = sourceGranularity == null ? " INSERT INTO point (\"metric_id\", \"timestamp\", \"value\") VALUES (?, ?, ?) " : " INSERT INTO point_" + sourceGranularity + " (\"metric_id\", \"timestamp\", \"value\", \"aggregation\") VALUES (?, ?, ?, ?) "; try (Connection connection = pugTSDB.getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(sql)) { statement.setInt(1, metric.getId()); statement.setTimestamp(2, timestamp); statement.setBytes(3, metric.valueToBytes(value)); if (sourceGranularity != null) { statement.setString(4, aggregation.getName()); } statement.execute(); } }
private static TransferTimingListingDTO recordToDto(Record16<Long, Integer, Integer, String, String, String, String, Integer, Integer, String, String, String, Byte, Timestamp, Timestamp, Long> r) { // You can do your mapping manually or use jooq methods like "into" etc return new TransferTimingListingDTO( r.get(TRANSFER_TIMING_FILE_TRANSITION_HISTORY_ID, Long.class), r.get("fileId", Long.class), r.get("atableId", Long.class), r.get("atableName", String.class), r.get(USER.USERNAME, String.class), r.get(FILE.CODE, String.class), r.get("fileTypeName", String.class), r.get(TRANSFER_TIMING_VISUAL_COUNT, Integer.class), r.get(TRANSFER_TIMING_SOMETHING_COUNT, Integer.class), r.get(field("fromStatus"), String.class), r.get(field("toStatus"), String.class), r.get(FILE_TRANSITION_HISTORY.LOCATION_IPV4, String.class), r.get(TRANSFER_TIMING_TRANSFER_STATUS, Boolean.class), // Set zone to specific one if you are not using UTC (you should) r.get(TRANSFER_TIMING_TRANSFER_STARTED_AT).toLocalDateTime().atZone(DATABASE_TIMEZONE), r.get(TRANSFER_TIMING_TRANSFER_ENDED_AT).toLocalDateTime().atZone(DATABASE_TIMEZONE), r.get(TRANSFER_TIMING_TRANSFER_TIME_SPENT_IN_SECONDS, Long.class) ); }
@Test public void testExecuteBatchFilter() throws Exception { truncateTable("product"); Timestamp currentDatetime = Timestamp.valueOf("2005-12-12 10:10:10.000000000"); List<String> log = TestAppender.getLogbackLogs(() -> { SqlContext ctx = agent.contextFrom("example/insert_product").setSqlId("333") .param("product_id", new BigDecimal(1)).param("product_name", "商品名1") .param("product_kana_name", "ショウヒンメイイチ").param("jan_code", "1234567890123") .param("product_description", "1番目の商品").param("ins_datetime", currentDatetime) .param("upd_datetime", currentDatetime).param("version_no", new BigDecimal(0)).addBatch() .param("product_id", new BigDecimal(2)).param("product_name", "商品名2") .param("product_kana_name", "ショウヒンメイニ").param("jan_code", "1234567890124") .param("product_description", "2番目の商品").param("ins_datetime", currentDatetime) .param("upd_datetime", currentDatetime).param("version_no", new BigDecimal(0)) .param("_userName", "testUserName").param("_funcId", "testFunction").addBatch(); agent.batch(ctx); }); assertThat(log, is(Files.readAllLines( Paths.get("src/test/resources/data/expected/DebugSqlFilter", "testExecuteBatchFilter.txt"), StandardCharsets.UTF_8))); }
/** * 删除资产名称 * @return */ public String delete() { Log.infoFileSync("====================开始调用删除资产名称信息方法delete()================"); try { assetnameService.delete(model.getAssetNameID()); tipMsg = "成功"; tipType = 0; } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getAssetNameID() + " 的资产名称异常", e); tipMsg = "失败"; tipType = 1; } model.getShowModel().setMsgTip(tipMsg); logService.create(new Logdetails(getUser(), "删除资产名称", model.getClientIp(), new Timestamp(System.currentTimeMillis()) , tipType, "删除资产名称ID为 "+ model.getAssetNameID() + " " + tipMsg + "!", "删除资产名称" + tipMsg)); Log.infoFileSync("====================结束调用删除资产名称信息方法delete()================"); return SUCCESS; }
/** * Initializes the default set of extractors * @return the defailt set of extractors */ private static Map<Class<?>,SQLExtractor> extractors() { if (!initialized) { extractorMap.put(boolean.class, new BooleanExtractor()); extractorMap.put(int.class, new IntegerExtractor()); extractorMap.put(long.class, new LongExtractor()); extractorMap.put(double.class, new DoubleExtractor()); extractorMap.put(Boolean.class, new BooleanExtractor()); extractorMap.put(Integer.class, new IntegerExtractor()); extractorMap.put(Long.class, new LongExtractor()); extractorMap.put(Double.class, new DoubleExtractor()); extractorMap.put(String.class, new StringExtractor()); extractorMap.put(java.util.Date.class, new DateExtractor()); extractorMap.put(java.sql.Date.class, new DateExtractor()); extractorMap.put(java.sql.Time.class, new TimeExtractor()); extractorMap.put(Timestamp.class, new TimestampExtractor()); extractorMap.put(LocalDate.class, new LocalDateExtractor()); extractorMap.put(LocalTime.class, new LocalTimeExtractor()); extractorMap.put(LocalDateTime.class, new LocalDateTimeExtractor()); initialized = true; } return extractorMap; }
/** * 删除单据 * @return */ public String delete() { Log.infoFileSync("====================开始调用删除单据信息方法delete()================"); try { depotHeadService.delete(model.getDepotHeadID()); tipMsg = "成功"; tipType = 0; } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getDepotHeadID() + " 的单据异常", e); tipMsg = "失败"; tipType = 1; } model.getShowModel().setMsgTip(tipMsg); logService.create(new Logdetails(getUser(), "删除单据", model.getClientIp(), new Timestamp(System.currentTimeMillis()) , tipType, "删除单据ID为 "+ model.getDepotHeadID() + " " + tipMsg + "!", "删除单据" + tipMsg)); Log.infoFileSync("====================结束调用删除单据信息方法delete()================"); return SUCCESS; }
@Override public void onCommand(User sender, MessageChannel channel, Message message, String[] args, Member member) { // Get the time since the message sent by the user was created. long pongTime = message.getCreationTime().until(ZonedDateTime.now(), ChronoUnit.MILLIS); channel.sendMessage("Pong! `" + pongTime + "ms`").queue(); try { SQLController.runSqlTask(conn -> { PreparedStatement statement = conn.prepareStatement("INSERT INTO pings (time_pinged, response_time) VALUES (?, ?)"); statement.setTimestamp(1, Timestamp.valueOf(LocalDateTime.now())); statement.setLong(2, pongTime); statement.execute(); }); } catch (SQLException e) { ExampleBot.LOGGER.error("There was an error inserting into the MySQL table.", e); } }
public void testAppendWithTimestamp() throws Exception { // Create a table with data in it; import it. // Then add more data, verify that only the incremental data is pulled. final String TABLE_NAME = "appendTimestamp"; Timestamp thePast = new Timestamp(System.currentTimeMillis() - 100); createTimestampTable(TABLE_NAME, 10, thePast); List<String> args = getArgListForTable(TABLE_NAME, false, false); args.add("--append"); createJob(TABLE_NAME, args); runJob(TABLE_NAME); assertDirOfNumbers(TABLE_NAME, 10); // Add some more rows. long importWasBefore = System.currentTimeMillis(); Thread.sleep(50); long rowsAddedTime = System.currentTimeMillis() - 5; assertTrue(rowsAddedTime > importWasBefore); assertTrue(rowsAddedTime < System.currentTimeMillis()); insertIdTimestampRows(TABLE_NAME, 10, 20, new Timestamp(rowsAddedTime)); // Import only those rows. runJob(TABLE_NAME); assertDirOfNumbers(TABLE_NAME, 20); }
/** * Tests fix for BUG#54095 - Unnecessary call in newSetTimestampInternal. * * This bug was fixed as a consequence of the patch for Bug#71084. * * @throws Exception * if the test fails. */ public void testBug54095() throws Exception { Connection testConn = getConnectionWithProps("useLegacyDatetimeCode=false"); Calendar testCal = Calendar.getInstance(); java.util.Date origDate = testCal.getTime(); PreparedStatement testPstmt = testConn.prepareStatement("SELECT ?"); testPstmt.setTimestamp(1, new Timestamp(0), testCal); assertEquals("Calendar object shouldn't have changed after PreparedStatement.setTimestamp().", origDate, testCal.getTime()); ResultSet testRs = testPstmt.executeQuery(); testRs.next(); assertEquals("Calendar object shouldn't have changed after PreparedStatement.executeQuery().", origDate, testCal.getTime()); testRs.getTimestamp(1, testCal); assertEquals("Calendar object shouldn't have changed after ResultSet.getTimestamp().", origDate, testCal.getTime()); testRs.close(); testPstmt.close(); testConn.close(); }
private static SurveyEntity buildSurvey(UserEntity owner, List<QuestionEntity> questionEntities) { SurveyEntity survey = new SurveyEntity(); survey.setName("Testundersøkelse"); survey.setCode("testabc"); survey.setId(1); survey.setDateCreated(new Timestamp(System.currentTimeMillis())); survey.setDeadline(new Timestamp(System.currentTimeMillis() + 36000)); survey.setQuestions(questionEntities); survey.setOwner(owner); for (QuestionEntity q : questionEntities) { q.setSurvey(survey); } return survey; }
@Override public Userlogin insertLogin(Userinfo userinfo) throws Exception{ String user_email = userinfo.getUser_email(); String user_password = userinfo.getUser_password(); Map userinfoMap = new HashMap<>(); userinfoMap.put("user_email", user_email); userinfoMap.put("user_password", user_password); List<Userinfo> loginUserInfo = userinfoDaoImpl.loginUserInfo(userinfoMap); //设置登陆的id long token_id = snowflakeIdUtil.nextId(); //放到数据库中 Userlogin userlogin = new Userlogin(); userlogin.setToken_id("#"+String.valueOf(token_id)); userlogin.setUser_id(loginUserInfo.get(0).getUser_id()); userlogin.setUser_login_time(String.valueOf( new Timestamp( (new Date()).getTime()) )); userloginDaoImpl.insertUserlogin(userlogin); userlogin.setToken_id(String.valueOf(token_id)); return userlogin; }
/** * 删除收支项目 * @return */ public String delete() { Log.infoFileSync("====================开始调用删除收支项目信息方法delete()================"); try { inOutItemService.delete(model.getInOutItemID()); tipMsg = "成功"; tipType = 0; } catch (DataAccessException e) { Log.errorFileSync(">>>>>>>>>>>删除ID为 " + model.getInOutItemID() + " 的收支项目异常", e); tipMsg = "失败"; tipType = 1; } model.getShowModel().setMsgTip(tipMsg); logService.create(new Logdetails(getUser(), "删除收支项目", model.getClientIp(), new Timestamp(System.currentTimeMillis()) , tipType, "删除收支项目ID为 "+ model.getInOutItemID() + ",名称为 " + model.getName() + tipMsg + "!", "删除收支项目" + tipMsg)); Log.infoFileSync("====================结束调用删除收支项目信息方法delete()================"); return SUCCESS; }
public EmailVerification calculateExpiryDate() { Calendar cal = Calendar.getInstance(); cal.setTime(new Timestamp(cal.getTime().getTime())); cal.add(Calendar.MINUTE, EXPIRATION); this.expiryDate = new Date(cal.getTime().getTime()); return this; }
public final Timestamp getCreated() { Connection con = DatabaseConnection.getConnection(); try { PreparedStatement ps; ps = con.prepareStatement("SELECT createdat FROM accounts WHERE id = ?"); ps.setInt(1, getAccID()); Timestamp ret; try (ResultSet rs = ps.executeQuery()) { if (!rs.next()) { rs.close(); ps.close(); return null; } ret = rs.getTimestamp("createdat"); } ps.close(); return ret; } catch (SQLException e) { throw new DatabaseException("error getting create", e); } }
private MetaWrapper buildMeta(MessageEntry msgEntry) { MetaWrapper metaWrapper = new MetaWrapper(); EntryHeader header = msgEntry.getEntryHeader(); RowData rowData = msgEntry.getMsgColumn().getRowDataLst().get(0); List<Column> columns = Support.getFinalColumns(header.getOperType(), rowData); for (Column column : columns) { MetaWrapper.MetaCell cell = new MetaWrapper.MetaCell(); cell.setColumnName(column.getName()); cell.setDataType(Support.getColumnType(column)); int[] ret = Support.getColumnLengthAndPrecision(column); cell.setDataLength(ret[0]); cell.setDataPrecision(ret[1]); cell.setDataScale(0); cell.setIsPk(column.getIsKey() ? "Y" : "N"); cell.setNullAble("N"); cell.setDdlTime(new Timestamp(header.getExecuteTime())); cell.setColumnId(column.getIndex()); cell.setInternalColumnId(column.getIndex()); cell.setHiddenColumn("NO"); cell.setVirtualColumn("NO"); metaWrapper.addMetaCell(cell); } return metaWrapper; }
@Override protected JournalExcelVO handleExportEcrfJournal(AuthenticationVO auth, Long trialId) throws Exception { JournalExcelWriter writer = new JournalExcelWriter(JournalModule.ECRF_JOURNAL, !CoreUtil.isPassDecryption()); Trial trial = CheckIDUtil.checkTrialId(trialId, this.getTrialDao()); writer.setTrial(this.getTrialDao().toTrialOutVO(trial)); Pattern ecrfJournalEntryTitleRegExp = Settings.getRegexp(SettingCodes.ECRF_JOURNAL_ENTRY_TITLE_REGEXP, Bundle.SETTINGS, DefaultSettings.ECRF_JOURNAL_ENTRY_TITLE_REGEXP); JournalEntryDao journalEntryDao = this.getJournalEntryDao(); Collection<JournalEntry> journalEntries = journalEntryDao.findEcrfJournal(trialId); ArrayList<JournalEntryOutVO> journalEntryVOs = new ArrayList<JournalEntryOutVO>(journalEntries.size()); Iterator<JournalEntry> journalEntriesIt = journalEntries.iterator(); while (journalEntriesIt.hasNext()) { JournalEntryOutVO journalEntryVO = journalEntryDao.toJournalEntryOutVO(journalEntriesIt.next()); if (journalEntryVO.isDecrypted() && (journalEntryVO.getInputField() != null || (journalEntryVO.getTrial() != null && ecrfJournalEntryTitleRegExp != null && ecrfJournalEntryTitleRegExp.matcher(journalEntryVO.getTitle()).find()))) { if (CommonUtil.HTML_SYSTEM_MESSAGES_COMMENTS) { journalEntryVO.setComment(diff_match_patch.prettyHtmlToUnicode(journalEntryVO.getComment())); } journalEntryVOs.add(journalEntryVO); } } writer.setVOs(journalEntryVOs); User modified = CoreUtil.getUser(); writer.getExcelVO().setRequestingUser(this.getUserDao().toUserOutVO(modified)); (new ExcelExporter(writer, writer)).write(); JournalExcelVO result = writer.getExcelVO(); Timestamp now = CommonUtil.dateToTimestamp(result.getContentTimestamp()); logSystemMessage(trial, writer.getTrial(), now, modified, SystemMessageCodes.ECRF_JOURNAL_EXPORTED, result, null, journalEntryDao); return result; }
@Test public void test11() { Timestamp ts1 = Timestamp.valueOf("1996-12-10 12:26:19.12"); Timestamp ts2 = Timestamp.valueOf("1996-12-10 12:26:19.12"); Timestamp ts3 = Timestamp.valueOf("1996-12-11 12:24:19.12"); assertTrue(ts1.equals(ts2) && ts2.equals(ts1), "Error ts1 != ts2"); assertFalse(ts1.equals(ts3) && ts3.equals(ts1), "Error ts1 == ts3"); }
private void saveProfile(ImmutableProfile profile) { try (Connection c = sql.getConnection()) { try (PreparedStatement ps = c.prepareStatement(replaceTableName(INSERT))) { ps.setString(1, UuidUtils.toString(profile.getUniqueId())); ps.setString(2, profile.getName().get()); ps.setTimestamp(3, new Timestamp(profile.getTimestamp())); ps.setString(4, profile.getName().get()); ps.setTimestamp(5, new Timestamp(profile.getTimestamp())); ps.execute(); } } catch (SQLException e) { e.printStackTrace(); } }
public Empenho(Fornecedor fornecedor, Timestamp emissao, String numero, String observacao, double valorTotal, ArrayList<EmpenhoItem> itens) { this.fornecedor = fornecedor; this.emissao = emissao; this.numero = numero; this.observacao = observacao; this.valorTotal = valorTotal; this.itens = itens; }
@Override public DBPixelPlacementUser map(int index, ResultSet r, StatementContext ctx) throws SQLException { Timestamp time = r.getTimestamp("time"); return new DBPixelPlacementUser( r.getInt("id"), r.getInt("x"), r.getInt("y"), r.getInt("color"), time == null ? 0 : time.getTime(), r.getString("users.username"), r.getInt("pixel_count"), r.getInt("pixel_count_alltime") ); }
@Override protected StaffStatusEntryOutVO handleAddStaffStatusEntry( AuthenticationVO auth, StaffStatusEntryInVO newStaffStatusEntry) throws Exception { checkStaffStatusEntryInput(newStaffStatusEntry); StaffStatusEntryDao statusEntryDao = this.getStaffStatusEntryDao(); StaffStatusEntry statusEntry = statusEntryDao.staffStatusEntryInVOToEntity(newStaffStatusEntry); Timestamp now = new Timestamp(System.currentTimeMillis()); User user = CoreUtil.getUser(); CoreUtil.modifyVersion(statusEntry, now, user); statusEntry = statusEntryDao.create(statusEntry); notifyStaffInactive(statusEntry, now); StaffStatusEntryOutVO result = statusEntryDao.toStaffStatusEntryOutVO(statusEntry); logSystemMessage(statusEntry.getStaff(), result.getStaff(), now, user, SystemMessageCodes.STAFF_STATUS_ENTRY_CREATED, result, null, this.getJournalEntryDao()); return result; }
private static void test_orderbooks_get_historical_data(String symbol_id, Timestamp time_start, Timestamp time_end, int limit) throws java_rest_coin_api.exception { java_rest_coin_api c = new java_rest_coin_api(KEY); System.out.println("Get historical orderbooks started"); java_rest_coin_api.orderbook[] result = c.orderbooks_get_historical_data(symbol_id, time_start, time_end, limit); if (result!=null) { for(java_rest_coin_api.orderbook o : result) System.out.println(orderbook_to_string(o)); } System.out.println("Get historical orderbooks finished"); System.out.println(); }
private static JournalEntry logSystemMessage(User user, InputFieldOutVO inputFieldVO, Timestamp now, User modified, String systemMessageCode, Object result, Object original, JournalEntryDao journalEntryDao) throws Exception { if (user == null) { return null; } return journalEntryDao.addSystemMessage(user, now, modified, systemMessageCode, new Object[] { CommonUtil.inputFieldOutVOToString(inputFieldVO) }, systemMessageCode, new Object[] { CoreUtil.getSystemMessageCommentContent(result, original, !CommonUtil.getUseJournalEncryption(JournalModule.USER_JOURNAL, null)) }); }
/** * @inheritDoc */ @Override protected Collection<DutyRosterTurn> handleFindByDepartmentCategoryCalendarInterval(Long staffDepartmentId, Long staffCategoryId, Boolean allocatable, String calendar, Timestamp from, Timestamp to) { Criteria dutyRosterCriteria = createDutyRosterTurnCriteria("dutyRosterTurn"); CriteriaUtil.applyClosedIntervalCriterion(dutyRosterCriteria, from, to, null); Criteria staffCriteria = null; if (staffDepartmentId != null) { staffCriteria = dutyRosterCriteria.createCriteria("staff", CriteriaSpecification.LEFT_JOIN); } else if (staffCategoryId != null || allocatable != null) { staffCriteria = dutyRosterCriteria.createCriteria("staff", CriteriaSpecification.INNER_JOIN); } if (staffDepartmentId != null || staffCategoryId != null || allocatable != null) { if (staffDepartmentId != null) { staffCriteria.add(Restrictions.or(Restrictions.isNull("dutyRosterTurn.staff"), Restrictions.eq("department.id", staffDepartmentId.longValue()))); } if (staffCategoryId != null) { staffCriteria.add(Restrictions.eq("category.id", staffCategoryId.longValue())); } if (allocatable != null) { staffCriteria.add(Restrictions.eq("allocatable", allocatable.booleanValue())); } } CategoryCriterion.apply(dutyRosterCriteria, new CategoryCriterion(calendar, "calendar", MatchMode.EXACT, EmptyPrefixModes.ALL_ROWS)); return dutyRosterCriteria.list(); }
/** * {@inheritDoc} */ @Override public DjRfcRelationAttributesRecord values(Long value1, Long value2, Integer value3, String value4, String value5, String value6, String value7, Timestamp value8) { value1(value1); value2(value2); value3(value3); value4(value4); value5(value5); value6(value6); value7(value7); value8(value8); return this; }
public static void insertEntidades(int numeroFila, int anio, int nivel, int entidad, String nombreEntidad, String abrevEntidad, String siglaEntidad, String base_legal, String mision, String politica, String objetivo, String diagnostico){ Connection conect=conectar(); String query = " insert into entidad (id, nombre, anho, nivel_id, abrev, sigla, fecha_creacion, base_legal, mision, politica, objetivo, diagnostico, version, numero_fila)" + " values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { Timestamp timestamp = new Timestamp(new Date().getTime()); PreparedStatement preparedStmt; preparedStmt = conect.prepareStatement(query); preparedStmt.setInt (1, entidad); preparedStmt.setString (2, nombreEntidad); preparedStmt.setInt (3, anio); preparedStmt.setInt (4, nivel); preparedStmt.setString(5, abrevEntidad); preparedStmt.setString (6, siglaEntidad); preparedStmt.setTimestamp (7, timestamp); preparedStmt.setString (8, base_legal); preparedStmt.setString (9, mision); preparedStmt.setString (10, politica); preparedStmt.setString (11, objetivo); preparedStmt.setString (12, diagnostico); preparedStmt.setInt (13, 50); preparedStmt.setInt (14, numeroFila); preparedStmt.execute(); conect.close(); } catch (SQLException e) {e.printStackTrace();} }
@Override public Timestamp getTimestampFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs) throws SQLException { if (isNull(columnIndex)) { return null; } findAndSeekToOffset(columnIndex); long length = this.rowFromServer.readFieldLength(); int offset = this.rowFromServer.getPosition(); return getTimestampFast(columnIndex, this.rowFromServer.getByteBuffer(), offset, (int) length, targetCalendar, tz, rollForward, conn, rs); }
public GardenStatus(Long id, Garden garden, int sunLight, int soilHumidity, int airHumidity, int airTemperature, Timestamp time) { super(); this.id = id; this.garden = garden; this.sunLight = sunLight; this.soilHumidity = soilHumidity; this.airHumidity = airHumidity; this.airTemperature = airTemperature; this.time = time; }
@Override protected InventoryStatusEntryOutVO handleAddInventoryStatusEntry(AuthenticationVO auth, InventoryStatusEntryInVO newInventoryStatusEntry) throws Exception { checkInventoryStatusEntryInput(newInventoryStatusEntry); InventoryStatusEntryDao statusEntryDao = this.getInventoryStatusEntryDao(); InventoryStatusEntry statusEntry = statusEntryDao.inventoryStatusEntryInVOToEntity(newInventoryStatusEntry); Timestamp now = new Timestamp(System.currentTimeMillis()); User user = CoreUtil.getUser(); CoreUtil.modifyVersion(statusEntry, now, user); statusEntry = statusEntryDao.create(statusEntry); notifyInventoryInactive(statusEntry, now); InventoryStatusEntryOutVO result = statusEntryDao.toInventoryStatusEntryOutVO(statusEntry); logSystemMessage(statusEntry.getInventory(), result.getInventory(), now, user, SystemMessageCodes.INVENTORY_STATUS_ENTRY_CREATED, result, null, this.getJournalEntryDao()); return result; }
/** * 把一个时间转换成timestamp格式(yyyy-MM-dd) * * @param str * @return */ public static Timestamp convertTimestamp(String str) { if (str == null || str.length() == 0) return null; try { return new Timestamp((new SimpleDateFormat("yyyy-MM-dd")).parse(str).getTime()); } catch (ParseException e) { e.printStackTrace(); return null; } }
/** * Setter for <code>kloopzcm.dj_releases.created</code>. */ public void setCreated(Timestamp value) { set(10, value); }
public void setTime(Timestamp time) { this.time = time; }
/** * {@inheritDoc} */ @Override public MdRelationAttributesRecord value10(Timestamp value) { setCreated(value); return this; }
public Timestamp get_time_coinapi() { return time_coinapi; }
public Transaction(final Address destAddress) { this(destAddress, new Timestamp(System.currentTimeMillis())); }
private void enrollParticipants(Map<String, Object> batch) { Util.DbInfo courseBatchDBInfo = Util.dbInfoMap.get(JsonKey.COURSE_BATCH_DB); Util.DbInfo courseEnrollmentdbInfo = Util.dbInfoMap.get(JsonKey.LEARNER_COURSE_DB); Map<String, String> additionalCourseInfo = (Map<String, String>) batch.get(JsonKey.COURSE_ADDITIONAL_INFO); Map<String, Boolean> participants = (Map<String, Boolean>) batch.get(JsonKey.PARTICIPANT); for (Map.Entry<String, Boolean> entry : participants.entrySet()) { if (!entry.getValue()) { Timestamp ts = new Timestamp(new Date().getTime()); Map<String, Object> userCourses = new HashMap<>(); userCourses.put(JsonKey.USER_ID, entry.getKey()); userCourses.put(JsonKey.BATCH_ID, batch.get(JsonKey.ID)); userCourses.put(JsonKey.COURSE_ID, batch.get(JsonKey.COURSE_ID)); userCourses.put(JsonKey.ID, generatePrimaryKey(userCourses)); userCourses.put(JsonKey.CONTENT_ID, batch.get(JsonKey.COURSE_ID)); userCourses.put(JsonKey.COURSE_ENROLL_DATE, ProjectUtil.getFormattedDate()); userCourses.put(JsonKey.ACTIVE, ProjectUtil.ActiveStatus.ACTIVE.getValue()); userCourses.put(JsonKey.STATUS, (int) batch.get(JsonKey.STATUS)); userCourses.put(JsonKey.DATE_TIME, ts); userCourses.put(JsonKey.COURSE_PROGRESS, 0); userCourses.put(JsonKey.COURSE_LOGO_URL, additionalCourseInfo.get(JsonKey.APP_ICON)); userCourses.put(JsonKey.COURSE_NAME, additionalCourseInfo.get(JsonKey.NAME)); userCourses.put(JsonKey.DESCRIPTION, additionalCourseInfo.get(JsonKey.DESCRIPTION)); if (ProjectUtil.isStringNullOREmpty(additionalCourseInfo.get(JsonKey.LEAF_NODE_COUNT))) { userCourses.put(JsonKey.LEAF_NODE_COUNT, additionalCourseInfo.get(JsonKey.LEAF_NODE_COUNT)); } try { cassandraOperation.insertRecord(courseEnrollmentdbInfo.getKeySpace(), courseEnrollmentdbInfo.getTableName(), userCourses); // TODO: for some reason, ES indexing is failing with Timestamp value. need to check and // correct it. userCourses.put(JsonKey.DATE_TIME, ProjectUtil.formatDate(ts)); insertDataToElastic(ProjectUtil.EsIndex.sunbird.getIndexName(), ProjectUtil.EsType.usercourses.getTypeName(), (String) batch.get(JsonKey.ID), userCourses); // update participant map value as true entry.setValue(true); } catch (Exception ex) { ProjectLogger.log("INSERT RECORD TO USER COURSES EXCEPTION ", ex); } } } ProjectLogger.log("Adding participants to user course table completed"); Map<String, Object> updatedBatch = new HashMap<>(); updatedBatch.put(JsonKey.ID, batch.get(JsonKey.ID)); updatedBatch.put(JsonKey.PARTICIPANT, participants); ProjectLogger.log("Updating participants to batch course table started"); cassandraOperation.updateRecord(courseBatchDBInfo.getKeySpace(), courseBatchDBInfo.getTableName(), updatedBatch); ProjectLogger.log("Updating participants to batch course table completed"); }
public Timestamp getTimestamp() { return new Timestamp(cal.getTimeInMillis()); }
public void setFoundDateTime(Timestamp foundDateTime) { this.foundDateTime = foundDateTime; }
@Override public Timestamp getTimestamp( int columnIndex ) throws SQLException { throwIfClosed(); return super.getTimestamp( columnIndex ); }