use of com.rebuild.core.service.feeds.FeedsScope in project rebuild by getrebuild.
the class FeedsListController method buildItem.
private JSONObject buildItem(Object[] o, ID user) {
JSONObject item = formatBase(o, user);
FeedsScope scope = FeedsScope.parse((String) o[7]);
item.put("scopeRaw", o[7]);
if (scope == FeedsScope.GROUP) {
Team team = Application.getUserStore().getTeam(ID.valueOf((String) o[7]));
item.put("scope", new Object[] { team.getIdentity(), team.getName() });
} else {
item.put("scope", Language.L(scope.getName()));
}
item.put("type", o[8]);
item.put("numComments", FeedsHelper.getNumOfComment((ID) o[0]));
// 相关记录
ID related = (ID) o[9];
if (related != null && MetadataHelper.containsEntity(related.getEntityCode())) {
EasyEntity entity = EasyMetaFactory.valueOf(related.getEntityCode());
String nameValue = FieldValueHelper.getLabelNotry(related);
JSONObject mixValue = FieldValueHelper.wrapMixValue(related, nameValue);
mixValue.put("icon", entity.getIcon());
mixValue.put("entityLabel", entity.getLabel());
item.put("relatedRecord", mixValue);
}
// 更多内容
if (o[10] != null) {
item.put("contentMore", JSON.parse((String) o[10]));
}
return item;
}
Aggregations