return ApiDBUtils.newUserResponse(vUser);
}
@Override
public DomainResponse createDomainResponse(Domain domain) {
DomainResponse domainResponse = new DomainResponse();
domainResponse.setDomainName(domain.getName());
domainResponse.setId(domain.getUuid());
domainResponse.setLevel(domain.getLevel());
domainResponse.setNetworkDomain(domain.getNetworkDomain());
Domain parentDomain = ApiDBUtils.findDomainById(domain.getParent());
if (parentDomain != null) {
domainResponse.setParentDomainId(parentDomain.getUuid());
}
StringBuilder domainPath = new StringBuilder("ROOT");
(domainPath.append(domain.getPath())).deleteCharAt(domainPath.length() - 1);
domainResponse.setPath(domainPath.toString());
if (domain.getParent() != null) {
domainResponse.setParentDomainName(ApiDBUtils.findDomainById(domain.getParent()).getName());
}
if (domain.getChildCount() > 0) {
domainResponse.setHasChild(true);
}
domainResponse.setObjectName("domain");
return domainResponse;
}