use of com.alibaba.dubbo.registry.common.domain.Owner in project dubbo by alibaba.
the class OwnerServiceImpl method toOverrideLiset.
private List<Owner> toOverrideLiset(List<Provider> pList, List<Override> cList) {
Map<String, Owner> oList = new HashMap<String, Owner>();
for (Provider p : pList) {
if (p.getUsername() != null) {
for (String username : Constants.COMMA_SPLIT_PATTERN.split(p.getUsername())) {
Owner o = new Owner();
o.setService(p.getService());
o.setUsername(username);
oList.put(o.getService() + "/" + o.getUsername(), o);
}
}
}
for (Override c : cList) {
Map<String, String> params = StringUtils.parseQueryString(c.getParams());
String usernames = params.get("owner");
if (usernames != null && usernames.length() > 0) {
for (String username : Constants.COMMA_SPLIT_PATTERN.split(usernames)) {
Owner o = new Owner();
o.setService(c.getService());
o.setUsername(username);
oList.put(o.getService() + "/" + o.getUsername(), o);
}
}
}
return new ArrayList<Owner>(oList.values());
}
use of com.alibaba.dubbo.registry.common.domain.Owner in project dubbo by alibaba.
the class Owners method delete.
public boolean delete(Long[] ids, Map<String, Object> context) {
String service = (String) context.get("service");
String username = (String) context.get("username");
Owner owner = new Owner();
owner.setService(service);
owner.setUsername(username);
if (service == null || service.length() == 0 || username == null || username.length() == 0) {
context.put("message", getMessage("NoSuchOperationData"));
return false;
}
if (!super.currentUser.hasServicePrivilege(service)) {
context.put("message", getMessage("HaveNoServicePrivilege", service));
return false;
}
ownerService.deleteOwner(owner);
return true;
}