Skip to content

Commit

Permalink
Merged in FEATURE/FS-111 (pull request labos#2)
Browse files Browse the repository at this point in the history
FEATURE/FS-111
  • Loading branch information
Francesco Amedeo Fontana committed Feb 8, 2017
2 parents f1f0466 + a97e42f commit d394185
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 27 deletions.
10 changes: 2 additions & 8 deletions global.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
resource.folder=/Applications/LocandaServer9/Locanda_resources
#resource.folder="Locanda_target/Locanda_resources"
#resource.folder=${project.build.directory}/${project.name}_resources
solr.homeDir=${resource.folder}/solr
solr.configFile=${solr.homeDir}/solr.xml



#solr.homeDir=${CATALINA_HOME}/webapps/Locanda/WEB-INF/classes/Locanda_resources
#solr.configFile=${CATALINA_HOME}/webapps/Locanda/WEB-INF/classes/Locanda_resources/solr.xml
3 changes: 2 additions & 1 deletion h2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ db.name=locanda
db.username=locanda
db.password=locanda
db.driverClassName=org.h2.Driver
db.url=jdbc:h2:${db.folder}/${db.name};DATABASE_TO_UPPER=FALSE

#db.url=jdbc:h2:${db.folder}/${db.name};DATABASE_TO_UPPER=FALSE
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<version>0.4</version>

<properties>
<resource.folder>${project.build.directory}/${project.name}_resources</resource.folder>
<!--<db.folder>${basedir}/opt/h2/databases</db.folder>-->
<db.folder>/Applications/LocandaServer9/databases</db.folder>
<resource.folder>./${project.name}_resources</resource.folder>
<db.folder>${resource.folder}/databases</db.folder>
<solr.folder>${resource.folder}/solr</solr.folder>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -37,7 +37,7 @@
<directory>${basedir}/${project.name}_target</directory>
<finalName>${project.name}</finalName>
<filters>
<filter>global.properties</filter>
<!--filter>global.properties</filter-->
<filter>h2.properties</filter>
</filters>
<resources>
Expand All @@ -49,7 +49,7 @@
</resource>
<resource>
<directory>${basedir}/solr</directory>
<targetPath>${resource.folder}/solr</targetPath>
<targetPath>${solr.folder}</targetPath>
</resource>
<resource>
<directory>${basedir}/h2</directory>
Expand All @@ -61,8 +61,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 2 additions & 0 deletions solr/solr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
adminPath: RequestHandler path to manage cores.
If 'null' (or absent), cores will not be manageable via request handler
-->

# GLOBALIZE
<cores adminPath="/admin/cores">
<core name="convention" instanceDir="convention"/>
<core name="guest" instanceDir="guest"/>
Expand Down
29 changes: 21 additions & 8 deletions src/resources/ExportResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import service.BookingService;
import service.ExportService;
import service.GroupLeaderService;
import service.HousedExportService;
import service.HousedService;
import service.TourismTypeService;
import service.TransportService;
import service.*;
import utils.I18nUtils;

@Path("/export/")
Expand All @@ -63,6 +57,9 @@ public class ExportResource {
private TourismTypeService tourismTypeService = null;
@Autowired
private TransportService transportService = null;
@Autowired
private RoomService roomService = null;

private static Logger logger = Logger.getLogger(Logger.class);

@GET
Expand Down Expand Up @@ -138,6 +135,7 @@ public Response exportFileQuestura(@PathParam("idStructure") Integer idStructure
List<HousedExport> housedExportSingleList = null;
Integer availableRooms;
Integer availableBeds;
Integer roomsInStructure;


exportDate = new Date(Long.parseLong(date));
Expand All @@ -153,6 +151,9 @@ public Response exportFileQuestura(@PathParam("idStructure") Integer idStructure

//CREO LA LISTA DEGLI HOUSED EXPORT Singoli
housedExportSingleList = this.findHousedExportSingleList(housedExportList);

//ESTRAGGO IL NUMERO DI STANZE NELLA STRUTTURA
roomsInStructure = roomService.findAll().size();

availableRooms =this.getExportService().calculateAvailableNumberOfRoomsForStructureInDate(idStructure, exportDate);
availableBeds = this.getExportService().calculateAvailableNumberOfBedsForStructureInDate(idStructure, exportDate);
Expand Down Expand Up @@ -229,6 +230,8 @@ public Response exportFileSired(@PathParam("idStructure") Integer idStructure,@Q
List<HousedExport> housedExportSingleList = null;
Integer availableRooms;
Integer availableBeds;
Integer roomsInStructure;
Integer bedsInRoom;

logger.info("#####FORCE:" + force);
exportDate = new Date(Long.parseLong(date));
Expand All @@ -246,6 +249,11 @@ public Response exportFileSired(@PathParam("idStructure") Integer idStructure,@Q

//CREO LA LISTA DEGLI HOUSED EXPORT Singoli
housedExportSingleList = this.findHousedExportSingleList(housedExportList);

//NUMERO TOTALE DI STANZE NELLA STRUTURA
roomsInStructure = this.roomService.findRoomsByIdStructure(idStructure).size();



availableRooms =this.getExportService().calculateAvailableNumberOfRoomsForStructureInDate(idStructure, exportDate);
availableBeds = this.getExportService().calculateAvailableNumberOfBedsForStructureInDate(idStructure, exportDate);
Expand Down Expand Up @@ -297,7 +305,10 @@ public Response exportFileSired(@PathParam("idStructure") Integer idStructure,@Q
each.getHoused().setHousedType(anHousedType);
guestQuesturaFormatter.setModalita(each.getMode());
guestQuesturaFormatter.setCamereOccupate(1);
guestQuesturaFormatter.setCamereDisponibili(availableRooms);
//NUMERO TOTALE DI LETTI NELLA STANZA
//Booking booking = this.bookingService.findBookingById(each.getHoused().getGuest().getId());
//bedsInRoom = booking.getRoom().getRoomType().getMaxGuests();
guestQuesturaFormatter.setCamereDisponibili(roomsInStructure);
guestQuesturaFormatter.setLettiDisponibili(availableBeds);
TourismType tourismTypeSingle = this.getTourismTypeService().findById(each.getHoused().getId_tourismType());
Transport transportSingle = this.getTransportService().findById(each.getHoused().getId_transport());
Expand All @@ -306,6 +317,8 @@ public Response exportFileSired(@PathParam("idStructure") Integer idStructure,@Q
Integer tourismTaxSingle = each.getHoused().getTouristTax() ? 1 : 0;
guestQuesturaFormatter.setTassaSoggiorno(tourismTaxSingle);
guestQuesturaFormatter.setDataFromHousedForRegione(each.getHoused());
//guestQuesturaFormatter.setDataArrivo(booking.getDateIn());
//guestQuesturaFormatter.setDataDiPartenza(booking.getDateOut());
sb.append(guestQuesturaFormatter.getRowRegione());

}
Expand Down
2 changes: 1 addition & 1 deletion webroot/META-INF/context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
username="${db.username}"
password="${db.password}"
driverClassName="${db.driverClassName}"
url="${db.url}"
url="jdbc:h2:${catalina.home}/webapps/Locanda/WEB-INF/classes/Locanda_resources/databases/${db.name};DATABASE_TO_UPPER=FALSE"
/>
</Context>
6 changes: 4 additions & 2 deletions webroot/WEB-INF/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
<context:property-placeholder location="/WEB-INF/solr.properties"/>

<bean id="multiCoreContainer" class="org.apache.solr.core.CoreContainer">
<constructor-arg><value>${solr.homeDir}</value></constructor-arg>
<constructor-arg><value>${solr.configFile}</value></constructor-arg>
<!--# GLOBALIZE-->
<constructor-arg><value>${CATALINA_HOME}/webapps/Locanda/WEB-INF/classes/Locanda_resources/solr</value></constructor-arg>
<!--# GLOBALIZE-->
<constructor-arg><value>${CATALINA_HOME}/webapps/Locanda/WEB-INF/classes/Locanda_resources/solr/solr.xml</value></constructor-arg>
</bean>


Expand Down

0 comments on commit d394185

Please sign in to comment.