当前位置: 首页>>代码示例>>Java>>正文


Java Text类代码示例

本文整理汇总了Java中com.google.appengine.api.datastore.Text的典型用法代码示例。如果您正苦于以下问题:Java Text类的具体用法?Java Text怎么用?Java Text使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Text类属于com.google.appengine.api.datastore包,在下文中一共展示了Text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
@Override
public void process() {
    UserService userService = UserServiceFactory.getUserService();
    // Step 1: Add Text into DB.
    Entity textEntity = getNewEntity();
    textEntity.setProperty("rawText", new Text(text));
    textEntity.setProperty("user",
            userService.getCurrentUser().getNickname());
    textEntity.setProperty("date", new Date());
    putIntoDatabase(textEntity);
    Key parentKey = textEntity.getKey();
    factory.setParentKey(parentKey);
    // Step 2: Call other processors.
    factory.createTypePredictor().process();
    factory.createKnowledgeGraphBuilder().process();
    factory.createSummaryGenerator().process();
}
 
开发者ID:SamChou19815,项目名称:chunk-reader,代码行数:18,代码来源:MainProcessor.java

示例2: parseWaveletEntity

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
private RemoteConvWavelet parseWaveletEntity(Entity entity) {
  Pair<SourceInstance, WaveletName> instanceAndWaveId = parseWaveletKey(entity.getKey());
  try {
    RobotSearchDigest digest = GsonProto.fromGson(new RobotSearchDigestGsonImpl(),
        DatastoreUtil.getExistingProperty(entity, WAVELET_DIGEST_PROPERTY, Text.class)
        .getValue());
    Assert.check(
        instanceAndWaveId.getSecond().waveId.equals(WaveId.deserialise(digest.getWaveId())),
        "Wave id mismatch: %s, %s", instanceAndWaveId, entity);
    Assert.check(DatastoreUtil.getExistingProperty(
            entity, WAVELET_LAST_MODIFIED_MILLIS_PROPERTY, Long.class)
        .equals(digest.getLastModifiedMillis()),
        "Mismatched last modified times: %s, %s", digest, entity);
    @Nullable String privateLocalId = DatastoreUtil.getOptionalProperty(
        entity, WAVELET_PRIVATE_LOCAL_ID_PROPERTY, String.class);
    @Nullable String sharedLocalId = DatastoreUtil.getOptionalProperty(
        entity, WAVELET_SHARED_LOCAL_ID_PROPERTY, String.class);
    return new RemoteConvWavelet(instanceAndWaveId.getFirst(), digest,
        instanceAndWaveId.getSecond().waveletId,
        privateLocalId == null ? null : new SlobId(privateLocalId),
        sharedLocalId == null ? null : new SlobId(sharedLocalId));
  } catch (MessageException e) {
    throw new RuntimeException("Failed to parse wave entity: " + entity, e);
  }
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:26,代码来源:PerUserTable.java

示例3: get

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
public ConvMetadataGsonImpl get(CheckedTransaction tx, SlobId convId)
    throws PermanentFailure, RetryableFailure {
  checkNotNull(tx, "Null tx");
  checkNotNull(convId, "Null convId");
  Entity entity = tx.get(makeKey(convId));
  if (entity == null) {
    log.info("No conv metadata found, using default");
    return new ConvMetadataGsonImpl();
  }
  String metadataString =
      DatastoreUtil.getExistingProperty(entity, PROPERTY, Text.class).getValue();
  log.info("Found conv metadata: " + metadataString);
  ConvMetadataGsonImpl metadata;
  try {
    metadata = GsonProto.fromGson(new ConvMetadataGsonImpl(), metadataString);
  } catch (MessageException e) {
    throw new RuntimeException("Failed to parse metadata: " + metadataString, e);
  }
  return metadata;
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:21,代码来源:ConvMetadataStore.java

示例4: CryptonomicaUser

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
public CryptonomicaUser(User googleUser,
                        PGPPublicKeyData pgpPublicKeyData,
                        NewUserRegistrationForm newUserRegistrationForm) {
    this.userId = googleUser.getUserId();
    this.webSafeStringKey = Key.create(
            CryptonomicaUser.class, googleUser.getUserId()
    ).toWebSafeString();
    this.firstName = pgpPublicKeyData.getFirstName().toLowerCase();
    this.lastName = pgpPublicKeyData.getLastName().toLowerCase();
    this.birthday = newUserRegistrationForm.getBirthday();
    this.googleUser = googleUser;
    if (googleUser.getEmail() != null) {
        this.email = new Email(googleUser.getEmail().toLowerCase()); // or email = pgpPublicKeyData.getUserEmail()
    }
    if (newUserRegistrationForm.getUserInfo() != null) {
        this.userInfo = new Text(newUserRegistrationForm.getUserInfo());
    }
    this.publicKeys = new ArrayList<>();
    Key<CryptonomicaUser> cryptonomicaUserKey = Key.create(CryptonomicaUser.class, googleUser.getUserId());
    this.publicKeys.add(
            Key.create(
                    cryptonomicaUserKey, PGPPublicKeyData.class, pgpPublicKeyData.getFingerprint()
            )
    );
}
 
开发者ID:Cryptonomica,项目名称:cryptonomica,代码行数:26,代码来源:CryptonomicaUser.java

示例5: DatastoreBackupInfo

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
/** DatastoreBackupInfo instances should only be obtained via DatastoreBackupService. */
DatastoreBackupInfo(Entity backupEntity) {
  backupName = (String) checkNotNull(backupEntity.getProperty("name"), "name");
  @SuppressWarnings("unchecked")
  List<String> rawKinds = (List<String>) checkNotNull(backupEntity.getProperty("kinds"), "kinds");
  Date rawStartTime = (Date) checkNotNull(backupEntity.getProperty("start_time"), "start_time");
  Date rawCompleteTime = (Date) backupEntity.getProperty("complete_time");
  Text rawGcsFilename = (Text) backupEntity.getProperty("gs_handle");

  kinds = ImmutableSet.copyOf(rawKinds);
  startTime = new DateTime(rawStartTime).withZone(UTC);
  completeTime = Optional.ofNullable(
      rawCompleteTime == null ? null : new DateTime(rawCompleteTime).withZone(UTC));
  gcsFilename = Optional.ofNullable(
      rawGcsFilename == null ? null : gcsPathToUri(rawGcsFilename.getValue()));
}
 
开发者ID:google,项目名称:nomulus,代码行数:17,代码来源:DatastoreBackupInfo.java

示例6: putEntity

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
/**
 * Internal routine to serialize and save the column lengths map.
 * 
 * @param e
 * @param lenMap
 * @param dam
 * @param datastore
 * @param user
 */
private void putEntity(Entity e, Map<String, Long> lenMap, DatastoreAccessMetrics dam, DatastoreImpl datastore, User user ) {
  logger.info(e.getKey().getName());

  // build up the string that will be saved in BigTables
  StringBuilder b = new StringBuilder();
  for ( Map.Entry<String, Long> entry : lenMap.entrySet() ) {
    String k = entry.getKey();
    Long v = entry.getValue();
    b.append(k).append(" ").append(v).append(" ");
  }
  e.setProperty(LENGTH_MAPPING, new Text(b.toString()));
  
  datastore.getDatastoreService().put(e);
  dam.recordPutUsage(TABLE_NAME);
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:25,代码来源:StringFieldLengthMapping.java

示例7: addObjectInstance

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
/**
 * Add object instance
 * 
 * @param instance The object instance
 */
public void addObjectInstance(WebObjectInstance instance) {
	String uri = instance.getUri();
	// Also insert object if not present yet
	if (!isObjectRegistered(uri)) {
		addObject(uri);
	}
	Entity webObjectInstance = new Entity(OBJECT_INSTANCE);
	webObjectInstance.setProperty("uri", instance.getUri());
	webObjectInstance.setProperty("content",
			new Text(instance.getContent()));
	webObjectInstance.setProperty("contentType", instance.getContentType());
	webObjectInstance.setProperty("timestamp", instance.getTimestamp());
	webObjectInstance.setProperty("statusCode", instance.getStatusCode());
	datastoreService.put(webObjectInstance);

}
 
开发者ID:lorenzosaino,项目名称:gae-webmonitor,代码行数:22,代码来源:DataStoreService.java

示例8: getAllObjectInstances

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
/**
 * Get all instances of an object present in the data store
 * 
 * @param uri The URI of the Web object
 * @return The list of Web instances
 */
public List<WebObjectInstance> getAllObjectInstances(String uri) {
	Filter uriFilter = new FilterPredicate("uri", FilterOperator.EQUAL, uri);
	Query query = new Query(OBJECT_INSTANCE)
			.setFilter(uriFilter)
			.addSort("timestamp", SortDirection.DESCENDING);

	List<Entity> instances = datastoreService.prepare(query)
			.asList(FetchOptions.Builder.withDefaults());
	List<WebObjectInstance> instanceList = new ArrayList<WebObjectInstance>();
	for (Entity e : instances) {
		String content = ((Text) e.getProperty("content")).getValue();
		String contentType = (String) e.getProperty("contentType");
		int statusCode = ((Integer) e.getProperty("statusCode")).intValue();
		Date timestamp = (Date) e.getProperty("timestamp");
		instanceList.add(new WebObjectInstance(uri, content, contentType,
				timestamp, statusCode));
	}
	return instanceList;
}
 
开发者ID:lorenzosaino,项目名称:gae-webmonitor,代码行数:26,代码来源:DataStoreService.java

示例9: getMostRecentObjectInstance

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
/**
 * Get the most recent instance of a web object available
 * 
 * @param uri The URI of the Web object
 * @return The instance of the Web object
 */
public WebObjectInstance getMostRecentObjectInstance(String uri) {
	Filter uriFilter = new FilterPredicate("uri", FilterOperator.EQUAL, uri);
	Query query = new Query(OBJECT_INSTANCE)
			.setFilter(uriFilter)
			.addSort("timestamp", SortDirection.DESCENDING);
	List<Entity> instances = datastoreService.prepare(query).asList(
			FetchOptions.Builder.withDefaults());
	if (instances == null || instances.isEmpty()) {
		return null;
	}
	Entity mostRecentInstance = instances.get(0);
	String content = ((Text) mostRecentInstance.getProperty("content"))
			.getValue();
	String contentType = (String) mostRecentInstance
			.getProperty("contentType");
	Date timestamp = (Date) mostRecentInstance.getProperty("timestamp");
	int statusCode = ((Long) mostRecentInstance.getProperty("statusCode"))
			.intValue();
	return new WebObjectInstance(uri, content, contentType, timestamp,
			statusCode);
}
 
开发者ID:lorenzosaino,项目名称:gae-webmonitor,代码行数:28,代码来源:DataStoreService.java

示例10: doPost

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	String identifier = req.getParameter("identifier");
	String content = req.getParameter("content");

	if (identifier != null && content != null) {
		Text contentText = new Text(content);

		PersistenceManager pm = PMF.get().getPersistenceManager();
		Template template = new TemplateManager( pm ).findById( identifier );
		template.setContent(contentText);
		pm.close();
	}

	resp.sendRedirect("/admin/template/");
}
 
开发者ID:santiagolizardo,项目名称:jerba,代码行数:18,代码来源:UpdateTemplateServlet.java

示例11: doPost

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	String identifier = req.getParameter("identifier");
	String content = req.getParameter("content");

	if (identifier != null && content != null) {
		Text text = new Text(content);
		Template template = new Template();
		template.setIdentifier(identifier);
		template.setContent(text);

		PersistenceManager pm = PMF.get().getPersistenceManager();
		pm.makePersistent(template);
		pm.close();
	}

	resp.sendRedirect("/admin/template/");
}
 
开发者ID:santiagolizardo,项目名称:jerba,代码行数:20,代码来源:AddTemplateServlet.java

示例12: addUser

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
public static void addUser(User bean) {
	PersistenceManager pm = PMF.get().getPersistenceManager();
	UserJDO user = new UserJDO();
	user.setTeamId(bean.getTeamId());
	user.setRunId(bean.getRunId());
	user.setEmail(bean.getFullId());
	user.setGameId(bean.getGameId());
	Long currentTime = System.currentTimeMillis();
	user.setLastModificationDate(currentTime);
	user.setLastModificationDateGame(currentTime);
	if (bean.getDeleted()!= null && bean.getDeleted()) user.setDeleted(bean.getDeleted());

	user.setId();
	JsonBeanSerialiser jbs = new JsonBeanSerialiser(bean);
	user.setPayload(new Text(jbs.serialiseToJson().toString()));
	try {
		pm.makePersistent(user);
	} finally {
		pm.close();
	}

}
 
开发者ID:WELTEN,项目名称:dojo-ibl,代码行数:23,代码来源:UserManager.java

示例13: createVariableDefinition

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
public static VariableEffectDefinition createVariableDefinition(VariableEffectDefinition variableDefinition) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    VariableEffectDefinitionJDO variableEffectDefinitionJDO = new VariableEffectDefinitionJDO();
    variableEffectDefinitionJDO.setName(variableDefinition.getName());
    variableEffectDefinitionJDO.setGameId(variableDefinition.getGameId());
    variableEffectDefinitionJDO.setEffectValue(variableDefinition.getEffectValue());
    variableEffectDefinitionJDO.setEffectType(variableDefinition.getEffectType());
    if (variableDefinition.getEffectCount() == null) variableDefinition.setEffectCount(1);
    variableEffectDefinitionJDO.setEffectCount(variableDefinition.getEffectCount());
    if (variableDefinition.getId() != null) variableEffectDefinitionJDO.setIdentifier(variableDefinition.getId());
    JsonBeanSerialiser jbs = new JsonBeanSerialiser(variableDefinition.getDependsOn());
    if (variableDefinition.getDependsOn() != null) variableEffectDefinitionJDO.setDependsOn(new Text(jbs.serialiseToJson().toString()));

    try {
        pm.makePersistent(variableEffectDefinitionJDO);
        return toBean(variableEffectDefinitionJDO);
    } finally {
        pm.close();
    }
}
 
开发者ID:WELTEN,项目名称:dojo-ibl,代码行数:21,代码来源:VariableEffectDefinitionManager.java

示例14: addRun

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
public static Long addRun(String title, String owner, Long gameId, Long runId, Long startTime, Long serverCreationTime, Run run) {
	PersistenceManager pm = PMF.get().getPersistenceManager();
	RunJDO runJdo = new RunJDO();
	runJdo.setGameId(gameId);
	runJdo.setRunId(runId);
	runJdo.setOwner(owner);
	runJdo.setTitle(title);
	runJdo.setStartTime(startTime);
	runJdo.setServerCreationTime(serverCreationTime);
	runJdo.setLastModificationDate(serverCreationTime);
	runJdo.setPayload(new Text(run.toString()));

	runJdo.setCode(run.getCode());
	runJdo.setAvoidNotification(run.getAvoidNotification());

	if (run.getRunConfig() != null) {
		runJdo.setTagId(run.getRunConfig().getNfcTag());
	}
	try {
		return pm.makePersistent(runJdo).getRunId();
	} finally {
		pm.close();
	}
}
 
开发者ID:WELTEN,项目名称:dojo-ibl,代码行数:25,代码来源:RunManager.java

示例15: convert

import com.google.appengine.api.datastore.Text; //导入依赖的package包/类
@Override
public EntityImpl convert() {

  EntityImpl entity =
      entity_.getParent() == null ? new EntityImpl(entity_.getKind(), Long.toString(entity_
          .getKey().getId(), 10)) : new EntityImpl(entity_.getKind(), Long.toString(entity_
          .getKey().getId(), 10), entity_.getParent().getKind(), Long.toString(entity_
          .getParent().getId(), 10));

  for (String propertyName : entity_.getProperties().keySet()) {
    Object propertyValue = entity_.getProperty(propertyName);
    if (propertyValue instanceof Text) {
      entity.setProperty(propertyName, ((Text) propertyValue).getValue());
    } else if (propertyValue instanceof Date) {
      entity.setProperty(propertyName, new Timestamp(((Date) propertyValue).getTime()));
    } else {
      entity.setProperty(propertyName, propertyValue);
    }
  }
  return entity;
}
 
开发者ID:csavelief,项目名称:gwt-sandbox,代码行数:22,代码来源:GaeEntityImpl.java


注:本文中的com.google.appengine.api.datastore.Text类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。