Dataset Viewer
Auto-converted to Parquet Duplicate
before
stringclasses
23 values
after
stringclasses
23 values
loc
int64
12
47
repo
stringclasses
1 value
public String find() throws Exception { logger.info( "Starting find()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Customer.class ); //f:hibernate criteria.add( Example.create( this.customer ).excludeZeroes().ignoreCase().enableLike( MatchMode.ANYWHERE ) ); //f:hibernate if ( this.customer.getId() != null ) { //f:hibernate criteria.add( Restrictions.idEq( this.customer.getId() ) ); //f:hibernate } //f:hibernate @SuppressWarnings("unchecked") List<Customer> l = (List<Customer>) criteria.list(); //f:hibernate request.put( "list", l ); t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.CR_MODE; logger.info( "Finishing find()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Customer.class ); //f:hibernate criteria.add( Example.create( this.customer ).excludeZeroes().ignoreCase().enableLike( MatchMode.ANYWHERE ) ); //f:hibernate if ( this.customer.getId() != null ) { //f:hibernate criteria.add( Restrictions.idEq( this.customer.getId() ) ); //f:hibernate } //f:hibernate @SuppressWarnings("unchecked") List<Customer> l = (List<Customer>) criteria.list(); //f:hibernate </DeepExtract> <DeepExtract> t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
20
MyWebMarket
public String save() throws Exception { logger.info( "Starting save()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.save( this.customer ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.UD_MODE; this.addActionMessage( this.getText( "saveSuccessful", new String[]{"customer"}) ); logger.info( "Finishing save()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.save( this.customer ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
14
MyWebMarket
public String update() throws Exception { logger.info( "Starting update()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.update( this.customer ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.UD_MODE; this.addActionMessage( this.getText( "updateSuccessful", new String[]{"customer"}) ); logger.info( "Finishing update()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.update( this.customer ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
14
MyWebMarket
public String delete() throws Exception { logger.info( "Starting delete()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.delete( this.customer ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.CR_MODE; this.addActionMessage( this.getText( "deleteSuccessful", new String[]{"customer"}) ); logger.info( "Finishing delete()" ); //f:log return this.input();
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.delete( this.customer ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
14
MyWebMarket
public String edit() throws Exception { logger.info( "Starting edit()" ); //f:log Integer id = Integer.valueOf( this.parameters.get( "id" )[0] ); Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Customer c = (Customer) sess.get( Customer.class, id ); //f:hibernate this.setCustomer( c ); t.commit(); //f:hibernate sess.close(); //f:hibernate logger.info( "Finishing edit()" ); //f:log this.task = SystemConstants.UD_MODE; return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Customer c = (Customer) sess.get( Customer.class, id ); //f:hibernate </DeepExtract> <DeepExtract> t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
16
MyWebMarket
public String execute() throws Exception { logger.info( "Starting execute()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( User.class ); //f:hibernate criteria.add( Restrictions.idEq( this.user.getUsername() ) ); //f:hibernate criteria.add( Restrictions.eq( "password", this.user.getPassword() ) ); //f:hibernate User user = (User) criteria.uniqueResult(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate if ( user != null ) { ActionContext.getContext().getSession().put( SystemConstants.AUTHENTICATED_USER, user ); logger.info( "Finishing execute() -- Success" ); //f:log return SUCCESS; } this.addActionError( this.getText( "login.failure" ) ); logger.info( "Finishing execute() -- Failure" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( User.class ); //f:hibernate criteria.add( Restrictions.idEq( this.user.getUsername() ) ); //f:hibernate criteria.add( Restrictions.eq( "password", this.user.getPassword() ) ); //f:hibernate User user = (User) criteria.uniqueResult(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
23
MyWebMarket
public String find() throws Exception { logger.info( "Starting find()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Product.class ); //f:hibernate criteria.add( Example.create( this.product ).excludeZeroes().ignoreCase().enableLike( MatchMode.ANYWHERE ) ); //f:hibernate if ( this.product.getId() != null ) { //f:hibernate criteria.add( Restrictions.idEq( this.product.getId() ) ); //f:hibernate } //f:hibernate @SuppressWarnings("unchecked") List<Product> l = (List<Product>) criteria.list(); //f:hibernate request.put( "list", l ); t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.CR_MODE; logger.info( "Finishing find()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Product.class ); //f:hibernate criteria.add( Example.create( this.product ).excludeZeroes().ignoreCase().enableLike( MatchMode.ANYWHERE ) ); //f:hibernate if ( this.product.getId() != null ) { //f:hibernate criteria.add( Restrictions.idEq( this.product.getId() ) ); //f:hibernate } //f:hibernate @SuppressWarnings("unchecked") List<Product> l = (List<Product>) criteria.list(); //f:hibernate </DeepExtract> <DeepExtract> t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
20
MyWebMarket
public String save() throws Exception { logger.info( "Starting save()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.save( this.product ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.UD_MODE; this.addActionMessage( this.getText( "saveSuccessful", new String[]{"product"}) ); logger.info( "Finishing save()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.save( this.product ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
14
MyWebMarket
public String update() throws Exception { logger.info( "Starting update()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.update( this.product ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.UD_MODE; this.addActionMessage( this.getText( "updateSuccessful", new String[]{"product"}) ); logger.info( "Finishing update()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.update( this.product ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
14
MyWebMarket
public String delete() throws Exception { logger.info( "Starting delete()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.delete( this.product ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.CR_MODE; this.addActionMessage( this.getText( "deleteSuccessful", new String[]{"product"}) ); logger.info( "Finishing delete()" ); //f:log return this.input();
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.delete( this.product ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
14
MyWebMarket
public String edit() throws Exception { logger.info( "Starting edit()" ); //f:log Integer id = Integer.valueOf( this.parameters.get( "id" )[0] ); Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Product p = (Product) sess.get( Product.class, id ); //f:hibernate this.setProduct( p ); t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.UD_MODE; logger.info( "Finishing edit()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Product p = (Product) sess.get( Product.class, id ); //f:hibernate </DeepExtract> <DeepExtract> t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
16
MyWebMarket
public String input() throws Exception { logger.info( "Starting input()" ); //f:log this.task = SystemConstants.CR_MODE; this.purchaseOrder = null; Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Customer.class ); //f:hibernate @SuppressWarnings("unchecked") List<Customer> lc = (List<Customer>) criteria.list(); //f:hibernate ActionContext.getContext().getSession().put( "listCustomer", lc ); criteria = sess.createCriteria( Product.class ); //f:hibernate @SuppressWarnings("unchecked") List<Product> lp = (List<Product>) criteria.list(); //f:hibernate ActionContext.getContext().getSession().put( "listProduct", lp ); t.commit(); //f:hibernate sess.close(); //f:hibernate logger.info( "Finishing input()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate </DeepExtract> <DeepExtract> Criteria criteria = sess.createCriteria( Customer.class ); //f:hibernate @SuppressWarnings("unchecked") List<Customer> lc = (List<Customer>) criteria.list(); //f:hibernate </DeepExtract> <DeepExtract> t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
23
MyWebMarket
public String find() throws Exception { logger.info( "Starting find()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( PurchaseOrder.class ); //f:hibernate criteria.add( Example.create( this.purchaseOrder ).excludeZeroes().ignoreCase().enableLike( MatchMode.ANYWHERE ) ); //f:hibernate if ( this.purchaseOrder.getId() != null ) { //f:hibernate criteria.add( Restrictions.idEq( this.purchaseOrder.getId() ) ); //f:hibernate } //f:hibernate if ( this.purchaseOrder.getCustomer().getId() != null ) { //f:hibernate criteria.add( Restrictions.eq( "customer", this.purchaseOrder.getCustomer() ) ); //f:hibernate } //f:hibernate criteria.setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY ); //f:hibernate @SuppressWarnings("unchecked") List<PurchaseOrder> l = (List<PurchaseOrder>) criteria.list(); //f:hibernate request.put( "list", l ); t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.CR_MODE; logger.info( "Finishing input()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( PurchaseOrder.class ); //f:hibernate criteria.add( Example.create( this.purchaseOrder ).excludeZeroes().ignoreCase().enableLike( MatchMode.ANYWHERE ) ); //f:hibernate if ( this.purchaseOrder.getId() != null ) { //f:hibernate criteria.add( Restrictions.idEq( this.purchaseOrder.getId() ) ); //f:hibernate } //f:hibernate if ( this.purchaseOrder.getCustomer().getId() != null ) { //f:hibernate criteria.add( Restrictions.eq( "customer", this.purchaseOrder.getCustomer() ) ); //f:hibernate } //f:hibernate criteria.setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY ); //f:hibernate @SuppressWarnings("unchecked") List<PurchaseOrder> l = (List<PurchaseOrder>) criteria.list(); //f:hibernate </DeepExtract> <DeepExtract> t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
25
MyWebMarket
public String save() throws Exception { logger.info( "Starting save()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate this.purchaseOrder.setOrderDate( new Date() ); for (PurchaseOrderItem item : this.purchaseOrder.getPurchaseOrderItems()) { item.setPurchaseOrder( this.purchaseOrder ); } sess.save( this.purchaseOrder ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.UD_MODE; this.addActionMessage( this.getText( "saveSuccessful", new String[] { "order" } ) ); logger.info( "Finishing save()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate </DeepExtract> <DeepExtract> sess.save( this.purchaseOrder ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
20
MyWebMarket
public String update() throws Exception { logger.info( "Starting update()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate for (PurchaseOrderItem item : this.purchaseOrder.getPurchaseOrderItems()){ item.setPurchaseOrder( this.purchaseOrder ); } sess.update( this.purchaseOrder ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.UD_MODE; this.addActionMessage( this.getText( "updateSuccessful", new String[] { "order" } ) ); logger.info( "Finishing update()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate </DeepExtract> <DeepExtract> sess.update( this.purchaseOrder ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
18
MyWebMarket
public String delete() throws Exception { logger.info( "Starting delete()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.delete( this.purchaseOrder ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.CR_MODE; this.addActionMessage( this.getText( "deleteSuccessful", new String[] { "order" } ) ); logger.info( "Finishing delete()" ); //f:log return this.input();
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate sess.delete( this.purchaseOrder ); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
13
MyWebMarket
public String edit() throws Exception { logger.info( "Starting edit()" ); //f:log Integer id = Integer.valueOf( this.parameters.get( "id" )[0] ); Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate PurchaseOrder po = (PurchaseOrder) sess.get( PurchaseOrder.class, id ); //f:hibernate this.setPurchaseOrder( po ); t.commit(); //f:hibernate sess.close(); //f:hibernate this.task = SystemConstants.UD_MODE; logger.info( "Finishing edit()" ); //f:log return INPUT;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate PurchaseOrder po = (PurchaseOrder) sess.get( PurchaseOrder.class, id ); //f:hibernate </DeepExtract> <DeepExtract> t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
16
MyWebMarket
public Double getProductPrice(Integer idProduct){ logger.info( "Starting getProductPrice()" ); //f:log Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Product.class ); //f:hibernate criteria.setProjection( Projections.property( "price" ) ); //f:hibernate criteria.add( Restrictions.eq( "id", idProduct ) ); //f:hibernate Double price = (Double) criteria.uniqueResult(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate logger.info( "Finishing getProductPrice()" ); //f:log return price;
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Product.class ); //f:hibernate criteria.setProjection( Projections.property( "price" ) ); //f:hibernate criteria.add( Restrictions.eq( "id", idProduct ) ); //f:hibernate Double price = (Double) criteria.uniqueResult(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
17
MyWebMarket
public String productReport() throws Exception { logger.info( "Starting productReport()" ); //f:log ActionContext ac = ActionContext.getContext(); ServletContext sc = (ServletContext) ac.get( StrutsStatics.SERVLET_CONTEXT ); JasperReport jasperReport = JasperCompileManager.compileReport( sc.getResourceAsStream( "/WEB-INF/classes/ProductReport.xml" ) ); //f:jr Map<String, Object> parameters = new HashMap<String, Object>(); //f:jr parameters.put( "ReportTitle", "List of Products" ); //f:jr parameters.put( "DataFile", new Date().toString() ); //f:jr Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Product.class ); //f:hibernate criteria.setProjection( Projections.projectionList().add( Projections.property( "id" ) ).add( Projections.property( "name" ) ).add( Projections.property( "price" ) ) ); //f:hibernate @SuppressWarnings("unchecked") List<Object[]> l = (List<Object[]>) criteria.list(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate HibernateQueryResultDataSource ds = new HibernateQueryResultDataSource(l, new String[] { "Id", "Name", "Price" }); //f:jr JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, parameters, ds ); //f:jr byte b[] = JasperExportManager.exportReportToPdf( jasperPrint ); //f:jr this.inputStream = new ByteArrayInputStream( b ); logger.info( "Finishing productReport()" ); //f:log return "download";
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Product.class ); //f:hibernate criteria.setProjection( Projections.projectionList().add( Projections.property( "id" ) ).add( Projections.property( "name" ) ).add( Projections.property( "price" ) ) ); //f:hibernate @SuppressWarnings("unchecked") List<Object[]> l = (List<Object[]>) criteria.list(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
35
MyWebMarket
public String customerReport() throws Exception { logger.info( "Starting customerReport()" ); //f:log ActionContext ac = ActionContext.getContext(); ServletContext sc = (ServletContext) ac.get( StrutsStatics.SERVLET_CONTEXT ); JasperReport jasperReport = JasperCompileManager.compileReport( sc.getResourceAsStream( "/WEB-INF/classes/CustomerReport.xml" ) ); //f:jr Map<String, Object> parameters = new HashMap<String, Object>(); //f:jr parameters.put( "ReportTitle", "List of Customers" ); //f:jr parameters.put( "DataFile", new Date().toString() ); //f:jr Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Customer.class ); //f:hibernate criteria.setProjection( Projections.projectionList().add( Projections.property( "id" ) ).add( Projections.property( "name" ) ).add( Projections.property( "phone" ) ) ); //f:hibernate @SuppressWarnings("unchecked") List<Object[]> l = (List<Object[]>) criteria.list(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate HibernateQueryResultDataSource ds = new HibernateQueryResultDataSource(l, new String[] { "Id", "Name", "Phone" }); //f:jr JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, parameters, ds ); //f:jr byte b[] = JasperExportManager.exportReportToPdf( jasperPrint ); //f:jr this.inputStream = new ByteArrayInputStream( b ); logger.info( "Finishing customerReport()" ); //f:log return "download";
<DeepExtract> Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Customer.class ); //f:hibernate criteria.setProjection( Projections.projectionList().add( Projections.property( "id" ) ).add( Projections.property( "name" ) ).add( Projections.property( "phone" ) ) ); //f:hibernate @SuppressWarnings("unchecked") List<Object[]> l = (List<Object[]>) criteria.list(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract>
35
MyWebMarket
public String input() throws Exception { logger.info( "Starting input()" ); //f:log SchedulerFactory sf = new StdSchedulerFactory(); //f:quartz Scheduler sc = sf.getScheduler(); //f:quartz JobDetail job = sc.getJobDetail( JobKey.jobKey( "supplyMailJob", "group" ) ); //f:quartz if ( job != null ) { //f:quartz this.timeInterval = job.getJobDataMap().getIntValue( "timeInterval" ); //f:quartz } //f:quartz logger.info( "Finishing input()" ); //f:log return super.input();
<DeepExtract> SchedulerFactory sf = new StdSchedulerFactory(); //f:quartz Scheduler sc = sf.getScheduler(); //f:quartz JobDetail job = sc.getJobDetail( JobKey.jobKey( "supplyMailJob", "group" ) ); //f:quartz if ( job != null ) { //f:quartz this.timeInterval = job.getJobDataMap().getIntValue( "timeInterval" ); //f:quartz } //f:quartz </DeepExtract>
12
MyWebMarket
public String schedule() throws Exception { logger.info( "Starting schedule()" ); //f:log SchedulerFactory sf = new StdSchedulerFactory(); //f:quartz Scheduler sc = sf.getScheduler(); //f:quartz JobDetail job = sc.getJobDetail( JobKey.jobKey( "supplyMailJob", "group" ) ); //f:quartz if ( job != null ) { //f:quartz sc.deleteJob( JobKey.jobKey( "supplyMailJob", "group" ) ); //f:quartz } //f:quartz job = newJob( SupplyMailJob.class ).withIdentity( "supplyMailJob", "group" ).build(); //f:quartz job.getJobDataMap().put( "timeInterval", this.timeInterval ); //f:quartz Trigger trigger = newTrigger().withIdentity( "supplyMailTrigger", "group" ).startNow().withSchedule( CronScheduleBuilder.cronSchedule( "0 0/" + (this.timeInterval * 60) + " * * * ?" ) ).build(); //f:quartz sc.scheduleJob( job, trigger ); //f:quartz logger.info( "Finishing schedule()" ); //f:log return INPUT;
<DeepExtract> SchedulerFactory sf = new StdSchedulerFactory(); //f:quartz Scheduler sc = sf.getScheduler(); //f:quartz JobDetail job = sc.getJobDetail( JobKey.jobKey( "supplyMailJob", "group" ) ); //f:quartz if ( job != null ) { //f:quartz sc.deleteJob( JobKey.jobKey( "supplyMailJob", "group" ) ); //f:quartz } //f:quartz job = newJob( SupplyMailJob.class ).withIdentity( "supplyMailJob", "group" ).build(); //f:quartz job.getJobDataMap().put( "timeInterval", this.timeInterval ); //f:quartz Trigger trigger = newTrigger().withIdentity( "supplyMailTrigger", "group" ).startNow().withSchedule( CronScheduleBuilder.cronSchedule( "0 0/" + (this.timeInterval * 60) + " * * * ?" ) ).build(); //f:quartz sc.scheduleJob( job, trigger ); //f:quartz </DeepExtract>
21
MyWebMarket
public void execute( JobExecutionContext context ) throws JobExecutionException { logger.info( "Starting execute() in job" ); //f:log org.hibernate.Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Product.class ); //f:hibernate criteria.add( Restrictions.lt( "supply", 5 ) ); //f:hibernate @SuppressWarnings("unchecked") List<Product> l = (List<Product>) criteria.list(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate if ( !l.isEmpty() ) { StringBuilder str = new StringBuilder(); str.append( "The following products are getting over:\n" ); Properties props = new Properties(); //f:mail props.setProperty( "mail.smtp.submitter", "terra" ); //f:mail props.setProperty( "mail.smtp.auth", "false" ); //f:mail props.setProperty( "mail.smtp.host", this.host ); //f:mail props.setProperty( "mail.smtp.port", "25" ); //f:mail javax.mail.Session session = javax.mail.Session.getInstance( props ); //f:mail try { //f:mail Message msg = new MimeMessage( session ); //f:mail msg.setFrom( new InternetAddress( this.from ) ); //f:mail InternetAddress[] address = { new InternetAddress( this.to ) }; //f:mail msg.setRecipients( Message.RecipientType.TO, address ); //f:mail msg.setSubject( "Low Supply of Products" ); //f:mail msg.setSentDate( new Date() ); //f:mail for ( Product p : l ) { str.append( p.getName() + "\t\t" + p.getSupply() + "\n" ); } msg.setText( str.toString() ); //f:mail Transport.send( msg ); //f:mail } catch (MessagingException mex) { mex.printStackTrace(); } }
<DeepExtract> org.hibernate.Session sess = HibernateUtil.getSessionFactory().openSession(); //f:hibernate Transaction t = sess.beginTransaction(); //f:hibernate Criteria criteria = sess.createCriteria( Product.class ); //f:hibernate criteria.add( Restrictions.lt( "supply", 5 ) ); //f:hibernate @SuppressWarnings("unchecked") List<Product> l = (List<Product>) criteria.list(); //f:hibernate t.commit(); //f:hibernate sess.close(); //f:hibernate </DeepExtract> <DeepExtract> Properties props = new Properties(); //f:mail props.setProperty( "mail.smtp.submitter", "terra" ); //f:mail props.setProperty( "mail.smtp.auth", "false" ); //f:mail props.setProperty( "mail.smtp.host", this.host ); //f:mail props.setProperty( "mail.smtp.port", "25" ); //f:mail javax.mail.Session session = javax.mail.Session.getInstance( props ); //f:mail try { //f:mail Message msg = new MimeMessage( session ); //f:mail msg.setFrom( new InternetAddress( this.from ) ); //f:mail InternetAddress[] address = { new InternetAddress( this.to ) }; //f:mail msg.setRecipients( Message.RecipientType.TO, address ); //f:mail msg.setSubject( "Low Supply of Products" ); //f:mail msg.setSentDate( new Date() ); //f:mail </DeepExtract> <DeepExtract> msg.setText( str.toString() ); //f:mail Transport.send( msg ); //f:mail </DeepExtract>
47
MyWebMarket

Dataset Card for "small_benchmark_webmarket-v2"

More Information needed

Downloads last month
17