本文整理了Java中org.apache.streams.pojo.json.Activity.getId()
方法的一些代码示例,展示了Activity.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getId()
方法的具体详情如下:
包路径:org.apache.streams.pojo.json.Activity
类名称:Activity
方法名:getId
[英]Uniquely identifies each activity within the service (Required)
[中]唯一标识服务中的每个活动(必需)
代码示例来源:origin: apache/streams
public String getId() {
if (this.id == null && this.document instanceof Activity) {
return ((Activity)this.document).getId();
}
return id;
}
代码示例来源:origin: apache/streams
private static void fixActivityId(Activity activity) {
if (activity.getId() != null && activity.getId().matches("\\{[a-z]*\\}")) {
activity.setId(null);
}
}
代码示例来源:origin: apache/streams
@Override
public List<StreamsDatum> process(StreamsDatum datum) {
List<StreamsDatum> datums = new LinkedList<>();
if (datum.getDocument() instanceof ObjectNode) {
Activity activity = this.serializer.deserialize((ObjectNode) datum.getDocument());
datums.add(new StreamsDatum(activity, activity.getId(), DateTime.now().withZone(DateTimeZone.UTC)));
successCount ++;
} else {
failCount ++;
throw new NotImplementedException("Not implemented for class type : " + datum.getDocument().getClass().toString());
}
LOGGER.debug("Processor current success count: {} and current fail: {}", successCount, failCount);
return datums;
}
代码示例来源:origin: apache/streams
@Override
public List<StreamsDatum> process(StreamsDatum entry) {
StreamsDatum result = null;
try {
Object item = entry.getDocument();
LOGGER.debug("{} processing {}", STREAMS_ID, item.getClass());
//Get G+ activity ID from our own activity ID
if (item instanceof Activity) {
Activity activity = (Activity) item;
String activityId = getGPlusID(activity.getId());
//Call Google Plus API to get list of comments for this activity ID
/* TODO: FILL ME OUT WITH THE API CALL **/
List<Comment> comments = new ArrayList<>();
GooglePlusActivityUtil.updateActivity(comments, activity);
result = new StreamsDatum(activity);
}
} catch (Exception ex) {
ex.printStackTrace();
LOGGER.error("Exception while converting Comment to Activity: {}", ex.getMessage());
}
if ( result != null ) {
return Stream.of(result).collect(Collectors.toList());
} else {
return new ArrayList<>();
}
}
代码示例来源:origin: apache/streams
@Override
public List<StreamsDatum> process(StreamsDatum entry) {
List<StreamsDatum> result = new LinkedList<>();
Object document = entry.getDocument();
try {
// first determine which classes this document might actually be
List<Activity> activityList = converterUtil.convert(document);
for (Activity activity : activityList) {
StreamsDatum datum = DatumUtils.cloneDatum(entry);
datum.setId(activity.getId());
datum.setDocument(activity);
result.add(datum);
}
} catch (Exception ex) {
LOGGER.warn("General exception in process! " + ex.getMessage());
}
return result;
}
代码示例来源:origin: apache/streams
/**
* Check validity of Activity.
* @param activity Activity
* @return isValid
*/
public static boolean isValid(Activity activity) {
return activity != null
&& activity.getId() != null
&& activity.getVerb() != null
&& activity.getProvider() != null
&& activity.getProvider().getId() != null;
}
内容来源于网络,如有侵权,请联系作者删除!