本文整理汇总了Java中com.google.appengine.api.datastore.Text.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Text.getValue方法的具体用法?Java Text.getValue怎么用?Java Text.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.appengine.api.datastore.Text
的用法示例。
在下文中一共展示了Text.getValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLifeVision
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public String getLifeVision(String userId) {
PersistenceManager pm = getPm();
try {
// "SELECT FROM " + GaeLifeVisionBean.class.getName() + " WHERE ownerId == '"+userId+"'";
Query query=pm.newQuery(GaeLifeVisionBean.class);
query.setFilter("ownerId == userId");
query.declareParameters("String userId");
LOG.log(Level.INFO,"Query: "+query);
List<GaeLifeVisionBean> visionsList=(List<GaeLifeVisionBean>)query.execute(userId);
LOG.log(Level.INFO," Result: "+visionsList.size());
if(visionsList!=null && visionsList.size()>0) {
Text lifeVision = visionsList.get(0).getLifeVision();
return (lifeVision==null?null:lifeVision.getValue());
}
} finally {
pm.close();
}
return "";
}
示例2: getPageText
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
public String getPageText() {
final Text text = page.getText();
if (text != null) {
return text.getValue();
} else {
return null;
}
}
示例3: FeedbackSubmissionEditQuestion
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
public FeedbackSubmissionEditQuestion(FeedbackQuestionAttributes questionAttributes, int qnIndx,
boolean isModeratedQuestion) {
courseId = questionAttributes.courseId;
questionNumber = questionAttributes.questionNumber;
this.qnIndx = qnIndx;
questionId = questionAttributes.getId();
questionText = questionAttributes.getQuestionDetails().getQuestionText();
Text description = questionAttributes.getQuestionDescription();
questionDescription = description == null ? null : description.getValue();
instructions = questionAttributes.getQuestionDetails().getInstructions();
visibilityMessages = questionAttributes.getVisibilityMessage();
questionType = questionAttributes.questionType;
numberOfEntitiesToGiveFeedbackTo = questionAttributes.numberOfEntitiesToGiveFeedbackTo;
this.isModeratedQuestion = isModeratedQuestion;
isRecipientNameHidden = questionAttributes.isRecipientNameHidden();
isGiverTeam = questionAttributes.giverType.equals(FeedbackParticipantType.TEAMS);
if (questionAttributes.recipientType.isTeam()) {
recipientType = RecipientType.TEAM;
} else if (questionAttributes.isRecipientAStudent()) {
recipientType = RecipientType.STUDENT;
} else if (questionAttributes.isRecipientInstructor()) {
recipientType = RecipientType.INSTRUCTOR;
}
setMessageToDisplayIfNoRecipientAvailable(questionAttributes);
}
示例4: getTextFromComment
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
public String getTextFromComment(Text commentText) {
String htmlText = commentText.getValue();
StringBuilder comment = new StringBuilder(200);
comment.append(Jsoup.parse(htmlText).text());
if (!(Jsoup.parse(htmlText).getElementsByTag("img").isEmpty())) {
comment.append("Images Link: ");
Elements ele = Jsoup.parse(htmlText).getElementsByTag("img");
for (Element element : ele) {
comment.append(element.absUrl("src") + ' ');
}
}
return SanitizationHelper.sanitizeForCsv(comment.toString());
}
示例5: sanitizeForRichText
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
/**
* Sanitizes the {@link Text} with rich-text.
* Removes disallowed elements based on defined policy.
* @return A new sanitized {@link Text} or null if the input was null.
*/
public static Text sanitizeForRichText(Text text) {
if (text == null || text.getValue() == null) {
return null;
}
return new Text(sanitizeForRichText(text.getValue()));
}
示例6: marshal
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
@Override
public String marshal(Text t) {
return (t == null) ? null : t.getValue();
}
示例7: JobRecord
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
/**
* Re-constitutes an instance of this class from a Data Store entity.
*
* @param entity
*/
public JobRecord(Entity entity) {
super(entity);
jobInstanceKey = (Key) entity.getProperty(JOB_INSTANCE_PROPERTY);
finalizeBarrierKey = (Key) entity.getProperty(FINALIZE_BARRIER_PROPERTY);
runBarrierKey = (Key) entity.getProperty(RUN_BARRIER_PROPERTY);
outputSlotKey = (Key) entity.getProperty(OUTPUT_SLOT_PROPERTY);
state = State.valueOf((String) entity.getProperty(STATE_PROPERTY));
exceptionHandlingAncestorKey =
(Key) entity.getProperty(EXCEPTION_HANDLING_ANCESTOR_KEY_PROPERTY);
Object exceptionHandlerSpecifiedProperty =
entity.getProperty(EXCEPTION_HANDLER_SPECIFIED_PROPERTY);
if (null != exceptionHandlerSpecifiedProperty) {
exceptionHandlerSpecified = (Boolean) exceptionHandlerSpecifiedProperty;
}
exceptionHandlerJobKey = (Key) entity.getProperty(EXCEPTION_HANDLER_JOB_KEY_PROPERTY);
Text exceptionHandlerGraphGuidText =
(Text) entity.getProperty(EXCEPTION_HANDLER_JOB_GRAPH_GUID_PROPERTY);
if (null != exceptionHandlerGraphGuidText) {
exceptionHandlerJobGraphGuid = exceptionHandlerGraphGuidText.getValue();
}
Object callExceptionHandlerProperty = entity.getProperty(CALL_EXCEPTION_HANDLER_PROPERTY);
if (null != callExceptionHandlerProperty) {
callExceptionHandler = (Boolean) callExceptionHandlerProperty;
}
Object ignoreExceptionProperty = entity.getProperty(IGNORE_EXCEPTION_PROPERTY);
if (null != ignoreExceptionProperty) {
ignoreException = (Boolean) ignoreExceptionProperty;
}
Text childGraphGuidText = (Text) entity.getProperty(CHILD_GRAPH_GUID_PROPERTY);
if (null != childGraphGuidText) {
childGraphGuid = childGraphGuidText.getValue();
}
exceptionKey = (Key) entity.getProperty(EXCEPTION_KEY_PROPERTY);
startTime = (Date) entity.getProperty(START_TIME_PROPERTY);
endTime = (Date) entity.getProperty(END_TIME_PROPERTY);
childKeys = (List<Key>) entity.getProperty(CHILD_KEYS_PROPERTY);
if (null == childKeys) {
childKeys = new LinkedList<>();
}
attemptNumber = (Long) entity.getProperty(ATTEMPT_NUM_PROPERTY);
maxAttempts = (Long) entity.getProperty(MAX_ATTEMPTS_PROPERTY);
backoffSeconds = (Long) entity.getProperty(BACKOFF_SECONDS_PROPERTY);
backoffFactor = (Long) entity.getProperty(BACKOFF_FACTOR_PROPERTY);
queueSettings.setOnBackend((String) entity.getProperty(ON_BACKEND_PROPERTY));
queueSettings.setOnModule((String) entity.getProperty(ON_MODULE_PROPERTY));
queueSettings.setModuleVersion((String) entity.getProperty(MODULE_VERSION_PROPERTY));
queueSettings.setOnQueue((String) entity.getProperty(ON_QUEUE_PROPERTY));
statusConsoleUrl = (String) entity.getProperty(STATUS_CONSOLE_URL);
rootJobDisplayName = (String) entity.getProperty(ROOT_JOB_DISPLAY_NAME);
}
示例8: buildIndex
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
public static int buildIndex(String group) throws IOException{
//Get all fences of group from DataStore.
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Key fenceKey = KeyFactory.createKey("Geofence", group);
Query query = new Query("Fence", fenceKey).addSort("id", Query.SortDirection.DESCENDING);
List<Entity> fencesFromStore = datastore.prepare(query).asList(FetchOptions.Builder.withDefaults());
if (!fencesFromStore.isEmpty()) {
//Create STRTree-Index.
STRtree index = new STRtree();
//Loop through the fences from DataStore.
for (Entity fenceFromStore : fencesFromStore) {
long id = (long) fenceFromStore.getProperty("id");
Gson gson = new Gson();
Text vText = (Text) fenceFromStore.getProperty("vertices");
String vString = vText.getValue();
double[][] vertices = gson.fromJson(vString, double[][].class);
//Store coordinates in an array.
Coordinate[] coordinates = new Coordinate[vertices.length];
int i = 0;
for(double[] point : vertices){
Coordinate coordinate = new Coordinate(point[0],point[1]);
coordinates[i++] = coordinate;
}
//Create polygon from the coordinates.
GeometryFactory fact = new GeometryFactory();
LinearRing linear = new GeometryFactory().createLinearRing(coordinates);
MyPolygon polygon = new MyPolygon(linear, null, fact, id);
//Add polygon to index.
index.insert(polygon.getEnvelopeInternal(), polygon);
}
//Build the index.
index.build();
//Write the index to Memcache.
MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService();
//Last param is expiration date. Set to null to keep it in Memcache forever.
syncCache.put(group, index, null);
}
return fencesFromStore.size();
}
示例9: isNullOrEmpty
import com.google.appengine.api.datastore.Text; //导入方法依赖的package包/类
/**
* Determine if an input text is null or empty.
*
* @param text Input text that might contain null, empty text or non-empty text
* @return True if the input text is null or empty; false, the otherwise
*/
public static boolean isNullOrEmpty(Text text) {
return (text == null || text.getValue() == null || text.getValue().isEmpty());
}