本文整理匯總了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);
}