Examples of EntityHandler


Examples of com.agiletec.aps.system.common.entity.parse.EntityHandler

    try {
      Content entityPrototype = (Content) this.getContentManager().getEntityPrototype(entityTypeCode);
      SAXParserFactory parseFactory = SAXParserFactory.newInstance();     
      SAXParser parser = parseFactory.newSAXParser();
      InputSource is = new InputSource(new StringReader(xml));
      EntityHandler handler = this.getEntityHandler();
      handler.initHandler(entityPrototype, this.getXmlAttributeRootElementName(), this.getCategoryManager());
      parser.parse(is, handler);
      return entityPrototype;
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "createEntityFromXml");
      throw new ApsSystemException("Error on creation entity", t);
View Full Code Here

Examples of com.agiletec.aps.system.common.entity.parse.EntityHandler

    try {
      IApsEntity entityPrototype = this.getUserProfileManager().getProfileType(entityTypeCode);
      SAXParserFactory parseFactory = SAXParserFactory.newInstance();     
      SAXParser parser = parseFactory.newSAXParser();
      InputSource is = new InputSource(new StringReader(xml));
      EntityHandler handler = this.getEntityHandler();
      handler.initHandler(entityPrototype, "profile", null);
      parser.parse(is, handler);
      return entityPrototype;
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "createEntityFromXml");
      throw new ApsSystemException("Errore caricamento entità", t);
View Full Code Here

Examples of com.xiaoleilu.hutool.db.handler.EntityHandler

      // 执行非查询语句,返回自增的键,如果有多个自增键,只返回第一个
      Long generatedKey = SqlExecutor.executeForGeneratedKey(conn, "UPDATE " + TABLE_NAME + " set field1 = ? where id = ?", 0, 0);
      log.info("主键:{}", generatedKey);

      /* 执行查询语句,返回实体列表,一个Entity对象表示一行的数据,Entity对象是一个继承自HashMap的对象,存储的key为字段名,value为字段值 */
      List<Entity> entityList = SqlExecutor.query(conn, "select * from " + TABLE_NAME + " where param1 = ?", new EntityHandler(), "值");
      log.info("{}", entityList);
    } catch (SQLException e) {
      Log.error(log, e, "SQL error!");
    } finally {
      DbUtil.close(conn);
View Full Code Here

Examples of com.xiaoleilu.hutool.db.handler.EntityHandler

      // 改,生成SQL为 UPDATE `table_name` SET `字段1` = ?, `字段2` = ? WHERE `条件1` = ?
      runner.update(entity, where);

      // 查,生成SQL为 SELECT * FROM `table_name` WHERE WHERE `条件1` = ? 第一个参数为返回的字段列表,如果null则返回所有字段
      List<Entity> entityList = runner.find(null, where, new EntityHandler());
      log.info("{}", entityList);

      // 分页,注意,ANSI SQL中不支持分页!
      List<Entity> pagedEntityList = runner.page(null, where, 0, 20, new EntityHandler());
      log.info("{}", pagedEntityList);

      // 满足条件的结果数,生成SQL为 SELECT count(1) FROM `table_name` WHERE WHERE `条件1` = ?
      int count = runner.count(where);
      log.info("count: {}", count);
View Full Code Here

Examples of com.xiaoleilu.hutool.db.handler.EntityHandler

      // 改,生成SQL为 UPDATE `table_name` SET `字段1` = ?, `字段2` = ? WHERE `条件1` = ?
      session.update(entity, where);

      // 查,生成SQL为 SELECT * FROM `table_name` WHERE WHERE `条件1` = ? 第一个参数为返回的字段列表,如果null则返回所有字段
      List<Entity> entityList = session.find(null, where, new EntityHandler());
      log.info("{}", entityList);

      // 分页,注意,ANSI SQL中不支持分页!
      List<Entity> pagedEntityList = session.page(null, where, 0, 20, new EntityHandler());
      log.info("{}", pagedEntityList);

      session.commit();
    } catch (Exception e) {
      session.quietRollback();
View Full Code Here

Examples of org.onebusaway.csv_entities.EntityHandler

    CsvEntityReader reader = new CsvEntityReader();
    reader.setInputLocation(_naptanCsvPath);
    AnnotationDrivenEntitySchemaFactory entitySchema = new AnnotationDrivenEntitySchemaFactory();
    entitySchema.addPackageToScan("org.onebusaway.uk.naptan.csv");
    reader.setEntitySchemaFactory(entitySchema);
    reader.addEntityHandler(new EntityHandler() {
      @Override
      public void handleEntity(Object arg0) {
        NaPTANStop stop = (NaPTANStop) arg0;
        _stopsByAtcoId.put(stop.getAtcoCode(), stop);
      }
View Full Code Here

Examples of org.onebusaway.csv_entities.EntityHandler

  public void readStationLocations(File path) throws CsvEntityIOException,
      IOException {
    BufferedReader reader = new BufferedReader(new FileReader(path));
    CsvEntityReader csvEntityReader = new CsvEntityReader();
    csvEntityReader.addEntityHandler(new EntityHandler() {
      @Override
      public void handleEntity(Object bean) {
        StationLocation stationLocation = (StationLocation) bean;
        Point2D.Double xy = ProjectionSupport.convertFromLatLon(
            stationLocation.getLat(), stationLocation.getLon());
View Full Code Here

Examples of org.onebusaway.csv_entities.EntityHandler

  @Override
  public String fromObject(Object obj, String resultCode, Writer stream)
      throws IOException {
    CsvEntityWriterFactory factory = new CsvEntityWriterFactory();
    Class<?> entityType = getEntityType(obj);
    EntityHandler csvHandler = factory.createWriter(entityType, stream);

    List<?> values = getEntityValues(obj);
    for (Object value : values)
      csvHandler.handleEntity(value);

    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.