use of com.google.gerrit.common.data.GroupInfo in project gerrit by GerritCodeReview.
the class PermissionRuleEditor method setValue.
@Override
public void setValue(PermissionRule value) {
if (clickHandler != null) {
clickHandler.removeHandler();
clickHandler = null;
}
GroupReference ref = value.getGroup();
GroupInfo info = groupInfo != null && ref.getUUID() != null ? groupInfo.get(ref.getUUID()) : null;
boolean link;
if (ref.getUUID() != null && AccountGroup.isInternalGroup(ref.getUUID())) {
final String token = Dispatcher.toGroup(ref.getUUID());
groupNameLink.setText(ref.getName());
groupNameLink.setHref("#" + token);
groupNameLink.setTitle(info != null ? info.getDescription() : null);
groupNameLink.setTarget(null);
clickHandler = groupNameLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.preventDefault();
event.stopPropagation();
Gerrit.display(token);
}
});
link = true;
} else if (info != null && info.getUrl() != null) {
groupNameLink.setText(ref.getName());
groupNameLink.setHref(info.getUrl());
groupNameLink.setTitle(info.getDescription());
groupNameLink.setTarget("_blank");
link = true;
} else {
groupNameSpan.setInnerText(ref.getName());
groupNameSpan.setTitle(ref.getUUID() != null ? ref.getUUID().get() : "");
link = false;
}
deletedGroupName.setInnerText(ref.getName());
groupNameLink.setVisible(link);
UIObject.setVisible(groupNameSpan, !link);
}
use of com.google.gerrit.common.data.GroupInfo in project gerrit by GerritCodeReview.
the class ProjectAccessFactory method buildGroupInfo.
private Map<AccountGroup.UUID, GroupInfo> buildGroupInfo(List<AccessSection> local) {
Map<AccountGroup.UUID, GroupInfo> infos = new HashMap<>();
for (AccessSection section : local) {
for (Permission permission : section.getPermissions()) {
for (PermissionRule rule : permission.getRules()) {
if (rule.getGroup() != null) {
AccountGroup.UUID uuid = rule.getGroup().getUUID();
if (uuid != null && !infos.containsKey(uuid)) {
GroupDescription.Basic group = groupBackend.get(uuid);
infos.put(uuid, group != null ? new GroupInfo(group) : null);
}
}
}
}
}
return Maps.filterEntries(infos, in -> in.getValue() != null);
}
Aggregations