--- /dev/null
+/*******************************************************************************\r
+ * ============LICENSE_START====================================================\r
+ * * org.onap.aaf\r
+ * * ===========================================================================\r
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
+ * * ===========================================================================\r
+ * * 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
+ * * http://www.apache.org/licenses/LICENSE-2.0\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
+ * * See the License for the specific language governing permissions and\r
+ * * limitations under the License.\r
+ * * ============LICENSE_END====================================================\r
+ * *\r
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * *\r
+ ******************************************************************************/\r
+package org.onap.aaf.authz.gw.mapper;\r
+\r
+import org.onap.aaf.cadi.util.Vars;\r
+\r
+import gw.v1_0.Error;\r
+import gw.v1_0.InRequest;\r
+import gw.v1_0.Out;\r
+\r
+public class Mapper_1_0 implements Mapper<InRequest,Out,Error> {\r
+ \r
+ @Override\r
+ public Class<?> getClass(API api) {\r
+ switch(api) {\r
+ case IN_REQ: return InRequest.class;\r
+ case OUT: return Out.class;\r
+ case ERROR: return Error.class;\r
+ case VOID: return Void.class;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public <A> A newInstance(API api) {\r
+ switch(api) {\r
+ case IN_REQ: return (A) new InRequest();\r
+ case OUT: return (A) new Out();\r
+ case ERROR: return (A)new Error();\r
+ case VOID: return null;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ ////////////// Mapping Functions /////////////\r
+ @Override\r
+ public gw.v1_0.Error errorFromMessage(StringBuilder holder, String msgID, String text,String... var) {\r
+ Error err = new Error();\r
+ err.setMessageId(msgID);\r
+ // AT&T Restful Error Format requires numbers "%" placements\r
+ err.setText(Vars.convert(holder, text, var));\r
+ for(String s : var) {\r
+ err.getVariables().add(s);\r
+ }\r
+ return err;\r
+ }\r
+\r
+}\r