Skip to content

Commit

Permalink
Merge pull request #100 from DPIRPSG/Develop
Browse files Browse the repository at this point in the history
Deliverable
  • Loading branch information
ManuelLR committed Dec 23, 2015
2 parents 27aeb58 + ba2a848 commit 1a74bf2
Show file tree
Hide file tree
Showing 230 changed files with 8,961 additions and 737 deletions.
10 changes: 10 additions & 0 deletions Cambios de DP6Entrega.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Cambios de DP6Entrega

- Mensaje de error en el registro de Consumer y Clerk
- Revisar el pattern de teléfono. No funcionaba con un teléfono de Chile
- Cambiar populate.xml para crear más items y que la paginación funcione.
- Puedes entrar en una URL de admin siendo consumer.
- Modificar security del proyecto.
- La URL del botón de crear clerk está mal.
- Faltan los servicios de issue de Git (https://github.com/DPIRPSG/DP6Entrega/issues/16)
-
Binary file added Roadmap of this lesson.pdf
Binary file not shown.
Binary file added UML/Domain model.pdf
Binary file not shown.
Binary file added UML/Domain model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added UML/V2.1_Acme-Supermarket_DM_A.asta
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Generated by Maven Integration for Eclipse
#Thu Nov 26 19:13:20 CET 2015
#Mon Dec 21 13:43:45 CET 2015
version=1.0
groupId=Design-and-Testing
m2e.projectName=Acme-Certifications
m2e.projectLocation=E\:\\Proyecto\\DP5Entrega\\WorkSpace\\Acme-Certifications
m2e.projectLocation=E\:\\Proyecto\\DP6Entrega\\WorkSpace\\Acme-Certifications
artifactId=Acme-Certifications
11 changes: 11 additions & 0 deletions WorkSpace/Acme-Supermarket/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
A continuaci�n se detallan lo que hemos considerado aspectos importantes a tener en cuenta en nuestra implementaci�n del proyecto y que no est�n reflejados en otras zonas del mismo:

Respecto a las "queries":
-Query C/1: Aunque podr�a tener m�s sentido no tener en cuenta los "orders" cancelados, hemos decidido tener en cuenta todo tipo de "orders" que hayan sido creadas debido a que el enunciado pide exactamente los "orders placed", es decir, pedidos realizados, sin distinci�n alguna en cuanto a si han sido cancelados, entregados o cualquier estado del mismo.

-Query B/5: Esta query referente al ratio la hemos interpretado como el n�mero de pedidos cancelados en el mes actual entre el n�mero de pedidos encargados dicho mes ("Placed" en el vocabulario del Statement). Seg�n otras interpretaciones, podr�a entenderse entre el n�mero de pedidos cancelados en el mes actual entre el n�mero de pedidos encargados sin tener en cuenta la fecha de encargo. Esto nos pareci� poco �til ya que en una cadena de gran tama�o a medida que pasase el tiempo el ratio ser�a muy pr�ximo a cero, sirviendo el ratio de poco como m�todo estad�stico.

-Query A/1: Se nos pide el item (o items) que tiene(o tengan) comentarios sin m�s. Sin embargo hemos visto oportuno filtrarlos no teniendo en cuenta aquellos items que hayan sido borrados (lo cu�l s�lo implica un cambio de valor en el atributo "deleted" de cada item).

Respecto al D06-Controllers
- Nos hemos percatado que nos piden lo siguiente: "It�s very important that your �PopulateDatabase.xml� file provides at least six items and six contracts.". En el dominio de nuestro problema no hemos encontrado una equivalencia a los contracts con lo que hemos decidido interpretarlos como los pedidos (Orders).
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import domain.CustomizationInfo;

import services.CustomizationInfoService;

@Controller
@RequestMapping("/about-us")
public class AboutUsController extends AbstractController {

// Services ----------------------------------------------------------

@Autowired
private CustomizationInfoService customizationInfoService;

// Constructors -----------------------------------------------------------

public AboutUsController() {
super();
}

//About Us

@RequestMapping(value = "/about-us")
public ModelAndView aboutUs(@RequestParam(required=false, defaultValue="94") int customizationInfoId){
ModelAndView result;
CustomizationInfo customizationInfo;

customizationInfo = customizationInfoService.findOne(customizationInfoId);

result = new ModelAndView("about-us/about-us");
result.addObject("customizationInfo", customizationInfo);

return result;
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package controllers;

import java.util.Collection;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import services.ActorService;
import services.CommentService;
import services.ItemService;
import domain.Comment;
import domain.Item;

@Controller
@RequestMapping("/comment")
public class CommentController extends AbstractController {

// Services ----------------------------------------------------------

@Autowired
private CommentService commentService;

@Autowired
private ItemService itemService;

@Autowired
private ActorService actorService;


// Constructors --------------------------------------------------------

public CommentController() {
super();
}


// Listing ------------------------------------------------------------

@RequestMapping(value = "/list", method = RequestMethod.GET)
public ModelAndView list(@RequestParam int itemId) {
ModelAndView result;
Collection<Comment> comments;
Item item;

item = itemService.findOne(itemId);
comments = commentService.findAllByItem(item);

result = new ModelAndView("comment/list");
result.addObject("comments", comments);
result.addObject("item", item);
result.addObject("requestURI", "comment/list.do");

return result;
}


// Creating --------------------------------------------------------------

@RequestMapping(value = "/create", method = RequestMethod.GET)
public ModelAndView create(@RequestParam int itemId) {
ModelAndView result;
Comment comment;
Item item;

item = itemService.findOne(itemId);
comment = commentService.createByItem(item);
result = createEditModelAndView(comment, item);

return result;
}

@RequestMapping(value="/create", method=RequestMethod.POST, params="save")
public ModelAndView save(@Valid Comment comment, BindingResult binding) {
ModelAndView result;

if (binding.hasErrors()) {
result = createEditModelAndView(comment, comment.getItem());
} else {
try {
commentService.save(comment);
result = new ModelAndView("redirect:list.do?itemId=" + comment.getItem().getId());
} catch (Throwable oops) {
result = createEditModelAndView(comment, comment.getItem(), "comment.commit.error");
}
}
return result;
}


// Ancillary methods ---------------------------------------------------

protected ModelAndView createEditModelAndView(Comment comment, Item item) {
ModelAndView result;

result = createEditModelAndView(comment, item, null);

return result;
}

protected ModelAndView createEditModelAndView(Comment comment, Item item, String message) {
ModelAndView result;
if(actorService.checkAuthority("ADMIN") || actorService.checkAuthority("CONSUMER") || actorService.checkAuthority("CLERK")){
comment.setUserName(actorService.findByPrincipal().getName());
}else{
comment.setUserName("Anonymous");
}

result = new ModelAndView("comment/create");
result.addObject("comment", comment);
result.addObject("item", item);
result.addObject("message", message);

return result;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package controllers;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import services.ExchangeRateService;
import services.ItemService;
import domain.ExchangeRate;
import domain.Item;

@Controller
@RequestMapping(value = "/item")
public class ItemController extends AbstractController {

// Services ----------------------------------------------------------

@Autowired
private ItemService itemService;
@Autowired
private ExchangeRateService exchangeRateService;

// Constructors ----------------------------------------------------------

public ItemController() {
super();
}

// Listing ----------------------------------------------------------

@RequestMapping(value = "/list", method = RequestMethod.GET)
public ModelAndView list(@RequestParam(required=false, defaultValue="") String keyword, @RequestParam(required=false) Integer exchangeRateId) {
ModelAndView result;
Collection<Item> items;
Collection<ExchangeRate> moneyList;
String keywordToFind;
ExchangeRate exchangeRate;

exchangeRate = null;
moneyList = exchangeRateService.findAll();

items = itemService.findAll();

if (!keyword.equals("")) {
String[] keywordComoArray = keyword.split(" ");
for (int i = 0; i < keywordComoArray.length; i++) {
if (!keywordComoArray[i].equals("")) {
keywordToFind = keywordComoArray[i];
items = itemService.findBySingleKeyword(keywordToFind);
break;
}
}
}

if(exchangeRateId != null) {
exchangeRate = exchangeRateService.findOne(exchangeRateId);
} else {
exchangeRate = exchangeRateService.findOneByName("Euros");
}

result = new ModelAndView("item/list");
result.addObject("requestURI", "item/list.do?");
result.addObject("items", items);
result.addObject("moneyList", moneyList);
result.addObject("exchangeRate", exchangeRate);
result.addObject("keyword", keyword);

return result;
}
}
Loading

0 comments on commit 1a74bf2

Please sign in to comment.