List of usage examples for java.sql Timestamp getTime
public long getTime()
From source file:com.flexive.core.storage.genericSQL.GenericEnvironmentLoader.java
/** * {@inheritDoc}/* www .j a v a 2 s . c o m*/ * @since 3.1.2 */ @Override public List<FxScriptSchedule> loadScriptSchedules(Connection con, FxEnvironmentImpl environment) throws FxLoadException { PreparedStatement ps = null; String sql; List<FxScriptSchedule> schedules = new ArrayList<FxScriptSchedule>(10); try { // 1 2 3 4 5 6 7 8 9 sql = "SELECT ID,SCRIPT,SNAME,ACTIVE,STARTTIME,ENDTIME,REPEATINTERVAL,REPEATTIMES,CRONSTRING FROM " + TBL_SCRIPT_SCHEDULES + " ORDER BY SCRIPT"; ps = con.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while (rs != null && rs.next()) { long id = rs.getLong(1); long scriptId = rs.getLong(2); String name = rs.getString(3); if (rs.wasNull()) name = ""; boolean active = rs.getBoolean(4); java.util.Date startTime = new java.util.Date(rs.getTimestamp(5).getTime()); Timestamp endts = rs.getTimestamp(6); final java.util.Date endTime; if (rs.wasNull()) endTime = null; else endTime = new java.util.Date(endts.getTime()); long repeatInterval = rs.getLong(7); int repeatTimes = rs.getInt(8); String cronString = rs.getString(9); if (rs.wasNull()) cronString = ""; schedules.add(new FxScriptSchedule(id, scriptId, name, active, startTime, endTime, repeatInterval, repeatTimes, cronString)); } } catch (SQLException exc) { throw new FxLoadException(LOG, exc, "ex.scripting.schedule.load.failed", -1, exc.getMessage()); } finally { Database.closeObjects(GenericEnvironmentLoader.class, null, ps); } return schedules; }
From source file:com.lineage.server.clientpackets.C_ItemUSe.java
/** * ??// ww w. j a va 2 s. c om * * @param */ public C_ItemUSe(final byte[] abyte0, final ClientThread client) throws Exception { // super(abyte0); // ? final L1PcInstance pc = client.getActiveChar(); // if (pc == null) { return; } // ?? if (pc.isGhost()) { return; } // ? if (pc.isDead()) { return; } // ?? if (pc.isTeleport()) { return; } // if (pc.isPrivateShop()) { return; } // ?? if (!pc.getMap().isUsableItem()) { pc.sendPackets(new S_ServerMessage(563)); // \f1 return; } // ??? if (pc.CanNotDoAnything()) { return; } // OBJID final int itemObjid = this.readD(); // ?? final L1ItemInstance useItem = pc.getInventory().getItem(itemObjid); // :? if (useItem == null) { return; } // :? if (useItem.getCount() <= 0) { pc.sendPackets(new S_ServerMessage(329, useItem.getLogName())); // \f1 // %0%o return; } // ?Class boolean isClass = false; final String className = useItem.getItem().getClassName(); // ? // Class?0 if (!className.equals("0")) { isClass = true; } // PC??0 if (pc.getCurrentHp() > 0) { int delay_id = 0; // ID if (useItem.getItem().getType2() == 0) { // ?? delay_id = ((L1EtcItem) useItem.getItem()).get_delayid(); // ?ID } if (delay_id != 0) { // if (pc.hasItemDelay(delay_id) == true) { return; } } final int min = useItem.getItem().getMinLevel(); // ??? final int max = useItem.getItem().getMaxLevel(); // ??? if ((min != 0) && (min > pc.getLevel())) { pc.sendPackets(new S_ServerMessage(318, String.valueOf(min))); // // %0??? return; } else if ((max != 0) && (max < pc.getLevel())) { pc.sendPackets(new S_PacketBox(S_PacketBox.MSG_LEVEL_OVER, max)); // // %d?? return; } // ? boolean isDelayEffect = false; if (useItem.getItem().getType2() == 0) { // ? (etcitem) final int delayEffect = ((L1EtcItem) useItem.getItem()).get_delayEffect(); // if (delayEffect > 0) { isDelayEffect = true; final Timestamp lastUsed = useItem.getLastUsed(); if (lastUsed != null) { final Calendar cal = Calendar.getInstance(); long UseTime = (cal.getTimeInMillis() - lastUsed.getTime()) / 1000; if (UseTime <= delayEffect) { // ? UseTime = (delayEffect - UseTime) / 60; // ? ( ?) final String UseTimeSurplus = useItem.getLogName() + " " + String.valueOf(UseTime); pc.sendPackets(new S_ServerMessage(1139, UseTimeSurplus)); // %0 return; } } } } // ?? final int use_type = useItem.getItem().getUseType(); switch (use_type) { case -14: // treasure_box (?) // ??ID final int item_Id = useItem.getItem().getItemId(); final L1TreasureBox box = L1TreasureBox.get(item_Id); if (box != null) { if (box.open(pc)) { final L1EtcItem temp = (L1EtcItem) useItem.getItem(); if (temp.get_delayEffect() > 0) { // ????? if (useItem.isStackable()) { if (useItem.getCount() > 1) { isDelayEffect = true; } pc.getInventory().removeItem(useItem.getId(), 1); } else { isDelayEffect = true; } } else { pc.getInventory().removeItem(useItem.getId(), 1); } } } break; case -13: // pc.getInventory().setArrow(useItem.getItem().getItemId()); pc.sendPackets(new S_ServerMessage(452, useItem.getLogName())); // %0%s break; case -12: // pc.getInventory().setSting(useItem.getItem().getItemId()); pc.sendPackets(new S_ServerMessage(452, useItem.getLogName())); // %0%s break; case -11: // 9()()(??)() if (pc.getInventory().consumeItem(41246, 300)) { final int itemId = useItem.getItem().getItemId(); MagicStone.get().useItem(pc, useItem, itemId, 0, 0, 0); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; case -10: // 1 ~ 4 ()()(??)() if (pc.getInventory().consumeItem(41246, 30)) { final int itemId = useItem.getItem().getItemId(); MagicStone.get().useItem(pc, useItem, itemId, 0, 0, 0); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; case -9: // 5 ~ 6()()(??)() if (pc.getInventory().consumeItem(41246, 60)) { final int itemId = useItem.getItem().getItemId(); MagicStone.get().useItem(pc, useItem, itemId, 0, 0, 0); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; case -8: // 7()()(??)() if (pc.getInventory().consumeItem(41246, 100)) { final int itemId = useItem.getItem().getItemId(); MagicStone.get().useItem(pc, useItem, itemId, 0, 0, 0); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; case -7: // 8()()(??)() if (pc.getInventory().consumeItem(41246, 200)) { final int itemId = useItem.getItem().getItemId(); MagicStone.get().useItem(pc, useItem, itemId, 0, 0, 0); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; case -6: // ? if (isClass) { final int[] newData = new int[2]; newData[0] = this.readC(); newData[1] = this.readC(); CiteItemClass.getInstance().item(newData, pc, useItem); } break; case -5: // ?? if (pc.hasSkillEffect(DECAY_POTION)) { pc.sendPackets(new S_ServerMessage(698)); // ?? return; } if (isClass) { CiteItemClass.getInstance().item(null, pc, useItem); } break; case -4: // (??) pc.sendPackets(new S_ServerMessage(74, useItem.getLogName())); // \f1%0%o // break; case -3: // ? case -2: // case -1: // ? case 0: // ? case 15: // ? case 13: // () case 32: // ?() case 34: // ?() case 36: // ?() if (isClass) { CiteItemClass.getInstance().item(null, pc, useItem); } break; case 1: // // ? if (pc.hasItemDelay(L1ItemDelay.WEAPON) == true) { return; } if (this.checkEquipped(pc, useItem)) { this.setEquippedWeapon(pc, useItem); } break; case 2: // case 18: // T? case 19: // case 20: // case 21: // ? case 22: // case 23: // case 24: // case 25: // case 37: // case 40: // case 43: // (?) case 44: // () case 45: // () // ? if (pc.hasItemDelay(L1ItemDelay.ARMOR) == true) { return; } if (this.checkEquipped(pc, useItem)) { this.setEquippedArmor(pc, useItem); } break; case 5: // ? (?/??)? / (?) case 17: // ? ? (?) if (isClass) { final int[] newData = new int[3]; newData[0] = this.readD(); // ?OBJID newData[1] = this.readH(); // X?? newData[2] = this.readH(); // Y?? CiteItemClass.getInstance().item(newData, pc, useItem); } break; case 6: // ? case 29: // ?(??) if (isClass) { final int[] newData = new int[2]; newData[1] = this.readH(); // ? / newData[0] = this.readD(); // ?OBJID CiteItemClass.getInstance().item(newData, pc, useItem); } break; case 7: // ? case 8: // ?? case 14: // ? (???) ?/// case 26: // ? case 27: // ? case 30: // ? (NPC?Ctrl ? XY??) / ? () case 46: // ?? if (isClass) { final int[] newData = new int[1]; newData[0] = this.readD(); // ?OBJID CiteItemClass.getInstance().item(newData, pc, useItem); } break; case 12: // case 31: // ? case 33: // ? case 35: // ? if (isClass) { final int[] newData = new int[1]; newData[0] = this.readH(); final String s = this.readS(); pc.setText(s); pc.setTextByte(this.readByte()); CiteItemClass.getInstance().item(newData, pc, useItem); } break; case 16: // ?? if (isClass) { final String cmd = this.readS(); pc.setText(cmd); // ?? CiteItemClass.getInstance().item(null, pc, useItem); } break; case 28: // ? if (isClass) { final int[] newData = new int[1]; newData[0] = this.readC(); CiteItemClass.getInstance().item(newData, pc, useItem); } break; case 42: // ? () if (isClass) { final int[] newData = new int[2]; newData[0] = this.readH(); // X?? newData[1] = this.readH(); // Y?? CiteItemClass.getInstance().item(newData, pc, useItem); } break; default: // _log.info("??: " + use_type); break; } // if (isDelayEffect) { final Timestamp ts = new Timestamp(System.currentTimeMillis()); useItem.setLastUsed(ts); // pc.getInventory().updateItem(useItem, L1PcInventory.COL_DELAY_EFFECT); pc.getInventory().saveItem(useItem, L1PcInventory.COL_DELAY_EFFECT); } try { L1ItemDelay.onItemUse(client, useItem); // } catch (final Exception e) { _log.error("?:" + useItem.getItemId(), e); } } }
From source file:org.eevolution.form.VCRP.java
public boolean checkResourceTypeAvailability(Timestamp dateTime, MResourceType t) { if (!t.isDateSlot()) { return true; }// www . j a v a 2 s . c om GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(dateTime.getTime()); boolean retValue = false; switch (gc.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: retValue = t.isOnSunday(); break; case Calendar.MONDAY: retValue = t.isOnMonday(); break; case Calendar.TUESDAY: retValue = t.isOnTuesday(); break; case Calendar.WEDNESDAY: retValue = t.isOnWednesday(); break; case Calendar.THURSDAY: retValue = t.isOnThursday(); break; case Calendar.FRIDAY: retValue = t.isOnFriday(); break; case Calendar.SATURDAY: retValue = t.isOnSaturday(); break; } return retValue; }
From source file:org.kuali.coeus.propdev.impl.core.ProposalDevelopmentViewHelperServiceImpl.java
public String getDateUploadedFormatted(Timestamp uploadDate) { if (uploadDate != null) { return getDateTimeService().toDateString(new Date(uploadDate.getTime())) + " " + getDateTimeService().toTimeString(new Time(uploadDate.getTime())); }// w w w. j a v a 2 s. c o m return StringUtils.EMPTY; }
From source file:se.technipelago.weather.chart.Generator.java
private XYDataset createHistoryDataset(final Date begin, final Date end, final String column, final String label) throws SQLException { final TimeSeriesCollection dataset = new TimeSeriesCollection(); PreparedStatement stmt = null; ResultSet result = null;// w w w . j a va 2 s . c om long spanDays = (end.getTime() - begin.getTime()) / 1000 / 60 / 60 / 24; try { final java.sql.Timestamp sqlBegin = new java.sql.Timestamp(begin.getTime()); final java.sql.Timestamp sqlEnd = new java.sql.Timestamp(end.getTime()); if (spanDays < 100) { stmt = conn.prepareStatement("SELECT ts, " + column + " FROM archive WHERE " + column + " IS NOT NULL AND ts BETWEEN ? AND ? ORDER BY ts"); } else if (spanDays < 1000) { stmt = conn.prepareStatement("SELECT date_format(ts, '%Y-%m-%d %H:00:00') AS day, AVG(" + column + ") AS value FROM archive WHERE " + column + " IS NOT NULL AND ts BETWEEN ? AND ? GROUP BY 1"); } else { stmt = conn.prepareStatement("SELECT date_format(ts, '%Y-%m-%d') AS day, AVG(" + column + ") AS value FROM archive WHERE " + column + " IS NOT NULL AND ts BETWEEN ? AND ? GROUP BY 1"); } stmt.setTimestamp(1, sqlBegin); stmt.setTimestamp(2, sqlEnd); result = stmt.executeQuery(); final TimeSeries s1 = new TimeSeries(label, FixedMillisecond.class); while (result.next()) { final java.sql.Timestamp ts = result.getTimestamp(1); final long timestamp = ts.getTime(); s1.add(new FixedMillisecond(timestamp), result.getFloat(2)); } dataset.addSeries(s1); } finally { if (result != null) { try { result.close(); } catch (SQLException e) { log.log(Level.SEVERE, "Failed to close ResultSet", e); } } if (stmt != null) { try { stmt.close(); } catch (SQLException ex) { log.log(Level.WARNING, "Failed to close select statement", ex); } } } return dataset; }
From source file:org.dcache.chimera.H2FsSqlDriver.java
@Override Stat createInode(String id, int type, int uid, int gid, int mode, int nlink, long size) { /* H2 uses weird names for the column with the auto-generated key, so we cannot use the code * in the base class./*from ww w . ja v a2 s .com*/ */ Timestamp now = new Timestamp(System.currentTimeMillis()); KeyHolder keyHolder = new GeneratedKeyHolder(); _jdbc.update(con -> { PreparedStatement ps = con.prepareStatement( "INSERT INTO t_inodes (ipnfsid,itype,imode,inlink,iuid,igid,isize,iio," + "ictime,iatime,imtime,icrtime,igeneration) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)", Statement.RETURN_GENERATED_KEYS); ps.setString(1, id); ps.setInt(2, type); ps.setInt(3, mode & UnixPermission.S_PERMS); ps.setInt(4, nlink); ps.setInt(5, uid); ps.setInt(6, gid); ps.setLong(7, size); ps.setInt(8, _ioMode); ps.setTimestamp(9, now); ps.setTimestamp(10, now); ps.setTimestamp(11, now); ps.setTimestamp(12, now); ps.setLong(13, 0); return ps; }, keyHolder); Stat stat = new Stat(); stat.setIno((Long) keyHolder.getKey()); stat.setId(id); stat.setCrTime(now.getTime()); stat.setGeneration(0); stat.setSize(size); stat.setATime(now.getTime()); stat.setCTime(now.getTime()); stat.setMTime(now.getTime()); stat.setUid(uid); stat.setGid(gid); stat.setMode(mode & UnixPermission.S_PERMS | type); stat.setNlink(nlink); stat.setDev(17); stat.setRdev(13); return stat; }
From source file:org.openehealth.coms.cc.web_frontend.consentcreator.service.Database.java
/** * Checks whether a password request exists for the given referer or not. * /*from ww w .j av a2s . c o m*/ * @param s * @param external * - if the request to view this data is internal this is false, * if true the request will be deleted if it is too old. * @return true if a valid request exists. Requests that have been stored * for more than three days become invalid. * */ public boolean existsPasswordRequest(String s, boolean external) { boolean exists = true; String sql = "SELECT * FROM passwordRequests WHERE refid = ?;"; Connection connection = null; PreparedStatement statement = null; ResultSet result = null; try { connection = conFact.getConnection(); statement = connection.prepareStatement(sql); statement.setString(1, s); result = statement.executeQuery(); if (!result.next()) { exists = false; } Timestamp stamp = result.getTimestamp(3); if (stamp.getTime() < new Timestamp(new Date().getTime()).getTime() - 3 * 24 * 3600000 && external) { removeRefID(s); throw new ServiceException("Referer abgelaufen"); } } catch (SQLException e) { exists = false; } finally { try { connection.close(); } catch (SQLException e) { Logger.getLogger(this.getClass()).error(e); } } return exists; }
From source file:org.opentaps.common.util.UtilCommon.java
/** * Gets the duration between two timestamps in localized format. * @param start a <code>Timestamp</code> value * @param end a <code>Timestamp</code> value * @param timeZone a <code>TimeZone</code> value * @param locale a <code>Locale</code> value * @return a <code>String</code> value *///from w ww . j a v a 2 s .com public static String getDuration(Timestamp start, Timestamp end, TimeZone timeZone, Locale locale) { Calendar cal = Calendar.getInstance(timeZone, locale); // set the time to the beginning of the day cal.setTime(UtilDateTime.getDayStart(start, timeZone, locale)); // the duration in milliseconds long duration = end.getTime() - start.getTime(); // compute number of full hours int hours = (int) (duration / 1000 / 60 / 60); // compute number of minutes int minutes = (int) ((duration / 1000 / 60) % 60); //TODO: oandreyev. Currently this way to make formated time is suitable but // algorithm should be refactored and based on applicable time format. return hours + ":" + (minutes < 10 ? "0" : "") + minutes; }
From source file:org.eevolution.form.VCRP.java
public CategoryDataset createWeightDataset(Timestamp start, MResource r) { GregorianCalendar gc1 = new GregorianCalendar(); gc1.setTimeInMillis(start.getTime()); gc1.clear(Calendar.MILLISECOND); gc1.clear(Calendar.SECOND);//from ww w . j ava2s . c o m gc1.clear(Calendar.MINUTE); gc1.clear(Calendar.HOUR_OF_DAY); String namecapacity = Msg.translate(Env.getCtx(), "Capacity"); String nameload = Msg.translate(Env.getCtx(), "Load"); String namesummary = Msg.translate(Env.getCtx(), "Summary"); String namepossiblecapacity = "Possible Capacity"; MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); double currentweight = DB.getSQLValue(null, "Select SUM( (mo.qtyordered-mo.qtydelivered)*(Select mp.weight From m_product mp Where mo.m_product_id=mp.m_product_id ) )From mpc_order mo Where ad_client_id=?", r.getAD_Client_ID()); // fjviejo e-evolution machineqty capacidad por el numero de maquinas // double dailyCapacity = DB.getSQLValue(null,"Select dailycapacity From s_resource Where s_resource_id=?",r.getS_Resource_ID()); double dailyCapacity = DB.getSQLValue(null, "Select dailycapacity*MachineQty From s_resource Where s_resource_id=?", r.getS_Resource_ID()); System.out.println("***** Capacidad diaria " + dailyCapacity); // e-evolution end double utilization = DB.getSQLValue(null, "Select percentutillization From s_resource Where s_resource_id=?", r.getS_Resource_ID()); double summary = 0; int day = 0; /* * Vit4B Modificado para que tome 28 dias y * * */ while (day < 29) { day++; switch (gc1.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: if (t.isOnSunday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.MONDAY: if (t.isOnMonday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.TUESDAY: if (t.isOnTuesday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.WEDNESDAY: if (t.isOnWednesday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.THURSDAY: if (t.isOnThursday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.FRIDAY: if (t.isOnFriday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; case Calendar.SATURDAY: if (t.isOnSaturday()) { currentweight -= (dailyCapacity * utilization) / 100; summary += ((dailyCapacity * utilization) / 100); dataset.addValue(dailyCapacity, namepossiblecapacity, new Integer(day)); dataset.addValue((dailyCapacity * utilization) / 100, namecapacity, new Integer(day)); } else { dataset.addValue(0, namepossiblecapacity, new Integer(day)); dataset.addValue(0, namecapacity, new Integer(day)); } break; } dataset.addValue(currentweight, nameload, new Integer(day)); dataset.addValue(summary, namesummary, new Integer(day)); gc1.add(Calendar.DATE, 1); } return dataset; }
From source file:org.kuali.ole.sys.service.impl.GeneralLedgerPendingEntryServiceImpl.java
/** * Convenience method to build a GLPE without a generalLedgerPendingEntrySourceDetail * * @param document a GeneralLedgerPostingDocument * @param account the account for use in the GLPE * @param objectCode the object code for use in the GLPE * @param subAccountNumber the sub account number for use in the GLPE * @param subObjectCode the subobject code for use in the GLPE * @param organizationReferenceId the organization reference id to use in the GLPE * @param projectCode the project code to use in the GLPE * @param referenceNumber the reference number to use in the GLPE * @param referenceTypeCode the reference type code to use in the GLPE * @param referenceOriginCode the reference origin code to use in the GLPE * @param description the description to put in the GLPE * @param isDebit true if the GLPE represents a debit, false if it represents a credit * @param amount the amount of the GLPE/* ww w .ja va 2s .c o m*/ * @param sequenceHelper the sequence helper to use * @return a populated general ledger pending entry */ @Override public GeneralLedgerPendingEntry buildGeneralLedgerPendingEntry(GeneralLedgerPostingDocument document, Account account, ObjectCode objectCode, String subAccountNumber, String subObjectCode, String organizationReferenceId, String projectCode, String referenceNumber, String referenceTypeCode, String referenceOriginCode, String description, boolean isDebit, KualiDecimal amount, GeneralLedgerPendingEntrySequenceHelper sequenceHelper) { if (LOG.isDebugEnabled()) { LOG.debug( "populateExplicitGeneralLedgerPendingEntry(AccountingDocument, AccountingLine, GeneralLedgerPendingEntrySequenceHelper, GeneralLedgerPendingEntry) - start"); } GeneralLedgerPendingEntry explicitEntry = new GeneralLedgerPendingEntry(); explicitEntry.setFinancialDocumentTypeCode( document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName()); explicitEntry.setVersionNumber(new Long(1)); explicitEntry.setTransactionLedgerEntrySequenceNumber(new Integer(sequenceHelper.getSequenceCounter())); Timestamp transactionTimestamp = new Timestamp(dateTimeService.getCurrentDate().getTime()); explicitEntry.setTransactionDate(new java.sql.Date(transactionTimestamp.getTime())); explicitEntry.setTransactionEntryProcessedTs(transactionTimestamp); explicitEntry.setAccountNumber(account.getAccountNumber()); if (account.getAccountSufficientFundsCode() == null) { account.setAccountSufficientFundsCode(OLEConstants.SF_TYPE_NO_CHECKING); } // FIXME! - inject the sufficient funds service explicitEntry.setAcctSufficientFundsFinObjCd(SpringContext.getBean(SufficientFundsService.class) .getSufficientFundsObjectCode(objectCode, account.getAccountSufficientFundsCode())); explicitEntry.setFinancialDocumentApprovedCode(GENERAL_LEDGER_PENDING_ENTRY_CODE.NO); explicitEntry.setTransactionEncumbranceUpdateCode(BLANK_SPACE); explicitEntry.setFinancialBalanceTypeCode(BALANCE_TYPE_ACTUAL); // this is the default that most documents use explicitEntry.setChartOfAccountsCode(account.getChartOfAccountsCode()); explicitEntry .setTransactionDebitCreditCode(isDebit ? OLEConstants.GL_DEBIT_CODE : OLEConstants.GL_CREDIT_CODE); // FIXME! - Home origination service should be injected and the result cached - this value never changes explicitEntry.setFinancialSystemOriginationCode(SpringContext.getBean(HomeOriginationService.class) .getHomeOrigination().getFinSystemHomeOriginationCode()); explicitEntry.setDocumentNumber(document.getDocumentNumber()); explicitEntry.setFinancialObjectCode(objectCode.getFinancialObjectCode()); explicitEntry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode()); explicitEntry.setOrganizationDocumentNumber(document.getDocumentHeader().getOrganizationDocumentNumber()); explicitEntry.setOrganizationReferenceId(organizationReferenceId); explicitEntry.setProjectCode( getEntryValue(projectCode, GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankProjectCode())); explicitEntry.setReferenceFinancialDocumentNumber(getEntryValue(referenceNumber, BLANK_SPACE)); explicitEntry.setReferenceFinancialDocumentTypeCode(getEntryValue(referenceTypeCode, BLANK_SPACE)); explicitEntry.setReferenceFinancialSystemOriginationCode(getEntryValue(referenceOriginCode, BLANK_SPACE)); explicitEntry.setSubAccountNumber( getEntryValue(subAccountNumber, GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber())); explicitEntry.setFinancialSubObjectCode( getEntryValue(subObjectCode, GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankFinancialSubObjectCode())); explicitEntry.setTransactionEntryOffsetIndicator(false); explicitEntry.setTransactionLedgerEntryAmount(amount); explicitEntry.setTransactionLedgerEntryDescription( getEntryValue(description, document.getDocumentHeader().getDocumentDescription())); explicitEntry.setUniversityFiscalPeriodCode(null); // null here, is assigned during batch or in specific document rule // classes explicitEntry.setUniversityFiscalYear(document.getPostingYear()); if (LOG.isDebugEnabled()) { LOG.debug( "populateExplicitGeneralLedgerPendingEntry(AccountingDocument, AccountingLine, GeneralLedgerPendingEntrySequenceHelper, GeneralLedgerPendingEntry) - end"); } return explicitEntry; }