add roles to label

This commit is contained in:
Shinsuke Sugaya 2015-10-17 09:11:50 +09:00
parent bb6579614e
commit c1120d5745
2 changed files with 13 additions and 2 deletions

View file

@ -191,7 +191,19 @@ public class LabelTypeService implements Serializable {
}
public OptionalEntity<LabelType> getLabelType(final String id) {
return labelTypeBhv.selectByPK(id);
return labelTypeBhv.selectByPK(id).map(entity -> {
final List<LabelToRole> wctrtmList = labelToRoleBhv.selectList(wctrtmCb -> {
wctrtmCb.query().setLabelTypeId_Equal(entity.getId());
});
if (!wctrtmList.isEmpty()) {
final List<String> roleTypeIds = new ArrayList<String>(wctrtmList.size());
for (final LabelToRole mapping : wctrtmList) {
roleTypeIds.add(mapping.getRoleTypeId());
}
entity.setRoleTypeIds(roleTypeIds.toArray(new String[roleTypeIds.size()]));
}
return entity;
});
}
}

View file

@ -16,7 +16,6 @@
package org.codelibs.fess.app.web.admin.labeltype;
import javax.annotation.Resource;
import org.codelibs.fess.Constants;