<file_sep>
package controllers.chapter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.validation.ValidationException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Validator;
import org.springframework.web.bind.annotation.ModelAttribute;
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 repositories.ParadeRepository;
import services.AreaService;
import services.ChapterService;
import services.FloatService;
import services.ParadeService;
import controllers.AbstractController;
import domain.Area;
import domain.Chapter;
import domain.Parade;

@Controller
@RequestMapping("/parade")
public class ParadeChapterController extends AbstractController {

	@Autowired
	ChapterService		chapterService;

	@Autowired
	ParadeService		paradeService;

	@Autowired
	FloatService		floatService;

	@Autowired
	AreaService			areaService;

	@Autowired
	ParadeRepository	paradeRepository;


	@RequestMapping(value = "/chapter/list", method = RequestMethod.GET)
	public ModelAndView list() {
		ModelAndView res;

		final Collection<Parade> parades = this.paradeService.findParadesByChapterId();
		final List<Boolean> finalModes = new ArrayList<>();
		finalModes.add(true);
		finalModes.add(false);

		res = new ModelAndView("parade/chapter/list");
		res.addObject("parades", parades);
		res.addObject("requestURI", "parade/chapter/list.do");
		res.addObject("finalModes", finalModes);
		return res;
	}


	@Autowired
	Validator	validator;


	@RequestMapping(value = "/chapter/editStatus", method = RequestMethod.POST, params = "save")
	public ModelAndView save(@ModelAttribute Parade parade, final BindingResult binding) {
		ModelAndView result;
		try {
			final Parade paradeOld = this.paradeRepository.findOne(parade.getId());
			final String subm = "SUBMITTED";
			Assert.isTrue(paradeOld.getStatus() == "SUBMITTED" || paradeOld.getStatus() == subm || paradeOld.getStatus().contains("SUBMITTED"));
			parade = this.paradeService.reconstructChapter(parade, binding);
			this.paradeService.saveStatus(parade);
			result = new ModelAndView("redirect:list.do");
		} catch (final ValidationException oops) {
			result = this.createEditModelAndView(parade);
		} catch (final Throwable oops) {
			result = this.createEditModelAndView(parade, "parade.commit.error");
		}

		return result;

	}

	@RequestMapping(value = "/chapter/create", method = RequestMethod.GET)
	public ModelAndView create() {
		ModelAndView res;
		Parade parade;

		parade = this.paradeService.create();

		res = this.createEditModelAndView(parade);

		return res;
	}

	@RequestMapping(value = "/chapter/editStatus", method = RequestMethod.GET)
	public ModelAndView edit(@RequestParam final int paradeId) {
		ModelAndView result;
		Parade parade;

		parade = this.paradeService.findOne(paradeId);
		//Area de la parade
		final Area area = this.areaService.getParadeArea(paradeId);
		//Se comprueba que la parade pertenece a la área que gestiona el chapter logeado
		final Chapter cha = this.chapterService.findByPrincipal();
		Assert.isTrue(area == cha.getArea());

		Assert.isTrue(parade.getFinalMode() == false);
		result = this.createEditModelAndView(parade);

		return result;
	}

	@RequestMapping(value = "/chapter/editStatus", method = RequestMethod.POST, params = "delete")
	public ModelAndView delete(final Parade parade, final BindingResult binding) {
		ModelAndView result;

		try {
			this.paradeService.delete(parade);
			result = new ModelAndView("redirect:list.do");
		} catch (final Throwable oops) {
			result = this.createEditModelAndView(parade, "parade.commit.error");
		}

		return result;
	}

	protected ModelAndView createEditModelAndView(final Parade parade) {
		ModelAndView result;

		result = this.createEditModelAndView(parade, null);

		return result;

	}

	protected ModelAndView createEditModelAndView(final Parade parade, final String message) {
		ModelAndView result;

		final Collection<Parade> parades = this.paradeService.findParadesByChapterId();

		result = new ModelAndView("parade/chapter/editStatus");
		result.addObject("parades", parades);
		result.addObject("parade", parade);
		result.addObject("message", message);

		return result;
	}
}
<file_sep>
package services;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Validator;

import repositories.AdministratorRepository;
import security.Authority;
import security.LoginService;
import security.UserAccount;
import utilities.TickerGenerator;
import domain.Actor;
import domain.Administrator;
import domain.Box;
import domain.Customisation;
import domain.Message;
import domain.SocialProfile;
import forms.AdministratorForm;

@Service
@Transactional
public class AdministratorService {

	// Repository
	@Autowired
	private AdministratorRepository	administratorRepository;

	// Services

	@Autowired
	public ActorService				actorService;

	@Autowired
	public FinderService			finderService;

	@Autowired
	public CustomisationService		customisationService;

	@Autowired
	public SocialProfileService		socialProfileService;


	public AdministratorService() {
		super();
	}

	// Simple CRUD

	// 8.1
	public Administrator create() {
		// User can't be logged to register
		//		final Authority a = new Authority();
		//		final Authority b = new Authority();
		//		final Authority c = new Authority();
		//		final Authority d = new Authority();
		//		final Authority e = new Authority();
		//		final UserAccount user = LoginService.getPrincipal();
		//		a.setAuthority(Authority.ADMIN);
		//		b.setAuthority(Authority.HANDYWORKER);
		//		c.setAuthority(Authority.CUSTOMER);
		//		d.setAuthority(Authority.REFEREE);
		//		e.setAuthority(Authority.SPONSOR);
		//		Assert.isTrue(!(user.getAuthorities().contains(a) || user.getAuthorities().contains(b) || user.getAuthorities().contains(c) || user.getAuthorities().contains(d) || user.getAuthorities().contains(e)));

		Administrator result;
		result = new Administrator();

		// Actor
		//		final Box trash = new Box();
		//		final Box out = new Box();
		//		final Box spam = new Box();
		//		final Box in = new Box();
		//		trash.setName("trash");
		//		in.setName("in");
		//		out.setName("out");
		//		spam.setName("spam");
		//		out.setPredefined(true);
		//		in.setPredefined(true);
		//		spam.setPredefined(true);
		//		trash.setPredefined(true);
		final Collection<Box> predefined = new ArrayList<Box>();
		//		predefined.add(in);
		//		predefined.add(out);
		//		predefined.add(spam);
		//		predefined.add(trash);

		//	result.setBoxes(predefined);

		final UserAccount newUser = new UserAccount();
		final Authority f = new Authority();
		f.setAuthority(Authority.MEMBER);
		newUser.addAuthority(f);
		result.setUserAccount(newUser);

		result.setSocialProfiles(new ArrayList<SocialProfile>());
		result.setName("");
		result.setEmail("");
		result.setAddress("");
		result.setSurname("");
		result.setPhoneNumber("");
		result.setPhoto("");

		// Administrator

		return result;
	}

	// Returns logged administrator
	public Administrator findByPrincipal() {
		Administrator res;
		UserAccount userAccount;

		userAccount = LoginService.getPrincipal();
		Assert.notNull(userAccount);
		res = this.findByUserAccount(userAccount);
		Assert.notNull(res);

		return res;
	}

	// 11.1
	//	public Administrator findByFixUpTask(final FixUpTask fixUpTask) {
	//		// Logged user must be a handyWorker
	//		final Authority a = new Authority();
	//		final UserAccount user = LoginService.getPrincipal();
	//		a.setAuthority(Authority.HANDYWORKER);
	//		Assert.isTrue(user.getAuthorities().contains(a));
	//
	//		Administrator res;
	//		res = this.administratorRepository.findFixUpTask(fixUpTask.getId());
	//		return res;
	//	}

	// Returns logged administrator from his or her userAccount
	public Administrator findByUserAccount(final UserAccount userAccount) {
		Administrator res;
		Assert.notNull(userAccount);

		res = this.administratorRepository.findByUserAccountId(userAccount.getId());

		return res;
	}

	public Collection<Administrator> findAll() {
		return this.administratorRepository.findAll();
	}

	public Administrator save(final Administrator mem) {

		// Restrictions
		Assert.isTrue(mem.getBan() != true);

		if (mem.getId() == 0) {
			Collection<Box> boxes = actorService.createPredefinedBoxes();
			mem.setBoxes(boxes);
			final Md5PasswordEncoder encoder = new Md5PasswordEncoder();
			final String oldpass = mem.getUserAccount().getPassword();
			final String hash = encoder.encodePassword(oldpass, null);

			final UserAccount cuenta = mem.getUserAccount();
			cuenta.setPassword(<PASSWORD>);
			mem.setUserAccount(cuenta);

			//			final Box in1 = new Box();
			//			in1.setName("In");
			//			in1.setPredefined(true);
			//			final Box in = this.boxService.save(in1);
			//
			//			final Collection<Box> boxesPredefined = new ArrayList<Box>();
			//			boxesPredefined.add(in);
			//			cus.setBoxes(boxesPredefined);

		}
		return this.administratorRepository.save(mem);
	}
	public Administrator findOne(final int administratorId) {
		Administrator c;

		Assert.notNull(administratorId);
		Assert.isTrue(administratorId != 0);
		c = this.administratorRepository.findOne(administratorId);

		Assert.notNull(c);
		return c;
	}

	public Administrator reconstruct(final AdministratorForm administratorForm, final BindingResult binding) {
		final Administrator administrator = this.create();

		Assert.isTrue(administratorForm.isConditionsAccepted());
		final Authority adm = new Authority();
		adm.setAuthority(Authority.ADMIN);
		Assert.isTrue(administratorForm.getUserAccount().getAuthorities().contains(adm));
		final Collection<Authority> colAdm = new ArrayList<Authority>();
		final Authority memb = new Authority();
		memb.setAuthority(Authority.ADMIN);
		colAdm.add(memb);
		//Assert.isTrue(memberForm.getUserAccount().getAuthorities() == colMem);
		//Damos valores a los atributos del member que devolveremos con los datos que nos llegan

		administrator.setAddress(administratorForm.getAddress());
		administrator.setEmail(administratorForm.getEmail());
		administrator.setMiddleName(administratorForm.getMiddleName());
		administrator.setName(administratorForm.getName());
		administrator.setPhoneNumber(administratorForm.getPhoneNumber());
		administrator.setPhoto(administratorForm.getPhoto());
		administrator.setSurname(administratorForm.getSurname());
		administrator.setUserAccount(administratorForm.getUserAccount());

		//		member.setFlagSpam(memberForm.isFlagSpam());
		//		member.setPolarityScore(memberForm.getPolarityScore());
		//		member.setBan(memberForm.getBan());

		administrator.setBan(false);

		return administrator;
	}


	@Autowired
	private Validator	validator;


	public Administrator reconstruct(final Administrator administrator, final BindingResult binding) {
		Administrator res;

		//Check authority
		final Authority a = new Authority();
		final UserAccount user = administrator.getUserAccount();
		a.setAuthority(Authority.ADMIN);
		Assert.isTrue(user.getAuthorities().contains(a) && user.getAuthorities().size() == 1);

		if (administrator.getId() == 0)
			res = administrator;
		else {
			res = this.administratorRepository.findOne(administrator.getId());

			res.setName(administrator.getName());
			res.setEmail(administrator.getEmail());
			res.setMiddleName(administrator.getMiddleName());
			res.setSurname(administrator.getSurname());
			res.setAddress(administrator.getAddress());
			res.setPhoneNumber(administrator.getPhoneNumber());
			res.setPhoto(administrator.getPhoto());

			this.validator.validate(res, binding);
		}
		return res;
	}
	public void calculateScoreApp() {
		Integer score = 0;
		final List<Customisation> cus = new ArrayList<>(this.customisationService.findAll());
		final Customisation cus1 = cus.get(0);
		final List<String> positive = new ArrayList<String>(cus1.getPositiveWords());
		final List<String> negative = new ArrayList<String>(cus1.getNegativeWords());

		final List<Actor> la = new ArrayList<>(this.actorService.findAll());
		Double res1 = null;

		for (final Actor a : la) {
			final List<Box> lb = new ArrayList<>(a.getBoxes());
			for (final Box b : lb)
				if (b.getName().contains("out box")) {
					final List<Message> lm = new ArrayList<>(b.getMessages());
					for (final Message m : lm) {
						final String text = m.getBody();
						for (final String p : positive)
							if (text.contains(p))
								score++;
						for (final String n : negative)
							if (text.contains(n))
								score--;
					}
					break;
				}
			if ((score >= -10 || score <= 10))
				res1 = new Double(score / 10);
			else if (score <= 100 || score >= -100)
				res1 = new Double(score / 100);
			else if (score <= 1000 || score >= -1000)
				res1 = new Double(score / 1000);

			a.setPolarityScore(res1);
		}

	}
	public void leave() {
		final Administrator logAdministrator = this.findByPrincipal();

		logAdministrator.setAddress("Unknown");
		logAdministrator.setBan(true);
		logAdministrator.setEmail("<EMAIL>");
		logAdministrator.setMiddleName("Unknown");
		logAdministrator.setName("Unknown");
		logAdministrator.setPhoneNumber("Unknown");
		logAdministrator.setPhoto("http://www.unknown.com");
		logAdministrator.setPolarityScore(0);
		for (final SocialProfile sp : logAdministrator.getSocialProfiles())
			this.socialProfileService.deleteLeave(sp);
		logAdministrator.setSocialProfiles(null);
		logAdministrator.setSurname("Unknown");

		final UserAccount ua = logAdministrator.getUserAccount();
		final String tick1 = TickerGenerator.tickerLeave();
		ua.setUsername("Unknown" + tick1);
		final String pass1 = TickerGenerator.generateTicker();
		final Md5PasswordEncoder encoder = new Md5PasswordEncoder();
		final String pass2 = encoder.encodePassword(pass1, null);
		ua.setPassword(pass2);
		logAdministrator.setUserAccount(ua);
	}
}
<file_sep>package controllers.brotherhood;


import java.util.List;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
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 domain.Parade;
import domain.Segment;


import services.ParadeService;
import services.SegmentService;


@Controller
@RequestMapping("/parade/segment")
public class ParadeSegmentController {
	
	@Autowired
	private SegmentService	segmentService;
	
	@Autowired
	private ParadeService	paradeService;
	
	private Parade			paradeACT;
	
	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public ModelAndView list(@RequestParam int paradeId) {
		ModelAndView result;
		
		Parade parade = this.paradeService.findOne(paradeId);
		this.paradeACT = parade;

		final List<Segment> segments = this.segmentService.getSegmentsByParade(parade);
		if(segments==null){
			return new ModelAndView("redirect:/welcome/index.do"); 
		}

		result = new ModelAndView("parade/segment/list");
		result.addObject("segments", segments);
		result.addObject("requestURI", "/parade/segment/list.do");

		return result;
	}
	
	@RequestMapping(value = "/create", method = RequestMethod.GET)
	public ModelAndView create() {
		ModelAndView result;
		Segment segment;

		segment = this.segmentService.create(this.paradeACT.getId());

		result = this.createEditModelAndView(segment, this.paradeACT);
		return result;
	}
	
	@RequestMapping(value = "/edit", method = RequestMethod.GET)
	public ModelAndView edit(@RequestParam final int segmentId) {
		ModelAndView result;
		Segment segment;

		segment = this.segmentService.findOne(segmentId);
		Assert.notNull(segment);
		if(this.paradeACT.getSegments().size()==segment.getSegmentOrder()){
			result = this.createEditModelAndView(segment,this.paradeACT);
		}else{
			result = this.list(this.paradeACT.getId());
		}
		
		
		return result;
	}
	
	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "save")
	public ModelAndView save(@Valid final Segment segment, final BindingResult binding) {
		ModelAndView result;

		if (binding.hasErrors())
			result = this.createEditModelAndView(segment, this.paradeACT);
		else
			try {
				if(this.segmentService.isCorrectDate(segment, this.paradeACT)){
					this.paradeService.saveSegmentInParade(segment,this.paradeACT);
					result = this.list(this.paradeACT.getId());
				}else{
					result = this.createEditModelAndView(segment,this.paradeACT, "segment.commit.error");
				}
				
			} catch (final Throwable oops) {
				result = this.createEditModelAndView(segment,this.paradeACT, "segment.commit.error");
			}
			
		return result;
	}
	
	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "delete")
	public ModelAndView delete(final Segment segment, final BindingResult binding) {
		ModelAndView result;

		try {
			this.paradeService.deleteSegmentInParade(segment, paradeACT);
			result = this.list(this.paradeACT.getId());
		} catch (final Throwable oops) {
			result = this.createEditModelAndView(segment,this.paradeACT);
		}
		
		return result;
	}

	

	protected ModelAndView createEditModelAndView(Segment segment,Parade parade) {
		ModelAndView result;
		result = this.createEditModelAndView(segment,parade, null);
		
		return result;
	}
	
	protected ModelAndView createEditModelAndView(Segment segment, Parade parade, String messageCode) {
		ModelAndView result;
		
		result = new ModelAndView("parade/segment/edit");
		result.addObject("segment", segment);
		
		result.addObject("parade",parade);
		result.addObject("message", messageCode);

		return result;
	}
	
	//-------------------------DISPLAY-----------------------------------
	
			@RequestMapping(value = "/display", method = RequestMethod.GET)
			public ModelAndView display(@RequestParam final int segmentId) {
				ModelAndView result;
				Segment segment;

				segment = this.segmentService.findOne(segmentId);
				Assert.notNull(segment);

				result = this.createDisplayModelAndView(segment);

				return result;
			}

			protected ModelAndView createDisplayModelAndView(final Segment segment) {
				ModelAndView result;
				result = this.createDisplayModelAndView(segment, null);

				return result;
			}

			protected ModelAndView createDisplayModelAndView(final Segment segment, final String messageCode) {
				ModelAndView result;

				result = new ModelAndView("parade/segment/display");
				result.addObject("segment", segment);
				result.addObject("messageCode", messageCode);
			
				return result;

			}

}
<file_sep>
package repositories;

import java.util.Collection;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Administrator;
import domain.Brotherhood;
import domain.Member;

@Repository
public interface DashboardRepository extends JpaRepository<Administrator, Integer> {

	//12.3.1 
	@Query("select min(e.size) from Brotherhood b join b.enrolements e where e.status ='APPROVED'")
	double minMembers();

	@Query("select max(e.size) from Brotherhood b join b.enrolements e where e.status ='APPROVED'")
	double maxMembers();

	@Query("select avg(e.size) from Brotherhood b join b.enrolements e where e.status ='APPROVED'")
	double avgMembers();

	@Query("select stddev(e.size) from Brotherhood b join b.enrolements e where e.status ='APPROVED'")
	double stddevMembers();

	//12.3.2
	@Query("select b from Brotherhood b join b.enrolements e where e.status='APPROVED' and e.dropOutMoment is null order by count(e) desc")
	Collection<Brotherhood> largestBrotherhoods();

	//12.3.3
	@Query("select b from Brotherhood b join b.enrolements e where e.status='APPROVED' and e.dropOutMoment is null order by count(e) asc")
	Collection<Brotherhood> smallestBrotherhoods();

	//12.3.4
	@Query("select 1.0 * count(r)/(select count(r1) from Request r1), r.procession.title, r.status from Request r group by r.status, r.procession")
	List<Object[]> requestRatioByProcession();

	//12.3.5 in service
	//12.3.6
	@Query("select 1.0 * count(r1)/(select count(r) from Request r) from Request r1 group by r1.status")
	List<Double> requestRatio();

	//12.3.7 
	@Query("select distinct m from Member m join m.requests r1 where r1.status='APPROVED' group by m.id having count(r1)> 0.1 * m.requests.size")
	Collection<Member> membersWith10PercentRequestsApproved();

	//12.3.8
	@Query("select e.position.positionEng, count(e) from Enrolement e group by e.position")
	List<Object[]> positionHistogram();
	//22.2.1
	@Query("select 1.0 * count(b)/(select count(b1) from Brotherhood b1) from Area a join a.brotherhoods b")
	double ratioBrotherhoodsPerArea();

	@Query("select a.brotherhoods.size from Area a")
	Collection<Double> countBrotherhoodsPerArea();

	@Query("select min(a.brotherhoods.size) from Area a")
	double minBrotherhoodsPerArea();

	@Query("select max(a.brotherhoods.size) from Area a")
	double maxBrotherhoodsPerArea();

	@Query("select avg(a.brotherhoods.size) from Area a")
	double avgBrotherhoodsPerArea();

	@Query("select stddev(a.brotherhoods.size) from Area a")
	double stddevBrotherhoodsPerArea();
	//22.2.2
	@Query("select min(f.processions.size) from Finder f")
	double minFinderResults();

	@Query("select max(f.processions.size) from Finder f")
	double maxFinderResults();

	@Query("select avg(f.processions.size) from Finder f")
	double avgFinderResults();

	@Query("select stddev(f.processions.size) from Finder f")
	double stddevFinderResults();

	//22.2.3
	@Query("select 1.0 * count(f)/(select count(f1) from Finder f1) from Finder f where f.keyword is null and f.startDate is null and f.endDate is null and f.area is null")
	double ratioEmptyFinders();

}
<file_sep>
package domain;

import java.util.Collection;
import java.util.List;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;

@Entity
@Access(AccessType.PROPERTY)
public class Customisation extends DomainEntity {

	//ATRIBUTOS DEL SISTEMA.
	public List<String>			negativeWords;
	public List<String>			positiveWords;
	public Integer				finderDuration;
	public Integer				resultsNumber;
	public String				systemName;
	public String				bannerURL;
	public Collection<String>	welcomeMessage;
	public List<String>			spamWords;
	public String				phoneNumberCountryCode;
	public List<String>			messagePriorities;
	public List<String>			creditCardMakes;
	public Double				fare;
	public Integer				vatPercentage;


	public enum negativeWords {   //En principio no hace falta
		NOT, BAD, HORRIBLE, AVERAGE, DISASTER
	};

	public enum positiveWords {
		GOOD, FANTASTIC, EXCELLENT, GREAT, AMAZING, TERRIFIC, BEAUTIFUL
	}


	@Column
	@ElementCollection(targetClass = String.class)
	public List<String> getNegativeWords() {
		return this.negativeWords;
	}

	public void setNegativeWords(final List<String> negativeWords) {
		this.negativeWords = negativeWords;
	}
	@Column
	@ElementCollection(targetClass = String.class)
	public List<String> getPositiveWords() {
		return this.positiveWords;
	}

	public void setPositiveWords(final List<String> positiveWords) {
		this.positiveWords = positiveWords;
	}

	@Min(value = 1L)
	@Max(value = 24)
	@NotNull
	public Integer getFinderDuration() {
		return this.finderDuration;
	}

	public void setFinderDuration(final Integer finderDuration) {
		this.finderDuration = finderDuration;
	}
	@NotNull
	@Min(value = 1L)
	@Max(value = 100)
	public Integer getResultsNumber() {
		return this.resultsNumber;
	}

	public void setResultsNumber(final Integer resultsNumber) {
		this.resultsNumber = resultsNumber;
	}
	@NotBlank
	public String getSystemName() {
		return this.systemName;
	}

	public void setSystemName(final String systemName) {
		this.systemName = systemName;
	}

	@NotBlank
	public String getBannerURL() {
		return this.bannerURL;
	}

	public void setBannerURL(final String bannerURL) {
		this.bannerURL = bannerURL;
	}

	@ElementCollection(targetClass = String.class)
	public Collection<String> getWelcomeMessage() {
		return this.welcomeMessage;
	}

	public void setWelcomeMessage(final Collection<String> welcomeMessage) {
		this.welcomeMessage = welcomeMessage;
	}

	@Column
	@ElementCollection(targetClass = String.class)
	public List<String> getSpamWords() {
		return this.spamWords;
	}

	public void setSpamWords(final List<String> spamWords) {
		this.spamWords = spamWords;
	}

	@NotBlank
	public String getPhoneNumberCountryCode() {
		return this.phoneNumberCountryCode;
	}

	public void setPhoneNumberCountryCode(final String phoneNumberCountryCode) {
		this.phoneNumberCountryCode = phoneNumberCountryCode;
	}

	@Column
	@ElementCollection(targetClass = String.class)
	public List<String> getMessagePriorities() {
		return this.messagePriorities;
	}

	public void setMessagePriorities(final List<String> messagePriorities) {
		this.messagePriorities = messagePriorities;
	}

	@ElementCollection(targetClass = String.class)
	public List<String> getCreditCardMakes() {
		return this.creditCardMakes;
	}

	public void setCreditCardMakes(final List<String> creditCardMakes) {
		this.creditCardMakes = creditCardMakes;
	}

	@NotNull
	@Min(value = 0)
	public Double getFare() {
		return this.fare;
	}

	//Esto puede dar fallos porque es un Long y no un double.
	public void setFare(final Double fare) {
		this.fare = fare;
	}

	@Min(value = 0L)
	@Max(value = 100)
	@NotNull
	public Integer getVatPercentage() {
		return this.vatPercentage;
	}

	public void setVatPercentage(final Integer vatPercentage) {
		this.vatPercentage = vatPercentage;
	}

}
<file_sep>
package services;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import repositories.InceptionRecordRepository;
import domain.Brotherhood;
import domain.InceptionRecord;

@Service
@Transactional
public class InceptionRecordService {

	@Autowired
	private InceptionRecordRepository	inceptionRecordRepository;

	@Autowired
	private BrotherhoodService			brotherhoodService;


	public InceptionRecord create() {
		final InceptionRecord res = new InceptionRecord();

		return res;
	}

	public InceptionRecord save(final InceptionRecord inc) {
		Assert.notNull(inc);
		final Brotherhood b = this.brotherhoodService.findByPrincipal();

		boolean test = false;

		if (inc.getId() != 0) {
			if (b.getInceptionRecord().getId() == inc.getId())
				test = true;
			Assert.isTrue(test, "You are not the owner of this inception record");
		}

		if (inc.getId() == 0) {
			b.setInceptionRecord(inc);
			this.brotherhoodService.save(b);
		}

		return this.inceptionRecordRepository.save(inc);
	}

	public void delete(final InceptionRecord inc) {
		Assert.notNull(inc);
		final Brotherhood b = this.brotherhoodService.findByPrincipal();

		b.setInceptionRecord(null);
		this.brotherhoodService.save(b);

		this.inceptionRecordRepository.delete(inc);
	}

	public InceptionRecord findOne(final int id) {
		return this.inceptionRecordRepository.findOne(id);
	}

	public Collection<InceptionRecord> findAll() {
		return this.inceptionRecordRepository.findAll();
	}

}
<file_sep>drop database if exists `Acme-Madruga`;
create database `Acme-Madruga`;
<file_sep>procession.list				= Processions list
procession.name 				= Name
procession.parentCategory		= Parent procession
procession.edit			 	= Edit
procession.delete			 	= Delete
procession.edit.link		 	= Edit
procession.delete.link	 	= Delete
procession.list.create		= New procession
procession.save				= Save
procession.cancel				= Cancel
procession.nombre				= Name
procession.mandatory = Some mandatory fields are blank.
procession.commit.error	= Errors
procession.confirm.delete		= Delete this procession?

procession.list.request		= Requests list
procession.ob = Fields with * are mandatory
procession.float			= Floats* (Hold control key to select more than one float)
procession.true				= Yes
procession.false			= No
procession.title			= Title*
procession.description		= Description*
procession.departureDate	= Departure date*
procession.ticker			= Ticker
procession.finalMode		= Final mode*<file_sep>package converters;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


import domain.Customisation;

@Component
@Transactional
public class CustomisationToStringConverter implements Converter<Customisation, String>{

	@Override
	public String convert(Customisation referee) {
        String result;
		
		if(referee == null){
			result = null;
		}else{
			result = String.valueOf(referee.getId());
		}
		
		return result;
	}
	
	

}<file_sep>
package repositories;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Area;

@Repository
public interface AreaRepository extends JpaRepository<Area, Integer> {

	@Query("select p.brotherhood.area from Parade p where p.id = ?1")
	Area getParadeArea(int id);
}
<file_sep>
package repositories;

import java.util.Collection;
import java.util.Date;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Procession;

@Repository
public interface ProcessionRepository extends JpaRepository<Procession, Integer> {

	@Query("select p from Procession p where p.brotherhood.id = ?1")
	Collection<Procession> findByBrotherhoodId(int brotherhoodId);

	@Query("select p from Request r join r.procession p where r.id=?1")
	Procession findByRequestId(Integer requestId);

	@Query("select p from Procession p where p.finalMode='1'")
	Collection<Procession> findAllFinalMode();

	//Finder
	@Query("select p from Procession p where p.title like %?1% or p.description like %?1%")
	Collection<Procession> findProcessionsByKeyword(String keyword);

	@Query("select p from Procession p where p.brotherhood.area.id=?1")
	Collection<Procession> findProcessionsByAreaId(int id);

	@Query("select p from Procession p where p.departureDate > ?1")
	Collection<Procession> findProcessionsByMinimumDate(Date minDate);

	@Query("select p from Procession p where p.departureDate < ?1")
	Collection<Procession> findProcessionsByMaximumDate(Date maxDate);

	@Query("select p from Procession p where p.departureDate between ?1 and ?2")
	Collection<Procession> findProcessionsByDateRange(Date min, Date max);
	
	@Query("select p from Procession p join p.brotherhood.enrolements e where e.id=?1")
	Collection<Procession> findByEnrolementId(int id);

	@Query("select p from Procession p join p.brotherhood.enrolements e where e.id=?1 and e.status='APPROVED'")
	Collection<Procession> findByEnrolementIdApproved(int id);
	
	@Query("select p from Procession p where p.finalMode='1' and p.departureDate>=?1")
	Collection<Procession> findAllFinalModeRequests(Date today);
}
<file_sep>
package controllers;

import java.util.Collection;

import javax.validation.ValidationException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
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 repositories.MemberRepository;
import security.Authority;
import security.UserAccount;
import services.MemberService;
import domain.Member;
import forms.MemberForm;

@Controller
@RequestMapping("/member")
public class MemberController extends AbstractController {

	@Autowired
	MemberService		memberService;

	@Autowired
	MemberRepository	memberRepository;


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

	public MemberController() {
		super();
	}
	// Edition ------------------------------
	@RequestMapping(value = "/register", method = RequestMethod.GET)
	public ModelAndView edit() {
		final ModelAndView res;
		//		Member member;
		//
		//		member = this.memberService.create();
		//		res = this.createEditModelAndView(member);

		Authority authority;
		Collection<Authority> authorities;
		UserAccount userAccount;
		userAccount = new UserAccount();
		authorities = userAccount.getAuthorities();
		authority = new Authority();
		authority.setAuthority(Authority.MEMBER);
		authorities.add(authority);
		userAccount.setAuthorities(authorities);

		final MemberForm memberForm = new MemberForm();
		memberForm.setUserAccount(userAccount);
		res = this.createEditModelAndView(memberForm);

		return res;

	}
	@RequestMapping(value = "/register", method = RequestMethod.POST, params = "save")
	public ModelAndView save(@ModelAttribute final MemberForm memberForm, final BindingResult binding) {
		ModelAndView result;

		try {
			Assert.isTrue(memberForm.isConditionsAccepted(), "conditionsAccepted");
			final Member member = this.memberService.reconstruct(memberForm, binding);
			final String vacia = "";
			if (!member.getEmail().isEmpty() || member.getEmail() != vacia)
				Assert.isTrue(member.getEmail().matches("^[A-z0-9]+@[A-z0-9.]+$") || member.getEmail().matches("^[A-z0-9 ]+ <[A-z0-9]+@[A-z0-9.]+>$"), "Wrong email");

			this.memberService.save(member);
			result = new ModelAndView("redirect:/welcome/index.do");
		} catch (final ValidationException oops) {
			result = this.createEditModelAndView(memberForm);
		} catch (final Throwable oops) {
			if (oops.getMessage() == "Wrong email")
				result = this.createEditModelAndView(memberForm, "member.email.error");
			else if (oops.getMessage() == "conditionsAccepted")
				result = this.createEditModelAndView(memberForm, "member.conditionsError");
			else
				result = this.createEditModelAndView(memberForm, "member.comit.error");
		}

		return result;
	}

	// Ancillary methods ------------------------------
	protected ModelAndView createEditModelAndView(final MemberForm memberForm) {
		ModelAndView result;

		result = this.createEditModelAndView(memberForm, null);

		return result;

	}

	protected ModelAndView createEditModelAndView(final MemberForm memberForm, final String message) {
		ModelAndView result;

		result = new ModelAndView("member/register");
		result.addObject("memberForm", memberForm);
		result.addObject("message", message);

		return result;
	}

	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public ModelAndView list(@RequestParam final int brotherhoodId) {
		final ModelAndView res;

		final Collection<Member> members = this.memberRepository.membersByBrotherhood(brotherhoodId);

		res = new ModelAndView("member/list");
		res.addObject("requestURI", "member/list.do");
		res.addObject("members", members);
		return res;
	}

}
<file_sep>
package services;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import repositories.LegalRecordRepository;
import domain.Brotherhood;
import domain.LegalRecord;

@Service
@Transactional
public class LegalRecordService {

	@Autowired
	private LegalRecordRepository	legalRecordRepository;

	@Autowired
	private BrotherhoodService		brotherhoodService;


	public LegalRecord create() {
		final LegalRecord res = new LegalRecord();

		return res;
	}

	public LegalRecord save(final LegalRecord leg) {
		Assert.notNull(leg);
		final Brotherhood b = this.brotherhoodService.findByPrincipal();
		boolean test = false;

		if (leg.getId() != 0) {
			for (final LegalRecord lr : b.getLegalRecords())
				if (lr.getId() == leg.getId())
					test = true;
			Assert.isTrue(test, "You are not the owner of this legal record");
		}

		if (leg.getId() == 0) {
			final Collection<LegalRecord> legsOld = b.getLegalRecords();
			legsOld.add(leg);
			b.setLegalRecords(legsOld);
			this.brotherhoodService.save(b);
		}

		return this.legalRecordRepository.save(leg);
	}

	public void delete(final LegalRecord leg) {
		Assert.notNull(leg);
		final Brotherhood b = this.brotherhoodService.findByPrincipal();

		final Collection<LegalRecord> legsOld = b.getLegalRecords();
		legsOld.remove(leg);
		b.setLegalRecords(legsOld);
		this.brotherhoodService.save(b);

		this.legalRecordRepository.delete(leg);
	}

	public LegalRecord findOne(final int id) {
		return this.legalRecordRepository.findOne(id);
	}

	public Collection<LegalRecord> findAll() {
		return this.legalRecordRepository.findAll();
	}
}
<file_sep>
package services;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import repositories.DashboardRepository;
import security.Authority;
import security.LoginService;
import security.UserAccount;
import domain.Brotherhood;
import domain.Member;
import domain.Procession;

@Service
@Transactional
public class DashboardService {

	@Autowired
	public DashboardRepository	dashboardRepository;

	@Autowired
	public ProcessionService	processionService;


	public DashboardService() {
		super();
	}

	private boolean checkAdmin() {
		final Authority a = new Authority();
		final UserAccount user = LoginService.getPrincipal();
		a.setAuthority(Authority.ADMIN);
		return user.getAuthorities().contains(a);
	}

	//12.3.1
	public double minMembers() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.minMembers();
	}
	public double maxMembers() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.maxMembers();
	}
	public double avgMembers() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.avgMembers();
	}
	public double stddevMembers() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.stddevMembers();
	}

	//12.3.2
	public Collection<Brotherhood> largestBrotherhoods() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.largestBrotherhoods();
	}

	//12.3.3
	public Collection<Brotherhood> smallestsBrotherhoods() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.smallestBrotherhoods();
	}

	//12.3.4 

	public List<Object[]> requestRatioByProcession() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.requestRatioByProcession();
	}

	//12.3.5
	public Collection<Procession> processionsOrganizedIn30Days() {
		Assert.isTrue(this.checkAdmin());
		final List<Procession> processions = new ArrayList<Procession>(this.processionService.findAll());
		final List<Procession> processionsQ = new ArrayList<Procession>(processions);
		for (final Procession p : processions) {
			final long diffInMillies = Math.abs(p.getDepartureDate().getTime() - Calendar.getInstance().getTime().getTime());
			final long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS);
			if (diff >= 30)
				processionsQ.remove(p);
		}
		return processionsQ;
	}

	//12.3.6
	public List<Double> requestRatio() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.requestRatio();
	}
	//12.3.7
	public Collection<Member> membersWith10PercentRequestsApproved() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.membersWith10PercentRequestsApproved();
	}
	//12.3.8
	public List<Object[]> positionHistogram() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.positionHistogram();
	}
	//22.2.1
	public double ratioBrotherhoodsPerArea() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.ratioBrotherhoodsPerArea();
	}

	public Collection<Double> countBrotherhoodsPerArea() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.countBrotherhoodsPerArea();
	}

	public double minBrotherhoodsPerArea() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.minBrotherhoodsPerArea();
	}

	public double maxBrotherhoodsPerArea() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.maxBrotherhoodsPerArea();
	}

	public double avgBrotherhoodsPerArea() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.avgBrotherhoodsPerArea();
	}

	public double stddevBrotherhoodsPerArea() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.stddevBrotherhoodsPerArea();
	}

	//22.2.2
	public double avgFinderResults() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.avgFinderResults();
	}

	public double minFinderResults() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.minFinderResults();
	}

	public double maxFinderResults() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.maxFinderResults();
	}

	public double stddevFinderResults() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.stddevFinderResults();
	}

	//22.2.3
	public double ratioEmptyFinders() {
		Assert.isTrue(this.checkAdmin());
		return this.dashboardRepository.ratioEmptyFinders();
	}
}
<file_sep>
package controllers.brotherhood;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
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 repositories.LegalRecordRepository;
import services.LegalRecordService;
import controllers.AbstractController;
import domain.LegalRecord;

@Controller
@RequestMapping("/legalrecord/brotherhood")
public class LegalRecordBrotherhoodController extends AbstractController {

	@Autowired
	private LegalRecordService		legalRecordService;

	@Autowired
	private LegalRecordRepository	legalRecordRepository;


	////////////////
	////CREATE//////
	////////////////

	@RequestMapping(value = "/create", method = RequestMethod.GET)
	public ModelAndView create() {
		ModelAndView res;
		LegalRecord legalRecord;

		legalRecord = this.legalRecordService.create();

		res = this.createEditModelAndView(legalRecord);

		return res;
	}

	protected ModelAndView createEditModelAndView(final LegalRecord legalRecord) {
		ModelAndView result;

		result = this.createEditModelAndView(legalRecord, null);

		return result;

	}

	protected ModelAndView createEditModelAndView(final LegalRecord legalRecord, final String message) {
		ModelAndView result;
		result = new ModelAndView("legalrecord/brotherhood/edit");
		result.addObject("legalRecord", legalRecord);
		result.addObject("message", message);

		return result;
	}

	////////////////////
	///////EDIT/////////
	////////////////////

	@RequestMapping(value = "/edit", method = RequestMethod.GET)
	public ModelAndView edit(@RequestParam final int legalRecordId) {
		ModelAndView result;
		LegalRecord legalRecord;

		legalRecord = this.legalRecordRepository.findOne(legalRecordId);
		Assert.notNull(legalRecord);

		result = this.createEditModelAndView(legalRecord);

		return result;
	}

	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "save")
	public ModelAndView save(@Valid final LegalRecord legalRecord, final BindingResult binding) {
		ModelAndView result;

		if (binding.hasErrors())
			result = this.createEditModelAndView(legalRecord);
		else
			try {
				this.legalRecordService.save(legalRecord);
				result = new ModelAndView("redirect:../../");
			} catch (final Throwable oops) {
				result = this.createEditModelAndView(legalRecord, "record.commit.error");
			}

		return result;
	}

	////////////////////
	///////DELETE///////
	////////////////////

	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "delete")
	public ModelAndView delete(final LegalRecord legalRecord, final BindingResult binding) {
		ModelAndView result;

		try {
			this.legalRecordService.delete(legalRecord);
			result = new ModelAndView("redirect:../../");
		} catch (final Throwable oops) {
			result = this.createEditModelAndView(legalRecord, "record.commit.error");
		}

		return result;
	}

}
<file_sep>
package services;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Validator;

import repositories.MemberRepository;
import security.Authority;
import security.LoginService;
import security.UserAccount;
import utilities.TickerGenerator;
import domain.Actor;
import domain.Box;
import domain.Brotherhood;
import domain.Customisation;
import domain.Enrolement;
import domain.Finder;
import domain.Member;
import domain.SocialProfile;
import forms.MemberForm;

@Service
@Transactional
public class MemberService {

	@Autowired
	public MemberRepository		memberRepository;

	@Autowired
	public AdministratorService	administratorService;

	@Autowired
	public ActorService			actorService;

	@Autowired
	public FinderService		finderService;

	@Autowired
	public CustomisationService	customisationService;

	@Autowired
	public SocialProfileService	socialProfileService;


	//Constructor
	public MemberService() {
		super();
	}
	public Member create() {
		// User can't be logged to register
		//		final Authority a = new Authority();
		//		final Authority b = new Authority();
		//		final Authority c = new Authority();
		//		final Authority d = new Authority();
		//		final Authority e = new Authority();
		//		final UserAccount user = LoginService.getPrincipal();
		//		a.setAuthority(Authority.ADMIN);
		//		b.setAuthority(Authority.HANDYWORKER);
		//		c.setAuthority(Authority.CUSTOMER);
		//		d.setAuthority(Authority.REFEREE);
		//		e.setAuthority(Authority.SPONSOR);
		//		Assert.isTrue(!(user.getAuthorities().contains(a) || user.getAuthorities().contains(b) || user.getAuthorities().contains(c) || user.getAuthorities().contains(d) || user.getAuthorities().contains(e)));

		Member result;
		result = new Member();

		// Actor
		//		final Box trash = new Box();
		//		final Box out = new Box();
		//		final Box spam = new Box();
		//		final Box in = new Box();
		//		trash.setName("trash");
		//		in.setName("in");
		//		out.setName("out");
		//		spam.setName("spam");
		//		out.setPredefined(true);
		//		in.setPredefined(true);
		//		spam.setPredefined(true);
		//		trash.setPredefined(true);
		final Collection<Box> predefined = new ArrayList<Box>();
		//		predefined.add(in);
		//		predefined.add(out);
		//		predefined.add(spam);
		//		predefined.add(trash);

		//	result.setBoxes(predefined);

		final UserAccount newUser = new UserAccount();
		final Authority f = new Authority();
		f.setAuthority(Authority.MEMBER);
		newUser.addAuthority(f);
		result.setUserAccount(newUser);

		result.setSocialProfiles(new ArrayList<SocialProfile>());
		result.setName("");
		result.setEmail("");
		result.setAddress("");
		result.setSurname("");
		result.setPhoneNumber("");
		result.setPhoto("");

		// Member

		result.setFinder(new Finder());

		return result;
	}

	public Collection<Member> membersByBrotherhood(final Brotherhood brotherhood) {
		return this.memberRepository.membersByBrotherhood(brotherhood.getId());
	}
	//Simple CRUD
	public Member findOne(final Member member) {
		return this.memberRepository.findOne(member.getId());
	}

	public Member findOnePrincipal() {
		final Authority a1 = new Authority();
		a1.setAuthority(Authority.MEMBER);

		final Actor a = this.actorService.findByPrincipal();

		Assert.isTrue(a.getUserAccount().getAuthorities().contains(a1));
		final Member m = new Member();
		m.setId(a.getId());
		final Member res = this.findOne(m);

		return res;
	}

	// Returns logged member
	public Member findByPrincipal() {
		Member res;
		UserAccount userAccount;

		userAccount = LoginService.getPrincipal();
		Assert.notNull(userAccount);
		res = this.findByUserAccount(userAccount);
		Assert.notNull(res);

		return res;
	}

	public Member findByUserAccount(final UserAccount userAccount) {
		Member res;
		Assert.notNull(userAccount);

		res = this.memberRepository.findByUserAccountId(userAccount.getId());

		return res;
	}

	public Collection<Member> findAll() {
		return this.memberRepository.findAll();
	}

	public Member save(final Member mem) {

		// Restrictions
		Assert.isTrue(mem.getBan() != true);

		final String pnumber = mem.getPhoneNumber();
		final Customisation cus = ((List<Customisation>) this.customisationService.findAll()).get(0);
		final String cc = cus.getPhoneNumberCountryCode();
		if (pnumber.matches("^[0-9]{4,}$"))
			mem.setPhoneNumber(cc.concat(pnumber));

		if (mem.getId() == 0) {
			Collection<Box> boxes = actorService.createPredefinedBoxes();
			mem.setBoxes(boxes);
			final Md5PasswordEncoder encoder = new Md5PasswordEncoder();
			final String oldpass = mem.getUserAccount().getPassword();
			final String hash = encoder.encodePassword(oldpass, null);

			final UserAccount cuenta = mem.getUserAccount();
			cuenta.setPassword(<PASSWORD>);
			mem.setUserAccount(cuenta);

			//			final Box in1 = new Box();
			//			in1.setName("In");
			//			in1.setPredefined(true);
			//			final Box in = this.boxService.save(in1);
			//
			//			final Collection<Box> boxesPredefined = new ArrayList<Box>();
			//			boxesPredefined.add(in);
			//			cus.setBoxes(boxesPredefined);
			final Finder f = new Finder();
			f.setMoment(new Date());
			final Finder fin = this.finderService.save(f);
			mem.setFinder(fin);
		}
		return this.memberRepository.save(mem);
	}
	public Member memberByEnrolemetId(final Integer enrolementId) {
		return this.memberRepository.memberByEnrolementId(enrolementId);
	}

	public List<Member> membersByEnrolemetId(final Collection<Enrolement> enrolements) {
		// TODO Auto-generated method stub
		final List<Member> res = new ArrayList<>();
		for (final Enrolement e : enrolements)
			res.add(this.memberByEnrolemetId(e.getId()));
		return res;
	}

	public Member findOne(final int memberId) {
		Member c;

		Assert.notNull(memberId);
		Assert.isTrue(memberId != 0);
		c = this.memberRepository.findOne(memberId);

		Assert.notNull(c);
		return c;
	}

	public Member findByRequestId(final int requestId) {
		return this.memberRepository.findByRequestId(requestId);
	}

	public Member reconstruct(final MemberForm memberForm, final BindingResult binding) {
		final Member member = this.create();

		Assert.isTrue(memberForm.isConditionsAccepted());
		final Authority mem = new Authority();
		mem.setAuthority(Authority.MEMBER);
		Assert.isTrue(memberForm.getUserAccount().getAuthorities().contains(mem));
		final Collection<Authority> colMem = new ArrayList<Authority>();
		final Authority memb = new Authority();
		memb.setAuthority(Authority.MEMBER);
		colMem.add(memb);
		//Assert.isTrue(memberForm.getUserAccount().getAuthorities() == colMem);
		//Damos valores a los atributos del member que devolveremos con los datos que nos llegan

		member.setAddress(memberForm.getAddress());
		member.setEmail(memberForm.getEmail());
		member.setMiddleName(memberForm.getMiddleName());
		member.setName(memberForm.getName());
		member.setPhoneNumber(memberForm.getPhoneNumber());
		member.setPhoto(memberForm.getPhoto());
		member.setSurname(memberForm.getSurname());
		member.setUserAccount(memberForm.getUserAccount());

		//		member.setFlagSpam(memberForm.isFlagSpam());
		//		member.setPolarityScore(memberForm.getPolarityScore());
		//		member.setBan(memberForm.getBan());

		member.setBan(false);
		member.setFinder(new Finder());

		return member;
	}


	@Autowired
	private Validator	validator;


	public Member reconstruct(final Member member, final BindingResult binding) {
		Member res;

		//Check authority
		final Authority a = new Authority();
		final UserAccount user = member.getUserAccount();
		a.setAuthority(Authority.MEMBER);
		Assert.isTrue(user.getAuthorities().contains(a) && user.getAuthorities().size() == 1);

		if (member.getId() == 0)
			res = member;
		else {
			res = this.memberRepository.findOne(member.getId());
			//			res.setBan(member.getBan());
			//			res.setFlagSpam(member.isFlagSpam());
			//			res.setBoxes(member.getBoxes());
			//			res.setEnrolements(member.getEnrolements());
			//			res.setRequests(member.getRequests());
			//			res.setSocialProfiles(member.getSocialProfiles());
			//res.setUserAccount(member.getUserAccount());
			res.setName(member.getName());
			res.setEmail(member.getEmail());
			res.setMiddleName(member.getMiddleName());
			res.setSurname(member.getSurname());
			res.setAddress(member.getAddress());
			res.setPhoneNumber(member.getPhoneNumber());
			res.setPhoto(member.getPhoto());

			System.out.println("debug test");

			this.validator.validate(res, binding);
		}
		return res;
	}

	public void leave() {
		final Member logMember = this.findByPrincipal();

		logMember.setAddress("Unknown");
		logMember.setBan(true);
		logMember.setEmail("<EMAIL>");
		logMember.setMiddleName("Unknown");
		logMember.setName("Unknown");
		logMember.setPhoneNumber("Unknown");
		logMember.setPhoto("http://www.unknown.com");
		logMember.setPolarityScore(0);
		for (final SocialProfile sp : logMember.getSocialProfiles())
			this.socialProfileService.deleteLeave(sp);
		logMember.setSocialProfiles(null);
		logMember.setSurname("Unknown");
		final UserAccount ua = logMember.getUserAccount();
		final String tick1 = TickerGenerator.tickerLeave();
		ua.setUsername("Unknown" + tick1);
		final String pass1 = TickerGenerator.generateTicker();
		final Md5PasswordEncoder encoder = new Md5PasswordEncoder();
		final String pass2 = encoder.encodePassword(pass1, null);
		ua.setPassword(pass2);
		logMember.setUserAccount(ua);
	}
}
<file_sep>
package repositories;

import java.util.Collection;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Member;

@Repository
public interface MemberRepository extends JpaRepository<Member, Integer> {

	@Query("select m from Member m join m.enrolements m1 where m1.brotherhood.id=?1 and m1.status='APPROVED'")
	public Collection<Member> membersByBrotherhood(int id);

	@Query("select m from Member m join m.enrolements m1 where m1.id=?1")
	public Member memberByEnrolementId(int id);

	@Query("select m from Member m where m.userAccount.id = ?1")
	Member findByUserAccountId(int userAccount);

	@Query("select m from Member m join m.requests r where r.id = ?1")
	Member findByRequestId(int requestId);
}
<file_sep>
package repositories;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Finder;

@Repository
public interface FinderRepository extends JpaRepository<Finder, Integer> {

	@Query("select m.finder from Member m where m.id=?1")
	Finder getFinderMember(int id);
}
<file_sep>
package domain;

import java.util.Collection;
import java.util.Date;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CascadeType;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Access(AccessType.PROPERTY)
public class Brotherhood extends Actor {

	private String						title;
	private Date						stablishmentDate;
	private Collection<String>			urls;
	private Collection<Enrolement>		enrolements;
	private Area						area;
	private Collection<LegalRecord>		legalRecords;
	private InceptionRecord				inceptionRecord;
	private Collection<LinkRecord>		linkRecords;
	private Collection<PeriodRecord>	periodRecords;


	@ManyToOne(optional = true)
	public Area getArea() {
		return this.area;
	}

	public void setArea(final Area area) {
		this.area = area;
	}

	@OneToMany(mappedBy = "brotherhood")
	public Collection<Enrolement> getEnrolements() {
		return this.enrolements;
	}

	public void setEnrolements(final Collection<Enrolement> enrolements) {
		this.enrolements = enrolements;
	}

	@NotBlank
	public String getTitle() {
		return this.title;
	}

	public void setTitle(final String title) {
		this.title = title;
	}

	@NotNull
	@Past
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	public Date getStablishmentDate() {
		return this.stablishmentDate;
	}

	public void setStablishmentDate(final Date stablishmentDate) {
		this.stablishmentDate = stablishmentDate;
	}

	@ElementCollection
	public Collection<String> getUrls() {
		return this.urls;
	}

	public void setUrls(final Collection<String> urls) {
		this.urls = urls;
	}

	@Valid
	@OneToMany(cascade = CascadeType.ALL)
	public Collection<LegalRecord> getLegalRecords() {
		return this.legalRecords;
	}

	public void setLegalRecords(final Collection<LegalRecord> legalRecords) {
		this.legalRecords = legalRecords;
	}

	@Valid
	@OneToOne(cascade = CascadeType.ALL, optional=true)
	public InceptionRecord getInceptionRecord() {
		return this.inceptionRecord;
	}

	public void setInceptionRecord(final InceptionRecord inceptionRecord) {
		this.inceptionRecord = inceptionRecord;
	}

	@Valid
	@OneToMany(cascade = CascadeType.ALL)
	public Collection<LinkRecord> getLinkRecords() {
		return this.linkRecords;
	}

	public void setLinkRecords(final Collection<LinkRecord> linkRecords) {
		this.linkRecords = linkRecords;
	}

	@Valid
	@OneToMany(cascade = CascadeType.ALL)
	public Collection<PeriodRecord> getPeriodRecords() {
		return this.periodRecords;
	}

	public void setPeriodRecords(final Collection<PeriodRecord> periodRecords) {
		this.periodRecords = periodRecords;
	}

}
<file_sep>
package repositories;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Chapter;

@Repository
public interface ChapterRepository extends JpaRepository<Chapter, Integer> {

	@Query("select c from Chapter c where c.userAccount.id = ?1")
	Chapter findByUserAccountId(int userAccount);

}
<file_sep>
package controllers;

import java.util.Collection;

import javax.validation.ValidationException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
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 repositories.AreaRepository;
import security.Authority;
import security.UserAccount;
import services.BrotherhoodService;
import domain.Area;
import domain.Brotherhood;
import domain.InceptionRecord;
import domain.LegalRecord;
import domain.LinkRecord;
import domain.PeriodRecord;
import forms.BrotherhoodForm;

@Controller
@RequestMapping("/brotherhood")
public class BrotherhoodController extends AbstractController {

	@Autowired
	BrotherhoodService	brotherhoodService;

	@Autowired
	AreaRepository		areaRepository;


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

	public BrotherhoodController() {
		super();
	}

	// Edition ------------------------------
	@RequestMapping(value = "/register", method = RequestMethod.GET)
	public ModelAndView edit() {
		ModelAndView res;

		Authority authority;
		Collection<Authority> authorities;
		UserAccount userAccount;
		userAccount = new UserAccount();
		authorities = userAccount.getAuthorities();
		authority = new Authority();
		authority.setAuthority(Authority.BROTHERHOOD);
		authorities.add(authority);
		userAccount.setAuthorities(authorities);

		final BrotherhoodForm brotherhoodForm = new BrotherhoodForm();
		brotherhoodForm.setUserAccount(userAccount);
		res = this.createEditModelAndView(brotherhoodForm);

		//brotherhood = this.brotherhoodService.create();
		//res = this.createEditModelAndView(brotherhood);
		return res;

	}

	@RequestMapping(value = "/register", method = RequestMethod.POST, params = "save")
	public ModelAndView save(@ModelAttribute final BrotherhoodForm brotherhoodForm, final BindingResult binding) {
		ModelAndView result;

		try {
			Assert.isTrue(brotherhoodForm.isConditionsAccepted(), "conditionsAccepted");
			final Brotherhood brotherhood = this.brotherhoodService.reconstruct(brotherhoodForm, binding);
			final String vacia = "";
			if (!brotherhood.getEmail().isEmpty() || brotherhood.getEmail() != vacia)
				Assert.isTrue(brotherhood.getEmail().matches("^[A-z0-9]+@[A-z0-9.]+$") || brotherhood.getEmail().matches("^[A-z0-9 ]+ <[A-z0-9]+@[A-z0-9.]+>$"), "Wrong email");

			this.brotherhoodService.save(brotherhood);
			result = new ModelAndView("redirect:/welcome/index.do");
		} catch (final ValidationException oops) {
			result = this.createEditModelAndView(brotherhoodForm);
		} catch (final Throwable oops) {
			if (oops.getMessage() == "Wrong email")
				result = this.createEditModelAndView(brotherhoodForm, "brotherhood.email.error");
			else if (oops.getMessage() == "conditionsAccepted")
				result = this.createEditModelAndView(brotherhoodForm, "member.conditionsError");
			else
				result = this.createEditModelAndView(brotherhoodForm, "brotherhood.comit.error");
		}
		if (!brotherhoodForm.isConditionsAccepted())
			result = this.createEditModelAndView(brotherhoodForm, "brotherhood.conditionsError");

		return result;

	}

	// Ancillary methods ------------------------------
	protected ModelAndView createEditModelAndView(final BrotherhoodForm brotherhoodForm) {
		ModelAndView result;

		result = this.createEditModelAndView(brotherhoodForm, null);

		return result;

	}

	protected ModelAndView createEditModelAndView(final BrotherhoodForm brotherhoodForm, final String message) {
		ModelAndView result;

		final Collection<Area> areas = this.areaRepository.findAll();

		result = new ModelAndView("brotherhood/register");
		result.addObject("areas", areas);
		result.addObject("brotherhoodForm", brotherhoodForm);
		result.addObject("message", message);

		return result;
	}

	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public ModelAndView list() {
		final ModelAndView res;

		final Collection<Brotherhood> brotherhoods = this.brotherhoodService.findAll();

		res = new ModelAndView("brotherhood/list");
		res.addObject("requestURI", "brotherhood/list.do");
		res.addObject("brotherhoods", brotherhoods);
		return res;
	}

	@RequestMapping(value = "/showRecords", method = RequestMethod.GET)
	public ModelAndView showRecords(@RequestParam final int brotherhoodId) {
		ModelAndView res;
		Brotherhood brotherhood;

		//brotherhood = this.brotherhoodService.findByPrincipal();
		brotherhood = this.brotherhoodService.findOne(brotherhoodId);
		res = this.createShowRecordsModelAndView(brotherhood);
		return res;

	}

	protected ModelAndView createShowRecordsModelAndView(final Brotherhood brotherhood) {
		ModelAndView result;

		result = this.createShowRecordsModelAndView(brotherhood, null);

		return result;

	}

	protected ModelAndView createShowRecordsModelAndView(final Brotherhood brotherhood, final String message) {
		final ModelAndView result;

		UserAccount userAccount;
		userAccount = brotherhood.getUserAccount();

		final Collection<LegalRecord> legalRecords = brotherhood.getLegalRecords();
		final Collection<PeriodRecord> periodRecords = brotherhood.getPeriodRecords();
		final InceptionRecord inceptionRecord = brotherhood.getInceptionRecord();
		final Collection<LinkRecord> linkRecords = brotherhood.getLinkRecords();

		result = new ModelAndView("brotherhood/showRecords");
		result.addObject("brotherhood", brotherhood);
		result.addObject("legalRecords", legalRecords);
		result.addObject("periodRecords", periodRecords);
		result.addObject("inceptionRecord", inceptionRecord);
		result.addObject("linkRecords", linkRecords);
		result.addObject("message", message);
		result.addObject("userAccount", userAccount);
		return result;
	}
}
<file_sep>
package repositories;

import java.util.Collection;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Enrolement;

@Repository
public interface EnrolementRepository extends JpaRepository<Enrolement, Integer> {

	@Query("select e from Member m join m.enrolements e where e.brotherhood.id=?1 and m.id=?2")
	public Enrolement findEnrolementByIds(Integer brotherhoodId, Integer memberId);

	@Query("select e from Member m join m.enrolements e where m.id=?1")
	public Collection<Enrolement> findEnrolementsByMemberId(Integer memberId);

	@Query("select e1 from Member m join m.enrolements e1 where m.id=?1 and e1.brotherhood.id=?2")
	public Enrolement existEnrolement(Integer memberId, Integer brotherhoodId);

	@Query("select e from Enrolement e where e.brotherhood.id=?1 and e.status='PENDING'")
	public Collection<Enrolement> enrolementsPending(Integer brotherhoodId);

}
<file_sep>
package repositories;

import java.util.Collection;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Actor;
import domain.Message;

@Repository
public interface MessageRepository extends JpaRepository<Message, Integer> {

	@Query("select m.recipients from Message m where m.id =?1")
	public Collection<Actor> getRecipientsWorking(int idmsj);
}
<file_sep>
package domain;

import java.util.Collection;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Access(AccessType.PROPERTY)
public class Area extends DomainEntity {

	private String					name;
	private Collection<String>		pictures;
	private Collection<Brotherhood>	brotherhoods;


	@OneToMany(mappedBy = "area")
	public Collection<Brotherhood> getBrotherhoods() {
		return this.brotherhoods;
	}

	public void setBrotherhoods(final Collection<Brotherhood> brotherhoods) {
		this.brotherhoods = brotherhoods;
	}

	@NotBlank
	public String getName() {
		return this.name;
	}

	public void setName(final String name) {
		this.name = name;
	}

	@ElementCollection(targetClass = String.class)
	@NotEmpty
	public Collection<String> getPictures() {
		return this.pictures;
	}

	public void setPictures(final Collection<String> pictures) {
		this.pictures = pictures;
	}

}
<file_sep>procession.list				= Lista de procesiones
procession.name				= Nombre
procession.parentCategory		= Categoría padre
procession.edit			 	= Editar
procession.delete			 	= Eliminar
procession.edit.link		 	= Editar
procession.delete.link	 	= Eliminar
procession.list.create		= Nueva procesión
procession.save				= Guardar
procession.cancel				= Cancelar
procession.nombre				= Nombre
procession.mandatory = Algunos campos obligatorios están en blanco.
procession.commit.error		= Se encontraron errores
procession.confirm.delete		= ¿Eliminar esta procesión?

procession.list.request		= Lista de peticiones
procession.ob = Los parámetros marcados con * son obligatorios.
procession.float			= Pasos* (Mantén pulsado control para seleccionar más de uno)
procession.true				= Sí
procession.false			= No
procession.title			= Título*
procession.description		= Descripción*
procession.departureDate	= Fecha de salida*
procession.ticker			= Ticker
procession.finalMode		= Modo final*<file_sep>record.list = Records
record.edit = Edit
record.show = See details
record.create = Create
record.save = Save
record.delete = Delete
record.cancel = Cancel

record.obligatorio = The fields marked with * are required
record.title = Title* :
record.description = Description* :
record.legalName = Legal name* :
record.applicableLaws = Applicable laws :
record.vatNumber	= VAT :
record.link			= Link :
record.startYear	= Start year :
record.endYear		= End year :
record.photos		= Photos :

legalRecord.create = Create legal record
linkRecord.create  = Create link record
periodRecord.create = Create period record
inceptionRecord.create = Create inception record

record.mandatory = (Fields with * are mandatory)
record.confirm.delete = Delete this record?
record.commit.error.blank = Error. The introduced values are incorrect or blank.
record.commit.error = Errors<file_sep>
package controllers.requests.brotherhood;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

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.BrotherhoodService;
import services.MemberService;
import services.ParadeService;
import services.RequestService;
import controllers.AbstractController;
import domain.Parade;
import domain.Request;

@Controller
@RequestMapping("/requests/brotherhood")
public class RequestBrotherhoodController extends AbstractController {

	@Autowired
	MemberService		memberService;

	@Autowired
	ParadeService		paradeService;

	@Autowired
	RequestService		requestService;

	@Autowired
	BrotherhoodService	brotherhoodService;


	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public ModelAndView show(@RequestParam final int paradeId) {
		final ModelAndView res;
		final Parade p;

		final Collection<Request> requests = this.requestService.findByParadeId(paradeId);
		final Parade p1 = new Parade();
		p1.setId(paradeId);
		p = this.paradeService.findOne(p1);

		this.brotherhoodService.checkBrotherhoodOwnsParade(p);

		res = new ModelAndView("requests/list");
		res.addObject("parade", p);
		res.addObject("requests", requests);
		res.addObject("brotherhoodView", true);

		return res;
	}

	@RequestMapping(value = "/accept", method = RequestMethod.GET)
	public ModelAndView acceptRequest(@RequestParam final int requestIdA) {
		final ModelAndView res;
		final Request r;

		final Request r1 = new Request();
		r1.setId(requestIdA);
		r = this.requestService.findOne(r1);
		this.requestService.checkRequestOwnsBrotherhood(r);
		res = this.createEditModelAndView(r, "APPROVED", null);

		return res;
	}

	@RequestMapping(value = "/reject", method = RequestMethod.GET)
	public ModelAndView rejectRequest(@RequestParam final int requestIdR) {
		final ModelAndView res;
		final Request r;

		final Request r1 = new Request();
		r1.setId(requestIdR);
		r = this.requestService.findOne(r1);
		this.requestService.checkRequestOwnsBrotherhood(r);
		res = this.createEditModelAndView(r, "REJECTED", null);

		return res;
	}

	private ModelAndView createEditModelAndView(final Request r, final String status, final String messageCode) {
		ModelAndView res;
		final List<Integer> li = new ArrayList<>(this.requestService.suggestPosition(r.getParade()));
		res = new ModelAndView("requests/edit");
		res.addObject("row", li.get(0));
		res.addObject("column", li.get(1));
		res.addObject("request", r);
		res.addObject("status", status);
		res.addObject("brotherhoodView", true);
		res.addObject("message", messageCode);
		res.addObject("formAction", "requests/brotherhood/edit.do");
		String redirect = "requests/brotherhood/list.do?paradeId=";
		redirect = redirect + r.getParade().getId();

		res.addObject("formBack", redirect);

		return res;
	}

	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "save")
	public ModelAndView save(Request r, final BindingResult binding) {
		ModelAndView res;
		if (r.getRowPosition() != 0 && r.getColumnPosition() != 0)
			if (this.requestService.checkPosition(r) == true) {
				res = this.createEditModelAndView(r, "APPROVED", "error.position.selected");
				return res;
			}
		r = this.requestService.reconstructBrotherhood(r, binding);

		if (binding.hasErrors())
			res = this.createEditModelAndView(r, r.getStatus(), "error.request");
		else

			try {
				this.requestService.checkPositionBeforeSave(r);

				final Request r1 = this.requestService.saveDirectly(r);

				String redirect = "redirect:list.do?paradeId=";
				redirect = redirect + r1.getParade().getId();
				res = new ModelAndView(redirect);
			} catch (final Throwable oops) {
				res = this.createEditModelAndView(r, r.getStatus(), "error.request");
			}

		return res;
	}
}
<file_sep>
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.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import security.Authority;
import security.UserAccount;
import services.AdministratorService;
import domain.Administrator;
import domain.Box;
import domain.SocialProfile;
import forms.AdministratorForm;

@Controller
@RequestMapping("/administrator/administrator")
public class AdministratorAdministratorController extends AbstractController {

	@Autowired
	private AdministratorService	administratorService;


	// Constructors -----------------------------------------------------------
	public AdministratorAdministratorController() {
		super();
	}

	////////////////////////////
	//////////EDIT//////////////
	////////////////////////////

	@RequestMapping(value = "/edit", method = RequestMethod.GET)
	public ModelAndView edit() {
		ModelAndView res;
		final Administrator administrator;

		administrator = this.administratorService.findByPrincipal();
		//customer = this.customerService.findOne(customerId);
		res = this.createEditModelAndView(administrator);
		return res;

	}

	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "save")
	public ModelAndView save(@Valid final Administrator administrator, final BindingResult binding) {
		ModelAndView result;

		try { //name, surname, address, email, title, departure	
			Assert.notNull(administrator.getName());
			Assert.isTrue(administrator.getName() != "");
			Assert.notNull(administrator.getEmail());
			Assert.isTrue(administrator.getEmail() != "");
			Assert.notNull(administrator.getAddress());
			Assert.isTrue(administrator.getAddress() != "");

		} catch (final Throwable error) {
			result = this.createEditModelAndView(administrator, "administrator.mandatory");
			return result;
		}

		final Administrator administratorMod = this.administratorService.reconstruct(administrator, binding);
		if (binding.hasErrors())
			result = this.createEditModelAndView(administrator);
		else
			try {
				final String vacia = "";
				if (!administratorMod.getEmail().isEmpty() || administratorMod.getEmail() != vacia)
					Assert.isTrue(administratorMod.getEmail().matches("^[A-z0-9]+@$") || administratorMod.getEmail().matches("^[A-z0-9 ]+ <[A-z0-9]+@>$"), "Wrong email");

				this.administratorService.save(administratorMod);
				result = new ModelAndView("redirect:../../");
			} catch (final Throwable error) {
				if (error.getMessage() == "Wrong email")
					result = this.createEditModelAndView(administratorMod, "administrator.email.error");
				else
					result = this.createEditModelAndView(administratorMod, "administrator.comit.error");
				System.out.println(error.getMessage());
			}

		return result;

	}

	protected ModelAndView createEditModelAndView(final Administrator administrator) {
		ModelAndView result;

		result = this.createEditModelAndView(administrator, null);

		return result;

	}

	protected ModelAndView createEditModelAndView(final Administrator administrator, final String message) {
		ModelAndView result;
		Collection<Box> boxes;
		final Collection<SocialProfile> socialProfiles;
		UserAccount userAccount;

		boxes = administrator.getBoxes();
		socialProfiles = administrator.getSocialProfiles();
		userAccount = administrator.getUserAccount();

		result = new ModelAndView("administrator/edit");
		result.addObject("administrator", administrator);
		result.addObject("boxes", boxes);
		result.addObject("socialProfiles", socialProfiles);
		result.addObject("message", message);
		result.addObject("userAccount", userAccount);
		return result;
	}

	////////////////////////////
	//////////CREATE////////////
	////////////////////////////
	@RequestMapping(value = "/create", method = RequestMethod.GET)
	public ModelAndView create() {
		ModelAndView res;

		Authority authority;
		Collection<Authority> authorities;
		UserAccount userAccount;
		userAccount = new UserAccount();
		authorities = userAccount.getAuthorities();
		authority = new Authority();
		authority.setAuthority(Authority.ADMIN);
		authorities.add(authority);
		userAccount.setAuthorities(authorities);

		final AdministratorForm adminForm = new AdministratorForm();
		adminForm.setUserAccount(userAccount);
		res = this.createCreateModelAndView(adminForm);

		//return res;

		//		administrator = this.administratorService.create();
		//		res = this.createCreateModelAndView(administrator);
		return res;

	}

	protected ModelAndView createCreateModelAndView(final AdministratorForm administratorForm) {
		ModelAndView result;

		result = this.createCreateModelAndView(administratorForm, null);

		return result;

	}

	protected ModelAndView createCreateModelAndView(final AdministratorForm administratorForm, final String message) {
		ModelAndView result;
		result = new ModelAndView("administrator/create");
		result.addObject("administratorForm", administratorForm);
		result.addObject("message", message);
		return result;
	}

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

		try { //name, surname, address, email, title, departure	
			;
			Assert.notNull(administratorForm.getEmail());
			Assert.isTrue(administratorForm.getEmail() != "");

		} catch (final Throwable error) {
			result = this.createCreateModelAndView(administratorForm, "administrator.mandatory");
			return result;
		}

		if (!administratorForm.isConditionsAccepted())
			result = this.createCreateModelAndView(administratorForm, "member.conditionsError");
		else {
			final Administrator administrator = this.administratorService.reconstruct(administratorForm, binding);
			if (binding.hasErrors())
				result = this.createCreateModelAndView(administratorForm);
			else
				try {
					final String vacia = "";
					if (!administrator.getEmail().isEmpty() || administrator.getEmail() != vacia)
						Assert.isTrue(administrator.getEmail().matches("^[A-z0-9]+@$") || administrator.getEmail().matches("^[A-z0-9 ]+ <[A-z0-9]+@>$"), "Wrong email");

					this.administratorService.save(administrator);
					result = new ModelAndView("redirect:../../");
				} catch (final Throwable error) {
					if (error.getMessage() == "Wrong email")
						result = this.createCreateModelAndView(administratorForm, "administrator.email.error");
					else
						result = this.createCreateModelAndView(administratorForm, "administrator.comit.error");
					System.out.println(error.getMessage());
				}
		}
		return result;

	}

	////////////////////////////
	//////////DELETE////////////
	////////////////////////////

	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "leave")
	public ModelAndView saveLeave(final Administrator administrator, final BindingResult binding) {
		ModelAndView result;

		if (binding.hasErrors())
			result = this.createEditModelAndView(administrator);
		else
			try {

				this.administratorService.leave();
				result = new ModelAndView("redirect:../../j_spring_security_logout");
			} catch (final Throwable error) {
				if (error.getMessage() == "Wrong email")
					result = this.createEditModelAndView(administrator, "brotherhood.email.error");
				else
					result = this.createEditModelAndView(administrator, "brotherhood.comit.error");
				System.out.println(error.getMessage());
			}

		return result;

	}

	////////////////////////////
	///////////SHOW/////////////
	////////////////////////////

	@RequestMapping(value = "/show", method = RequestMethod.GET)
	public ModelAndView show() {
		ModelAndView res;
		Administrator administrator;

		administrator = this.administratorService.findByPrincipal();
		//brotherhood = this.brotherhoodService.findOne(brotherhoodId);
		res = this.createShowModelAndView(administrator);
		return res;

	}

	protected ModelAndView createShowModelAndView(final Administrator administrator) {
		ModelAndView result;

		result = this.createShowModelAndView(administrator, null);

		return result;

	}

	protected ModelAndView createShowModelAndView(final Administrator administrator, final String message) {
		ModelAndView result;
		//		Collection<Box> boxes;
		//		final Collection<SocialProfile> socialProfiles;
		//		final Collection<Endorsement> endorsements;
		//		final Collection<FixUpTask> fixUpTasks;
		UserAccount userAccount;

		//		fixUpTasks = brotherhood.getFixUpTasks();
		//		boxes = brotherhood.getBoxes();
		//		socialProfiles = brotherhood.getSocialProfiles();
		//		endorsements = brotherhood.getEndorsements();
		userAccount = administrator.getUserAccount();
		//		 if (socialProfiles.isEmpty())
		//		 * socialProfiles = null;
		//		 * if (endorsements.isEmpty())
		//		 * endorsements = null;
		//if (boxes.isEmpty())
		//	boxes = null;

		result = new ModelAndView("administrator/show");
		result.addObject("administrator", administrator);
		//		result.addObject("boxes", boxes);
		//		result.addObject("socialProfiles", socialProfiles);
		result.addObject("message", message);
		//		result.addObject("endorsements", endorsements);
		//		result.addObject("fixUpTasks", fixUpTasks);
		result.addObject("userAccount", userAccount);
		return result;
	}

}
<file_sep>
package controllers.brotherhood;

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.servlet.ModelAndView;

import security.UserAccount;
import services.BrotherhoodService;
import domain.Brotherhood;
import domain.InceptionRecord;
import domain.LegalRecord;
import domain.LinkRecord;
import domain.PeriodRecord;

@Controller
@RequestMapping("/history/brotherhood")
public class HistoryBrotherhoodController {

	@Autowired
	private BrotherhoodService	brotherhoodService;


	@RequestMapping(value = "/showHistory", method = RequestMethod.GET)
	public ModelAndView showHistory() {
		ModelAndView res;
		Brotherhood brotherhood;

		brotherhood = this.brotherhoodService.findByPrincipal();
		//brotherhood = this.brotherhoodService.findOne(brotherhoodId);
		res = this.createShowRecordsModelAndView(brotherhood);
		return res;

	}

	protected ModelAndView createShowRecordsModelAndView(final Brotherhood brotherhood) {
		ModelAndView result;

		result = this.createShowRecordsModelAndView(brotherhood, null);

		return result;

	}

	protected ModelAndView createShowRecordsModelAndView(final Brotherhood brotherhood, final String message) {
		final ModelAndView result;

		UserAccount userAccount;
		userAccount = brotherhood.getUserAccount();

		final Collection<LegalRecord> legalRecords = brotherhood.getLegalRecords();
		final Collection<PeriodRecord> periodRecords = brotherhood.getPeriodRecords();
		final InceptionRecord inceptionRecord = brotherhood.getInceptionRecord();
		final Collection<LinkRecord> linkRecords = brotherhood.getLinkRecords();

		result = new ModelAndView("history/brotherhood/showHistory");
		result.addObject("brotherhood", brotherhood);
		result.addObject("legalRecords", legalRecords);
		result.addObject("periodRecords", periodRecords);
		result.addObject("inceptionRecord", inceptionRecord);
		result.addObject("linkRecords", linkRecords);
		result.addObject("message", message);
		result.addObject("userAccount", userAccount);
		return result;
	}

}
<file_sep>parade.list				= Parades list
parade.name 				= Name
parade.parentCategory		= Parent parade
parade.edit			 	= Edit
parade.delete			 	= Delete
parade.edit.link		 	= Edit
parade.delete.link	 	= Delete
parade.list.create		= New parade
parade.save				= Save
parade.cancel				= Cancel
parade.nombre				= Name
parade.mandatory = Some mandatory fields are blank.
parade.commit.error	= Errors. Remember that reject reason is mandatory if status is "Rejected".
parade.confirm.delete		= Delete this parade?

parade.status			= Status
parade.rejectReason		= Reject reason

parade.list.request		= Requests list
parade.ob = Fields with * are mandatory
parade.float			= Floats* (Hold control key to select more than one float)
parade.true				= Yes
parade.false			= No
parade.title			= Title*
parade.description		= Description*
parade.departureDate	= Departure date*
parade.ticker			= Ticker
parade.finalMode		= Final mode*
parade.segment.list		= Segments<file_sep>
package repositories;

import java.util.Collection;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Administrator;
import domain.Brotherhood;
import domain.Chapter;
import domain.Member;

@Repository
public interface DashboardRepository extends JpaRepository<Administrator, Integer> {

	//12.3.1

	@Query("select min(e.size) from Brotherhood b join b.enrolements e where e.status ='APPROVED'")
	double minMembers();

	@Query("select max(e.size) from Brotherhood b join b.enrolements e where e.status ='APPROVED'")
	double maxMembers();

	@Query("select avg(e.size) from Brotherhood b join b.enrolements e where e.status ='APPROVED'")
	double avgMembers();

	@Query("select stddev(e.size) from Brotherhood b join b.enrolements e where e.status ='APPROVED'")
	double stddevMembers();

	//12.3.2

	@Query("select b from Brotherhood b join b.enrolements e where e.status='APPROVED' and e.dropOutMoment is null order by count(e) desc")
	Collection<Brotherhood> largestBrotherhoods();

	//12.3.3

	@Query("select b from Brotherhood b join b.enrolements e where e.status='APPROVED' and e.dropOutMoment is null order by count(e) asc")
	Collection<Brotherhood> smallestBrotherhoods();

	//12.3.4

	@Query("select 1.0 * count(r)/(select count(r1) from Request r1), r.parade.title, r.status from Request r group by r.status, r.parade")
	List<Object[]> requestRatioByParade();

	//12.3.5 in service
	//12.3.6

	@Query("select 1.0 * count(r1)/(select count(r) from Request r) from Request r1 group by r1.status")
	List<Double> requestRatio();

	//12.3.7

	@Query("select distinct m from Member m join m.requests r1 where r1.status='APPROVED' group by m.id having count(r1)> 0.1 * m.requests.size")
	Collection<Member> membersWith10PercentRequestsApproved();

	//12.3.8

	@Query("select e.position.positionEng, count(e) from Enrolement e group by e.position")
	List<Object[]> positionHistogram();
	//22.2.1

	@Query("select 1.0 * count(b)/(select count(b1) from Brotherhood b1) from Area a join a.brotherhoods b")
	double ratioBrotherhoodsPerArea();

	@Query("select a.brotherhoods.size from Area a")
	Collection<Double> countBrotherhoodsPerArea();

	@Query("select min(a.brotherhoods.size) from Area a")
	double minBrotherhoodsPerArea();

	@Query("select max(a.brotherhoods.size) from Area a")
	double maxBrotherhoodsPerArea();

	@Query("select avg(a.brotherhoods.size) from Area a")
	double avgBrotherhoodsPerArea();

	@Query("select stddev(a.brotherhoods.size) from Area a")
	double stddevBrotherhoodsPerArea();
	//22.2.2

	@Query("select min(f.parades.size) from Finder f")
	double minFinderResults();

	@Query("select max(f.parades.size) from Finder f")
	double maxFinderResults();

	@Query("select avg(f.parades.size) from Finder f")
	double avgFinderResults();

	@Query("select stddev(f.parades.size) from Finder f")
	double stddevFinderResults();

	//22.2.3

	@Query("select 1.0 * count(f)/(select count(f1) from Finder f1) from Finder f where f.keyword is null and f.startDate is null and f.endDate is null and f.area is null")
	double ratioEmptyFinders();

	//---------------------------------ACME PARADE-----------------------------------
	@Query("select max(1 + b.periodRecords.size + b.legalRecords.size + b.linkRecords.size) from Brotherhood b")
	double maxNumRecordsPerHistory();

	@Query("select min(1 + b.periodRecords.size + b.legalRecords.size + b.linkRecords.size) from Brotherhood b")
	double minNumRecordsPerHistory();

	@Query("select avg(1 + b.periodRecords.size + b.legalRecords.size + b.linkRecords.size)from Brotherhood b")
	double avgNumRecordsPerHistory();

	@Query("select stddev(1 + b.periodRecords.size + b.legalRecords.size + b.linkRecords.size)from Brotherhood b")
	double stddevNumRecordsPerHistory();

	@Query("select b from Brotherhood b join b.periodRecords p join b.legalRecords l join b.linkRecords li order by (1 + count(p) + count(l) + count(li))")
	Collection<Brotherhood> largestHistoryBrotherhood();

	@Query("select b from Brotherhood b where (1 + b.periodRecords.size + b.legalRecords.size + b.linkRecords.size)>?1 *1.0")
	Collection<Brotherhood> largerThanAvgHistoryBrotherhood(double avgHistory);

	//Queries de la B
	@Query("select 1.0 * count(a)/(select count(a1) from Area a1) from Area a where a.id not in (select a.id from Chapter c join c.area a)")
	double ratioAreasNoChapter();

	@Query("select count(p)*1.0/(select count(c) from Chapter c) from Parade p join p.brotherhood b1 where b1 in (select b from Chapter c join c.area.brotherhoods b)")
	double avgParadesPerChapter();

	@Query("select 1.0 *count(p) from Parade p join p.brotherhood b1 where b1 in (select b from Chapter c join c.area.brotherhoods b) and p.finalMode=1 group by b1.area")
	Collection<Double> countParadesPerChapter();

	@Query("select c from Chapter c , Parade p where p.brotherhood member of c.area.brotherhoods group by c having count(p)>=1.1*?1")
	Collection<Chapter> chapterMoreParadesThanAvg(Double avg);

	@Query("select 1.0 * count(p1)/(select count(p2) from Parade p2 where p2.finalMode='1') from Parade p1 where p1.finalMode='0'")
	double ratioParadesDraftModevsFinalMode();

	@Query("select 1.0 * count(p1)/(select count(p2) from Parade p2) from Parade p1 where p1.finalMode='1' group by p1.status")
	Collection<Double> ratioParadesFinalModeGroupedByStatus();
}
<file_sep>package services;

import java.util.ArrayList;
import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import repositories.ActorRepository;
import repositories.SocialProfileRepository;
import security.LoginService;
import security.UserAccount;
import domain.Actor;
import domain.SocialProfile;

@Transactional
@Service
public class SocialProfileService {
	
	@Autowired
	private SocialProfileRepository socialProfileRepository;
	
	@Autowired
	private ActorRepository actorRepository;
	
	public SocialProfile create(){
		return new SocialProfile();
	}
	
	public Collection<SocialProfile> findAll(){
		return socialProfileRepository.findAll();
	}
	
	public SocialProfile findOne(int socialProfileId){
		return socialProfileRepository.findOne(socialProfileId);
	}
	
	public SocialProfile save(SocialProfile socialProfile){
		return socialProfileRepository.save(socialProfile);
	}
	
	public void delete(SocialProfile socialProfile){
		socialProfileRepository.delete(socialProfile);
		final UserAccount actual = LoginService.getPrincipal();
		final Actor a = this.actorRepository.getActor(actual);
		a.getSocialProfiles().remove(socialProfile);
	}

	public void deleteLeave(final SocialProfile socialProfile) {
		this.socialProfileRepository.delete(socialProfile);

	}

	public void saveMyProfile(SocialProfile socialProfile) {
		final UserAccount actual = LoginService.getPrincipal();
		final Actor a = this.actorRepository.getActor(actual);
		final SocialProfile profile = this.socialProfileRepository.save(socialProfile);
		if (!a.getSocialProfiles().contains(socialProfile)) {
			final Collection<SocialProfile> profiles = a.getSocialProfiles();
			profiles.add(profile);
			a.setSocialProfiles(profiles);
		}
	}

	public Collection<SocialProfile> findMyProfiles() {
		Collection<SocialProfile> res = new ArrayList<SocialProfile>();
		final UserAccount actual = LoginService.getPrincipal();
		final Actor a = this.actorRepository.getActor(actual);
		if(a.getSocialProfiles()==null){
			a.setSocialProfiles(res);
			this.actorRepository.save(a);
			return res;
		}
		
		return a.getSocialProfiles();
	}


}
<file_sep>
package converters;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import domain.Enrolement;

@Component
@Transactional
public class EnrolementToStringConverter implements Converter<Enrolement, String> {

	@Override
	public String convert(final Enrolement enrolement) {
		String res;

		if (enrolement == null)
			res = null;
		else
			res = String.valueOf(enrolement.getId());

		return res;
	}

}
<file_sep>
package controllers.members;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

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.BrotherhoodService;
import services.EnrolementService;
import services.MemberService;
import services.PositionService;
import controllers.AbstractController;
import domain.Brotherhood;
import domain.Enrolement;
import domain.Member;
import domain.Position;

@Controller
@RequestMapping("/members/brotherhood")
public class MembersBrotherhoodController extends AbstractController {

	@Autowired
	MemberService		memberService;

	@Autowired
	PositionService		positionService;

	@Autowired
	BrotherhoodService	brotherhoodService;

	@Autowired
	EnrolementService	enrolementService;


	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public ModelAndView list() {
		final ModelAndView res;
		final Collection<Member> members;

		final Brotherhood b = this.brotherhoodService.findOnePrincipal();
		members = this.memberService.membersByBrotherhood(b);
		res = new ModelAndView("members/list");
		res.addObject("members", members);
		res.addObject("requestURI", "members/brotherhood/list.do");

		return res;
	}

	@RequestMapping(value = "/show", method = RequestMethod.GET)
	public ModelAndView show(@RequestParam final int memberId) {
		final ModelAndView res;
		final Member member;
		final Brotherhood b;
		final Enrolement enrolement;

		final Member m = new Member();
		m.setId(memberId);
		member = this.memberService.findOne(m);
		b = this.brotherhoodService.findOnePrincipal();

		enrolement = this.enrolementService.findEnrolementByIds(b, member);
		this.brotherhoodService.checkBrotherhood2(enrolement);

		res = new ModelAndView("members/show");
		res.addObject("member", member);
		res.addObject("enrolement", enrolement);

		return res;
	}

	@RequestMapping(value = "/show", method = RequestMethod.POST, params = "delete")
	public ModelAndView deleteMember(final Member m, final BindingResult binding) {
		ModelAndView res;

		try {
			this.brotherhoodService.deleteMember(m);
			res = new ModelAndView("redirect:list.do");
		} catch (final Throwable oops) {
			res = new ModelAndView("redirect:list.do");
		}
		return res;

	}
	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "edit")
	public ModelAndView editMember(final Enrolement e, final BindingResult binding) {
		ModelAndView res;

		try {
			final Enrolement e1 = this.enrolementService.findOne(e);
			this.brotherhoodService.checkBrotherhood(e1);
			res = this.createEditModelAndView(e1);
		} catch (final Throwable oops) {
			res = new ModelAndView("redirect:list.do");
		}
		return res;

	}

	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "save")
	public ModelAndView saveMember(Enrolement e, final BindingResult binding) {
		ModelAndView res;
		e = this.enrolementService.reconstruct2(e, binding);
		try {
			this.brotherhoodService.checkBrotherhood(e);
			this.enrolementService.saveDirectly(e);
			res = new ModelAndView("redirect:list.do");
		} catch (final Throwable oops) {
			res = new ModelAndView("redirect:list.do");
		}
		return res;

	}

	private ModelAndView createEditModelAndView(final Enrolement e1) {
		ModelAndView res;

		res = this.createEditModelAndView(e1, null);
		return res;
	}

	private ModelAndView createEditModelAndView(final Enrolement e1, final String messageCode) {
		ModelAndView res;
		res = new ModelAndView("members/edit");
		final List<Position> lp = new ArrayList<>(this.positionService.findAll());

		res.addObject("enrolement", e1);
		res.addObject("message", messageCode);
		res.addObject("listPositions", lp);

		return res;
	}
}
<file_sep>
package services;

import java.util.ArrayList;

import javax.validation.ConstraintViolationException;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import utilities.AbstractTest;
import domain.LegalRecord;
import domain.PeriodRecord;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
	"classpath:spring/junit.xml"
})
@Transactional
public class PeriodRecordServiceTest extends AbstractTest {

	//SUT
	@Autowired
	private PeriodRecordService	prs;

	/**
	 * THIS TEST IS FOR TESTING THE REQUIREMENT #1
	 * THERE ARE 2 GOOD TESTING CASES, AND 9 BAD TESTING CASES
	 * COVERED INSTRUCTIONS IN THIS TEST: 100%
	 * COVERED INSTRUCTIONS IN LegalRecordService: 73.7%
	 * COVERED DATA IN THIS TEST: 75%
	 * */
	
	@Test
	public void editRecord() {
		final Object testingData[][] = {
			
				/**
				 * TESTING REQUIREMENT #1
				 * POSITIVE TEST
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
				 * */
				{
				"brotherhood1", "periodRecord1", null
			}, 
			
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LEGAL RECORD IF YOU ARE NOT THE OWNER
			 * (Expected IllegalArgumentException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			{
				"brotherhood2", "periodRecord1", IllegalArgumentException.class
			}
		};

		for (int i = 0; i < testingData.length; i++)
			this.template((String) testingData[i][0], super.getEntityId((String) testingData[i][1]), (Class<?>) testingData[i][2]);
	}

	protected void template(final String username, final int id, final Class<?> expected) {

		Class<?> caught;

		caught = null;

		try {
			this.authenticate(username);
			final PeriodRecord lr = this.prs.findOne(id);
			this.prs.save(lr);

			this.unauthenticate();

		} catch (final Throwable oops) {
			caught = oops.getClass();
		}

		super.checkExceptions(expected, caught);
	}
	
	@Test
	public void createRecord() {
		final PeriodRecord savetest = this.prs.create();
		savetest.setDescription("Sample");
		savetest.setTitle("SAMPLE");
		savetest.setEndYear(2021);
		savetest.setPhotos(new ArrayList<String>());
		savetest.setStartYear(2020);
		
		final PeriodRecord savetest2 = this.prs.create();
		savetest2.setDescription("");
		savetest2.setTitle("SAMPLE");
		savetest2.setEndYear(2021);
		savetest2.setPhotos(new ArrayList<String>());
		savetest2.setStartYear(2020);
		
		final PeriodRecord savetest3 = this.prs.create();
		savetest3.setDescription("Sample");
		savetest3.setTitle("");
		savetest3.setEndYear(2021);
		savetest3.setPhotos(new ArrayList<String>());
		savetest3.setStartYear(2020);
		
		final PeriodRecord savetest4 = this.prs.create();
		savetest4.setDescription("Sample");
		savetest4.setTitle("SAMPLE");
		savetest4.setEndYear(null);
		savetest4.setPhotos(new ArrayList<String>());
		savetest4.setStartYear(2020);
		
		final PeriodRecord savetest5 = this.prs.create();
		savetest5.setDescription("Sample");
		savetest5.setTitle("SAMPLE");
		savetest5.setEndYear(2021);
		savetest5.setPhotos(new ArrayList<String>());
		savetest5.setStartYear(null);
		
		final PeriodRecord savetest6 = this.prs.create();
		savetest6.setDescription(null);
		savetest6.setTitle("SAMPLE");
		savetest6.setEndYear(2021);
		savetest6.setPhotos(new ArrayList<String>());
		savetest6.setStartYear(2020);
		
		final PeriodRecord savetest7 = this.prs.create();
		savetest7.setDescription("Sample");
		savetest7.setTitle(null);
		savetest7.setEndYear(2021);
		savetest7.setPhotos(new ArrayList<String>());
		savetest7.setStartYear(2020);
		
		final PeriodRecord savetest8 = this.prs.create();
		savetest8.setDescription("Sample");
		savetest8.setTitle("SAMPLE");
		savetest8.setEndYear(2021);
		savetest8.setPhotos(new ArrayList<String>());
		savetest8.setStartYear(2020);
		
		final PeriodRecord savetest9 = this.prs.create();
		savetest9.setDescription("A very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long text");
		savetest9.setTitle("A very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long textA very long text");
		savetest9.setEndYear(2021);
		savetest9.setPhotos(new ArrayList<String>());
		savetest9.setStartYear(2020);
		
		
		final Object testingData[][] = {
			
				/**
				 * TESTING REQUIREMENT #1
				 * POSITIVE TEST
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
				 * */
				{
				"brotherhood1", savetest, null
			}, 
			
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LINK RECORD WITH EMPTY OR NULL VALUES
			 * (Expected ConstraintViolationException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			{
				"brotherhood1", savetest2, ConstraintViolationException.class
			},
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LINK RECORD WITH EMPTY OR NULL VALUES
			 * (Expected ConstraintViolationException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			
			{
				"brotherhood1", savetest3, ConstraintViolationException.class
			},
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LINK RECORD WITH EMPTY OR NULL VALUES
			 * (Expected ConstraintViolationException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			
			{
				"brotherhood1", savetest4, ConstraintViolationException.class
			},		
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LINK RECORD WITH EMPTY OR NULL VALUES
			 * (Expected ConstraintViolationException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			{
				"brotherhood1", savetest5, ConstraintViolationException.class
			},
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LINK RECORD WITH EMPTY OR NULL VALUES
			 * (Expected ConstraintViolationException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			{
				"brotherhood1", savetest6, ConstraintViolationException.class
			},
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LINK RECORD WITH EMPTY OR NULL VALUES
			 * (Expected ConstraintViolationException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			{
				"brotherhood1", savetest7, ConstraintViolationException.class
			},
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LINK RECORD WITH EMPTY OR NULL VALUES
			 * (Expected ConstraintViolationException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			{
				"brotherhood1", savetest8, ConstraintViolationException.class
			},
			/**
			 * TESTING REQUIREMENT #1
			 * NEGATIVE TEST: YOU CANNOT EDIT A LINK RECORD WITH EMPTY OR NULL VALUES
			 * (Expected ConstraintViolationException)
				 * COVERED INSTRUCTIONS: 100%
				 * COVERED DATA: 20%
			 * */
			{
				"brotherhood1", savetest9, ConstraintViolationException.class
			},
			
		};

		for (int i = 0; i < testingData.length; i++)
			this.template2((String) testingData[i][0], (PeriodRecord) testingData[i][1], (Class<?>) testingData[i][2]);
	}

	protected void template2(final String username, final PeriodRecord lr, final Class<?> expected) {

		Class<?> caught;

		caught = null;

		try {
			this.authenticate(username);
			this.prs.save(lr);

			this.unauthenticate();

		} catch (final Throwable oops) {
			caught = oops.getClass();
		}

		super.checkExceptions(expected, caught);
	}
	
	
}
<file_sep>
package controllers.chapter;

import java.util.List;

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.ParadeService;
import services.SegmentService;
import controllers.AbstractController;
import domain.Parade;
import domain.Segment;

@Controller
@RequestMapping("/chapter/segment")
public class ParadeChapterSegmentController extends AbstractController {

	@Autowired
	private ParadeService	paradeService;

	@Autowired
	private SegmentService	segmentService;


	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public ModelAndView list(@RequestParam final int paradeId) {
		ModelAndView result;
		final Parade parade = this.paradeService.findOne(paradeId);
		final List<Segment> segments = this.segmentService.getSegmentsByParade(parade);

		result = new ModelAndView("chapter/segment/list");
		result.addObject("segments", segments);
		result.addObject("requestURI", "/chapter/segment/list.do");

		return result;
	}

}
<file_sep>
package domain;

import java.util.Collection;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.NotBlank;

@Entity
@Access(AccessType.PROPERTY)
public class LegalRecord extends Record {

	private String				legalName;
	private Collection<String>	applicableLaws;
	private Integer				vatNumber;


	@NotBlank
	public String getLegalName() {
		return this.legalName;
	}

	public void setLegalName(final String legalName) {
		this.legalName = legalName;
	}

	@ElementCollection
	public Collection<String> getApplicableLaws() {
		return this.applicableLaws;
	}

	public void setApplicableLaws(final Collection<String> applicableLaws) {
		this.applicableLaws = applicableLaws;
	}

	@Min(0)
	public Integer getVatNumber() {
		return this.vatNumber;
	}

	public void setVatNumber(final Integer vatNumber) {
		this.vatNumber = vatNumber;
	}

}
<file_sep>
package repositories;

import java.util.Collection;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Request;

@Repository
public interface RequestRepository extends JpaRepository<Request, Integer> {

	@Query("select r from Request r where r.parade.id = ?1")
	Collection<Request> findByParadeId(int paradeId);

	@Query("select r from Member m join m.requests r where r.parade.id=?1 and m.id=?2")
	public Request findRequestByIds(Integer paradeId, Integer memberId);

	@Query("select r from Member m join m.requests r where m.id=?1")
	public Collection<Request> findRequestByMemberId(Integer memberId);

	@Query("select r from Request r join r.parade p where p.id=?1")
	public Collection<Request> findRequestByParadeId(Integer paradeId);

	@Query("select r from Member m join m.requests r where m.id=?1 and r.parade.id=?2")
	public Request existRequest(Integer memberId, Integer paradeId);

	@Query("select r from Request r where r.parade.id=?1 and r.status='PENDING'")
	public Collection<Request> requestPending(Integer paradeId);

	@Query("select r from Request r where r.parade.id=?1 and r.status='APPROVED'")
	public Collection<Request> findAllApproved(Integer paradeId);

	@Query("select r from Request r join r.parade p where r.rowPosition=?1 and r.columnPosition=?2 and p.id=?3")
	public Request checkPosition(Integer row, Integer column, Integer paradeId);

}
<file_sep>
package domain;

import java.util.Collection;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.URL;

@Entity
@Access(AccessType.PROPERTY)
public class Sponsorship extends DomainEntity {

	private String				banner;
	private Boolean				isActive;
	private String				targetURL;
	private Collection<Parade>	parades;
	private CreditCard			creditCard;


	@NotBlank
	@URL
	public String getTargetURL() {
		return this.targetURL;
	}

	public void setTargetURL(final String targetURL) {
		this.targetURL = targetURL;
	}

	@NotBlank
	public String getBanner() {
		return this.banner;
	}

	public void setBanner(final String banner) {
		this.banner = banner;
	}

	public void setIsActive(final Boolean isActive) {
		this.isActive = isActive;
	}

	@NotNull
	public Boolean getIsActive() {
		return this.isActive;
	}

	public void setIsActive(final boolean isActive) {
		this.isActive = isActive;
	}

	@ManyToMany
	public Collection<Parade> getParades() {
		return this.parades;
	}

	public void setParades(final Collection<Parade> parades) {
		this.parades = parades;
	}
	@NotNull
	@ManyToOne(optional = false)
	public CreditCard getCreditCard() {
		return this.creditCard;
	}

	public void setCreditCard(final CreditCard creditCard) {
		this.creditCard = creditCard;
	}
}
<file_sep>
package controllers.brotherhood;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Validator;
import org.springframework.web.bind.annotation.ModelAttribute;
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.BrotherhoodService;
import services.FloatService;
import services.ProcessionService;
import controllers.AbstractController;
import domain.Brotherhood;
import domain.Procession;

@Controller
@RequestMapping("/procession")
public class ProcessionBrotherhoodController extends AbstractController {

	@Autowired
	BrotherhoodService	brotherhoodService;

	@Autowired
	ProcessionService	processionService;

	@Autowired
	FloatService		floatService;


	@RequestMapping(value = "/brotherhood/list", method = RequestMethod.GET)
	public ModelAndView list() {
		ModelAndView res;

		final Brotherhood bro = this.brotherhoodService.findByPrincipal();

		final Collection<Procession> processions = this.processionService.findByBrotherhoodId(bro.getId());
		final List<Boolean> finalModes = new ArrayList<>();
		finalModes.add(true);
		finalModes.add(false);

		res = new ModelAndView("procession/brotherhood/list");
		res.addObject("processions", processions);
		res.addObject("requestURI", "procession/brotherhood/list.do");
		res.addObject("finalModes", finalModes);
		return res;
	}


	@Autowired
	Validator	validator;


	@RequestMapping(value = "/brotherhood/edit", method = RequestMethod.POST, params = "save")
	public ModelAndView save(@ModelAttribute final Procession procession, final BindingResult binding) {
		ModelAndView result;
		Procession procMod;
		try {
			Assert.notNull(procession.getDescription());
			Assert.isTrue(procession.getDescription() != "");
			Assert.notNull(procession.getDepartureDate());
			Assert.notNull(procession.getFloats());
			Assert.isTrue(procession.getFloats().isEmpty() == false);
			Assert.notNull(procession.getTitle());
			Assert.isTrue(procession.getTitle() != "");

		} catch (final Throwable error) {
			result = this.createEditModelAndView(procession, "procession.mandatory");
			return result;
		}
		try {
			procMod = this.processionService.reconstruct(procession, binding);
			this.validator.validate(procMod, binding);
			if (binding.hasErrors())
				result = this.createEditModelAndView(procMod);
			else {
				this.processionService.save(procMod);
				result = new ModelAndView("redirect:list.do");
			}
		} catch (final Throwable oops) {
			result = this.createEditModelAndView(procession, "procession.commit.error");
		}

		return result;
	}

	@RequestMapping(value = "/brotherhood/create", method = RequestMethod.GET)
	public ModelAndView create() {
		ModelAndView res;
		Procession procession;

		procession = this.processionService.create();

		res = this.createEditModelAndView(procession);

		return res;
	}

	@RequestMapping(value = "/brotherhood/edit", method = RequestMethod.GET)
	public ModelAndView edit(@RequestParam final int processionId) {
		ModelAndView result;
		Procession procession;
		final Brotherhood brotherhood = this.brotherhoodService.findByPrincipal();

		procession = this.processionService.findOne(processionId);
		Assert.isTrue(procession.getBrotherhood().getId() == brotherhood.getId());
		Assert.isTrue(procession.getFinalMode() == false);
		result = this.createEditModelAndView(procession);

		return result;
	}

	@RequestMapping(value = "/brotherhood/edit", method = RequestMethod.POST, params = "delete")
	public ModelAndView delete(final Procession procession, final BindingResult binding) {
		ModelAndView result;

		try {
			this.processionService.delete(procession);
			result = new ModelAndView("redirect:list.do");
		} catch (final Throwable oops) {
			result = this.createEditModelAndView(procession, "procession.commit.error");
		}

		return result;
	}

	protected ModelAndView createEditModelAndView(final Procession procession) {
		ModelAndView result;

		result = this.createEditModelAndView(procession, null);

		return result;

	}

	protected ModelAndView createEditModelAndView(final Procession procession, final String message) {
		ModelAndView result;
		final Brotherhood bro = this.brotherhoodService.findByPrincipal();
		final Collection<domain.Float> floats = this.floatService.findByBrotherhoodId(bro.getId());

		result = new ModelAndView("procession/edit");
		result.addObject("floats", floats);
		result.addObject("procession", procession);
		result.addObject("message", message);

		return result;
	}

}
<file_sep>record.list = Crónicas
record.edit = Editar
record.show = Ver detalles
record.create = Crear
record.save = Guardar
record.delete = Borrar
record.cancel = Cancelar

record.obligatorio = Los campos marcados con * son obligatorios
record.title = Título* :
record.description = Descripción* :
record.legalName = Nombre legal* :
record.applicableLaws = Leyes aplicables :
record.vatNumber	= IVA :
record.link			= Enlace :
record.startYear	= Año de inicio :
record.endYear		= Año de fin :
record.photos		= FotosS :

legalRecord.create = Crear crónica legal
linkRecord.create  = Crear crónica de enlace
periodRecord.create = Crear crónica periódica
inceptionRecord.create = Crear crónica inicial

record.mandatory = (Los campos con * son obligatorios)
record.confirm.delete = ¿Eliminar esta crónica?
record.commit.error.blank = Error. The introduced values are incorrect or blank.
record.commit.error = Errors<file_sep>
package controllers.enrolements;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

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.servlet.ModelAndView;

import services.BrotherhoodService;
import services.EnrolementService;
import services.MemberService;
import controllers.AbstractController;
import domain.Brotherhood;
import domain.Enrolement;
import domain.Member;

@Controller
@RequestMapping("/enrolements/member")
public class EnrolementsMemberController extends AbstractController {

	@Autowired
	MemberService		memberService;

	@Autowired
	BrotherhoodService	brotherhoodService;

	@Autowired
	EnrolementService	enrolementService;


	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public ModelAndView list() {
		final ModelAndView res;
		final Collection<Enrolement> enrolements;

		final Member member = this.memberService.findOnePrincipal();
		enrolements = this.enrolementService.findEnrolementsByMemberId(member);
		res = new ModelAndView("enrolements/list");
		res.addObject("enrolements", enrolements);
		res.addObject("memberView", true);
		res.addObject("requestURI", "enrolements/member/list.do");

		return res;
	}

	@RequestMapping(value = "/create", method = RequestMethod.GET)
	public ModelAndView create() {
		final ModelAndView res;
		final Enrolement e;

		e = this.enrolementService.create();
		res = this.createEditModelAndView(e);

		return res;
	}

	@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "save")
	public ModelAndView save(Enrolement e, final BindingResult binding) {
		ModelAndView res;
		e = this.enrolementService.reconstruct(e, binding);
		if (binding.hasErrors())
			res = this.createEditModelAndView(e);
		else

			try {

				this.enrolementService.save(e);
				res = new ModelAndView("redirect:list.do");
			} catch (final Throwable oops) {
				res = this.createEditModelAndView(e, "error.enrolement");
			}

		return res;
	}

	protected ModelAndView createEditModelAndView(final Enrolement e) {
		ModelAndView res;
		res = this.createEditModelAndView(e, null);

		return res;
	}

	protected ModelAndView createEditModelAndView(final Enrolement e, final String messageCode) {
		ModelAndView res;
		res = new ModelAndView("enrolements/edit");
		final Member m = this.memberService.findByPrincipal();
		final List<Brotherhood> lb = new ArrayList<>(this.brotherhoodService.findAllNotApproved(m));

		res.addObject("memberView", true);
		res.addObject("enrolement", e);
		res.addObject("message", messageCode);
		res.addObject("listBrotherhoods", lb);

		return res;
	}

}
<file_sep>package services;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import domain.Customisation;

import repositories.CustomisationRepository;


@Transactional
@Service
public class CustomisationService {
	@Autowired
	private CustomisationRepository customisationRepository;
	
	public Customisation create(){
		return new Customisation();
	}
	
	public Collection<Customisation> findAll(){
		return customisationRepository.findAll();
	}
	
	public Customisation findOne(int customisationId){
		return customisationRepository.findOne(customisationId);
	}
	
	public Customisation save(Customisation customisation){
		return customisationRepository.save(customisation);
	}
	
	public void delete(Customisation customisation){
		customisationRepository.delete(customisation);
	}
	
	public Customisation getCustomisation(){
		List<Customisation> x = new ArrayList<Customisation>();
		x.addAll(this.findAll());
		Customisation res;
		
		res = x.get(0);
		
		return res;
		
	}
	

}
<file_sep>parade.list				= Lista de desfiles
parade.name				= Nombre
parade.parentCategory		= Categoría padre
parade.edit			 	= Editar
parade.delete			 	= Eliminar
parade.edit.link		 	= Editar
parade.delete.link	 	= Eliminar
parade.list.create		= Nuevo desfile
parade.save				= Guardar
parade.cancel				= Cancelar
parade.nombre				= Nombre
parade.mandatory = Algunos campos obligatorios están en blanco.
parade.commit.error		= Se encontraron errores. Recuerda que la razón de rechazo es obligatoria si el estado es "Rejected".
parade.confirm.delete		= ¿Eliminar este desfile?

parade.status			= Estado
parade.rejectReason		= Razón de rechazo

parade.list.request		= Lista de peticiones
parade.ob = Los parámetros marcados con * son obligatorios.
parade.float			= Pasos* (Mantén pulsado control para seleccionar más de uno)
parade.true				= Sí
parade.false			= No
parade.title			= Título*
parade.description		= Descripción*
parade.departureDate	= Fecha de salida*
parade.ticker			= Ticker
parade.finalMode		= Modo final*
parade.segment.list		= Segmentos
