Examples of GbEntity


Examples of gobo.dto.GbEntity

      final List<GbEntity> midData =
        gss.getDataOrNull(spreadsheet.getKey(), KIND_NAME, 3, COUNT);

      // Compare
      for (int i = 0; i < srcData.size(); i++) {
        final GbEntity src = srcData.get(i);
        for (int j = 0; j < midData.size(); j++) {
          final GbEntity dest = midData.get(j);
          if (src.getKey().equals(dest.getKey())) {
            List<GbProperty> srcProps = src.getProperties();
            List<GbProperty> destProps = dest.getProperties();
            for (GbProperty srcProp : srcProps) {
              final String srcName = srcProp.getName();
              for (GbProperty destProp : destProps) {
                final String destName = destProp.getName();
                if (srcName.equals(destName)) {

                  if (destProp.getValueType().equals(GbProperty.SHORT_BLOB)) {
                    assertThat(
                      destProp.getValue().toString(),
                      is("'" + GbProperty.NOT_SUPPORTED));
                  } else {
                    assertThat(destProp.asDatastoreValue(), equalTo(srcProp
                      .getValue()));
                  }

                }
              }
            }
          }
        }
      }

      // Restore Data to Datastore
      GbDatastoreService.restoreData(KIND_NAME, midData);

      // Get Data from Datastore.
      final List<GbEntity> destData = GbDatastoreService.getData(null, KIND_NAME, COUNT);

      // Compare
      for (int i = 0; i < srcData.size(); i++) {
        final GbEntity src = srcData.get(i);
        for (int j = 0; j < destData.size(); j++) {
          final GbEntity dest = destData.get(j);
          if (src.getKey().equals(dest.getKey())) {
            List<GbProperty> srcProps = src.getProperties();
            List<GbProperty> destProps = dest.getProperties();
            for (GbProperty srcProp : srcProps) {
              final String srcName = srcProp.getName();
              for (GbProperty destProp : destProps) {
                final String destName = destProp.getName();
                if (srcName.equals(destName)) {
View Full Code Here

Examples of gobo.dto.GbEntity

  public static List<GbEntity> entities() {

    List<GbEntity> list = new ArrayList<GbEntity>();
    for (int i = 1; i <= 5; i++) {

      GbEntity entity = new GbEntity();
      entity.setKey(KeyFactory.createKey(TEST_KIND, i));

      GbProperty property1 = new GbProperty();
      property1.setName("prop1");
      property1.setValueType(GbProperty.STRING);
      property1.setValue("prepare1_" + i);
      entity.addProperty(property1);

      GbProperty property2 = new GbProperty();
      property2.setName("prop2");
      property2.setValueType(GbProperty.LONG);
      property2.setValue(String.valueOf("10" + i));
      entity.addProperty(property2);

      list.add(entity);
    }
    return list;
  }
View Full Code Here

Examples of gobo.dto.GbEntity

  public static List<GbEntity> entitiesWidhDiffKeys() {

    List<GbEntity> list = new ArrayList<GbEntity>();
    for (int i = 1; i <= 5; i++) {

      GbEntity entity = new GbEntity();
      entity.setKey(KeyFactory.createKey(TEST_KIND, i + 3));

      GbProperty property1 = new GbProperty();
      property1.setName("prop1");
      property1.setValueType(GbProperty.STRING);
      property1.setValue("prepare2_" + i);
      entity.addProperty(property1);

      GbProperty property2 = new GbProperty();
      property2.setName("prop2");
      property2.setValueType(GbProperty.LONG);
      property2.setValue(String.valueOf("20" + i));
      entity.addProperty(property2);

      list.add(entity);
    }
    return list;
  }
View Full Code Here

Examples of gobo.dto.GbEntity

  public static List<GbEntity> entitiesWithDiffProp() {

    List<GbEntity> list = new ArrayList<GbEntity>();
    for (int i = 1; i <= 5; i++) {

      GbEntity entity = new GbEntity();
      entity.setKey(KeyFactory.createKey(TEST_KIND, i));

      GbProperty property1 = new GbProperty();
      property1.setName("prop3");
      property1.setValueType(GbProperty.STRING);
      property1.setValue("prepare3_" + i);
      entity.addProperty(property1);

      GbProperty property2 = new GbProperty();
      property2.setName("prop2");
      property2.setValueType(GbProperty.LONG);
      property2.setValue(String.valueOf("30" + i));
      entity.addProperty(property2);

      list.add(entity);
    }
    return list;
  }
View Full Code Here

Examples of gobo.dto.GbEntity

  public static List<GbEntity> entitiesWithNull() {

    List<GbEntity> list = new ArrayList<GbEntity>();
    for (int i = 1; i <= 5; i++) {

      GbEntity entity = new GbEntity();
      entity.setKey(KeyFactory.createKey(TEST_KIND, i));

      GbProperty property1 = new GbProperty();
      property1.setName("prop3");
      property1.setValueType(GbProperty.STRING);
      property1.setValue("prepare4_" + i);
      entity.addProperty(property1);

      GbProperty property2 = new GbProperty();
      property2.setName("prop2");
      property2.setValueType(GbProperty.LONG);
      if (i == 3) {
        property2.setValue(null);
      } else {
        property2.setValue(String.valueOf("40" + i));
      }
      entity.addProperty(property2);

      list.add(entity);
    }
    return list;
  }
View Full Code Here

Examples of gobo.dto.GbEntity

  public static List<GbEntity> entities(String kindName) {

    List<GbEntity> list = Lists.newArrayList();
    for (int i = 0; i < 10; i++) {
      GbEntity entity = new GbEntity();
      entity.setKey(KeyFactory.createKey(kindName, i + 1));
      entity.setProperties(entities2());
      list.add(entity);
    }
    return list;
  }
View Full Code Here

Examples of gobo.dto.GbEntity

    QueryResultList<Entity> data = query.asQueryResultList(fetchOptions);

    // Re-package.
    GbEntityList<GbEntity> list = new GbEntityList<GbEntity>();
    for (Entity entity : data) {
      GbEntity gbEntity = new GbEntity();
      gbEntity.setKey(entity.getKey());
      Set<String> propNames = entity.getProperties().keySet();
      for (String propName : propNames) {
        GbProperty gbProperty = new GbProperty();
        gbProperty.setName(propName);
        gbProperty.setValue(entity.getProperty(propName));
        gbEntity.addProperty(gbProperty);
      }
      list.add(gbEntity);
    }

    // Set cursor
View Full Code Here

Examples of gobo.dto.GbEntity

    if (startIndex >= maxRow) {
      return null;
    }
    query.setMaximumRow(maxRow);
    feed = ss.query(query, CellFeed.class);
    GbEntity gbEntity = null;
    List<GbEntity> data = new ArrayList<GbEntity>();
    for (CellEntry cell : feed.getEntries()) {
      final String shortId = cell.getId().substring(cell.getId().lastIndexOf('/') + 1);
      int col = Integer.parseInt(shortId.substring(shortId.lastIndexOf('C') + 1));
      if (col == 1) {
        gbEntity = new GbEntity();
        gbEntity.setKeyString(cell.getCell().getValue());
        data.add(gbEntity);
        continue;
      }

      GbProperty gbProperty = new GbProperty();
      gbProperty.setName(columnTitle[col - 1]);
      gbProperty.setValueType(dataType[col - 1]);
      gbProperty.setValue(cell.getCell().getValue());
      gbEntity.addProperty(gbProperty);
    }
    return data;
  }
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.