本文整理汇总了Java中com.google.appengine.api.datastore.Entity.setUnindexedProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.setUnindexedProperty方法的具体用法?Java Entity.setUnindexedProperty怎么用?Java Entity.setUnindexedProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.appengine.api.datastore.Entity
的用法示例。
在下文中一共展示了Entity.setUnindexedProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveFile
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
/**
* Save Full File
*
* @param inputStream
*/
private static void saveFile(InputStream inputStream) {
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("CET"));
time.set(Calendar.HOUR_OF_DAY,0);
time.set(Calendar.MINUTE,0);
time.set(Calendar.SECOND,0);
Date measuredAt = time.getTime();
long millis = time.getTimeInMillis();
//
Entity entity = new Entity(ENTITY_TYPE_FICHEROS,millis);
entity.setIndexedProperty("Date", measuredAt);
entity.setUnindexedProperty("File", GlobalUtils.getString(inputStream));
// Store
datastore.put(entity);
}
示例2: setOrRemoveUnindexedProperty
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
public static void setOrRemoveUnindexedProperty(
Entity e, String propertyName, @Nullable Object value) {
Preconditions.checkNotNull(e, "Null entity");
Preconditions.checkNotNull(propertyName, "Null propertyName");
if (value == null) {
e.removeProperty(propertyName);
} else {
e.setUnindexedProperty(propertyName, value);
}
}
示例3: saveToDataStore
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
private void saveToDataStore(List<Medicion> mediciones) {
mLogger.info("Storing " + mediciones.size() + " hours");
// Saved date
Date savedDate = Calendar.getInstance(TimeZone.getTimeZone("CET")).getTime();
// Load datastore
List<Entity> batch = new ArrayList<>();
for (Medicion medicion : mediciones){
// Measured date
long measuredAtMillis = medicion.getMeasuredAt();
Date measuredAt = new Date();
Calendar measuredAtCalendar = Calendar.getInstance(TimeZone.getTimeZone("CET"));
measuredAtCalendar.setTimeInMillis(measuredAtMillis);
measuredAt.setTime(measuredAtMillis);
//
long savedAtMillis = medicion.getSavedAtHour();
Date savedAt = new Date();
savedAt.setTime(savedAtMillis);
// Una entidad por cada compuesto
for (Compuesto compuesto: Compuesto.measuredCompuestos()) {
// Build entity
Entity entity = new Entity(ENTITY_TYPE_MEDIDAS, measuredAt.getTime() + compuesto.getId());
entity.setIndexedProperty(PROPERTY_COMPUESTO, compuesto.name());
entity.setIndexedProperty(PROPERTY_AVISO, medicion.getAviso());
entity.setIndexedProperty(PROPERTY_AVISO_STATE, medicion.getAvisoState());
entity.setIndexedProperty(PREPERTY_AVISO_MAX_TODAY, medicion.getAvisoMaxToday());
entity.setIndexedProperty(PROPERTY_ESCENARIO_STATE_TODAY, medicion.getEscenarioStateToday());
entity.setIndexedProperty(PROPERTY_ESCENARIO_STATE_TOMORROW, medicion.getEscenarioStateTomorrow());
entity.setIndexedProperty(PROPERTY_ESCENARIO_STATE_TOMORROW_MANUAL, medicion.getEscenarioManualTomorrow());
entity.setIndexedProperty(PROPERTY_SAVED_AT, savedDate);
entity.setIndexedProperty(PROPERTY_MEASURE_DATE, measuredAt);
entity.setIndexedProperty(PROPERTY_MEASURE_TIME, stringHour(measuredAtCalendar.get(Calendar.HOUR_OF_DAY)));
// Build stations
Map<String, Object> valueMap = medicion.getCompuestoValues(compuesto);
if (valueMap != null) {
for (Map.Entry<String, Object> entry : valueMap.entrySet()) {
entity.setUnindexedProperty(entry.getKey(), entry.getValue());
}
}
// Store
batch.add(entity);
}
}
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
datastore.put(batch);
}
示例4: setNonNullUnindexedProperty
import com.google.appengine.api.datastore.Entity; //导入方法依赖的package包/类
public static void setNonNullUnindexedProperty(Entity e, String propertyName, Object value) {
Preconditions.checkNotNull(e, "Null entity");
Preconditions.checkNotNull(propertyName, "Null propertyName");
Preconditions.checkNotNull(value, "Null value");
e.setUnindexedProperty(propertyName, value);
}