Update templates for new abstraction method.
authorJason Stephenson <jason@sigio.com>
Fri, 8 Aug 2014 13:59:37 +0000 (09:59 -0400)
committerJason Stephenson <jason@sigio.com>
Fri, 8 Aug 2014 13:59:37 +0000 (09:59 -0400)
Signed-off-by: Jason Stephenson <jason@sigio.com>
templates/includes/LookupVersionResponse.inc
templates/includes/ResponseHeader.inc [new file with mode: 0644]
templates/includes/data.inc [new file with mode: 0644]
templates/includes/problem.inc [new file with mode: 0644]
templates/problem.tt [deleted file]
templates/response.tt

index 7e9e888..676e8ad 100644 (file)
@@ -1,5 +1,5 @@
-[% FOREACH version IN versions %]
+[% FOREACH version IN data.versions -%]
 <VersionSupported>
-[% version %]
+[%- version -%]
 </VersionSupported>
-[% END %]
+[% END -%]
diff --git a/templates/includes/ResponseHeader.inc b/templates/includes/ResponseHeader.inc
new file mode 100644 (file)
index 0000000..78f69ea
--- /dev/null
@@ -0,0 +1,12 @@
+<ResponseHeader>
+<FromAgencyId>
+<AgencyId>
+[% header.FromAgencyId.AgencyId %]
+</AgencyId>
+</FromAgencyId>
+<ToAgencyId>
+<AgencyId>
+[% header.ToAgencyId.AgencyId %]
+</AgencyId>
+</ToAgencyId>
+</ResponseHeader>
diff --git a/templates/includes/data.inc b/templates/includes/data.inc
new file mode 100644 (file)
index 0000000..1c05de3
--- /dev/null
@@ -0,0 +1,6 @@
+<[% type %]>
+[%
+    myfile = "includes/$type" _ ".inc";
+    INCLUDE $myfile
+-%]
+</[% type %]>
diff --git a/templates/includes/problem.inc b/templates/includes/problem.inc
new file mode 100644 (file)
index 0000000..8dd0dc6
--- /dev/null
@@ -0,0 +1,14 @@
+<Problem>
+<ProblemType>
+[% problem.ProblemType %]
+</ProblemType>
+<ProblemDetail>
+[% problem.ProblemDetail %]
+</ProblemDetail>
+<ProblemElement>
+[% problem.ProblemElement %]
+</ProblemElement>
+<ProblemValue>
+[% problem.ProblemValue %]
+</ProblemValue>
+</Problem>
diff --git a/templates/problem.tt b/templates/problem.tt
deleted file mode 100644 (file)
index 1dd2fea..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-[%# INCLUDE 'includes/header.inc' %]
-  <[% messagetype %]>
-    [% IF processingerror %]
-    <Problem>
-      <ProcessingError>
-        [% FOREACH errormessage IN processingerrortype.keys %]
-          <ProcessingErrorType>
-            <Value>
-            [% SWITCH errormessage %]
-              [% CASE 'BadBarcode' %]
-                We could not find an item with that barcode
-              [% CASE 'NotIssued' %]
-                The item is not on loan
-              [% CASE 'RESERVED' %]
-                The item is on hold for another borrower
-              [% CASE 'RENEW_ISSUE' %]
-                This item is already on loan to this borrower
-              [% CASE 'NO_HOLD' %]
-                There is no hold on this item
-              [% CASE 'NO_HOLD_BORROWER' %]
-                 We can not place a hold, we have no borrower information
-              [% CASE 'Wrongbranch' %]
-                 We are trying to check this item in at the wrong branch
-              [% CASE 'BORROWER_NOT_FOUND' %]
-                We can not place a request, we have no borrower information
-              [% CASE 'ITEM_NOT_FOUND' %]
-                 We can not place a request, we have no item information
-              [% CASE 'ITEMNOTSAMEBRANCH' %]
-                 Circulation rules stop this borrower from checking out this item, the borrower and item are not from the same branch
-              [% END %]
-               
-          </Value>
-        </ProcessingErrorType>
-        [% END %]
-     [% END %]
-        <ProcessingErrorElement>
-          <ElementName>[% processingerrorelement | xml %]</ElementName>
-          <ProcessingErrorValue>[% barcode | xml %]</ProcessingErrorValue>
-        </ProcessingErrorElement>
-      </ProcessingError> 
-      <ProblemDetail>[% error_detail | xml %]</ProblemDetail>
-    </Problem>
-  </[% messagetype %]>
-
index 0c77300..d400d4e 100644 (file)
@@ -1,14 +1,9 @@
-   <[% messagetype %]>
-       <ResponseHeader>
-            <FromAgencyId>
-              <AgencyId>[% fromagency | trim%]</AgencyId>
-            </FromAgencyId>
-            <ToAgencyId>
-               <AgencyId>[% toagency | trim %]</AgencyId>
-            </ToAgencyId>
-        </ResponseHeader>
-    [% myfile = "includes/$messagetype" _ ".inc" %]
-    [% INCLUDE $myfile %]    
-    </[% messagetype %]>
-
-
+[% IF header;
+      INCLUDE "includes/ResponseHeader.inc";
+   END;
+   IF data;
+      INCLUDE "includes/data.inc";
+   ELSIF problem;
+      INCLUDE "includes/problem.inc";
+   END;
+-%]