[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/core/report ErrorChunk.java,NONE,1.1 IDRSHead.j
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2002-09-09 21:27:48
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report
In directory usw-pr-cvs1:/tmp/cvs-serv10950/src/net/sourceforge/idrs/core/report
Modified Files:
IDRSHead.java
Added Files:
ErrorChunk.java
Log Message:
added transaction support and new form handling
--- NEW FILE: ErrorChunk.java ---
/*
ErrorChunk.java
Copyright (C) 2001 Marc Boorshtein
The contents of this file are subject to the Mozilla Public License Version 1.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.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License.
*/
package net.sourceforge.idrs.core.report;
import java.io.Serializable;
/**
Encapsulates any error text found in an RML page
*/
public class ErrorChunk implements Chunk, Serializable {
//static final long serialVersionUID = -8639937515957851296L;
/**
Initializes the Chunk
@param text Text to be stored
*/
public ErrorChunk() {
}
/**
Returns the text stored
@param head IDRSHead for report
*/
public String toString(IDRSHead head) throws Exception {
String err;
err = (String) head.getRequest().getAttribute("doc_Error");
return (err != null) ? err : "";
}
}
Index: IDRSHead.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/IDRSHead.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** IDRSHead.java 22 Aug 2002 20:06:33 -0000 1.10
--- IDRSHead.java 9 Sep 2002 21:27:44 -0000 1.11
***************
*** 21,26 ****
--- 21,29 ----
protected HashMap varNames;
protected HashMap pos;
+ protected transient HashMap trans;
protected String[] objNames, dbNames;
+
+
protected transient boolean send = true;
static final long serialVersionUID = -4520281654183459125L;
***************
*** 147,150 ****
--- 150,156 ----
this.digest = digest;
+ if (this.trans == null) this.trans = new HashMap();
+ trans.clear();
+
this.userInfo=userInfo;
this.idrs = context;
***************
*** 245,248 ****
--- 251,258 ----
}
+ //we've made it this far, commit all changes
+ commitAllTransactions();
+
+
***************
*** 638,667 ****
}
! /*
/**
*Creates an error in the request
*@param err as string
! /
public void createError(String err) {
request.setAttribute(ERR_NAME,err);
}
/**
*Determines if there is an error
*@return true if there is an error
! /
public boolean isError() {
return request.getAttribute(ERR_NAME) != null;
}
/**
*Retrieves the error
! /
public String getError() {
return (String) request.getAttribute(ERR_NAME);
}
! */
}
--- 648,721 ----
}
!
/**
*Creates an error in the request
*@param err as string
! */
public void createError(String err) {
+ System.out.println("Error 1: " + err);
request.setAttribute(ERR_NAME,err);
+ System.out.println("Error 2: " + request.getAttribute(ERR_NAME));
}
+
/**
*Determines if there is an error
*@return true if there is an error
! */
public boolean isError() {
+ System.out.println("Error : " + request.getAttribute(ERR_NAME));
return request.getAttribute(ERR_NAME) != null;
}
+
/**
*Retrieves the error
! */
public String getError() {
return (String) request.getAttribute(ERR_NAME);
}
! public void commitAllTransactions() throws Exception {
! Iterator it = trans.keySet().iterator();
!
! Connection con;
! while (it.hasNext()) {
! con = (Connection) trans.get((String) it.next());
! con.commit();
! it.remove();
! }
! }
!
! public void rollbackAllTransactions() throws Exception {
! Iterator it = trans.keySet().iterator();
!
! Connection con;
! while (it.hasNext()) {
! con = (Connection) trans.get(it.next());
! con.rollback();
! it.remove();
! }
! }
!
! public void addTransaction(String conName) throws Exception {
! if (trans.get(conName) == null) {
! Connection con = (Connection) conns.get(conName);
! con.setAutoCommit(false);
! trans.put(conName,con);
! }
! }
!
! public void setPageSize(String db, int size) throws Exception {
! ((DB) dbs.get(db)).setNumRecs(size);
! }
!
! public void setPageFirst(String db, int startWith) throws Exception {
! ((DB) dbs.get(db)).startWith(startWith);
! }
!
!
!
}
|