/Users/detro/workspace-nb/JAEBI/src/java/org/jaebi/server/service/XRequestCommandSelect.java

Vai alla documentazione di questo file.
00001 /*
00002  * XRequestCommandSelect.java
00003  *
00004  * Created on June 5, 2005, 7:13 PM
00005  * Created by Detro - 566/2145
00006  */
00007 
00008 package org.jaebi.server.service;
00009 
00010 import java.util.ArrayList;
00011 import java.util.HashMap;
00012 import org.jaebi.server.service.exception.BackEndHandlerGenericException;
00013 import org.jaebi.server.service.exception.BackEndHandlerSQLCreationException;
00014 import org.jaebi.server.service.exception.CommandExecException;
00015 import org.jaebi.server.service.exception.XRequestCommandInitException;
00016 import org.jaebi.server.service.xml.exception.JAXBXResponseFactoryBuildingException;
00017 import org.jaebi.server.service.xml.xrequest.Xrequest;
00018 
00025 public class XRequestCommandSelect extends XRequestCommand {
00026     
00028     public XRequestCommandSelect(Xrequest xrequestObj, BackEndHandlerImpl backEndHandler) 
00029         throws XRequestCommandInitException {
00030         
00031         super(xrequestObj, backEndHandler);
00032         
00033         /* Controlla se la Factory ha costruito 
00034          * l'XRequestCommand con l'Xrequest corretto */
00035         if ( !xrequestObj.getType().equalsIgnoreCase("select") ) {
00036             throw new XRequestCommandInitException(
00037                     exceptionPrefix + "Xrequest Type does not match");
00038         }
00039     }
00040     
00046     public Object execute() 
00047      throws CommandExecException {
00048      
00049         try {
00050             ArrayList columnsName = getColumnsName();
00051             HashMap whereValues = getWhereColumnsValue();
00052             
00053             // Verifica se ci sono Columns da inserire nella Select
00054             if ( columnsName.size() == 0 )
00055                 columnsName = null;
00056             
00057             // Verifica se ci sono condizioni di Where da inserire nella Select
00058             if ( whereValues.size() == 0 )
00059                 whereValues = null;
00060             
00061             return xresponseFactory.buildXresponse(
00062                         backEndHandler.select( 
00063                             getAffectedTable(), 
00064                             columnsName,
00065                             whereValues
00066                         )
00067                     );
00068         } catch ( JAXBXResponseFactoryBuildingException e ) {
00069             // Errore durante la creazione dell'XResponse
00070             try {
00071                 return xresponseFactory.buildXresponse(false, 
00072                         "Internal Error - " + e.getMessage() );
00073             } catch ( JAXBXResponseFactoryBuildingException otherE ) {
00074                 throw new CommandExecException( exceptionPrefix + otherE );
00075             }
00076         } catch ( BackEndHandlerGenericException e) {
00077             // Errore nel BackEnd
00078             try {
00079                 return xresponseFactory.buildXresponse(false, 
00080                         "BackEnd Error - " + e.getMessage() );
00081             } catch ( JAXBXResponseFactoryBuildingException otherE ) {
00082                 throw new CommandExecException( exceptionPrefix + otherE );
00083             }
00084         } catch ( BackEndHandlerSQLCreationException sqle) {
00085             // Errore nel BackEndHandler durante la creazione dell'SQL
00086             try {
00087                 return xresponseFactory.buildXresponse(false, 
00088                         "Error in Submitted Data - " + sqle.getMessage() );
00089             } catch ( JAXBXResponseFactoryBuildingException otherE ) {
00090                 throw new CommandExecException( exceptionPrefix + otherE );
00091             }
00092         }
00093     }
00094     
00095 }

Generato il Mon Jun 27 22:50:38 2005 per JAEBI - JAva Enterprice BackEnd Interfacement da  doxygen 1.4.3