* * Licensed under the Apache License, Version 2.0 (the "License");\r
* * you may not use this file except in compliance with the License.\r
* * You may obtain a copy of the License at\r
- * * \r
+ * *\r
* * http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
+ * *\r
* * Unless required by applicable law or agreed to in writing, software\r
* * distributed under the License is distributed on an "AS IS" BASIS,\r
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
*\r
*/\r
public class AuthRespImpl implements AuthorizationResponse {\r
- private boolean authorized;\r
- private List<AuthorizationResponseSupplement> advice;\r
- private List<AuthorizationResponseSupplement> obligations;\r
- \r
- /** Constructor. This version will not be used in Data Router R1 since we will not have advice and obligations.\r
- * \r
- * @param authorized flag indicating whether the response carried a permit response (<code>true</code>) \r
- * or something else (<code>false</code>).\r
- * @param advice list of advice elements returned in the response.\r
- * @param obligations list of obligation elements returned in the response.\r
- */\r
- public AuthRespImpl(boolean authorized, List<AuthorizationResponseSupplement> advice, List<AuthorizationResponseSupplement> obligations) {\r
- this.authorized = authorized;\r
- this.advice = (advice == null ? null : new ArrayList<AuthorizationResponseSupplement> (advice));\r
- this.obligations = (obligations == null ? null : new ArrayList<AuthorizationResponseSupplement> (obligations));\r
- }\r
- \r
- /** Constructor. Simple version for authorization responses that have no advice and no obligations.\r
- * \r
- * @param authorized flag indicating whether the response carried a permit (<code>true</code>) or something else (<code>false</code>).\r
- */\r
- public AuthRespImpl(boolean authorized) {\r
- this(authorized, null, null);\r
- }\r
+ private boolean authorized;\r
+ private List<AuthorizationResponseSupplement> advice;\r
+ private List<AuthorizationResponseSupplement> obligations;\r
+\r
+ /** Constructor. This version will not be used in Data Router R1 since we will not have advice and obligations.\r
+ *\r
+ * @param authorized flag indicating whether the response carried a permit response (<code>true</code>)\r
+ * or something else (<code>false</code>).\r
+ * @param advice list of advice elements returned in the response.\r
+ * @param obligations list of obligation elements returned in the response.\r
+ */\r
+ private AuthRespImpl(boolean authorized, List<AuthorizationResponseSupplement> advice,\r
+ List<AuthorizationResponseSupplement> obligations) {\r
+ this.authorized = authorized;\r
+ this.advice = (advice == null ? null : new ArrayList<>(advice));\r
+ this.obligations = (obligations == null ? null : new ArrayList<>(obligations));\r
+ }\r
+\r
+ /** Constructor. Simple version for authorization responses that have no advice and no obligations.\r
+ *\r
+ * @param authorized flag indicating whether the response carried a permit (<code>true</code>)\r
+ * or something else (<code>false</code>).\r
+ */\r
+ AuthRespImpl(boolean authorized) {\r
+ this(authorized, null, null);\r
+ }\r
\r
- /**\r
- * Indicates whether the request is authorized or not.\r
- * \r
- * @return a boolean flag that is <code>true</code> if the request is permitted, and <code>false</code> otherwise.\r
- */\r
- @Override\r
- public boolean isAuthorized() {\r
- return authorized;\r
- }\r
+ /**\r
+ * Indicates whether the request is authorized or not.\r
+ *\r
+ * @return a boolean flag that is <code>true</code> if the request is permitted, and <code>false</code> otherwise.\r
+ */\r
+ @Override\r
+ public boolean isAuthorized() {\r
+ return authorized;\r
+ }\r
\r
- /**\r
- * Returns any advice elements that were included in the authorization response.\r
- * \r
- * @return A list of objects implementing the <code>AuthorizationResponseSupplement</code> interface, with each object representing an\r
- * advice element from the authorization response.\r
- */\r
- @Override\r
- public List<AuthorizationResponseSupplement> getAdvice() {\r
- return advice;\r
- }\r
+ /**\r
+ * Returns any advice elements that were included in the authorization response.\r
+ *\r
+ * @return A list of objects implementing the <code>AuthorizationResponseSupplement</code> interface,\r
+ * with each object representing an advice element from the authorization response.\r
+ */\r
+ @Override\r
+ public List<AuthorizationResponseSupplement> getAdvice() {\r
+ return advice;\r
+ }\r
\r
- /**\r
- * Returns any obligation elements that were included in the authorization response.\r
- * \r
- * @return A list of objects implementing the <code>AuthorizationResponseSupplement</code> interface, with each object representing an\r
- * obligation element from the authorization response.\r
- */\r
- @Override\r
- public List<AuthorizationResponseSupplement> getObligations() {\r
- return obligations;\r
- }\r
+ /**\r
+ * Returns any obligation elements that were included in the authorization response.\r
+ *\r
+ * @return A list of objects implementing the <code>AuthorizationResponseSupplement</code> interface,\r
+ * with each object representing an obligation element from the authorization response.\r
+ */\r
+ @Override\r
+ public List<AuthorizationResponseSupplement> getObligations() {\r
+ return obligations;\r
+ }\r
\r
}\r