List of usage examples for java.sql Timestamp getTime
public long getTime()
From source file:l1j.server.server.clientpackets.C_ItemUSe.java
/** * ??/* w w w . j ava2 s. c o m*/ * * @param */ public C_ItemUSe(final byte[] abyte0, final ClientThread client) throws Exception { // super(abyte0); // OBJID final int itemObjid = this.readD(); // ? 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; } // ?? 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 -10: // if (isClass) { ItemClass.getInstance().item(null, pc, useItem); } break; case -8: // ? if (isClass) { ItemClass.getInstance().item(null, pc, useItem); } break; case -7: // ? if (isClass) { final int[] newData = new int[2]; newData[0] = this.readC(); newData[1] = this.readC(); ItemClass.getInstance().item(newData, pc, useItem); } break; case -6: // if (isClass) { ItemClass.getInstance().item(null, pc, useItem); } break; case -5: // ? if (isClass) { ItemClass.getInstance().item(null, pc, useItem); } break; case -9: // ?? case -4: // ? (?) case -3: // ? (??) case -2: // ? (?) if (pc.hasSkillEffect(DECAY_POTION)) { pc.sendPackets(new S_ServerMessage(698)); // ?? return; } if (isClass) { ItemClass.getInstance().item(null, pc, useItem); } break; case -1: // (??) pc.sendPackets(new S_ServerMessage(74, useItem.getLogName())); // \f1%0%o break; case 0: // ? if (isClass) { ItemClass.getInstance().item(null, pc, useItem); } break; case 1: // // ? if (pc.hasItemDelay(L1ItemDelay.WEAPON) == true) { return; } if (pc.checkEquipped(useItem)) { pc.setEquippedWeapon(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 (pc.checkEquipped(useItem)) { pc.setEquippedArmor(useItem); } break; case 5: // ? (?/??)? / (?) if (isClass) { final int[] newData = new int[3]; newData[0] = this.readD(); // ?OBJID newData[1] = this.readH(); // X?? newData[2] = this.readH(); // Y?? ItemClass.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 ItemClass.getInstance().item(newData, pc, useItem); } break; case 7: // ? if (isClass) { final int[] newData = new int[1]; newData[0] = this.readD(); // ?OBJID ItemClass.getInstance().item(newData, pc, useItem); } break; case 8: // ?? if (isClass) { final int[] newData = new int[1]; newData[0] = this.readD(); // ?OBJID ItemClass.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(); pc.setText(this.readS()); pc.setTextByte(this.readByte()); ItemClass.getInstance().item(newData, pc, useItem); } break; case 13: // () case 32: // ?() case 34: // ?() case 36: // ?() if (isClass) { ItemClass.getInstance().item(null, pc, useItem); } break; case 14: // ? (???) ?/// if (isClass) { final int[] newData = new int[1]; newData[0] = this.readD(); // ?OBJID ItemClass.getInstance().item(newData, pc, useItem); } break; case 15:// ? if (isClass) { ItemClass.getInstance().item(null, pc, useItem); } break; case 16: // ?? // ?ID final int awakeSkillId = pc.getAwakeSkillId(); if ((awakeSkillId == AWAKEN_ANTHARAS) || (awakeSkillId == AWAKEN_FAFURION) || (awakeSkillId == AWAKEN_VALAKAS)) { pc.sendPackets(new S_ServerMessage(1384)); // ??? return; } if (isClass) { final String cmd = this.readS(); pc.setText(cmd); // ?? ItemClass.getInstance().item(null, pc, useItem); } break; 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?? ItemClass.getInstance().item(newData, pc, useItem); } break; case 26: // ? case 27: // ? case 46: // ?? if (isClass) { final int[] newData = new int[1]; newData[0] = this.readD(); // ?OBJID ItemClass.getInstance().item(newData, pc, useItem); } break; case 28: // ? if (isClass) { final int[] newData = new int[1]; newData[0] = this.readC(); ItemClass.getInstance().item(newData, pc, useItem); } break; case 30: // ? (NPC?Ctrl ? XY??) if (isClass) { final int obj = this.readD(); // ?OBJID final int[] newData = new int[] { obj }; ItemClass.getInstance().item(newData, pc, useItem); } break; case 42: // ? () if (isClass) { final int[] newData = new int[3]; newData[0] = this.readH(); // X?? newData[1] = this.readH(); // Y?? ItemClass.getInstance().item(newData, pc, useItem); } break; default: // _log.info("??: " + use_type); break; } // ?? (0:??1:?2:) final int item_type = useItem.getItem().getType2(); switch (item_type) { case 0: // ? (L1EtcItem) // ??ID final int itemId = useItem.getItem().getItemId(); // ?? final int etcitem_type = useItem.getItem().getType(); switch (etcitem_type) { case 0: // pc.getInventory().setArrow(useItem.getItem().getItemId()); pc.sendPackets(new S_ServerMessage(452, useItem.getLogName())); // %0%s break; case 15: // pc.getInventory().setSting(useItem.getItem().getItemId()); pc.sendPackets(new S_ServerMessage(452, useItem.getLogName())); // %0%s break; case 16: // treasure_box (?) final L1TreasureBox box = L1TreasureBox.get(itemId); 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; default: // // _log.info("??: " + use_type); break; } switch (itemId) { /* * case 40024: // ???? Potion.UseHeallingPotion(pc, UseItem, 55, 197); return; */ // 1 ~ 4 ()()(??)() case 47064: case 47065: case 47066: case 47067: case 47074: case 47075: case 47076: case 47077: case 47084: case 47085: case 47086: case 47087: case 47094: case 47095: case 47096: case 47097: if (pc.getInventory().consumeItem(41246, 30)) { Effect.useEffectItem(pc, useItem); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; // 5 ~ 6()()(??)() case 47068: case 47069: case 47078: case 47079: case 47088: case 47089: case 47098: case 47099: if (pc.getInventory().consumeItem(41246, 60)) { Effect.useEffectItem(pc, useItem); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; // 7()()(??)() case 47070: case 47080: case 47090: case 47100: if (pc.getInventory().consumeItem(41246, 100)) { Effect.useEffectItem(pc, useItem); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; // 8()()(??)() case 47071: case 47081: case 47091: case 47101: if (pc.getInventory().consumeItem(41246, 200)) { Effect.useEffectItem(pc, useItem); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; // 9()()(??)() case 47072: case 47082: case 47092: case 47102: if (pc.getInventory().consumeItem(41246, 300)) { Effect.useEffectItem(pc, useItem); } else { isDelayEffect = false; pc.sendPackets(new S_ServerMessage(337, "$5240")); // \f1%0?%s } break; case 40576: // ? if (!pc.isElf()) { pc.sendPackets(new S_ServerMessage(264)); // \f1?? } break; case 40577: // ? if (!pc.isWizard()) { pc.sendPackets(new S_ServerMessage(264)); // \f1?? } break; case 40578: // ? if (!pc.isKnight()) { pc.sendPackets(new S_ServerMessage(264)); // \f1?? } break; default: // final int locX = ((L1EtcItem) useItem.getItem()).get_locx(); final int locY = ((L1EtcItem) useItem.getItem()).get_locy(); final short mapId = ((L1EtcItem) useItem.getItem()).get_mapid(); // ???? if ((locX != 0) && (locY != 0)) { if (!((itemId >= 40289) && (itemId <= 40297))) { if (pc.getMap().isEscapable() || pc.isGm()) { L1Teleport.teleport(pc, locX, locY, mapId, pc.getHeading(), true); pc.getInventory().removeItem(useItem, 1); } else { pc.sendPackets(new S_ServerMessage(647)); // ?? } } } // _log.info("??: " + use_type); break; } 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:com.oltpbenchmark.benchmarks.seats.SEATSWorker.java
/** * Execute one of the FindFlight transactions * @param txn/*w ww. j av a 2 s . c o m*/ * @throws SQLException */ private boolean executeFindFlights(FindFlights proc) throws SQLException { long depart_airport_id; long arrive_airport_id; Timestamp start_date; Timestamp stop_date; // Select two random airport ids if (rng.nextInt(100) < SEATSConstants.PROB_FIND_FLIGHTS_RANDOM_AIRPORTS) { // Does it matter whether the one airport actually flies to the other one? depart_airport_id = this.profile.getRandomAirportId(); arrive_airport_id = this.profile.getRandomOtherAirport(depart_airport_id); // Select a random date from our upcoming dates start_date = this.profile.getRandomUpcomingDate(); stop_date = new Timestamp(start_date.getTime() + (SEATSConstants.MILLISECONDS_PER_DAY * 2)); } // Use an existing flight so that we guaranteed to get back results else { FlightId flight_id = this.profile.getRandomFlightId(); depart_airport_id = flight_id.getDepartAirportId(); arrive_airport_id = flight_id.getArriveAirportId(); Timestamp flightDate = flight_id.getDepartDate(this.profile.getFlightStartDate()); long range = Math.round(SEATSConstants.MILLISECONDS_PER_DAY * 0.5); start_date = new Timestamp(flightDate.getTime() - range); stop_date = new Timestamp(flightDate.getTime() + range); if (LOG.isDebugEnabled()) LOG.debug(String.format("Using %s as look up in %s: %d / %s", flight_id, proc, flight_id.encode(), flightDate)); } // If distance is greater than zero, then we will also get flights from nearby airports long distance = -1; if (rng.nextInt(100) < SEATSConstants.PROB_FIND_FLIGHTS_NEARBY_AIRPORT) { distance = SEATSConstants.DISTANCES[rng.nextInt(SEATSConstants.DISTANCES.length)]; } if (LOG.isTraceEnabled()) LOG.trace("Calling " + proc); List<Object[]> results = proc.run(conn, depart_airport_id, arrive_airport_id, start_date, stop_date, distance); conn.commit(); if (results.size() > 1) { // Convert the data into a FlightIds that other transactions can use int ctr = 0; for (Object row[] : results) { FlightId flight_id = new FlightId((Long) row[0]); assert (flight_id != null); boolean added = profile.addFlightId(flight_id); if (added) ctr++; } // WHILE if (LOG.isDebugEnabled()) LOG.debug(String.format("Added %d out of %d FlightIds to local cache", ctr, results.size())); } return (true); }
From source file:org.kuali.kfs.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/*w w w . j av a2s . 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(KFSConstants.SF_TYPE_NO_CHECKING); } // FIXME! - inject the sufficient funds service explicitEntry.setAcctSufficientFundsFinObjCd(getSufficientFundsService() .getSufficientFundsObjectCode(objectCode, account.getAccountSufficientFundsCode())); explicitEntry .setFinancialDocumentApprovedCode(KFSConstants.PENDING_ENTRY_APPROVED_STATUS_CODE.NOT_PROCESSED); explicitEntry.setTransactionEncumbranceUpdateCode(BLANK_SPACE); explicitEntry.setFinancialBalanceTypeCode(BALANCE_TYPE_ACTUAL); // this is the default that most documents use explicitEntry.setChartOfAccountsCode(account.getChartOfAccountsCode()); explicitEntry .setTransactionDebitCreditCode(isDebit ? KFSConstants.GL_DEBIT_CODE : KFSConstants.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; }
From source file:org.kuali.ole.sys.service.impl.GeneralLedgerPendingEntryServiceImpl.java
/** * This populates an empty GeneralLedgerPendingEntry explicitEntry object instance with default values. * * @param accountingDocument//from w ww. ja va 2 s . c om * @param accountingLine * @param sequenceHelper * @param explicitEntry */ @Override public void populateExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySource glpeSource, GeneralLedgerPendingEntrySourceDetail glpeSourceDetail, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, GeneralLedgerPendingEntry explicitEntry) { if (LOG.isDebugEnabled()) { LOG.debug( "populateExplicitGeneralLedgerPendingEntry(AccountingDocument, AccountingLine, GeneralLedgerPendingEntrySequenceHelper, GeneralLedgerPendingEntry) - start"); } explicitEntry.setFinancialDocumentTypeCode(glpeSource.getFinancialDocumentTypeCode()); 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(glpeSourceDetail.getAccountNumber()); // JHK: changing implementation to work around object refresh issues // if (ObjectUtils.isNull(glpeSourceDetail.getAccount()) && getPersistenceStructureService().hasReference(glpeSourceDetail.getClass(), OLEPropertyConstants.ACCOUNT)) { // glpeSourceDetail.refreshReferenceObject(OLEPropertyConstants.ACCOUNT); // } // // if ((ObjectUtils.isNull(glpeSourceDetail.getObjectCode()) || StringUtils.isBlank(glpeSourceDetail.getObjectCode().getFinancialObjectTypeCode())) && getPersistenceStructureService().hasReference(glpeSourceDetail.getClass(), OLEPropertyConstants.OBJECT_CODE)) { // glpeSourceDetail.refreshReferenceObject(OLEPropertyConstants.OBJECT_CODE); // } Account account = SpringContext.getBean(AccountService.class).getByPrimaryIdWithCaching( glpeSourceDetail.getChartOfAccountsCode(), glpeSourceDetail.getAccountNumber()); ObjectCode objectCode = SpringContext.getBean(ObjectCodeService.class).getByPrimaryIdWithCaching( glpeSource.getPostingYear(), glpeSourceDetail.getChartOfAccountsCode(), glpeSourceDetail.getFinancialObjectCode()); if (account != null) { if (LOG.isDebugEnabled()) { LOG.debug("GLPE: Testing to see what should be used for SF Object Code: " + glpeSourceDetail); } String sufficientFundsCode = account.getAccountSufficientFundsCode(); if (StringUtils.isBlank(sufficientFundsCode)) { sufficientFundsCode = OLEConstants.SF_TYPE_NO_CHECKING; if (LOG.isDebugEnabled()) { LOG.debug("Code was blank on the account - using 'N'"); } } if (objectCode != null) { if (LOG.isDebugEnabled()) { LOG.debug("SF Code / Object: " + sufficientFundsCode + " / " + objectCode); } String sifficientFundsObjectCode = SpringContext.getBean(SufficientFundsService.class) .getSufficientFundsObjectCode(objectCode, sufficientFundsCode); explicitEntry.setAcctSufficientFundsFinObjCd(sifficientFundsObjectCode); } else { LOG.debug("Object code object was null, skipping setting of SF object field."); } } if (objectCode != null) { explicitEntry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode()); } 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(glpeSourceDetail.getChartOfAccountsCode()); explicitEntry.setTransactionDebitCreditCode( glpeSource.isDebit(glpeSourceDetail) ? OLEConstants.GL_DEBIT_CODE : OLEConstants.GL_CREDIT_CODE); explicitEntry.setFinancialSystemOriginationCode(SpringContext.getBean(HomeOriginationService.class) .getHomeOrigination().getFinSystemHomeOriginationCode()); explicitEntry.setDocumentNumber(glpeSourceDetail.getDocumentNumber()); explicitEntry.setFinancialObjectCode(glpeSourceDetail.getFinancialObjectCode()); explicitEntry.setOrganizationDocumentNumber(glpeSource.getDocumentHeader().getOrganizationDocumentNumber()); explicitEntry.setOrganizationReferenceId(glpeSourceDetail.getOrganizationReferenceId()); explicitEntry.setProjectCode(getEntryValue(glpeSourceDetail.getProjectCode(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankProjectCode())); explicitEntry.setReferenceFinancialDocumentNumber( getEntryValue(glpeSourceDetail.getReferenceNumber(), BLANK_SPACE)); explicitEntry.setReferenceFinancialDocumentTypeCode( getEntryValue(glpeSourceDetail.getReferenceTypeCode(), BLANK_SPACE)); explicitEntry.setReferenceFinancialSystemOriginationCode( getEntryValue(glpeSourceDetail.getReferenceOriginCode(), BLANK_SPACE)); explicitEntry.setSubAccountNumber(getEntryValue(glpeSourceDetail.getSubAccountNumber(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber())); explicitEntry.setFinancialSubObjectCode(getEntryValue(glpeSourceDetail.getFinancialSubObjectCode(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankFinancialSubObjectCode())); explicitEntry.setTransactionEntryOffsetIndicator(false); explicitEntry.setTransactionLedgerEntryAmount( glpeSource.getGeneralLedgerPendingEntryAmountForDetail(glpeSourceDetail)); explicitEntry.setTransactionLedgerEntryDescription( getEntryValue(glpeSourceDetail.getFinancialDocumentLineDescription(), glpeSource.getDocumentHeader().getDocumentDescription())); explicitEntry.setUniversityFiscalPeriodCode(null); // null here, is assigned during batch or in specific document rule // classes explicitEntry.setUniversityFiscalYear(glpeSource.getPostingYear()); // TODO wait for core budget year data structures to be put in place // explicitEntry.setBudgetYear(accountingLine.getBudgetYear()); // explicitEntry.setBudgetYearFundingSourceCode(budgetYearFundingSourceCode); if (LOG.isDebugEnabled()) { LOG.debug( "populateExplicitGeneralLedgerPendingEntry(AccountingDocument, AccountingLine, GeneralLedgerPendingEntrySequenceHelper, GeneralLedgerPendingEntry) - end"); } }
From source file:com.collabnet.ccf.core.EntityService.java
/** * For a given source artifact id, source repository and the target * repository details, this method finds out the target artifact id mapped * to the source artifact id by looking up the identity mapping table. * //w ww . j a v a 2 s . c o m * If the source artifact id had ever passed through the wiring the identity * mapping will contain the corresponding target artifact id. This method * fetches the target artifact id and returns. If there is no target * artifact id mapped to this source artifact id this method return a null. * * The difference to the ordinary target lookup method is that this one does * not require the target repository id. This one is found out automatically * by querying the synchronization status table as well. * * @param sourceArtifactId * - The source artifact id that should be looked up for a target * artifact id * @param sourceSystemId * - The system id of the source repository * @param sourceRepositoryId * - The repository id of the source artifact * @param targetSystemId * - The system id of the target repository * @param artifactType * - The artifact type * * @return array with target artifactId, sourceArtifactLastModifiedDate, * sourceArtifactVersion, targetArtifactVersion (in this order) */ private Object[] lookupParentTargetArtifact(Element element, String sourceArtifactId, String sourceSystemId, String sourceRepositoryId, String targetSystemId, String artifactType) { IOrderedMap inputParameters = new OrderedHashMap(); inputParameters.add(sourceSystemId); inputParameters.add(sourceRepositoryId); inputParameters.add(targetSystemId); inputParameters.add(sourceArtifactId); inputParameters.add(artifactType); inputParameters.add(sourceSystemId); inputParameters.add(targetSystemId); inputParameters.add(sourceRepositoryId); Object[] resultSet = null; parentIdentityMappingDatabaseReader.connect(); resultSet = parentIdentityMappingDatabaseReader.next(inputParameters, 1000); Object[] results = null; if (resultSet == null || resultSet.length == 0) { log.debug(sourceArtifactId + "-" + sourceRepositoryId + "-" + sourceSystemId + "-" + "???" + "-" + targetSystemId + " are not mapped."); } else if (resultSet.length == 1) { if (resultSet[0] instanceof OrderedHashMap) { OrderedHashMap result = (OrderedHashMap) resultSet[0]; if (result.size() == 5) { results = new Object[5]; results[0] = result.get(0); Timestamp timeStamp = (Timestamp) result.get(1); Date date; if (timeStamp == null) { // use earliest date possible date = new Date(0); } else { date = new Date(timeStamp.getTime()); } results[1] = date; results[2] = result.get(2); results[3] = result.get(3); results[4] = result.get(4); } else { String cause = "Seems as if the SQL statement for parentIdentityMappingDatabase reader does not return 5 values."; XPathUtils.addAttribute(element, GenericArtifactHelper.ERROR_CODE, GenericArtifact.ERROR_INTERNAL_DATABASE_TABLE_CORRUPT); log.error(cause); throw new CCFRuntimeException(cause); } } else { String cause = "SQL query on identity mapping table did not return data in correct format!"; XPathUtils.addAttribute(element, GenericArtifactHelper.ERROR_CODE, GenericArtifact.ERROR_INTERNAL_DATABASE_TABLE_CORRUPT); log.error(cause); throw new CCFRuntimeException(cause); } } else { String cause = "There is more than one mapping for the combination " + sourceArtifactId + "-" + sourceRepositoryId + "-" + sourceSystemId + "-" + "???" + "-" + targetSystemId + " in the identity mapping table."; XPathUtils.addAttribute(element, GenericArtifactHelper.ERROR_CODE, GenericArtifact.ERROR_INTERNAL_DATABASE_TABLE_CORRUPT); log.error(cause); throw new CCFRuntimeException(cause); } return results; }
From source file:com.oltpbenchmark.benchmarks.auctionmark.AuctionMarkProfile.java
private Timestamp getScaledCurrentTimestamp(Timestamp time) { assert (this.clientStartTime != null); tmp_now.setTime(System.currentTimeMillis()); time.setTime(AuctionMarkUtil.getScaledTimestamp(this.loaderStartTime, this.clientStartTime, tmp_now)); if (LOG.isTraceEnabled()) LOG.trace(String.format("Scaled:%d / Now:%d / BenchmarkStart:%d / ClientStart:%d", time.getTime(), tmp_now.getTime(), this.loaderStartTime.getTime(), this.clientStartTime.getTime())); return (time); }
From source file:org.kuali.ole.sys.service.impl.GeneralLedgerPendingEntryServiceImpl.java
/** * This populates an empty GeneralLedgerPendingEntry instance with default values for a bank offset. A global error will be * posted as a side-effect if the given bank has not defined the necessary bank offset relations. * * @param bank//from w ww . ja v a2 s . c o m * @param depositAmount * @param financialDocument * @param universityFiscalYear * @param sequenceHelper * @param bankOffsetEntry * @param errorPropertyName * @return whether the entry was populated successfully */ @Override public boolean populateBankOffsetGeneralLedgerPendingEntry(Bank bank, KualiDecimal depositAmount, GeneralLedgerPostingDocument financialDocument, Integer universityFiscalYear, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, GeneralLedgerPendingEntry bankOffsetEntry, String errorPropertyName) { bankOffsetEntry.setFinancialDocumentTypeCode( dataDictionaryService.getDocumentTypeNameByClass(financialDocument.getClass())); bankOffsetEntry.setVersionNumber(1L); bankOffsetEntry.setTransactionLedgerEntrySequenceNumber(sequenceHelper.getSequenceCounter()); Timestamp transactionTimestamp = new Timestamp(dateTimeService.getCurrentDate().getTime()); bankOffsetEntry.setTransactionDate(new java.sql.Date(transactionTimestamp.getTime())); bankOffsetEntry.setTransactionEntryProcessedTs(transactionTimestamp); Account cashOffsetAccount = bank.getCashOffsetAccount(); if (ObjectUtils.isNull(cashOffsetAccount)) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_NO_ACCOUNT, new String[] { bank.getBankCode() }); return false; } if (!cashOffsetAccount.isActive()) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_ACCOUNT_CLOSED, new String[] { bank.getBankCode(), cashOffsetAccount.getChartOfAccountsCode(), cashOffsetAccount.getAccountNumber() }); return false; } if (cashOffsetAccount.isExpired()) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_ACCOUNT_EXPIRED, new String[] { bank.getBankCode(), cashOffsetAccount.getChartOfAccountsCode(), cashOffsetAccount.getAccountNumber() }); return false; } bankOffsetEntry.setChartOfAccountsCode(bank.getCashOffsetFinancialChartOfAccountCode()); bankOffsetEntry.setAccountNumber(bank.getCashOffsetAccountNumber()); bankOffsetEntry.setFinancialDocumentApprovedCode( AccountingDocumentRuleBaseConstants.GENERAL_LEDGER_PENDING_ENTRY_CODE.NO); bankOffsetEntry.setTransactionEncumbranceUpdateCode(BLANK_SPACE); bankOffsetEntry.setFinancialBalanceTypeCode(BALANCE_TYPE_ACTUAL); bankOffsetEntry.setTransactionDebitCreditCode(depositAmount.isPositive() ? GL_DEBIT_CODE : GL_CREDIT_CODE); bankOffsetEntry.setFinancialSystemOriginationCode(SpringContext.getBean(HomeOriginationService.class) .getHomeOrigination().getFinSystemHomeOriginationCode()); bankOffsetEntry.setDocumentNumber(financialDocument.getDocumentNumber()); ObjectCode cashOffsetObject = bank.getCashOffsetObject(); if (ObjectUtils.isNull(cashOffsetObject)) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_NO_OBJECT_CODE, new String[] { bank.getBankCode() }); return false; } if (!cashOffsetObject.isFinancialObjectActiveCode()) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_INACTIVE_OBJECT_CODE, new String[] { bank.getBankCode(), cashOffsetObject.getFinancialObjectCode() }); return false; } bankOffsetEntry.setFinancialObjectCode(bank.getCashOffsetObjectCode()); bankOffsetEntry.setFinancialObjectTypeCode(bank.getCashOffsetObject().getFinancialObjectTypeCode()); bankOffsetEntry.setOrganizationDocumentNumber( financialDocument.getDocumentHeader().getOrganizationDocumentNumber()); bankOffsetEntry.setOrganizationReferenceId(null); bankOffsetEntry.setProjectCode(OLEConstants.getDashProjectCode()); bankOffsetEntry.setReferenceFinancialDocumentNumber(null); bankOffsetEntry.setReferenceFinancialDocumentTypeCode(null); bankOffsetEntry.setReferenceFinancialSystemOriginationCode(null); if (StringUtils.isBlank(bank.getCashOffsetSubAccountNumber())) { bankOffsetEntry.setSubAccountNumber(OLEConstants.getDashSubAccountNumber()); } else { SubAccount cashOffsetSubAccount = bank.getCashOffsetSubAccount(); if (ObjectUtils.isNull(cashOffsetSubAccount)) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_NONEXISTENT_SUB_ACCOUNT, new String[] { bank.getBankCode(), cashOffsetAccount.getChartOfAccountsCode(), cashOffsetAccount.getAccountNumber(), bank.getCashOffsetSubAccountNumber() }); return false; } if (!cashOffsetSubAccount.isActive()) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_INACTIVE_SUB_ACCOUNT, new String[] { bank.getBankCode(), cashOffsetAccount.getChartOfAccountsCode(), cashOffsetAccount.getAccountNumber(), bank.getCashOffsetSubAccountNumber() }); return false; } bankOffsetEntry.setSubAccountNumber(bank.getCashOffsetSubAccountNumber()); } if (StringUtils.isBlank(bank.getCashOffsetSubObjectCode())) { bankOffsetEntry.setFinancialSubObjectCode(OLEConstants.getDashFinancialSubObjectCode()); } else { SubObjectCode cashOffsetSubObject = bank.getCashOffsetSubObject(); if (ObjectUtils.isNull(cashOffsetSubObject)) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_NONEXISTENT_SUB_OBJ, new String[] { bank.getBankCode(), cashOffsetAccount.getChartOfAccountsCode(), cashOffsetAccount.getAccountNumber(), cashOffsetObject.getFinancialObjectCode(), bank.getCashOffsetSubObjectCode() }); return false; } if (!cashOffsetSubObject.isActive()) { GlobalVariables.getMessageMap().putError(errorPropertyName, OLEKeyConstants.ERROR_DOCUMENT_BANK_OFFSET_INACTIVE_SUB_OBJ, new String[] { bank.getBankCode(), cashOffsetAccount.getChartOfAccountsCode(), cashOffsetAccount.getAccountNumber(), cashOffsetObject.getFinancialObjectCode(), bank.getCashOffsetSubObjectCode() }); return false; } bankOffsetEntry.setFinancialSubObjectCode(bank.getCashOffsetSubObjectCode()); } bankOffsetEntry.setTransactionEntryOffsetIndicator(true); bankOffsetEntry.setTransactionLedgerEntryAmount(depositAmount.abs()); bankOffsetEntry.setUniversityFiscalPeriodCode(null); // null here, is assigned during batch or in specific document rule bankOffsetEntry.setUniversityFiscalYear(universityFiscalYear); bankOffsetEntry.setAcctSufficientFundsFinObjCd(SpringContext.getBean(SufficientFundsService.class) .getSufficientFundsObjectCode(cashOffsetObject, cashOffsetAccount.getAccountSufficientFundsCode())); return true; }
From source file:info.novatec.inspectit.cmr.service.RegistrationServiceTest.java
/** * Test the registering of the method sensor type to method occurring not for the first time. * /*from ww w. j a v a 2 s.c om*/ * @throws RemoteException * If {@link RemoteException} occurs. */ @Test public void registerSensorTypeWithMethodSecondTime() throws RemoteException { long methodId = 20; long methodSensorId = 50; MethodIdentToSensorType methodIdentToSensorType = new MethodIdentToSensorType(); methodIdentToSensorType.setId(1L); Timestamp timestamp = new Timestamp(System.currentTimeMillis() - 1); methodIdentToSensorType.setTimestamp(timestamp); when(methodIdentToSensorTypeDao.find(methodId, methodSensorId)).thenReturn(methodIdentToSensorType); registrationService.addSensorTypeToMethod(methodSensorId, methodId); ArgumentCaptor<MethodIdentToSensorType> argument = ArgumentCaptor.forClass(MethodIdentToSensorType.class); verify(methodIdentToSensorTypeDao, times(1)).saveOrUpdate(argument.capture()); verifyZeroInteractions(methodIdentDao); verifyZeroInteractions(methodSensorTypeIdentDao); assertThat(argument.getValue().getId(), is(equalTo(1L))); assertThat(argument.getValue().getTimestamp().getTime(), is(greaterThan(timestamp.getTime()))); }
From source file:org.kuali.kfs.sys.service.impl.GeneralLedgerPendingEntryServiceImpl.java
/** * This populates an empty GeneralLedgerPendingEntry explicitEntry object instance with default values. * * @param accountingDocument/* w w w . jav a2s. co m*/ * @param accountingLine * @param sequenceHelper * @param explicitEntry */ @Override public void populateExplicitGeneralLedgerPendingEntry(GeneralLedgerPendingEntrySource glpeSource, GeneralLedgerPendingEntrySourceDetail glpeSourceDetail, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, GeneralLedgerPendingEntry explicitEntry) { if (LOG.isDebugEnabled()) { LOG.debug( "populateExplicitGeneralLedgerPendingEntry(AccountingDocument, AccountingLine, GeneralLedgerPendingEntrySequenceHelper, GeneralLedgerPendingEntry) - start"); } explicitEntry.setFinancialDocumentTypeCode(glpeSource.getFinancialDocumentTypeCode()); 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(glpeSourceDetail.getAccountNumber()); Account account = getAccountService().getByPrimaryIdWithCaching(glpeSourceDetail.getChartOfAccountsCode(), glpeSourceDetail.getAccountNumber()); ObjectCode objectCode = SpringContext.getBean(ObjectCodeService.class).getByPrimaryIdWithCaching( glpeSource.getPostingYear(), glpeSourceDetail.getChartOfAccountsCode(), glpeSourceDetail.getFinancialObjectCode()); if (account != null) { if (LOG.isDebugEnabled()) { LOG.debug("GLPE: Testing to see what should be used for SF Object Code: " + glpeSourceDetail); } String sufficientFundsCode = account.getAccountSufficientFundsCode(); if (StringUtils.isBlank(sufficientFundsCode)) { sufficientFundsCode = KFSConstants.SF_TYPE_NO_CHECKING; if (LOG.isDebugEnabled()) { LOG.debug("Code was blank on the account - using 'N'"); } } if (objectCode != null) { if (LOG.isDebugEnabled()) { LOG.debug("SF Code / Object: " + sufficientFundsCode + " / " + objectCode); } String sifficientFundsObjectCode = getSufficientFundsService() .getSufficientFundsObjectCode(objectCode, sufficientFundsCode); explicitEntry.setAcctSufficientFundsFinObjCd(sifficientFundsObjectCode); } else { LOG.debug("Object code object was null, skipping setting of SF object field."); } } if (objectCode != null) { explicitEntry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode()); } explicitEntry .setFinancialDocumentApprovedCode(KFSConstants.PENDING_ENTRY_APPROVED_STATUS_CODE.NOT_PROCESSED); explicitEntry.setTransactionEncumbranceUpdateCode(BLANK_SPACE); explicitEntry.setFinancialBalanceTypeCode(BALANCE_TYPE_ACTUAL); // this is the default that most documents use explicitEntry.setChartOfAccountsCode(glpeSourceDetail.getChartOfAccountsCode()); explicitEntry.setTransactionDebitCreditCode( glpeSource.isDebit(glpeSourceDetail) ? KFSConstants.GL_DEBIT_CODE : KFSConstants.GL_CREDIT_CODE); explicitEntry.setFinancialSystemOriginationCode(SpringContext.getBean(HomeOriginationService.class) .getHomeOrigination().getFinSystemHomeOriginationCode()); explicitEntry.setDocumentNumber(glpeSourceDetail.getDocumentNumber()); explicitEntry.setFinancialObjectCode(glpeSourceDetail.getFinancialObjectCode()); explicitEntry.setOrganizationDocumentNumber(glpeSource.getDocumentHeader().getOrganizationDocumentNumber()); explicitEntry.setOrganizationReferenceId(glpeSourceDetail.getOrganizationReferenceId()); explicitEntry.setProjectCode(getEntryValue(glpeSourceDetail.getProjectCode(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankProjectCode())); explicitEntry.setReferenceFinancialDocumentNumber( getEntryValue(glpeSourceDetail.getReferenceNumber(), BLANK_SPACE)); explicitEntry.setReferenceFinancialDocumentTypeCode( getEntryValue(glpeSourceDetail.getReferenceTypeCode(), BLANK_SPACE)); explicitEntry.setReferenceFinancialSystemOriginationCode( getEntryValue(glpeSourceDetail.getReferenceOriginCode(), BLANK_SPACE)); explicitEntry.setSubAccountNumber(getEntryValue(glpeSourceDetail.getSubAccountNumber(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber())); explicitEntry.setFinancialSubObjectCode(getEntryValue(glpeSourceDetail.getFinancialSubObjectCode(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankFinancialSubObjectCode())); explicitEntry.setTransactionEntryOffsetIndicator(false); explicitEntry.setTransactionLedgerEntryAmount( glpeSource.getGeneralLedgerPendingEntryAmountForDetail(glpeSourceDetail)); explicitEntry.setTransactionLedgerEntryDescription( getEntryValue(glpeSourceDetail.getFinancialDocumentLineDescription(), glpeSource.getDocumentHeader().getDocumentDescription())); explicitEntry.setUniversityFiscalPeriodCode(null); // null here, is assigned during batch or in specific document rule // classes explicitEntry.setUniversityFiscalYear(glpeSource.getPostingYear()); // TODO wait for core budget year data structures to be put in place // explicitEntry.setBudgetYear(accountingLine.getBudgetYear()); // explicitEntry.setBudgetYearFundingSourceCode(budgetYearFundingSourceCode); if (LOG.isDebugEnabled()) { LOG.debug( "populateExplicitGeneralLedgerPendingEntry(AccountingDocument, AccountingLine, GeneralLedgerPendingEntrySequenceHelper, GeneralLedgerPendingEntry) - end"); } }
From source file:com.collabnet.ccf.core.EntityService2.java
/** * For a given source artifact id, source repository and the target * repository details, this method finds out the target artifact id mapped * to the source artifact id by looking up the identity mapping table. * /* ww w. ja v a2 s .co m*/ * If the source artifact id had ever passed through the wiring the identity * mapping will contain the corresponding target artifact id. This method * fetches the target artifact id and returns. If there is no target * artifact id mapped to this source artifact id this method return a null. * * The difference to the ordinary target lookup method is that this one does * not require the target repository id. This one is found out automatically * by querying the synchronization status table as well. * * @param sourceArtifactId * - The source artifact id that should be looked up for a target * artifact id * @param sourceSystemId * - The system id of the source repository * @param sourceRepositoryId * - The repository id of the source artifact * @param targetSystemId * - The system id of the target repository * @param artifactType * - The artifact type * * @return array with target artifactId, sourceArtifactLastModifiedDate, * sourceArtifactVersion, targetArtifactVersion (in this order) */ private Object[] lookupParentTargetArtifact(Element element, String sourceArtifactId, String sourceSystemId, String sourceRepositoryId, String targetSystemId, String artifactType) { IOrderedMap inputParameters = new OrderedHashMap(); inputParameters.add(sourceRepositoryId); inputParameters.add(sourceArtifactId); inputParameters.add(artifactType); Object[] resultSet = null; parentIdentityMappingDatabaseReader.connect(); resultSet = parentIdentityMappingDatabaseReader.next(inputParameters, 1000); Object[] results = null; if (resultSet == null || resultSet.length == 0) { log.debug(sourceArtifactId + "-" + sourceRepositoryId + "-" + sourceSystemId + "-" + "???" + "-" + targetSystemId + " are not mapped."); } else if (resultSet.length == 1) { if (resultSet[0] instanceof OrderedHashMap) { OrderedHashMap result = (OrderedHashMap) resultSet[0]; if (result.size() == 5) { results = new Object[5]; results[0] = result.get(0); Timestamp timeStamp = (Timestamp) result.get(1); Date date; if (timeStamp == null) { // use earliest date possible date = new Date(0); } else { date = new Date(timeStamp.getTime()); } results[1] = date; results[2] = result.get(2); results[3] = result.get(3); results[4] = result.get(4); } else { String cause = "Seems as if the SQL statement for parentIdentityMappingDatabase reader does not return 5 values."; XPathUtils.addAttribute(element, GenericArtifactHelper.ERROR_CODE, GenericArtifact.ERROR_INTERNAL_DATABASE_TABLE_CORRUPT); log.error(cause); throw new CCFRuntimeException(cause); } } else { String cause = "SQL query on identity mapping table did not return data in correct format!"; XPathUtils.addAttribute(element, GenericArtifactHelper.ERROR_CODE, GenericArtifact.ERROR_INTERNAL_DATABASE_TABLE_CORRUPT); log.error(cause); throw new CCFRuntimeException(cause); } } else { String cause = "There is more than one mapping for the combination " + sourceArtifactId + "-" + sourceRepositoryId + "-" + sourceSystemId + "-" + "???" + "-" + targetSystemId + " in the identity mapping table."; XPathUtils.addAttribute(element, GenericArtifactHelper.ERROR_CODE, GenericArtifact.ERROR_INTERNAL_DATABASE_TABLE_CORRUPT); log.error(cause); throw new CCFRuntimeException(cause); } return results; }