Search in sources :

Example 1 with DataCollection

use of org.apache.shindig.protocol.DataCollection in project liferay-ide by liferay.

the class LiferayAppDataService method doGetPersonData.

protected DataCollection doGetPersonData(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, SecurityToken securityToken) throws Exception {
    long companyId = getCompanyId(securityToken);
    Map<String, Map<String, String>> peopleAppData = new HashMap<String, Map<String, String>>();
    List<ExpandoColumn> expandoColumns = getExpandoColumns(companyId, appId);
    if (expandoColumns == null) {
        return null;
    }
    if (fields.isEmpty()) {
        fields = new LinkedHashSet<String>();
        for (ExpandoColumn expandoColumn : expandoColumns) {
            fields.add(expandoColumn.getName());
        }
    }
    for (UserId userId : userIds) {
        String userIdString = userId.getUserId(securityToken);
        long userIdLong = GetterUtil.getLong(userIdString);
        Map<String, String> personAppData = new HashMap<String, String>();
        for (String field : fields) {
            String value = getExpandoValue(companyId, appId, userIdLong, getColumnName(appId, field));
            personAppData.put(field, value);
        }
        peopleAppData.put(userIdString, personAppData);
    }
    return new DataCollection(peopleAppData);
}
Also used : HashMap(java.util.HashMap) DataCollection(org.apache.shindig.protocol.DataCollection) ExpandoColumn(com.liferay.portlet.expando.model.ExpandoColumn) UserId(org.apache.shindig.social.opensocial.spi.UserId) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

ExpandoColumn (com.liferay.portlet.expando.model.ExpandoColumn)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 DataCollection (org.apache.shindig.protocol.DataCollection)1 UserId (org.apache.shindig.social.opensocial.spi.UserId)1