List of usage examples for org.joda.time DateTime now
public static DateTime now()
ISOChronology
in the default time zone. From source file:ch.opentrainingcenter.client.views.ngchart.DynamicChartViewPart.java
License:Open Source License
private void addFilterSection(final Composite body) { final Section sectionFilter = toolkit.createSection(body, FormToolkitSupport.SECTION_STYLE); sectionFilter.setExpanded(true);//from w w w . j av a 2s. com sectionFilter.setText(Messages.DynamicChartViewPart_1); sectionFilter.setDescription(Messages.DynamicChartViewPart_2); final TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB); td.colspan = 1; td.grabHorizontal = true; td.grabVertical = true; sectionFilter.setLayoutData(td); final Composite container = toolkit.createComposite(sectionFilter); GridLayoutFactory.swtDefaults().numColumns(7).applyTo(container); final Label lDay = new Label(container, SWT.NONE); lDay.setText(Messages.DynamicChartViewPart_3); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lDay); tagMonatJahrCombo = new Combo(container, SWT.READ_ONLY); tagMonatJahrCombo.setBounds(50, 50, 150, 65); tagMonatJahrCombo.setItems(XAxisChart.items()); tagMonatJahrCombo.select(store.getInt(PreferenceConstants.CHART_XAXIS_CHART)); tagMonatJahrCombo.addSelectionListener(new UpdateSelectionAdapter()); final Label y = new Label(container, SWT.NONE); y.setText(Messages.DynamicChartViewPart_4); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(y); yAchseCombo = new Combo(container, SWT.READ_ONLY); yAchseCombo.setItems(TrainingChart.items()); yAchseCombo.select(store.getInt(PreferenceConstants.CHART_YAXIS_CHART)); yAchseCombo.addSelectionListener(new UpdateSelectionAdapter()); final XAxisChart cst = XAxisChart.getByIndex(tagMonatJahrCombo.getSelectionIndex()); compareWithLastYear = new Button(container, SWT.CHECK); compareWithLastYear.setText(Messages.DynamicChartViewPart_9); compareWithLastYear.setEnabled(!XAxisChart.DAY.equals(cst)); compareWithLastYear.setSelection(store.getBoolean(PreferenceConstants.CHART_COMPARE)); compareWithLastYear.setToolTipText(Messages.DynamicChartViewPart_10); compareWithLastYear.addSelectionListener(new UpdateSelectionAdapter()); GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.BEGINNING).span(3, 1).applyTo(compareWithLastYear); // ------- neue Zeile final Label vonLabel = toolkit.createLabel(container, Messages.DynamicChartViewPart_6); von = org.joda.time.DateTime.now().minusWeeks(store.getInt(PreferenceConstants.CHART_WEEKS)); final DateFormatSymbols symbols = DateFormatSymbols.getInstance(Locale.getDefault()); symbols.setShortWeekdays(NEW_SHORT_WEEKDAYS); dateVon = new DateWidget(container, SWT.BORDER | SWT.DATE | SWT.DROP_DOWN); dateVon.setDate(von); dateVon.addSelectionListener(new UpdateSelectionAdapter()); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(vonLabel); final Label bisLabel = toolkit.createLabel(container, Messages.DynamicChartViewPart_7); dateBis = new DateWidget(container, SWT.BORDER | SWT.DATE | SWT.DROP_DOWN); dateBis.setDate(DateTime.now()); dateBis.addSelectionListener(new UpdateSelectionAdapter()); GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(bisLabel); comboSport = new Combo(container, SWT.READ_ONLY); comboSport.setItems(Sport.items()); comboSport.select(store.getInt(PreferenceConstants.CHART_SPORT)); comboSport.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { update(); } }); sectionFilter.setClient(container); }
From source file:ch.simuonline.idh.attribute.resolver.dc.aq.AttributeQueryDataConnector.java
License:Apache License
/** {@inheritDoc} */ @Override/*from w w w . jav a 2 s . c o m*/ @Nonnull protected Map<String, IdPAttribute> doDataConnectorResolve( @Nonnull final AttributeResolutionContext resolutionContext, @Nonnull final AttributeResolverWorkContext workContext) throws ResolutionException { ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this); final DateTime start = DateTime.now(); log.debug("{} Begin with resolving Attributes, the principal is: {}, Start time of AQ Extension: {}!", getLogPrefix(), resolutionContext.getPrincipal(), start); // get informations about the query target AQTarget queryTarget = targetResolvingStrategy.resolveTargetInformations(resolutionContext); if (queryTarget == null || StringSupport.trimOrNull(queryTarget.getNameID()) == null || (signatureRequired && queryTarget.getCertificate() == null) || StringSupport.trimOrNull(queryTarget.getEntityID()) == null || StringSupport.trimOrNull(queryTarget.getAttributeQueryURL()) == null) { log.warn("{} No working target informations for the attribute query found for principal: {}", getLogPrefix(), resolutionContext.getPrincipal()); return null; } // get the aq context and check if there are attributes to resolve from the metadata of this service provider AttributeQueryContext aqcontext = resolutionContext.getSubcontext(AttributeQueryContext.class, false); List<AQAttribute> attributesToResolve = null; if (aqcontext != null) { attributesToResolve = aqcontext.getAttributesToResolve(); } // if there are no attributes to resolve from the metadatas, no attribtue query is needed if ((attributesToResolve == null || attributesToResolve.isEmpty()) && requireMetadataAttributes) { log.warn("{} Attributes from the SP Metadata required, but no attributes found", getLogPrefix()); return null; } // Building the Attribute Query AttributeQuery query = attributeQueryBuilder.buildAttributeQuery(queryTarget, keyManager, attributesToResolve); if (query == null) { log.warn("{} Attribute query build failed", getLogPrefix()); return null; } // Method for creating the SOAP Envelope Envelope envelope = createSOAPEnvelope(query); try { Element dom = XMLObjectSupport.marshall(envelope); log.debug("{} Print attribute query with envelope {}", getLogPrefix(), SerializeSupport.prettyPrintXML(dom)); } catch (MarshallingException e) { log.debug("{} Unable to print out created attribute query", getLogPrefix()); } // Create InOutOperationContext to send the soap envelope InOutOperationContext<Envelope, Envelope> ioCtx = new InOutOperationContext<Envelope, Envelope>(null, null); ioCtx.setOutboundMessageContext(new MessageContext<Envelope>()); ioCtx.getOutboundMessageContext().getSubcontext(SOAP11Context.class, true).setEnvelope(envelope); // Get a SOAP CLient HttpSOAPClient soapClient = getSOAPClient(); // Send the AttributeQuery try { soapClient.send(queryTarget.getAttributeQueryURL(), ioCtx); } catch (Exception e) { log.warn("{} Sending SOAP Message failed {}", getLogPrefix(), e); return null; } // Get the Response Envelope Envelope SOAPResponse = ioCtx.getInboundMessageContext().getSubcontext(SOAP11Context.class, false) .getEnvelope(); if (SOAPResponse == null || SOAPResponse.getBody() == null) { log.warn("{} No SOAP Response Recieved", getLogPrefix()); return null; } Response samlResponse = null; final List<XMLObject> bodyElements = SOAPResponse.getBody().getUnknownXMLObjects(); for (XMLObject element : bodyElements) { if (element instanceof Response) { samlResponse = (Response) element; } } if (samlResponse == null) { log.warn("{} SOAP Response Body containts no SAML Response!", getLogPrefix()); return null; } // Log the Response try { Element dom = XMLObjectSupport.marshall(samlResponse); log.debug("{} Print SAML Response: {}", getLogPrefix(), SerializeSupport.prettyPrintXML(dom)); } catch (MarshallingException e) { log.warn("{} Unable to print SAML Response. {}", getLogPrefix(), e); } // Validate the saml response if (!validateResponse(samlResponse, query.getID(), query.getIssueInstant(), queryTarget)) { log.warn("{} SAML Response from the AttributeQuery is not valid!", getLogPrefix()); return null; } // Get the attribute statement final List<AttributeStatement> attributeStatements = samlResponse.getAssertions().get(0) .getAttributeStatements(); // if there is no attribue statement, the method returns null (no attributes) if (attributeStatements == null || attributeStatements.size() == 0) return null; // Create the Attributes to release final List<Attribute> responseAttributes = attributeStatements.get(0).getAttributes(); final Map<String, IdPAttribute> returnMap = new HashMap<>(responseAttributes.size()); for (Attribute responseAttribute : responseAttributes) { final IdPAttribute idpAttribute = new IdPAttribute(responseAttribute.getFriendlyName()); final List<XMLObject> responseAttributeValues = responseAttribute.getAttributeValues(); final ArrayList<IdPAttributeValue<?>> idpAttributeValues = new ArrayList<>( responseAttributeValues.size()); for (XMLObject responseAttributeValue : responseAttributeValues) { if (responseAttributeValue instanceof XSString) { idpAttributeValues .add(StringAttributeValue.valueOf(((XSString) responseAttributeValue).getValue())); } } log.debug("{} New Attribute produced from AttributeStatement, friendly name: {}, name: {}", getLogPrefix(), responseAttribute.getFriendlyName(), responseAttribute.getName()); idpAttribute.setValues(idpAttributeValues); returnMap.put(idpAttribute.getId(), idpAttribute); } log.debug("{} Duration of AQ Data Connector: {}ms", getLogPrefix(), (DateTime.now().getMillis() - start.getMillis())); return returnMap; }
From source file:ch.simuonline.idh.attribute.resolver.dc.aq.AttributeQueryDataConnector.java
License:Apache License
/** * /* w ww. jav a 2 s. c om*/ * Validator of the SAML Response * * @param response the response object to validate * @param randomID the randomID from the attribute query * @param queryTime the timestamp from the attribute query * @param nameID the nameID from the query subject * @param entityID the entityID from the attribute authority * @return true if validation of the response was positive, false if something with the response is wrong * @throws ResolutionException throws if some element of the response is not readable */ protected boolean validateResponse(@Nonnull Response response, String randomID, DateTime queryTime, AQTarget queryTarget) throws ResolutionException { try { // Check SAML version if (response.getVersion() != SAMLVersion.VERSION_20) { log.warn("{} Validation of SALM2 response failed! Unsupported SAML version of response: {} ", getLogPrefix(), response.getVersion()); return false; } // It should have exactly one assertion in this response if (response.getAssertions().size() != 1) { log.warn( "{} Validation of SALM2 response failed! There are {} assertions, but it must have exactly 1 assertion!", getLogPrefix(), response.getAssertions().size()); return false; } // Validate if response status is success if (!response.getStatus().getStatusCode().getValue() .equals("urn:oasis:names:tc:SAML:2.0:status:Success")) { log.warn( "{} Validation of SALM2 response failed! Wrong Status Code: {}, it has to be urn:oasis:names:tc:SAML:2.0:status:Success", getLogPrefix(), response.getStatus().getStatusCode().getValue()); return false; } Assertion assertion = response.getAssertions().get(0); if (assertion.getVersion() != SAMLVersion.VERSION_20) { log.warn("{} Validation of SALM2 response failed! Assertion is not a SAML 2.0 version Assertion", getLogPrefix()); return false; } // Check if issuer has the right entityID Issuer assertionIssuer = assertion.getIssuer(); String entityID = queryTarget.getEntityID(); if (!assertionIssuer.getValue().equals(entityID)) { log.warn("{} Validation of SALM2 response failed! Wrong Issuer {}, it should be {}", getLogPrefix(), assertion.getIssuer().getValue(), entityID); return false; } // verify signature of assertion if (assertion.isSigned() && signatureRequired) { log.debug("{} Begin with checking signature", getLogPrefix()); Signature signature = assertion.getSignature(); // checks if its a valid signature profile SAMLSignatureProfileValidator spv = new SAMLSignatureProfileValidator(); try { spv.validate(signature); log.debug("{} Signature hat correct profile", getLogPrefix()); } catch (SignatureException e) { log.warn("{} Validation of SALM2 response failed! Exception while validating the exception: {}", getLogPrefix(), e); return false; } // String certificate = "MIIDLDCCAhSgAwIBAgIVAPhMcSU5PCjjIosHSOpreF2ztyCZMA0GCSqGSIb3DQEBBQUAMBsxGTAXBgNVBAMMEHNoaWJhYS50aS5iZmguY2gwHhcNMTUwNDIxMDYzNTM2WhcNMzUwNDIxMDYzNTM2WjAbMRkwFwYDVQQDDBBzaGliYWEudGkuYmZoLmNoMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkmZJpYDL6CbQtzUBrwvfPOAdihQyI+BZiio6060GC4H8ObyaBIbRNFVkaG6FVlfBR8XVvB6SiRIMjd4pmWii0/lfhy67/61dHs35+AwSKzYcxThsov8YtTnyhj3bAij0Ved2cmdx3ZCQyfCmPH2mI6bFssDxMczRT4oTtCCmmOQH3XoebT2HJ8CMXqTxBQzQm0f5voc8BfeGVBjduDGS5D14kS7couuTmgTIa91EnypeXH67ZHk8QlRcPFRyGHn2s3ivPjbwRrvWtqpHCry14MvQVtOcu8TJ0OsN4+h3ds2OX+ZigIcxVOfBx+VM9O8vlHwzrCm0ACoi9uy0mVbDZQIDAQABo2cwZTAdBgNVHQ4EFgQUdWPQ51FiJv3dS+MEmDlF8XcSWzkwRAYDVR0RBD0wO4IQc2hpYmFhLnRpLmJmaC5jaIYnaHR0cHM6Ly9zaGliYWEudGkuYmZoLmNoL2lkcC9zaGliYm9sZXRoMA0GCSqGSIb3DQEBBQUAA4IBAQAxXuCR2Xd7cM+LTRkateGSu3SblomsOFnWJT3hizLsRa9y2kbQz14NAn3KF5pQ1srEX4AS18AM6YVjkR2r8if96m8PmrGxwGUNwK6AYXoBQ/oRq3ZC1DZJFS8qmgmX9wr96Gb0yJbFmJeHOfvqgzPSdB+oZUX3RTPXF6QOnt7+LFvSf1EfDwadp8lq8MQAqtHszHYFMkRGPJC+KBEC6PNkFa36K3pD+E2yh9Q51Yg5eic7GyG5qyZeYIuo3hERS9w3ZlLGjQ+mkvxN5gM3U7fJAYkcdc+crABVy/XAuLoLUMiIUD0gaKjs2enRB+LQVX+rjyiyukETAvdftadGFxv8"; // X509Certificate cert = X509Support.decodeCertificate(certificate); X509Certificate cert = queryTarget.getCertificate(); AttributeQueryKeyManager keyManager = new AttributeQueryKeyManager(cert); X509Credential validationCredential = new X509KeyManagerX509CredentialAdapter(keyManager, "verification"); try { SignatureValidator.validate(signature, validationCredential); log.debug("{} Signature validated, no problem", getLogPrefix()); } catch (SignatureException e) { log.warn("{} Validation of SALM2 response failed! Assertion Signature is not correct!", getLogPrefix()); return false; } } else if (!assertion.isSigned() && signatureRequired) { log.warn( "{} Validation of SALM2 response failed! Assertion Signature is required but this assertion is not sigened!", getLogPrefix()); return false; } else { log.warn("{} No signature check required!", getLogPrefix()); } // CONDITIONS OF ASSERTION Conditions conditions = assertion.getConditions(); if (conditions != null) { log.debug("{} Check conditions of assertion!", getLogPrefix()); DateTime now = DateTime.now(); DateTime notBefore = conditions.getNotBefore(); log.debug("Evaluating Conditions NotBefore '{}' against now(+5min) '{}'", notBefore, now.plusMinutes(5)); if (notBefore != null && notBefore.isAfter(now.plusMinutes(5))) { log.warn("{} Validation of SALM2 response failed! The condition not before {} failed.", getLogPrefix(), notBefore); return false; } DateTime notOnOrAfter = conditions.getNotOnOrAfter(); log.debug("Evaluating Conditions NotOnOrAfter '{}' against now(-5min) '{}'", notOnOrAfter, now.minusMinutes(5)); if (notOnOrAfter != null && notOnOrAfter.isBefore(now.minusMinutes(5))) { log.warn("{} Validation of SALM2 response failed! The condition not on or after {} failed.", getLogPrefix(), notOnOrAfter); return false; } } else { log.debug("{} Asertion does not contain conditions!", getLogPrefix()); } // SUBJECT OF ASSERTION Subject assertionSubject = assertion.getSubject(); if (assertionSubject == null) { log.warn("{} Validation of SALM2 response failed! No Subject found", getLogPrefix()); return false; } // check if the nameid is correct String nameID = queryTarget.getNameID(); if (!assertionSubject.getNameID().getValue().equals(nameID)) { log.warn("{} Validation of SALM2 response failed! Wrong nameID: {}, expected: {}", getLogPrefix(), assertion.getSubject().getNameID().getValue(), nameID); return false; } // check if the in response to id is correct if (!assertionSubject.getSubjectConfirmations().get(0).getSubjectConfirmationData().getInResponseTo() .equals(randomID)) { log.warn("{} Validation of SALM2 response failed! Wrong InResponseTo ID: {}, it has to be {}", getLogPrefix(), response.getInResponseTo(), randomID); return false; } // verify that the assertion has not more than one attribue statements if (assertion.getAttributeStatements().size() > 1) { log.warn( "{} Validation of SALM2 response failed! {} attribute statements, but expected is 0 or one {}", getLogPrefix(), assertion.getAttributeStatements().size()); return false; } } catch (Exception e) { log.warn( "{} Validation of SALM2 response failed! {} Can not read all Elements of the assertion to verify response! Exception: {}", getLogPrefix(), e); return false; } log.debug("{} SAML2 Response validated, it's valid", getLogPrefix()); return true; }
From source file:chess.states.HumanMoveState.java
@Override public State stateProcess(int[][] squareValues, int nonMatchingSquares, int pieceTaken) { if (nonMatchingSquares == 1 ^ pieceTaken == 1) { if (lastMatched == null) { lastMatched = DateTime.now(); stateLogger.debug("Set lastMatched to " + lastMatched.toString()); }/*from ww w. j a v a2 s. c o m*/ if (lastMatched.isBefore(DateTime.now().minusSeconds(secondsForBoardCheck))) { stateLogger.debug(String.format("lastMatched is past %s seconds. LastMatched=%s Now =%s", secondsForBoardCheck, lastMatched.toString(), DateTime.now().toString())); ArrayList<ChessPiece>[] activeList = engine.getBoard().getActivePieces(); ChessPiece missingPiece = null; for (ChessPiece activePiece : activeList[humanColor]) { boolean foundPiece = false; for (SquareValue sv2 : diffList.subList(0, engine.getNumActivePieces())) { if (activePiece.getLocation().getX() == sv2.x && activePiece.getLocation().getY() == sv2.y) { foundPiece = true; } } if (!foundPiece) { missingPiece = activePiece; } } SquareValue sq = null; for (SquareValue indexSv : diffList.subList(0, engine.getNumActivePieces())) { if (engine.getBoard().getPiece(indexSv.x, indexSv.y) == null && indexSv.value > emptySquareDetectionValue) { sq = indexSv; } } if (sq == null) { ArrayList<SquareValue> opponentSquare = new ArrayList<>(); for (ChessPiece indexSv : engine.getBoard().getActivePieces()[engineColor]) { double diff = Math.abs(squareValues[indexSv.getLocation().getX()][indexSv.getLocation() .getY()] - goodSquareValues[indexSv.getLocation().getX()][indexSv.getLocation().getY()]); opponentSquare.add( new SquareValue(indexSv.getLocation().getX(), indexSv.getLocation().getY(), diff)); } Collections.sort(opponentSquare, new Comparator<SquareValue>() { @Override public int compare(SquareValue v1, SquareValue v2) { return Double.compare(v2.value, v1.value); } }); sq = opponentSquare.get(0); } if (missingPiece == null) { stateLogger.debug("MissingPiece is null"); lastMatched = null; return this; } stateLogger.debug(String.format("missingPiece x=%d y=%d movedTo x=%d y=%d", missingPiece.getLocation().getX(), missingPiece.getLocation().getY(), sq.x, sq.y)); String humanMove = ChessUtil.convertXYtoChessMove(missingPiece.getLocation().getX(), missingPiece.getLocation().getY(), sq.x, sq.y); String move = engine.makeMove(humanMove); if (move.equals("Invalid Move")) { stateLogger.info("Human Made Invalid Move " + humanMove); lastMatched = null; stateLogger.debug("Set lastMatched to Null"); return this; } stateLogger.info(String.format("Human made %s", move)); return State.getState(State.ENGINESTATE); } } else { lastMatched = null; stateLogger.debug("Set lastMatched to Null"); } return this; }
From source file:cn.cuizuoli.appranking.batch.flow.EodDecider.java
License:Apache License
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (DateTime.now().getHourOfDay() == 0) { return new FlowExecutionStatus(END_OF_DAY); } else {//ww w .j av a 2s . co m return FlowExecutionStatus.COMPLETED; } }
From source file:cn.cuizuoli.appranking.batch.partition.FeedTypePartitioner.java
License:Apache License
@Override public Map<String, ExecutionContext> partition(int gridSize) { Map<String, ExecutionContext> map = new HashMap<String, ExecutionContext>(); int i = 0;/*ww w .j av a 2 s . c om*/ for (FeedType feedType : FeedType.getFeedType(mediaType)) { if (mediaType == MediaType.GOOGLE) { for (Category category : Category.values()) { ExecutionContext context = new ExecutionContext(); context.put(FEED_TYPE, feedType.getCode()); context.put(CATEGORY, category.getCode()); DateTime datetime = DateTime.now(); context.put(HOUR, DateUtil.toHour(datetime)); context.put(DAY, DateUtil.toDay(datetime)); map.put(PARTITION_KEY + i + "." + feedType.getCode() + "." + category.getCode(), context); i++; } } else { for (Country country : Country.values()) { ExecutionContext context = new ExecutionContext(); context.put(COUNTRY, country.getCode()); context.put(FEED_TYPE, feedType.getCode()); DateTime datetime = DateTime.now(); context.put(HOUR, DateUtil.toHour(datetime)); context.put(DAY, DateUtil.toDay(datetime)); map.put(PARTITION_KEY + i + "." + feedType.getCode(), context); i++; } } } return map; }
From source file:cn.cuizuoli.appranking.batch.tasklet.EodTasklet.java
License:Apache License
@Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { if (DateTime.now().getHourOfDay() == 0) { appRankingService.addEod();/*from ww w . j a v a2 s .co m*/ } if (DateTime.now().getDayOfWeek() == 1) { appRankingService.addEow(); } if (DateTime.now().getDayOfMonth() == 1) { appRankingService.addEom(); } if (DateTime.now().getDayOfWeek() == 1) { appRankingService.deleteAppRankingHour(); } return RepeatStatus.FINISHED; }
From source file:cn.cuizuoli.appranking.incrementer.AppRankingIncrementer.java
License:Apache License
@Override public String nextStringValue() throws DataAccessException { return DateTime.now().toString(YYYYMMDDHH_FORMATTER) + super.nextStringValue(); }
From source file:cn.cuizuoli.appranking.service.AppRankingService.java
License:Apache License
/** * add/*from w ww . j av a 2 s .c o m*/ * @param appRanking */ @Transactional public void add(AppRanking appRanking) { appRanking.setId(appRankingIncrementer.nextStringValue()); appRanking.setDateHour(DateTime.now().toString("yyyyMMddHH")); appRankingRepository.insert(appRanking); }
From source file:cn.cuizuoli.appranking.service.AppRankingService.java
License:Apache License
/** * batchAdd//from ww w .ja v a2s . c om * @param appRankingList */ @Transactional public void batchAdd(List<AppRanking> appRankingList) { SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); AppRankingRepository batchAppRankingRepository = sqlSession.getMapper(AppRankingRepository.class); int i = 1; for (AppRanking appRanking : appRankingList) { appRanking.setId(appRankingIncrementer.nextStringValue()); appRanking.setDateHour(DateTime.now().toString("yyyyMMddHH")); batchAppRankingRepository.insert(appRanking); if (i % 100 == 0) { sqlSession.commit(); } i++; } sqlSession.commit(); sqlSession.close(); }