From f9b608ef9717ba3b3f1893c762c9245331051e34 Mon Sep 17 00:00:00 2001 From: guido Date: Tue, 28 May 2013 12:29:24 +0200 Subject: [PATCH] [STRUTS] Actions refactoring -Deleted all unused Struts code -Deleted installer folder -Minor code formatting refactoring --- .gitignore | 3 +- installer/README_INSTALL | 39 ---- installer/data/f2b.sed | 1 - installer/data/newuser.sql | 9 - installer/data/solr.properties | 2 - installer/install.sh | 288 ------------------------- src/action/ConventionAction.java | 175 +-------------- src/action/ExportAction.java | 9 - src/action/ExtraAction.java | 137 ------------ src/action/ExtraPriceListAction.java | 3 - src/action/FacilityAction.java | 2 - src/action/GuestAction.java | 249 +--------------------- src/action/HelpAction.java | 11 +- src/action/HomeAction.java | 1 - src/action/ImageAction.java | 2 - src/action/LocaleAction.java | 2 - src/action/LogoutAction.java | 16 +- src/action/OnlineBookingAction.java | 10 - src/action/RoomAction.java | 305 --------------------------- src/action/RoomFacilityAction.java | 93 -------- src/action/RoomPriceListAction.java | 11 +- src/action/RoomTypeAction.java | 204 +----------------- src/action/SeasonAction.java | 148 ------------- src/action/StructureAction.java | 45 +--- 24 files changed, 13 insertions(+), 1752 deletions(-) delete mode 100644 installer/README_INSTALL delete mode 100644 installer/data/f2b.sed delete mode 100644 installer/data/newuser.sql delete mode 100644 installer/data/solr.properties delete mode 100755 installer/install.sh diff --git a/.gitignore b/.gitignore index 9b1c8b13..1cf5c591 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/dist +/Locanda_target +/target diff --git a/installer/README_INSTALL b/installer/README_INSTALL deleted file mode 100644 index d2f5e038..00000000 --- a/installer/README_INSTALL +++ /dev/null @@ -1,39 +0,0 @@ -ENGLISH -Instructions for installation on a Linux environment: - --Check the correct installation of the packages -with all dependencies- needed to execute Locanda: - - Oracle Java JRE (version 7 recommended) - - Apache Tomcat (version 7 recommended) - - MySQL (version 5.1 or above) or HyperSQL (included in this package) - Note: Locanda is able to use both MySQL and HSQL, you can choose your favourite platform - - A web browser that supports Javascript. Google Chrome or Mozilla Firefox recommended - --Check that Tomcat and MySQL (if used) servers are up and running - --If you have chosen HSQL you need to start the HSQL server and setup the database. Please refer to the documentation in the HSQL directory. - --Import the locanda database from "locanda.sql" dump file (MySQL only. HSQL installation is ready with the database) - --Run the installation script "install.sh" - --The application is now available at the URL "http://localhost:8080/locanda". - - - -ITALIANO -Istruzioni per l'installazione in ambiente Linux: - --Assicurarsi di avere nel sistema i pacchetti, con tutte le dipendenze, necessari ad eseguire Locanda: - - Oracle Java JRE (versione 7 consigliata) - - Apache Tomcat (versione 7 consigliata) - - MySQL (versione 5.1 o superiore) o HyperSQL (incluso in questo pacchetto) - Nota: Locanda può utilizzare sia MySQL che HSQL, scegliete quello che più vi piace - - Un browser web che supporti Javascript. Consigliamo Google Chrome o Mozilla Firefox - --Assicurarsi che i server Tomcat e MySQL (se utilizzato) siano avviati correttamente. - --Importare nel proprio MySQL il database dal dump file "locanda.sql" (Gli utenti HSQL hanno il database già nel pacchetto) - --Lanciare lo script di installazione "install.sh" - --Basta ora puntare il browser all'indirizzo "http://localhost:8080/locanda" per accedere all'applicazione. \ No newline at end of file diff --git a/installer/data/f2b.sed b/installer/data/f2b.sed deleted file mode 100644 index a36a010e..00000000 --- a/installer/data/f2b.sed +++ /dev/null @@ -1 +0,0 @@ -s/\//\\\//g \ No newline at end of file diff --git a/installer/data/newuser.sql b/installer/data/newuser.sql deleted file mode 100644 index ef93a487..00000000 --- a/installer/data/newuser.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; -GRANT INSERT ON locanda.* TO 'newuser'@'localhost'; -GRANT DELETE ON locanda.* TO 'newuser'@'localhost'; -GRANT SELECT ON locanda.* TO 'newuser'@'localhost'; -GRANT UPDATE ON locanda.* TO 'newuser'@'localhost'; - - -FLUSH PRIVILEGES; - diff --git a/installer/data/solr.properties b/installer/data/solr.properties deleted file mode 100644 index 5517fb29..00000000 --- a/installer/data/solr.properties +++ /dev/null @@ -1,2 +0,0 @@ -homeDir=SOLRPATH/solr -configFile=SOLRPATH/solr/solr.xml diff --git a/installer/install.sh b/installer/install.sh deleted file mode 100755 index 758ec81b..00000000 --- a/installer/install.sh +++ /dev/null @@ -1,288 +0,0 @@ -#!/bin/sh - -# Copyright 2011 - Sardegna Ricerche, Distretto ICT, Pula, Italy -# -# Licensed under the EUPL, Version 1.1. -# You may not use this work except in compliance with the Licence. -# You may obtain a copy of the Licence at: -# -# http://www.osor.eu/eupl -# -# Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the Licence for the specific language governing permissions and limitations under the Licence. -# In case of controversy the competent court is the Court of Cagliari (Italy). - - -#FILE=/tmp/mydb -TMPDIR="/tmp/" -BASEDIR=$(dirname $0) -LOCANDAVERSION="3.0" -LOCANDADIST="${TMPDIR}locanda-${LOCANDAVERSION}_dist" - - -MAX=100 -IDLE=30 -WAIT=10000 -USERNAME="LOCANDA" -PASSWORD="LOCANDA" -DRIVERCLASS="org.hsqldb.jdbcDriver" -URL="jdbc:hsqldb:hsql://localhost/locanda" - -HSQLURL="jdbc:hsqldb:hsql://localhost/locanda" -HSQLDRIVERCLASS="org.hsqldb.jdbcDriver" - -MYSQLURL="jdbc:mysql://localhost:3306/locanda" -MYSQLDRIVERCLASS="com.mysql.jdbc.Driver" - -SOLRP=$HOME - - - -#$1 user (root mysql) -#$2 passwd -#$3 host -#$4 port -#$5 NEWMYSQLUSER -#$6 NEWMYSQLPASSWD -mysqlLocandaCreate(){ - echo "Creating Database Locanda on mysql://$3:$4" - mysqladmin --user=$1 --password=$2 --host=$3 --port=$4 create locanda - - if [ $? = 0 ]; then - echo "\nCreating schemas..." - mysql --user=$1 --password=$2 --host=$3 --port=$4 locanda < ${BASEDIR}/data/locanda.sql - - else - echo "\nDatabase locanda alredy exist" - echo "would you drop and restore a new one? y/[n]" - read IST - IST="${IST:="n"}" - - if [ $IST = 'y' ]; then - echo "Dropping and restoring..." - echo " Dropping Database." - mysqladmin --user=$1 --password=$2 --host=$3 --port=$4 --force drop locanda - echo " Creating Database." - mysqladmin --user=$1 --password=$2 --host=$3 --port=$4 create locanda - echo " Creating Schemas." - mysql --user=$1 --password=$2 --host=$3 --port=$4 locanda < ${BASEDIR}/data/locanda.sql - - fi - fi - - echo "Now we create a new MySqlUser for locanda database." - echo "Creating " - echo "\t user:\t $5" - echo "\t password:\t $6" - echo "User can SELECT, INSERT, DELETE, UPDATE" - cat ${BASEDIR}/data/newuser.sql | sed -e "s/newuser/$5/" | sed -e "s/password/$6/" > ${TMPDIR}/newuser.sql - mysql --user=$1 --password=$2 --host=$3 --port=$4 < ${TMPDIR}/newuser.sql - -} - - -solrConfig(){ - IST=n - while [ ! $IST = y ]; do { - echo "\nWhere do you want to put the solr folder?" - - echo "Default [$HOME]" - read SOLRP - SOLRP="${SOLRP:=$HOME}" - - - echo "This is your solr path. Correct? y/[n]" - echo "${SOLRP}" - read IST - IST="${IST:="n"}" - - } - done - - - ESOLRP=`echo ${SOLRP} | sed -e 's/\/$//'| sed -f ${BASEDIR}/data/f2b.sed ` - - echo "\nCreating configuration files" - cat ${BASEDIR}/data/solr.properties | - sed -e "s/SOLRPATH/${ESOLRP}/" > ${LOCANDADIST}/WEB-INF/solr.properties - - echo "\nExtracting data in ${SOLRP}" - tar -zxvf ${BASEDIR}/data/solr.tar.gz -C ${SOLRP} > /dev/null 2>&1 -} - - -clean(){ - rm -rf ${LOCANDADIST} > /dev/null 2>&1 -} - -extract(){ - echo "Extracting..." - unzip ${BASEDIR}/locanda.war -d ${LOCANDADIST} > /dev/null 2>&1 -} - - -warbuild(){ - echo "Creating War..." - cd ${LOCANDADIST} - zip -r ${TMPDIR}/locanda.war ./* > /dev/null 2>&1 -} - -edit(){ - echo "Editing configuration..." - - EURL=`echo ${URL} | sed -f ${BASEDIR}/data/f2b.sed` - EUSERNAME=`echo ${USERNAME} | sed -f ${BASEDIR}/data/f2b.sed` - EPASSWORD=`echo ${PASSWORD} | sed -f ${BASEDIR}/data/f2b.sed` - EDRIVERCLASS=`echo ${DRIVERCLASS} | sed -f ${BASEDIR}/data/f2b.sed` - - cat ${BASEDIR}/data/context.xml | - sed -e "s/maxActive\=\"100\"/maxActive\=\"${MAX}\"/" | - sed -e "s/maxIdle\=\"30\"/maxIdle\=\"${IDLE}\"/" | - sed -e "s/maxWait\=\"10000\"/maxWait\=\"${WAIT}\"/" | - sed -e "s/username\=\"SA\"/username\=\"${EUSERNAME}\"/" | - sed -e "s/password\=\"\"/password\=\"${EPASSWORD}\"/" | - sed -e "s/driverClassName\=\"org\.hsqldb\.jdbcDriver\"/driverClassName\=\"${EDRIVERCLASS}\"/" | - sed -e "s/url\=\"jdbc\:hsqldb\:hsql\:\/\/localhost\/locanda\"/url\=\"${EURL}\"/" > ${LOCANDADIST}/META-INF/context.xml -} - -install(){ - IST=n - while [ ! $IST = y ]; do { - echo "Where do you want to install locanda.war?" - echo "must be in you Tomcat app directory: [${CATALINA_HOME}/webapps/]" - read INSTALLDIR - INSTALLDIR="${INSTALLDIR:=${CATALINA_HOME}/webapps/}" - - echo "\n Would you like to install locanda in ${INSTALLDIR} ??" - echo "Correct? y/[n]" - read IST - IST="${IST:="n"}" - } - done - - echo "Installing locanda ..." - mv -i ${TMPDIR}/locanda.war ${INSTALLDIR}; - -} - - -interactiveEdit(){ - IST=n - while [ ! $IST = y ]; do { - echo "\nSetting Parameters" - - echo "Username: [LOCANDA]" - read USERNAME - USERNAME="${USERNAME:=LOCANDA}" - - echo "Password: [LOCANDA]" - read PASSWORD - PASSWORD="${PASSWORD:=LOCANDA}" - - echo "Max connections: Default [100]" - read MAX - MAX="${MAX:=100}" - - echo "Idle connections: Default [30]" - read IDLE - IDLE="${IDLE:=30}" - - echo "Wait connections: Default [10000]" - read WAIT - WAIT="${WAIT:=10000}" - - echo "Set Database Driverclass: Default [$1]" - read DRIVERCLASS - DRIVERCLASS="${DRIVERCLASS:=$1}" - - echo "Set Url to Database: Default [$2]" - read URL - URL="${URL:=$2}" - - echo "RESUME:" - echo "Max connections:\t${MAX}" - echo "Max idle:\t\t${IDLE}" - echo "Max wait:\t\t${WAIT}" - echo "Username:\t\t${USERNAME}" - echo "Password:\t\t${PASSWORD}" - echo "Driverclass:\t\t${DRIVERCLASS}" - echo "Url:\t\t\t${URL}" - - echo "" - echo "Correct? y/[n]" - read IST - IST="${IST:="n"}" - } - done -} - - - - - - - - - -echo "Welcome to locanda installation:" - - -DB="0" -while [ ! \( ${DB} = "1" -o ${DB} = "2" \) ]; do { - - echo "" - echo "wich db do you want to use??" - echo " [1]: HyperSQL. (you don't need to install other sw)" - echo " [2]: MySql. (you need to install it!)" - echo "" - echo "Please chose 1 or 2: [1]Default " - - read DB - DB="${DB:=1}" -} -done - - -case ${DB} in - 1) - echo "HSQL" - echo "Please install hsql service, you it can found in data/hsql dir" - interactiveEdit $HSQLDRIVERCLASS $HSQLURL - ;; - 2) - echo "MySQL" - interactiveEdit $MYSQLDRIVERCLASS $MYSQLURL - echo "\nNow insert your admin credential for MySql" - echo "we configure a new user and set the locanda database" - echo "Username: " - read MADMIN - echo "Password: " - read MPASSWD - echo "Host: [localhost] " - read MHOST - MHOST="${MHOST:=localhost}" - echo "Port: [3306] " - read MPORT - MPORT="${MPORT:=3306}" - mysqlLocandaCreate ${MADMIN} ${MPASSWD} ${MHOST} ${MPORT} ${USERNAME} ${PASSWORD} - ;; -esac - - - - -clean -extract -solrConfig -edit -warbuild -install -#clean - -echo "Enjoy Locanda!" - -exit 0 - - - diff --git a/src/action/ConventionAction.java b/src/action/ConventionAction.java index ee39a542..1c95f107 100644 --- a/src/action/ConventionAction.java +++ b/src/action/ConventionAction.java @@ -35,142 +35,16 @@ public class ConventionAction extends ActionSupport implements SessionAware,UserAware{ private Map session = null; private Integer idStructure; -// private Message message = new Message(); -// private List conventions = null; -// private Convention convention = null; -// private String term; -// @Autowired -// private StructureService structureService = null; -// @Autowired -// private ConventionService conventionService = null; -// @Autowired -// private BookingService bookingService = null; @Actions({ @Action(value="/findAllConventions",results = { @Result(name="success",location="/WEB-INF/jsp/conventions.jsp") - }) -// @Action(value="/findAllConventionsJson",results = { -// @Result(type ="json",name="success", params={"root","conventions"}) -// }) + }) }) public String findAllConventions(){ -// List filteredConventions = null; -// -// filteredConventions = new ArrayList(); -// for(Convention each: this.getConventionService().findConventionsByIdStructure(this.getIdStructure())){ -// if(!each.getActivationCode().equals("thisconventionshouldntneverberemoved")){ -// filteredConventions.add(each); -// } -// } -// this.setConventions(filteredConventions); return SUCCESS; } - -// @Actions({ -// @Action(value="/findAllConventionsFilteredJson",results = { -// @Result(type ="json",name="success", params={"root","conventions"}) -// }) -// }) -// public String findAllConventionsFiltered() { -// List allConventions= null; -// List returnedConventions = new ArrayList(); -// -// -// if (this.getTerm() != null && this.getTerm().length() > 1) { -// allConventions = this.getConventionService().findConventionsByIdStructure( -// this.getIdStructure()); -// -// for (Convention convention : allConventions) { -// if (convention.getName().toLowerCase() -// .contains(this.getTerm().toLowerCase())) { -// returnedConventions.add(convention); -// } -// } -// } -// this.setConventions(returnedConventions); -// return SUCCESS; -// } -// -// -// -// @Actions({ -// @Action(value="/goUpdateConvention",results = { -// @Result(name="success",location="/WEB-INF/jsp/convention_edit.jsp") -// }) -// , -// @Action(value="/goUpdateConventionJson",results = { -// @Result(type="json", params={"root", "convention"}) -// }) -// }) -// public String goUpdateConvention() { -// -// this.setConvention(this.getConventionService().findConventionById(this.getConvention().getId())); -// return SUCCESS; -// } -// -// @Actions({ -// @Action(value="/saveUpdateConvention",results = { -// @Result(type ="json",name="success", params={"root","message"}) -// }), -// @Action(value="/conventionJson",results = { -// @Result(type="json", params={"root", "convention"}) -// }) -// }) -// public String saveUpdateConvention(){ -// Convention oldConvention = null; -// -// oldConvention = this.getConventionService().findConventionById(this.getConvention().getId()); -// if(oldConvention == null){ -// //It's a new convention -// -// this.getConvention().setId_structure(this.getIdStructure()); -// this.getConventionService().insertConvention(this.getConvention()); -// //this.getStructureService().refreshPriceLists(structure); -// this.getStructureService().addPriceListsForConvention(this.getIdStructure(), this.getConvention().getId()); -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("conventionAddSuccessAction")); -// -// }else{ -// //It's an existing convention -// this.getConvention().setId_structure(this.getIdStructure()); -// this.getConventionService().updateConvention(this.getConvention()); -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("conventionUpdateSuccessAction")); -// } -// return SUCCESS; -// } -// -// @Actions({ -// @Action(value="/deleteConvention",results = { -// @Result(type ="json",name="success", params={"root","message"}), -// @Result(type ="json",name="error", params={"root","message"}) -// }) -// }) -// public String deleteConvention(){ -// Integer count = 0; -// Integer id_convention; -// -// id_convention = this.getConvention().getId(); -// -// -// if(this.getBookingService().countBookingsByIdConvention(id_convention) > 0){ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("conventionDeleteBookingError")); -// return ERROR; -// } -// count = this.getConventionService().deleteConvention(id_convention); -// if(count > 0){ -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("conventionDeleteSuccessAction")); -// return SUCCESS; -// }else{ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("conventionDeleteErrorAction")); -// return ERROR; -// } -// } -// + public Map getSession() { return session; } @@ -184,49 +58,4 @@ public Integer getIdStructure() { public void setIdStructure(Integer idStructure) { this.idStructure = idStructure; } -// -// public List getConventions() { -// return conventions; -// } -// public void setConventions(List conventions) { -// this.conventions = conventions; -// } -// public Convention getConvention() { -// return convention; -// } -// public void setConvention(Convention convention) { -// this.convention = convention; -// } -// public Message getMessage() { -// return message; -// } -// public void setMessage(Message message) { -// this.message = message; -// } -// public StructureService getStructureService() { -// return structureService; -// } -// public void setStructureService(StructureService structureService) { -// this.structureService = structureService; -// } -// public ConventionService getConventionService() { -// return conventionService; -// } -// public void setConventionService(ConventionService conventionService) { -// this.conventionService = conventionService; -// } -// public BookingService getBookingService() { -// return bookingService; -// } -// public void setBookingService(BookingService bookingService) { -// this.bookingService = bookingService; -// } - -// public String getTerm() { -// return term; -// } -// -// public void setTerm(String term) { -// this.term = term; -// } } \ No newline at end of file diff --git a/src/action/ExportAction.java b/src/action/ExportAction.java index 4807a85e..30df333a 100644 --- a/src/action/ExportAction.java +++ b/src/action/ExportAction.java @@ -28,8 +28,6 @@ @Result(name="notLogged", location="/WEB-INF/jsp/homeNotLogged.jsp") public class ExportAction extends ActionSupport implements SessionAware { private Map session = null; -// private Message message = new Message(); - @Actions({ @Action(value="/goExport",results = { @@ -46,11 +44,4 @@ public Map getSession() { public void setSession(Map session) { this.session = session; } -// public Message getMessage() { -// return message; -// } -// public void setMessage(Message message) { -// this.message = message; -// } - } \ No newline at end of file diff --git a/src/action/ExtraAction.java b/src/action/ExtraAction.java index e294eb6e..2b0dc33e 100644 --- a/src/action/ExtraAction.java +++ b/src/action/ExtraAction.java @@ -37,16 +37,6 @@ public class ExtraAction extends ActionSupport implements SessionAware,UserAware { private Map session = null; private Integer idStructure; -// private Message message = new Message(); -// private List extras = null; -// private Extra extra = null; -// @Autowired -// private ExtraService extraService = null; -// @Autowired -// private ExtraPriceListService extraPriceListService = null; -// @Autowired -// private BookingService bookingService = null; - @Actions({ @Action(value="/findAllExtras",results = { @@ -54,99 +44,9 @@ public class ExtraAction extends ActionSupport implements SessionAware,UserAware }) }) public String findAllExtras() { -// List extras = null; -// -// extras = this.getExtraService().findExtrasByIdStructure(this.getIdStructure()); -// this.setExtras(extras); return SUCCESS; } -// @Actions({ -// @Action(value="/goUpdateExtra",results = { -// @Result(name="success",location="/WEB-INF/jsp/extra_edit.jsp") -// }) -// }) -// public String goUpdateExtra() { -// Extra extra = null; -// -// extra = this.getExtraService().findExtraById(this.getExtra().getId()); -// this.setExtra(extra); -// -// return SUCCESS; -// } -// -// @Actions({ -// @Action(value="/saveUpdateExtra",results = { -// @Result(type ="json",name="success", params={"root","message"}), -// @Result(name = "input", location = "/WEB-INF/jsp/validationError.jsp"), -// @Result(type ="json",name="error", params={"root","message"}) -// }) -// }) -// public String saveUpdateExtra() { -// Extra oldExtra = null; -// -// oldExtra = this.getExtraService().findExtraById(this.getExtra().getId()); -// this.getExtra().setId_structure(this.getIdStructure()); -// if(oldExtra == null){ -// //It's a new extra -// this.getExtraService().insertExtra(this.getExtra()); -// -// this.buildExtraPriceListFromExtra(); -// -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("extraAddSuccessAction")); -// return SUCCESS; -// }else{ -// //It's an existing extra -// this.getExtraService().updateExtra(this.getExtra()); -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("extraUpdateSuccessAction")); -// return SUCCESS; -// } -// } -// -// @Actions({ -// @Action(value="/deleteExtra",results = { -// @Result(type ="json",name="success", params={"root","message"}), -// @Result(type ="json",name="error", params={"root","message"}) -// }) -// }) -// public String deleteExtra() { -// Integer count = 0; -// Integer id_extra = 0; -// -// id_extra = this.getExtra().getId(); -// -// if(this.getBookingService().countBookingsByIdExtra(id_extra) > 0){ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("extraDeleteBookingError")); -// return "error"; -// } -// -// count = this.getExtraService().deleteExtra(id_extra); -// if(count > 0){ -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("extraDeleteSuccessAction")); -// return "success"; -// }else{ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("extraDeleteSuccessAction")); -// return "error"; -// } -// } -// -// public void buildExtraPriceListFromExtra() { -// ExtraPriceListItem newExtraPriceListItem = null; -// -// for (ExtraPriceList eachPriceList : this.getExtraPriceListService().findExtraPriceListsByIdStructure(this.getIdStructure())) { -// newExtraPriceListItem = new ExtraPriceListItem(); -// newExtraPriceListItem.setId_extra(this.getExtra().getId()); -// newExtraPriceListItem.setPrice(0.0); -// newExtraPriceListItem.setId_extraPriceList(eachPriceList.getId()); -// this.getExtraPriceListService().insertExtraPriceListItem(newExtraPriceListItem); -// } -// } -// public Map getSession() { return session; } @@ -160,41 +60,4 @@ public Integer getIdStructure() { public void setIdStructure(Integer idStructure) { this.idStructure = idStructure; } -// public Message getMessage() { -// return message; -// } -// public void setMessage(Message message) { -// this.message = message; -// } -// public List getExtras() { -// return extras; -// } -// public void setExtras(List extras) { -// this.extras = extras; -// } -// public Extra getExtra() { -// return extra; -// } -// public void setExtra(Extra extra) { -// this.extra = extra; -// } -// public ExtraService getExtraService() { -// return extraService; -// } -// public void setExtraService(ExtraService extraService) { -// this.extraService = extraService; -// } -// public ExtraPriceListService getExtraPriceListService() { -// return extraPriceListService; -// } -// public void setExtraPriceListService(ExtraPriceListService extraPriceListService) { -// this.extraPriceListService = extraPriceListService; -// } -// public BookingService getBookingService() { -// return bookingService; -// } -// public void setBookingService(BookingService bookingService) { -// this.bookingService = bookingService; -// } - } \ No newline at end of file diff --git a/src/action/ExtraPriceListAction.java b/src/action/ExtraPriceListAction.java index 536e9c92..5e718abc 100644 --- a/src/action/ExtraPriceListAction.java +++ b/src/action/ExtraPriceListAction.java @@ -163,9 +163,7 @@ public String findExtraPriceListItems() { }) }) public String updateExtraPriceListItems(){ - ExtraPriceList oldExtraPriceList = null; - oldExtraPriceList = this.getExtraPriceListService().findExtraPriceListById(this.getPriceList().getId()); for(ExtraPriceListItem each: this.getPriceList().getItems()){ this.getExtraPriceListService().updateExtraPriceListItem(each); } @@ -265,5 +263,4 @@ public Integer getIdStructure() { public void setIdStructure(Integer idStructure) { this.idStructure = idStructure; } - } \ No newline at end of file diff --git a/src/action/FacilityAction.java b/src/action/FacilityAction.java index c5bba0bb..0f14d3a9 100644 --- a/src/action/FacilityAction.java +++ b/src/action/FacilityAction.java @@ -28,8 +28,6 @@ public class FacilityAction extends ActionSupport { ) ) public String findAllFacilities() { - return SUCCESS; } - } \ No newline at end of file diff --git a/src/action/GuestAction.java b/src/action/GuestAction.java index a4dc8bc9..104fd851 100644 --- a/src/action/GuestAction.java +++ b/src/action/GuestAction.java @@ -37,17 +37,6 @@ public class GuestAction extends ActionSupport implements SessionAware,UserAware{ private Map session = null; private Integer idStructure = null; -// private List guests = null; -// private Guest guest = null; -// private Integer id; -// private Message message = new Message(); -// private List bookings = null; -// private String term; -// private List years = null; -// @Autowired -// private GuestService guestService = null; -// @Autowired -// private BookingService bookingService = null; @Actions({ @Action(value="/findAllGuests",results = { @@ -55,16 +44,6 @@ public class GuestAction extends ActionSupport implements SessionAware,UserAware }) }) public String findAllGuests(){ -// List listYears = new ArrayList(); -// Integer currentYear = Calendar.getInstance().get(Calendar.YEAR); -// -// for (int i=1900; i<=currentYear; i++) { -// listYears.add(i); -// } -// this.setYears(listYears); -// this.setGuests( -// this.getGuestService().findGuestsByIdStructure( -// this.getIdStructure())); return SUCCESS; } @Actions({ @@ -73,177 +52,8 @@ public String findAllGuests(){ }) }) public String goUpdateGuestsFromPlanner(){ -// List listYears = new ArrayList(); -// Integer currentYear = Calendar.getInstance().get(Calendar.YEAR); -// -// for (int i=1900; i<=currentYear; i++) { -// listYears.add(i); -// } -// this.setYears(listYears); -// this.setGuests( -// this.getGuestService().findGuestsByIdStructure( -// this.getIdStructure())); return SUCCESS; } -// -// @Actions({ -// @Action(value="/findAllGuestsJson",results = { -// @Result(type ="json",name="success", params={"root","guests"}) -// }) , -// @Action(value="/findAllGuestsFiltered",results = { -// @Result(name="success",location="/WEB-INF/jsp/guests.jsp") -// }) -// }) -// public String findAllGuestsFiltered() { -// List allGuests = null; -// List returnedGuests = new ArrayList(); -// -// this.addYears(); -// if (this.getTerm() != null && this.getTerm().length() > 1) { -// allGuests = this.getGuestService().findGuestsByIdStructure( -// this.getIdStructure()); -// -// for (Guest guest : allGuests) { -// if (guest.getLastName().toLowerCase() -// .contains(this.getTerm().toLowerCase())) { -// returnedGuests.add(guest); -// } -// } -// } -// this.setGuests(returnedGuests); -// return SUCCESS; -// } -// -// @Actions({ -// @Action(value="/findAllGuestsByName",results = { -// @Result(name="success",location="/WEB-INF/jsp/guests.jsp") -// }) -// }) -// public String findAllGuestsByName() { -// List allGuests = null; -// List returnedGuests = null; -// -// this.addYears(); -// -// returnedGuests = new ArrayList(); -// if (this.getTerm() != null && this.getTerm().length() > 1) { -// allGuests = this.getGuestService().findGuestsByIdStructure(this.getIdStructure()); -// for (Guest guest : allGuests) { -// String allName = guest.getFirstName().toLowerCase() -// + guest.getLastName().toLowerCase(); -// if (allName.equals(this.getTerm().toLowerCase())) { -// returnedGuests.add(guest); -// } -// } -// } -// this.setGuests(returnedGuests); -// return SUCCESS; -// } -// -// @Actions({ -// @Action(value="/findGuestById",results = { -// @Result(type ="json",name="success", params={ -// "excludeProperties","session,guests,id,guestService,bookingService" -// }) , -// @Result(type ="json",name="error", params={"root","message"}) -// }) -// }) -// public String findGuestById() { -// Guest aGuest = null; -// -// this.addYears(); -// aGuest = this.getGuestService().findGuestById(this.getId()); -// if(aGuest != null){ -// this.setGuest(aGuest); -// this.getMessage().setResult(Message.SUCCESS); -// return SUCCESS; -// } -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("guestNotFoundError")); -// return ERROR; -// } -// -// @Actions({ -// @Action(value="/goUpdateGuest",results = { -// @Result(name="success",location="/WEB-INF/jsp/guest_edit.jsp") -// }) -// }) -// public String goUpdateGuest() { -// -// this.addYears(); -// -// this.setGuest(this.getGuestService().findGuestById(this.getId())); -// this.setBookings(this.getBookingService().findBookingsByIdBooker(this.getId())); -// -// return SUCCESS; -// } -// -// @Actions({ -// @Action(value="/saveUpdateGuest",results = { -// @Result(type ="json",name="success", params={ -// "root","message" -// }) -// }) -// }) -// public String saveUpdateGuest(){ -// Guest oldGuest = null; -// -// oldGuest = this.getGuestService().findGuestById(this.getGuest().getId()); -// this.getGuest().setId_structure(this.getIdStructure()); -// if(oldGuest == null){ -// //It's a new guest -// this.getGuestService().insertGuest(this.getGuest()); -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("guestAddSuccessAction")); -// -// }else{ -// //It's an existing guest -// this.getGuestService().updateGuest(this.getGuest()); -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("guestUpdateSuccessAction")); -// } -// return SUCCESS; -// } -// -// @Actions({ -// @Action(value="/deleteGuest",results = { -// @Result(type ="json",name="success", params={"root","message"}), -// @Result(type ="json",name="error", params={"root","message"}) -// }) -// }) -// public String deleteGuest(){ -// Integer id_guest = 0; -// Integer count = 0; -// -// id_guest = this.getId(); -// -// if(this.getBookingService().countBookingsByIdGuest(id_guest) > 0){ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("guestDeleteBookingError")); -// return ERROR; -// } -// count = this.getGuestService().deleteGuest(id_guest); -// if(count>0){ -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("guestDeleteSuccessAction")); -// return SUCCESS; -// }else{ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("guestDeleteErrorAction")); -// return ERROR; -// } -// } -// -// private void addYears(){ -// List listYears =new ArrayList(); -// Integer currentYear = Calendar.getInstance().get(Calendar.YEAR); -// -// for (int i=1900; i getSession() { return session; @@ -257,60 +67,5 @@ public Integer getIdStructure() { } public void setIdStructure(Integer idStructure) { this.idStructure = idStructure; - } -// public Message getMessage() { -// return message; -// } -// public void setMessage(Message message) { -// this.message = message; -// } -// public Integer getId() { -// return id; -// } -// public void setId(Integer id) { -// this.id = id; -// } -// public List getGuests() { -// return guests; -// } -// public void setGuests(List guests) { -// this.guests = guests; -// } -// public Guest getGuest() { -// return guest; -// } -// public void setGuest(Guest guest) { -// this.guest = guest; -// } -// public List getBookings() { -// return bookings; -// } -// public void setBookings(List bookings) { -// this.bookings = bookings; -// } -// public String getTerm() { -// return term; -// } -// public void setTerm(String term) { -// this.term = term; -// } -// public List getYears() { -// return years; -// } -// public void setYears(List years) { -// this.years = years; -// } -// public GuestService getGuestService() { -// return guestService; -// } -// public void setGuestService(GuestService guestService) { -// this.guestService = guestService; -// } -// public BookingService getBookingService() { -// return bookingService; -// } -// public void setBookingService(BookingService bookingService) { -// this.bookingService = bookingService; -// } -// -} + } +} \ No newline at end of file diff --git a/src/action/HelpAction.java b/src/action/HelpAction.java index b6234bf7..c40ca4e5 100644 --- a/src/action/HelpAction.java +++ b/src/action/HelpAction.java @@ -28,8 +28,6 @@ @Result(name="notLogged", location="/WEB-INF/jsp/homeNotLogged.jsp") public class HelpAction extends ActionSupport implements SessionAware { private Map session = null; -// private Message message = new Message(); - @Actions({ @Action(value="/goAboutInfo",results = { @@ -45,12 +43,5 @@ public Map getSession() { } public void setSession(Map session) { this.session = session; - } -// public Message getMessage() { -// return message; -// } -// public void setMessage(Message message) { -// this.message = message; -// } - + } } \ No newline at end of file diff --git a/src/action/HomeAction.java b/src/action/HomeAction.java index d101a1a8..6c7974eb 100644 --- a/src/action/HomeAction.java +++ b/src/action/HomeAction.java @@ -66,5 +66,4 @@ public Map getSession() { public void setSession(Map session) { this.session = session; } - } \ No newline at end of file diff --git a/src/action/ImageAction.java b/src/action/ImageAction.java index c6b7ae86..7ab1dace 100644 --- a/src/action/ImageAction.java +++ b/src/action/ImageAction.java @@ -28,8 +28,6 @@ public class ImageAction extends ActionSupport { ) ) public String findAllImages() { - return SUCCESS; } - } \ No newline at end of file diff --git a/src/action/LocaleAction.java b/src/action/LocaleAction.java index 1785f6bc..b1fa216c 100644 --- a/src/action/LocaleAction.java +++ b/src/action/LocaleAction.java @@ -23,7 +23,6 @@ public class LocaleAction extends ActionSupport{ private String sect; public String execute() { - return "SUCCESS"; } @@ -39,5 +38,4 @@ public String getSect() { public void setSect(String sect) { this.sect = sect; } - } \ No newline at end of file diff --git a/src/action/LogoutAction.java b/src/action/LogoutAction.java index 1f6856b2..5a3c707a 100644 --- a/src/action/LogoutAction.java +++ b/src/action/LogoutAction.java @@ -17,9 +17,6 @@ import java.util.Map; - -import model.UserAware; - import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Actions; import org.apache.struts2.convention.annotation.InterceptorRef; @@ -35,17 +32,15 @@ @InterceptorRef("userAwareStack") }) @Result(name="notLogged", location="/WEB-INF/jsp/homeNotLogged.jsp") -public class LogoutAction extends ActionSupport implements SessionAware,UserAware{ +public class LogoutAction extends ActionSupport implements SessionAware{ private Map session = null; - private Integer idStructure; @Actions(value={ @Action(value="/logout", results={ @Result(name="success", location="/WEB-INF/jsp/homeNotLogged.jsp") }) }) - public String execute(){ - + public String execute(){ this.getSession().put("user", null); return SUCCESS; } @@ -57,11 +52,4 @@ public Map getSession() { public void setSession(Map session) { this.session = session; } - public Integer getIdStructure() { - return idStructure; - } - public void setIdStructure(Integer idStructure) { - this.idStructure = idStructure; - } - } \ No newline at end of file diff --git a/src/action/OnlineBookingAction.java b/src/action/OnlineBookingAction.java index b4ff79a9..39f39476 100644 --- a/src/action/OnlineBookingAction.java +++ b/src/action/OnlineBookingAction.java @@ -23,7 +23,6 @@ import java.util.Locale; import java.util.Map; -import model.Booker; import model.Booking; import model.Extra; import model.ExtraItem; @@ -296,12 +295,6 @@ private List calculateExtraItems(Integer id_structure, Booking bookin }) }) public String goOnlinePreviewBookings(){ - /*User user = null; - Structure structure = null; - - user = (User)session.get("user"); - structure = user.getStructure(); - this.setIdStructure(structure.getId());*/ return SUCCESS; } @@ -402,13 +395,10 @@ public Structure getStructure() { public void setStructure(Structure structure) { this.structure = structure; } - public Guest getOnlineGuest() { return onlineGuest; } - public void setOnlineGuest(Guest onlineGuest) { this.onlineGuest = onlineGuest; } - } \ No newline at end of file diff --git a/src/action/RoomAction.java b/src/action/RoomAction.java index ee68b4a7..9a967508 100644 --- a/src/action/RoomAction.java +++ b/src/action/RoomAction.java @@ -20,11 +20,9 @@ import java.util.Map; import model.Facility; -import model.Image; import model.Room; import model.RoomType; import model.UserAware; -import model.internal.Message; import model.internal.TreeNode; import org.apache.struts2.convention.annotation.Action; @@ -36,12 +34,9 @@ import org.apache.struts2.interceptor.SessionAware; import org.springframework.beans.factory.annotation.Autowired; -import service.BookingService; import service.FacilityService; -import service.ImageService; import service.RoomService; import service.RoomTypeService; -import service.StructureService; import com.opensymphony.xwork2.ActionSupport; @@ -52,30 +47,19 @@ @Result(name="notLogged", location="/WEB-INF/jsp/homeNotLogged.jsp") public class RoomAction extends ActionSupport implements SessionAware,UserAware{ private Map session = null; - private Room room = null; - private Message message = new Message(); private List roomFacilities = null; - private List roomFacilitiesIds = new ArrayList(); private List rooms = null; - private Integer roomId; - private Image image = null; private Integer roomTypeId = null; private List roomTypes = null; private List roomTypeFacilities = null; private List treeNodes = new ArrayList(); private Integer idStructure; @Autowired - private StructureService structureService = null; - @Autowired private RoomTypeService roomTypeService = null; @Autowired private RoomService roomService = null; @Autowired - private ImageService imageService = null; - @Autowired private FacilityService facilityService = null; - @Autowired - private BookingService bookingService = null; @Actions({ @Action(value="/findAllRooms",results = { @@ -115,242 +99,8 @@ public String findAllTreeRooms() { } return SUCCESS; } - - @Actions({ - @Action(value="/findRoomTypesForRoom",results = { - @Result(name="success",location="/WEB-INF/jsp/contents/roomTypeFacility_table.jsp") - }), - @Action(value="/findRoomTypesForRoomJson",results = { - @Result(name="input", location="/WEB-INF/jsp/validationError.jsp"), - @Result(type ="json",name="success", params={"root","message"}), - @Result(type ="json",name="error", params={"root","message"}) - }) - }) - public String findAllRoomTypesForRoom() { - List selectedFacilities = null; - - this.setRoomFacilities(this.getFacilityService().findCheckedByIdStructure(this.getIdStructure(),0,100)); - selectedFacilities = this.getFacilityService().findCheckedByIdRoomType(this.getRoom().getRoomType().getId(),0,100); - for(Facility each: selectedFacilities){ - this.getRoomFacilitiesIds().add(each.getId()); //populating roomFacilitiesIds array with the ids of facilities that are already in rooms to be edited - } - return SUCCESS; - } - - @Actions({ - @Action(value="/goUpdateRoom",results = { - @Result(name="success",location="/WEB-INF/jsp/room_edit.jsp"), - @Result(name = "nullpointer", type="redirect", location = "findAllRooms.action") - }) - }) - public String goUpdateRoom() { - Room oldRoom = null; - - oldRoom = this.getRoomService().findRoomById(this.getRoom().getId()); - oldRoom.setImages(this.getImageService().findCheckedByIdRoom(this.getRoom().getId(),0,100)); - this.setRoom(oldRoom); - this.setRoomTypes(this.getRoomTypeService().findRoomTypesByIdStructure(this.getIdStructure())); - this.setRoomFacilities(this.getFacilityService().findCheckedByIdStructure(this.getIdStructure(),0,100)); - for(Facility each: this.getRoom().getFacilities()){ - this.getRoomFacilitiesIds().add(each.getId()); //populating roomFacilitiesIds array with the ids of facilities that are already in rooms to be edited - } - return SUCCESS; - } - - @Actions({ - @Action(value="/saveUpdateRoom",results = { - @Result(name="input", location="/WEB-INF/jsp/validationError.jsp"), - @Result(type ="json",name="success", params={"root","message"}), - @Result(type ="json",name="error", params={"root","message"}) - }) - }) - public String saveUpdateRoom() { - Room oldRoom = null; - - oldRoom = (this.getRoom().getId() == null )? null : this.getRoomService().findRoomById(this.getRoom().getId()); - if(oldRoom == null){ - //It's a new room - return this.saveRoom(this.getIdStructure()); - }else{ - //It's an existing room - return this.updateRoom(this.getIdStructure(), oldRoom); - } - } - - private String saveRoom(Integer id_structure){ - List rooms = null; - String names = ""; - List checkedFacilities = null; - RoomType theRoomType = null; - List filteredRoomFacilitiesIds = null; - Integer anInt; - String text = null; - - filteredRoomFacilitiesIds = new ArrayList(); - for(Object each: this.getRoomFacilitiesIds()){ - try{ - anInt = Integer.parseInt((String)each); - filteredRoomFacilitiesIds.add(anInt); - }catch (Exception e) { - - } - } - rooms = this.splitRooms(); - for(Room each: rooms){ - - if(this.getRoomService().findRoomByIdStructureAndName(id_structure,each.getName()) != null){ - names = names + "," + each.getName(); - } - } - - if(names.length()>0){ - this.getMessage().setResult(Message.ERROR); - text = getText("rooms") + names.substring(1) + getText("alreadyPresent"); - this.getMessage().setDescription(text); - return "error"; - } - else{ - checkedFacilities = this.getFacilityService().findByIds(filteredRoomFacilitiesIds); - for(Room each: rooms){ - - if(this.getRoom().getRoomType().getId() < 0){ - this.getMessage().setResult(Message.ERROR); - - text = (this.getRoomTypeService().findRoomTypesByIdStructure(id_structure).size() > 0)? getText("roomTypeNotSelectedAction") : getText("roomTypeAbsentAction"); - this.getMessage().setDescription(text); - return "error"; - } - - each.setFacilities(checkedFacilities); - - theRoomType = this.getRoomTypeService().findRoomTypeById(this.getRoom().getRoomType().getId()); - each.setRoomType(theRoomType); - each.setId_roomType(theRoomType.getId()); - each.setId_structure(id_structure); - - this.getRoomService().insertRoom(each); - - } - this.getMessage().setResult(Message.SUCCESS); - text = getText("roomsAddSuccessAction"); - this.getMessage().setDescription(text); - return "success"; - } - } - - private List splitRooms(){ - List rooms = null; - - rooms = new ArrayList(); - for(String each: this.getRoom().getName().split(",")){ - if(each.trim().length()>0){ - Room aRoom = new Room(); - aRoom.setName(each.trim()); - aRoom.setNotes(this.getRoom().getNotes()); - aRoom.setRoomType(this.getRoom().getRoomType()); - rooms.add(aRoom); - } - } - return rooms; - } - private String updateRoom(Integer id_structure, Room oldRoom){ - String newName = null; - List checkedFacilities = null; - RoomType theRoomType = null; - List filteredRoomFacilitiesIds = null; - Integer anInt; - - filteredRoomFacilitiesIds = new ArrayList(); - for(Object each: this.getRoomFacilitiesIds()){ - try{ - anInt = Integer.parseInt((String)each); - filteredRoomFacilitiesIds.add(anInt); - }catch (Exception e) { - } - } - newName = this.getRoom().getName(); - if(newName.contains(",")){ - this.getMessage().setResult(Message.ERROR); - this.getMessage().setDescription(getText("roomNameCommaError")); - return "error"; - } - if(!newName.equals(oldRoom.getName())){ - if(this.getRoomService().findRoomByIdStructureAndName(id_structure, newName) != null){ - this.getMessage().setResult(Message.ERROR); - this.getMessage().setDescription(getText("roomNameAlreadyPresentError")); - return "error"; - } - } - - checkedFacilities = this.getFacilityService().findByIds(filteredRoomFacilitiesIds); - this.getRoom().setFacilities(checkedFacilities); - - theRoomType = this.getRoomTypeService().findRoomTypeById(this.getRoom().getRoomType().getId()); - this.getRoom().setRoomType(theRoomType); - this.getRoom().setId_roomType(this.getRoom().getRoomType().getId()); - - this.getRoom().setId_structure(id_structure); - - this.getRoomService().updateRoom(this.getRoom()); - - this.getMessage().setResult(Message.SUCCESS); - this.getMessage().setDescription(getText("roomUpdateSuccessAction")); - return "success"; - } - @Actions({ - @Action(value="/deleteRoom",results = { - @Result(type ="json",name="success", params={"root","message"}), - @Result(type ="json",name="error", params={"root","message"}) - }) - }) - public String deleteRoom() { - - Integer count = 0; - Integer id_room; - - - id_room = this.getRoom().getId(); - - if(this.getBookingService().countBookingsByIdRoom(id_room)>0){ - this.getMessage().setResult(Message.ERROR); - this.getMessage().setDescription("Non è possibile cancellare la stanza perchè esistono Booking associati a quella stanza"); - return "error"; - } - count = this.getRoomService().deleteRoom(id_room); - if(count>0){ - this.getMessage().setResult(Message.SUCCESS); - this.getMessage().setDescription(getText("roomDeleteSuccessAction")); - return "success"; - }else{ - this.getMessage().setResult(Message.ERROR); - this.getMessage().setDescription(getText("roomDeleteErrorAction")); - return "error"; - } - } - - /* - @Actions({ - @Action(value="/deleteRoomImage",results = { - @Result(type ="json",name="success", params={"root","message"}), - @Result(type ="json",name="error", params={"root","message"}) - }) - - }) - public String deleteRoomImage() { - - if(this.getImageService().deleteRoomImage(this.getImage().getId()) >0){ - this.getMessage().setResult(Message.SUCCESS); - this.getMessage().setDescription(getText("roomImageDeleteSuccessAction")); - return "success"; - }else{ - this.getMessage().setResult(Message.ERROR); - this.getMessage().setDescription(getText("roomImageDeleteErrorAction")); - return "error"; - } - } - */ public Map getSession() { return session; } @@ -358,24 +108,6 @@ public Map getSession() { public void setSession(Map session) { this.session = session; } - public Room getRoom() { - return room; - } - public void setRoom(Room room) { - this.room = room; - } - public Message getMessage() { - return message; - } - public void setMessage(Message message) { - this.message = message; - } - public List getFacilities() { - return roomFacilitiesIds; - } - public void setFacilities(List roomFacilitiesIds) { - this.roomFacilitiesIds = roomFacilitiesIds; - } public List getRoomFacilities() { return roomFacilities; } @@ -394,30 +126,12 @@ public List getRooms() { public void setRooms(List rooms) { this.rooms = rooms; } - public Integer getRoomId() { - return roomId; - } - public void setRoomId(Integer roomId) { - this.roomId = roomId; - } - public List getRoomFacilitiesIds() { - return roomFacilitiesIds; - } - public void setRoomFacilitiesIds(List roomFacilitiesIds) { - this.roomFacilitiesIds = roomFacilitiesIds; - } public List getRoomTypes() { return roomTypes; } public void setRoomTypes(List roomTypes) { this.roomTypes = roomTypes; } - public Image getImage() { - return image; - } - public void setImage(Image image) { - this.image = image; - } public List getRoomTypeFacilities() { return roomTypeFacilities; } @@ -430,12 +144,6 @@ public List getTreeNodes() { public void setTreeNodes(List treeNodes) { this.treeNodes = treeNodes; } - public StructureService getStructureService() { - return structureService; - } - public void setStructureService(StructureService structureService) { - this.structureService = structureService; - } public RoomTypeService getRoomTypeService() { return roomTypeService; } @@ -448,29 +156,16 @@ public RoomService getRoomService() { public void setRoomService(RoomService roomService) { this.roomService = roomService; } - public ImageService getImageService() { - return imageService; - } - public void setImageService(ImageService imageService) { - this.imageService = imageService; - } public FacilityService getFacilityService() { return facilityService; } public void setFacilityService(FacilityService facilityService) { this.facilityService = facilityService; } - public BookingService getBookingService() { - return bookingService; - } - public void setBookingService(BookingService bookingService) { - this.bookingService = bookingService; - } public Integer getIdStructure() { return idStructure; } public void setIdStructure(Integer idStructure) { this.idStructure = idStructure; } - } \ No newline at end of file diff --git a/src/action/RoomFacilityAction.java b/src/action/RoomFacilityAction.java index 93b1fb3e..cff3e2fb 100644 --- a/src/action/RoomFacilityAction.java +++ b/src/action/RoomFacilityAction.java @@ -49,15 +49,9 @@ public class RoomFacilityAction extends ActionSupport implements SessionAware,Us private List roomFacilities = null; private List roomFacilitiesIds = new ArrayList(); private Integer idRoom; - private Room room = null; - private Message message = new Message(); private Facility facility; private Integer idStructure; @Autowired - private StructureService structureService = null; - @Autowired - private RoomService roomService = null; - @Autowired private FacilityService facilityService = null; @Actions({ @@ -73,68 +67,6 @@ public String goUpdateRoomFacilities() { } return SUCCESS; } - - /* - @Actions({ - @Action(value="/updateRoomFacilities", results={ - @Result(type ="json",name="success", params={"root","message"}) - }) - }) - public String updateRoomFacilities() { - List checkedFacilities = null; - - this.setRoom(this.getRoomService().findRoomById(this.getIdRoom())); - checkedFacilities = this.getFacilityService().findFacilitiesByIds(this.getRoomFacilitiesIds()); - this.getRoom().setFacilities(checkedFacilities); - this.getFacilityService().deleteAllFacilitiesFromRoom(this.getIdRoom()); - this.getFacilityService().insertRoomFacilities(this.getRoomFacilitiesIds(), this.getIdRoom()); - - this.getMessage().setResult(Message.SUCCESS); - this.getMessage().setDescription(getText("facilitiesUpdatedSuccessAction")); - return SUCCESS; - } - */ - /* - @Actions({ - @Action(value="/deleteFacility", results={ - @Result(type ="json",name="success", params={"root","message"}), - @Result(type ="json",name="error", params={"root","message"}) - }) - }) - public String deleteUploadedFacility() { - - if(this.getFacilityService().deleteUploadedFacility(this.getFacility().getId()) > 0){ - this.getMessage().setResult(Message.SUCCESS); - return SUCCESS; - }else{ - this.getMessage().setResult(Message.ERROR); - return ERROR; - } - } -*/ - /* - @Actions({ - @Action(value="/updateFacility", results={ - @Result(type ="json",name="success", params={ - "excludeProperties","session,roomFacilities,roomFacilitiesIds,idRoom,room,structureService,roomService,facilityService" - }), - @Result(type ="json",name="error", params={ - "excludeProperties","session,roomFacilities,roomFacilitiesIds,idRoom,room,structureService,roomService,facilityService" - }) - }) - }) - public String updateUploadedFacility() { - - if(this.getFacilityService().updateUploadedFacility(this.getFacility()) > 0){ - this.setFacility(this.getFacilityService().findFacilityById(this.getFacility().getId())); - this.getMessage().setResult(Message.SUCCESS); - return SUCCESS; - }else{ - this.setFacility(this.getFacilityService().findFacilityById(this.getFacility().getId())); - this.getMessage().setResult(Message.ERROR); - return ERROR; - } - }*/ public Map getSession() { return session; @@ -155,36 +87,12 @@ public Integer getIdRoom() { public void setIdRoom(Integer idRoom) { this.idRoom = idRoom; } - public Room getRoom() { - return room; - } - public void setRoom(Room room) { - this.room = room; - } - public Message getMessage() { - return message; - } - public void setMessage(Message message) { - this.message = message; - } public List getRoomFacilitiesIds() { return roomFacilitiesIds; } public void setRoomFacilitiesIds(List roomFacilitiesIds) { this.roomFacilitiesIds = roomFacilitiesIds; } - public StructureService getStructureService() { - return structureService; - } - public void setStructureService(StructureService structureService) { - this.structureService = structureService; - } - public RoomService getRoomService() { - return roomService; - } - public void setRoomService(RoomService roomService) { - this.roomService = roomService; - } public FacilityService getFacilityService() { return facilityService; } @@ -203,5 +111,4 @@ public Integer getIdStructure() { public void setIdStructure(Integer idStructure) { this.idStructure = idStructure; } - } \ No newline at end of file diff --git a/src/action/RoomPriceListAction.java b/src/action/RoomPriceListAction.java index 19bc41cd..7264155d 100644 --- a/src/action/RoomPriceListAction.java +++ b/src/action/RoomPriceListAction.java @@ -76,14 +76,12 @@ public class RoomPriceListAction extends ActionSupport implements SessionAware,U @Autowired private ConventionService conventionService = null; - @Actions({ @Action(value="/goFindAllRoomPriceLists",results = { @Result(name="success",location="/WEB-INF/jsp/roomPriceLists.jsp") }) }) public String goFindAllRoomPriceLists() { - return SUCCESS; } @@ -93,17 +91,13 @@ public String goFindAllRoomPriceLists() { ) ) public String toBlankPage() { - return SUCCESS; } @Actions({ @Action(value="/findAllRoomPriceLists",results = { - @Result(type ="json",name="success", params={ - "root","treeNodes" - }), - @Result(type ="json",name="error", params={ - "excludeProperties","session" + @Result(type ="json",name="success", params={"root","treeNodes"}), + @Result(type ="json",name="error", params={"excludeProperties","session" }), @Result(name="input", location = "/WEB-INF/jsp/validationError.jsp") }) @@ -167,7 +161,6 @@ public String findAllRoomPriceLists() { }) }) public String findRoomPriceListItems() { - this.setPriceList(this.getRoomPriceListService().findRoomPriceListByIdStructureAndIdSeasonAndIdRoomTypeAndIdConvention( this.getIdStructure(), this.getSeasonId(), this.getRoomTypeId(), this.getConventionId())); return SUCCESS; diff --git a/src/action/RoomTypeAction.java b/src/action/RoomTypeAction.java index e0e64db5..2c586fce 100644 --- a/src/action/RoomTypeAction.java +++ b/src/action/RoomTypeAction.java @@ -37,154 +37,19 @@ public class RoomTypeAction extends ActionSupport implements SessionAware,UserAware{ private Map session = null; private Integer idStructure; -// private Message message = new Message(); -// private List roomTypes; -// private RoomType roomType = null; -// private Image image = null; -// private List facilities = null; -// private List roomTypeFacilitiesIds = new ArrayList(); -// @Autowired -// private StructureService structureService = null; -// @Autowired -// private RoomTypeService roomTypeService; -// @Autowired -// private ImageService imageService = null; -// @Autowired -// private FacilityService facilityService = null; -// @Autowired -// private RoomService roomService = null; @Actions({ @Action(value="/findAllRoomTypes",results = { @Result(name="success",location="/WEB-INF/jsp/roomTypes.jsp") - }), @Action(value="/findAllRoomTypesJson",results = { @Result(type ="json",name="success", params={"root","roomTypes"}) }) }) public String findAllRoomTypes() { -// List roomTypes = null; -// -// roomTypes = this.getRoomTypeService().findRoomTypesByIdStructure(this.getIdStructure()); -// for(RoomType each: roomTypes){ -// each.setImages(this.getImageService().findCheckedByIdRoomType(each.getId(),0,100)); -// } -// this.setRoomTypes(roomTypes); -// this.setFacilities(this.getFacilityService().findCheckedByIdStructure(this.getIdStructure(),0,100)); return SUCCESS; } -// -// @Actions({ -// @Action(value="/goUpdateRoomType",results = { -// @Result(name="success",location="/WEB-INF/jsp/roomType_edit.jsp") -// }) -// }) -// public String goUpdateRoomType() { -// RoomType roomType = null; -// -// roomType = this.getRoomTypeService().findRoomTypeById(this.getRoomType().getId()); -// roomType.setFacilities( -// this.getFacilityService().findCheckedByIdRoomType(this.getRoomType().getId(),0,100)); -// roomType.setImages(this.getImageService().findCheckedByIdRoomType(this.getRoomType().getId(),0,100)); -// -// this.setRoomType(roomType); -// this.setFacilities(this.getFacilityService().findCheckedByIdStructure(this.getIdStructure(),0,100)); -// for(Facility each: this.getRoomType().getFacilities()){ -// this.getRoomTypeFacilitiesIds().add(each.getId()); //populating roomFacilitiesIds array with the ids of facilities that are already in rooms to be edited -// } -// return SUCCESS; -// } -// -// /* -// @Actions({ -// @Action(value="/saveUpdateRoomType",results = { -// @Result(type ="json",name="success", params={"root","message"}) -// }) -// }) -// public String saveUpdateRoomType(){ -// RoomType oldRoomtype = null; -// List checkedFacilities = null; -// List filteredRoomTypeFacilitesIds = null; -// Integer anInt; -// -// this.getRoomType().setId_structure(this.getIdStructure()); -// -// filteredRoomTypeFacilitesIds = new ArrayList(); -// for(Object each: this.getRoomTypeFacilitiesIds()){ -// try{ -// anInt = Integer.parseInt((String)each); -// filteredRoomTypeFacilitesIds.add(anInt); -// }catch (Exception e) { -// } -// } -// checkedFacilities = this.getFacilityService().findFacilitiesByIds(filteredRoomTypeFacilitesIds); -// this.getRoomType().setFacilities(checkedFacilities); -// -// oldRoomtype = this.getRoomTypeService().findRoomTypeById(this.getRoomType().getId()); -// if(oldRoomtype == null){ -// //It's a new room type -// this.getRoomTypeService().insertRoomType(this.getRoomType()); -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("roomTypeAddSuccessAction")); -// }else{ -// //It's an existing room type -// this.getRoomTypeService().updateRoomType(this.getRoomType()); -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("roomTypeUpdateSuccessAction")); -// } -// return SUCCESS; -// }*/ -// -// @Actions({ -// @Action(value="/deleteRoomType",results = { -// @Result(type ="json",name="success", params={"root","message"}), -// @Result(type ="json",name="error", params={"root","message"}) -// }) -// }) -// public String deleteRoomType(){ -// Integer id_roomType = 0; -// Integer count = 0; -// -// id_roomType = this.getRoomType().getId(); -// if(this.getRoomService().countRoomsByIdRoomType(id_roomType) > 0){ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("roomTypeDeleteRoomError")); -// return ERROR; -// } -// -// count = this.getRoomTypeService().deleteRoomType(id_roomType); -// if(count >0){ -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("roomTypeDeleteSuccessAction")); -// return SUCCESS; -// }else{ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("roomTypeDeleteErrorAction")); -// return ERROR; -// } -// } -// -// /* -// @Actions({ -// @Action(value="/deleteRoomTypeImage",results = { -// @Result(type ="json",name="success", params={"root","message"}), -// @Result(type ="json",name="error", params={"root","message"}) -// }) -// }) -// public String deleteRoomTypeImage() { -// -// if(this.getImageService().deleteRoomTypeImage(this.getImage().getId())>0){ -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("roomTypeImageDeleteSuccessAction")); -// return "success"; -// }else{ -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("roomTypeImageDeleteErrorAction")); -// return "error"; -// } -// } -// */ + public Map getSession() { return session; } @@ -198,71 +63,4 @@ public Integer getIdStructure() { public void setIdStructure(Integer idStructure) { this.idStructure = idStructure; } -// public Message getMessage() { -// return message; -// } -// public void setMessage(Message message) { -// this.message = message; -// } -// public List getRoomTypes() { -// return roomTypes; -// } -// public void setRoomTypes(List roomTypes) { -// this.roomTypes = roomTypes; -// } -// public RoomType getRoomType() { -// return roomType; -// } -// public void setRoomType(RoomType roomType) { -// this.roomType = roomType; -// } -// public Image getImage() { -// return image; -// } -// public void setImage(Image image) { -// this.image = image; -// } -// public List getRoomTypeFacilitiesIds() { -// return roomTypeFacilitiesIds; -// } -// public void setRoomTypeFacilitiesIds(List roomFacilitiesIds) { -// this.roomTypeFacilitiesIds = roomFacilitiesIds; -// } -// public List getFacilities() { -// return facilities; -// } -// public void setFacilities(List roomTypeFacilities) { -// this.facilities = roomTypeFacilities; -// } -// public StructureService getStructureService() { -// return structureService; -// } -// public void setStructureService(StructureService structureService) { -// this.structureService = structureService; -// } -// public RoomTypeService getRoomTypeService() { -// return roomTypeService; -// } -// public void setRoomTypeService(RoomTypeService roomTypeService) { -// this.roomTypeService = roomTypeService; -// } -// public ImageService getImageService() { -// return imageService; -// } -// public void setImageService(ImageService imageService) { -// this.imageService = imageService; -// } -// public FacilityService getFacilityService() { -// return facilityService; -// } -// public void setFacilityService(FacilityService facilityService) { -// this.facilityService = facilityService; -// } -// public RoomService getRoomService() { -// return roomService; -// } -// public void setRoomService(RoomService roomService) { -// this.roomService = roomService; -// } - } \ No newline at end of file diff --git a/src/action/SeasonAction.java b/src/action/SeasonAction.java index f964b535..440e51b4 100644 --- a/src/action/SeasonAction.java +++ b/src/action/SeasonAction.java @@ -37,113 +37,14 @@ public class SeasonAction extends ActionSupport implements SessionAware,UserAware { private Map session = null; private Integer idStructure; -// private Integer id; -// private List seasons = null; -// private Season season = null; -// private Integer idPeriod = null; -// private List periods = new ArrayList(); -// private Message message = new Message(); -// @Autowired -// private StructureService structureService = null; -// @Autowired -// private SeasonService seasonService = null; @Actions({ @Action(value = "/findAllSeasons", results = { @Result(name = "success", location = "/WEB-INF/jsp/seasons.jsp") }) }) public String findAllSeasons() { - -// this.setSeasons(this.getSeasonService().findSeasonsByIdStructure(this.getIdStructure())); - return SUCCESS; } -// -// @Actions({ -// @Action(value = "/goUpdateSeason", -// results = { @Result(name = "success", location = "/WEB-INF/jsp/season_edit.jsp") }) -// }) -// public String goUpdateSeason() { -// Season theSeason = null; -// -// theSeason = this.getSeasonService().findSeasonById(this.getId()); -// this.setSeason(theSeason); -// return SUCCESS; -// } -// -// @Actions({ @Action(value = "/saveUpdateSeason", results = { -// @Result(type = "json", name = "success", params = {"root","message"}), -// @Result(name = "input", location = "/WEB-INF/jsp/validationError.jsp"), -// @Result(type = "json", name = "error", params = {"root", "message"}) -// }) -// }) -// public String saveUpdateSeason() { -// Season oldSeason = null; -// List periodsWithoutNulls = null; -// -// periodsWithoutNulls = new ArrayList(); -// -// for (Period currPeriod : this.getPeriods()) { -// if ((currPeriod != null )){ -//// if (! currPeriod.checkDates()){ -//// this.getMessage().setResult(Message.ERROR); -//// this.getMessage().setDescription(getText("dateOutMoreDateInAction")); -//// return ERROR; -//// } -// periodsWithoutNulls.add(currPeriod); -// } -// } -// this.getSeason().setPeriods(periodsWithoutNulls); -// -//// if (!this.getStructureService().hasPeriodFreeForSeason(this.getIdStructure(), this.getSeason())) { -//// this.getMessage().setResult(Message.ERROR); -//// this.getMessage().setDescription(getText("periodOverlappedAction")); -//// return ERROR; -//// } -// this.getSeason().setId_structure(this.getIdStructure()); -// -// int currentYear = (this.getSeason().getYear() == null )?Calendar.getInstance().get(Calendar.YEAR): this.getSeason().getYear(); -// this.getSeason().setYear(currentYear); -// -//// if (!this.getSeasonService().checkYears(this.getSeason())) { -//// this.getMessage().setResult(Message.ERROR); -//// this.getMessage().setDescription(getText("periodYearError")); -//// return ERROR; -//// } -// oldSeason = this.getSeasonService().findSeasonById(this.getSeason().getId()); -// if (oldSeason == null) { -// //It's a new season -// //Setting the season's year to the current year -// this.getSeasonService().insertSeason(this.getSeason()); -// //this.getStructureService().refreshPriceLists(structure); -// this.getStructureService().addPriceListsForSeason(this.getIdStructure(), this.getSeason().getId()); -// this.getMessage().setDescription(getText("seasonAddSuccessAction")); -// } else { -// //It's an existing season -// this.getSeasonService().updateSeason(this.getSeason()); -// this.getMessage().setDescription(getText("seasonUpdateSuccessAction")); -// } -// this.getMessage().setResult(Message.SUCCESS); -// return SUCCESS; -// } -// -// @Actions({ @Action(value = "/deleteSeason", results = { -// @Result(type = "json", name = "success", params = {"root", "message"}), -// @Result(type = "json", name = "error", params = {"root", "message"}) -// }) -// }) -// public String deleteSeason() { -// try{ -// this.getSeasonService().deleteSeason(this.getSeason().getId()); -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("seasonDeleteSuccessAction")); -// return SUCCESS; -// }catch (Exception e) { -// this.getMessage().setResult(Message.ERROR); -// this.getMessage().setDescription(getText("seasonDeleteErrorAction")); -// return ERROR; -// } -// } public Map getSession() { return session; @@ -158,53 +59,4 @@ public Integer getIdStructure() { public void setIdStructure(Integer idStructure) { this.idStructure = idStructure; } -// public Message getMessage() { -// return message; -// } -// public void setMessage(Message message) { -// this.message = message; -// } -// public Integer getIdPeriod() { -// return idPeriod; -// } -// public void setIdPeriod(Integer idPeriod) { -// this.idPeriod = idPeriod; -// } -// public Season getSeason() { -// return season; -// } -// public void setSeason(Season season) { -// this.season = season; -// } -// public List getSeasons() { -// return seasons; -// } -// public void setSeasons(List seasons) { -// this.seasons = seasons; -// } -// public List getPeriods() { -// return periods; -// } -// public void setPeriods(List periods) { -// this.periods = periods; -// } -// public Integer getId() { -// return id; -// } -// public void setId(Integer id) { -// this.id = id; -// } -// public SeasonService getSeasonService() { -// return seasonService; -// } -// public void setSeasonService(SeasonService seasonService) { -// this.seasonService = seasonService; -// } -// public StructureService getStructureService() { -// return structureService; -// } -// public void setStructureService(StructureService structureService) { -// this.structureService = structureService; -// } - } \ No newline at end of file diff --git a/src/action/StructureAction.java b/src/action/StructureAction.java index 8a4b4b15..1c00450c 100644 --- a/src/action/StructureAction.java +++ b/src/action/StructureAction.java @@ -55,10 +55,6 @@ public class StructureAction extends ActionSupport implements SessionAware,UserA private StructureService structureService = null; @Autowired private UserService userService = null; -// @Autowired -// private ImageService imageService = null; -// @Autowired -// private FacilityService facilityService = null; @Actions({ @Action(value="/goUpdateDetails",results = { @@ -66,34 +62,8 @@ public class StructureAction extends ActionSupport implements SessionAware,UserA }) }) public String goUpdateDetails() { -// Structure structure = null; -// -// structure = this.getStructureService().findStructureById(this.getIdStructure()); -//// structure.setImages(this.getImageService().findCheckedByIdStructure(structure.getId())); -//// structure.setFacilities(this.getFacilityService().findCheckedByIdStructure(structure.getId())); -// -// this.setStructure(structure); return SUCCESS; } - -// @Actions({ -// @Action(value="/updateDetails",results = { -// @Result(type ="json",name="success", params={"root","message"}), -// @Result(type ="json",name="error", params={"root","message"}) -// }) -// }) -// public String updateDetails() { -// User user = null; -// -// user = (User)this.getSession().get("user"); -// -// this.getStructure().setId_user(user.getId()); -// this.getStructureService().updateStructure(this.getStructure()); -// -// this.getMessage().setResult(Message.SUCCESS); -// this.getMessage().setDescription(getText("structureDetailsUpdatedSuccessAction")); -// return SUCCESS; -// } @Actions({ @Action(value="/updateAccount",results = { @@ -177,18 +147,5 @@ public UserService getUserService() { } public void setUserService(UserService userService) { this.userService = userService; - } -// public ImageService getImageService() { -// return imageService; -// } -// public void setImageService(ImageService imageService) { -// this.imageService = imageService; -// } -// public FacilityService getFacilityService() { -// return facilityService; -// } -// public void setFacilityService(FacilityService facilityService) { -// this.facilityService = facilityService; -// } - + } } \ No newline at end of file