My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Copyright 2012 stanislawbartkowski@gmail.com
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.javahotel.db.copy;

import com.javahotel.common.toobject.InvoiceP;
import com.javahotel.db.context.ICommandContext;
import com.javahotel.db.hotelbase.jpa.Invoice;
import com.javahotel.db.jtypes.ToLD;
import com.javahotel.db.util.HotelChangeXMLToMap;
import com.javahotel.db.util.HotelCreateXML;
import com.javahotel.db.util.HotelVerifyXML;
import com.javahotel.dbres.exceptions.HotelException;
import com.javahotel.dbres.messid.IMessId;
import com.javahotel.dbres.resources.IMess;

/**
* @author hotel
*
*/
class CopyInvoice {

static void copy(final ICommandContext iC, InvoiceP sou, Invoice dest) {
if (sou.getBooking() == null) {
iC.logFatal(IMessId.NULLBOOKINGINVOICE);
}
if (sou.getCustomer() == null) {
iC.logFatal(IMessId.NULLCUSTOMERINVOICE, sou.getBooking());
}
CopyHelper.setPattName(iC, sou, IMess.INVOICEPATTID, IMess.INVOICEPATT);
CopyHelper.copyDict1(iC, sou, dest, FieldList.InvoiceList);
CopyHelper.checkPersonDateOp(iC, dest);
CopyHelper.copyCustomer(iC, sou, dest);
CopyHelper.copyBooking(iC, sou, dest);
sou.getInvoiceD().getdFields()
.put(InvoiceP.INVOICENUMBER, sou.getName());
String xml = HotelCreateXML.constructXMLFile(iC, IMess.INVOICEPATTERN,
sou.getInvoiceD());
boolean ok = false;
if (xml != null && HotelVerifyXML.verify(iC, xml, IMess.INVOICEXSD)) {
ok = true;
}
if (!ok) {
iC.getLog().getL().info(xml);
String mess = iC.logEvent(IMessId.INPROPERINVOICEXML,
dest.getName(), IMess.INVOICEXSD);
throw new HotelException(mess);
}
dest.setInvoiceXML(xml);
}

static void copy(final ICommandContext iC, Invoice sou, InvoiceP dest) {
CopyHelper.copyDict2(iC, sou, dest, FieldList.InvoiceList);
HotelChangeXMLToMap.constructMapFromXML(iC, dest.getInvoiceD(),
sou.getInvoiceXML());
String i = (String) dest.getInvoiceD().getdFields()
.get(InvoiceP.INVOICENUMBER);
dest.setName(i);
dest.setCustomer(ToLD.toLId(sou.getCustomer().getId()));
dest.setBooking(ToLD.toLId(sou.getBooking().getId()));
}

}

Change log

r525 by stanislawbartkowski on Jan 1, 2012   Diff
[No log message]
Go to: 
Project members, sign in to write a code review

Older revisions

r507 by stanislawbartkowski on Dec 26, 2011   Diff
Changes related to invoice making
r500 by stanislawbartkowski on Dec 11, 2011   Diff
Huge changes related to XML objects
and invoice making
All revisions of this file

File info

Size: 2902 bytes, 72 lines

File properties

svn:mime-type
text/plain
Powered by Google Project Hosting