Search in sources :

Example 1 with FeedsScope

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;
}
Also used : EasyEntity(com.rebuild.core.metadata.easymeta.EasyEntity) JSONObject(com.alibaba.fastjson.JSONObject) FeedsScope(com.rebuild.core.service.feeds.FeedsScope) Team(cn.devezhao.bizz.security.member.Team) ID(cn.devezhao.persist4j.engine.ID)

Aggregations

Team (cn.devezhao.bizz.security.member.Team)1 ID (cn.devezhao.persist4j.engine.ID)1 JSONObject (com.alibaba.fastjson.JSONObject)1 EasyEntity (com.rebuild.core.metadata.easymeta.EasyEntity)1 FeedsScope (com.rebuild.core.service.feeds.FeedsScope)1