comparison gwt-client/src/main/java/org/dive4elements/river/client/server/auth/UserClient.java @ 8203:238fc722f87a

sed 's/logger/log/g' src/**/*.java
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 13:19:22 +0200
parents ea9eef426962
children 8c64617a7991 0a5239a1e46e
comparison
equal deleted inserted replaced
8202:e4606eae8ea5 8203:238fc722f87a
28 * UserClient is a class to allow easier communication 28 * UserClient is a class to allow easier communication
29 * with the REST based artifact user protocol 29 * with the REST based artifact user protocol
30 */ 30 */
31 public class UserClient { 31 public class UserClient {
32 32
33 private static final Logger logger = Logger.getLogger(UserClient.class); 33 private static final Logger log = Logger.getLogger(UserClient.class);
34 34
35 private String url; 35 private String url;
36 36
37 public UserClient(String url) { 37 public UserClient(String url) {
38 this.url = url; 38 this.url = url;
57 return account.equals(user.getAccount()); 57 return account.equals(user.getAccount());
58 } 58 }
59 59
60 public boolean createUser(User user) throws ConnectionException { 60 public boolean createUser(User user) throws ConnectionException {
61 if(user == null) { 61 if(user == null) {
62 logger.warn("createUser: given user is null"); 62 log.warn("createUser: given user is null");
63 return false; 63 return false;
64 } 64 }
65 65
66 logger.debug("Creating new user " + user.getName()); 66 log.debug("Creating new user " + user.getName());
67 HttpClient client = new HttpClientImpl(this.url); 67 HttpClient client = new HttpClientImpl(this.url);
68 68
69 Document document = XMLUtils.newDocument(); 69 Document document = XMLUtils.newDocument();
70 70
71 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( 71 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
87 artuser.appendChild(account); 87 artuser.appendChild(account);
88 action.appendChild(type); 88 action.appendChild(type);
89 action.appendChild(artuser); 89 action.appendChild(artuser);
90 document.appendChild(action); 90 document.appendChild(action);
91 91
92 logger.debug("Create user request xml: " + XMLUtils.toString(document)); 92 log.debug("Create user request xml: " + XMLUtils.toString(document));
93 93
94 Document resp = client.createUser(document); 94 Document resp = client.createUser(document);
95 95
96 logger.debug("Create user response xml: " + XMLUtils.toString(resp)); 96 log.debug("Create user response xml: " + XMLUtils.toString(resp));
97 97
98 String XPATH_RESPONSE = "/art:result"; 98 String XPATH_RESPONSE = "/art:result";
99 Node nresult = (Node) XMLUtils.xpath( 99 Node nresult = (Node) XMLUtils.xpath(
100 resp, 100 resp,
101 XPATH_RESPONSE, 101 XPATH_RESPONSE,
143 143
144 action.appendChild(type); 144 action.appendChild(type);
145 action.appendChild(account); 145 action.appendChild(account);
146 document.appendChild(action); 146 document.appendChild(action);
147 147
148 boolean debug = logger.isDebugEnabled(); 148 boolean debug = log.isDebugEnabled();
149 149
150 if (debug) { 150 if (debug) {
151 logger.debug("Find user request xml: " + 151 log.debug("Find user request xml: " +
152 XMLUtils.toString(document)); 152 XMLUtils.toString(document));
153 } 153 }
154 154
155 Document resp = client.findUser(document); 155 Document resp = client.findUser(document);
156 156
157 if (debug) { 157 if (debug) {
158 logger.debug("Find user request response xml: " + 158 log.debug("Find user request response xml: " +
159 XMLUtils.toString(resp)); 159 XMLUtils.toString(resp));
160 } 160 }
161 161
162 return resp.getDocumentElement(); 162 return resp.getDocumentElement();
163 } 163 }

http://dive4elements.wald.intevation.org