Skip to content

Commit

Permalink
D06
Browse files Browse the repository at this point in the history
  • Loading branch information
pakote13rg committed Jun 3, 2022
1 parent 3afd51d commit cdc7414
Show file tree
Hide file tree
Showing 30 changed files with 1,405 additions and 1,299 deletions.
246 changes: 136 additions & 110 deletions reports/UML_domain_model.uxf

Large diffs are not rendered by default.

140 changes: 70 additions & 70 deletions src/main/java/acme/entities/chimpums/Chimpum.java
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
package acme.entities.chimpums;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;

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

import acme.entities.items.Item;
import acme.framework.datatypes.Money;
import acme.framework.entities.AbstractEntity;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
public class Chimpum extends AbstractEntity{

protected static final long serialVersionUID = 1L;

@NotNull
@Pattern(regexp = "^[A-Z]{3}-[0-9]{2}-[0-9]{2}-[0-9]{2}$")
protected String code;

@NotNull
@Past
@Temporal(TemporalType.TIMESTAMP)
protected Date creationMoment;

@NotNull
@Temporal(TemporalType.TIMESTAMP)
protected Date startDate;

@NotNull
@Temporal(TemporalType.TIMESTAMP)
protected Date endDate;

@NotBlank
@Length(min=1, max = 100)
protected String title;

@NotBlank
@Length(min=1, max = 255)
protected String description;

@NotNull
@Valid
protected Money budget;

@URL
protected String moreInfo;

@NotNull
@Valid
@OneToOne(optional = false)
@JoinColumn(unique = true)
protected Item item;

}
//package acme.entities.chimpums;
//
//import java.util.Date;
//
//import javax.persistence.Entity;
//import javax.persistence.JoinColumn;
//import javax.persistence.OneToOne;
//import javax.persistence.Temporal;
//import javax.persistence.TemporalType;
//import javax.validation.Valid;
//import javax.validation.constraints.NotBlank;
//import javax.validation.constraints.NotNull;
//import javax.validation.constraints.Past;
//import javax.validation.constraints.Pattern;
//
//import org.hibernate.validator.constraints.Length;
//import org.hibernate.validator.constraints.URL;
//
//import acme.entities.items.Item;
//import acme.framework.datatypes.Money;
//import acme.framework.entities.AbstractEntity;
//import lombok.Getter;
//import lombok.Setter;
//
//@Entity
//@Getter
//@Setter
//public class Chimpum extends AbstractEntity{
//
// protected static final long serialVersionUID = 1L;
//
// @NotNull
// @Pattern(regexp = "^[A-Z]{3}-[0-9]{2}-[0-9]{2}-[0-9]{2}$")
// protected String code;
//
// @NotNull
// @Past
// @Temporal(TemporalType.TIMESTAMP)
// protected Date creationMoment;
//
// @NotNull
// @Temporal(TemporalType.TIMESTAMP)
// protected Date startDate;
//
// @NotNull
// @Temporal(TemporalType.TIMESTAMP)
// protected Date endDate;
//
// @NotBlank
// @Length(min=1, max = 100)
// protected String title;
//
// @NotBlank
// @Length(min=1, max = 255)
// protected String description;
//
// @NotNull
// @Valid
// protected Money budget;
//
// @URL
// protected String moreInfo;
//
// @NotNull
// @Valid
// @OneToOne(optional = false)
// @JoinColumn(unique = true)
// protected Item item;
//
//}
70 changes: 70 additions & 0 deletions src/main/java/acme/entities/sisit/Sisit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package acme.entities.sisit;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;

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

import acme.entities.items.Item;
import acme.framework.datatypes.Money;
import acme.framework.entities.AbstractEntity;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
public class Sisit extends AbstractEntity{

protected static final long serialVersionUID = 1L;

@NotNull
@Pattern(regexp = "^[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{1,3}$")
protected String code;

@NotNull
@Past
@Temporal(TemporalType.TIMESTAMP)
protected Date creationMoment;

@NotBlank
@Length(min=1, max = 100)
protected String name;

@NotBlank
@Length(min=1, max = 255)
protected String summary;

@NotNull
@Temporal(TemporalType.TIMESTAMP)
protected Date startDate;

@NotNull
@Temporal(TemporalType.TIMESTAMP)
protected Date endDate;

@NotNull
@Valid
protected Money share;

@URL
protected String moreInfo;

@NotNull
@Valid
@OneToOne(optional = false)
@JoinColumn(unique = true)
protected Item item;

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ public interface AdministratorDashboardRepository extends AbstractRepository {
List<String> maximunBudgetOfToolGroupedByCurrency();


//CHIMPUM
@Query("select 1.0 * count(a) / (select count(b) from Item b) from Chimpum a")
Double getRatioOfItemsWithChimpum();
//Sisit
@Query("select 1.0 * count(a) / (select count(b) from Item b where b.itemType = acme.entities.items.ItemType.TOOL) from Sisit a")
Double getRatioOfToolsWithSisit();

@Query("select t.budget.currency, avg(t.budget.amount) from Chimpum t group by t.budget.currency")
List<String> getAverageBudgetOfChimpumGroupedByCurrency();
@Query("select t.share.currency, avg(t.share.amount) from Sisit t where t.item.itemType = acme.entities.items.ItemType.TOOL group by t.share.currency")
List<String> getAverageShareOfSisitGroupedByCurrency();

@Query("select t.budget.currency, stddev(t.budget.amount) from Chimpum t group by t.budget.currency")
List<String> getDeviationBudgetOfChimpumGroupedByCurrency();
@Query("select t.share.currency, stddev(t.share.amount) from Sisit t where t.item.itemType = acme.entities.items.ItemType.TOOL group by t.share.currency")
List<String> getDeviationShareOfSisitGroupedByCurrency();

@Query("select t.budget.currency, min(t.budget.amount) from Chimpum t group by t.budget.currency")
List<String> getMinimunBudgetOfChimpumGroupedByCurrency();
@Query("select t.share.currency, min(t.share.amount) from Sisit t where t.item.itemType = acme.entities.items.ItemType.TOOL group by t.share.currency")
List<String> getMinimunShareOfSisitGroupedByCurrency();

@Query("select t.budget.currency, max(t.budget.amount) from Chimpum t group by t.budget.currency")
List<String> getMaximunBudgetOfChimpumGroupedByCurrency();
@Query("select t.share.currency, max(t.share.amount) from Sisit t where t.item.itemType = acme.entities.items.ItemType.TOOL group by t.share.currency")
List<String> getMaximunShareOfSisitGroupedByCurrency();

//COMPONENT
@Query("select count(c) from Item c where c.itemType = acme.entities.items.ItemType.COMPONENT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ public AdministratorDashboard findOne(final Request<AdministratorDashboard> requ
final Map<String,Double> maximunBudgetOfToolGroupedByCurrency;


//CHIMPUM DECLARACION
final Double ratioOfItemsWithChimpum;
final Map<String,Double> averageBudgetOfChimpumGroupedByCurrency;
final Map<String,Double> deviationBudgetOfChimpumGroupedByCurrency;
final Map<String,Double> minimunBudgetOfChimpumGroupedByCurrency;
final Map<String,Double> maximunBudgetOfChimpumGroupedByCurrency;
//SISIT DECLARACION
final Double ratioOfToolsWithSisit;
final Map<String,Double> averageShareOfSisitGroupedByCurrency;
final Map<String,Double> deviationShareOfSisitGroupedByCurrency;
final Map<String,Double> minimunShareOfSisitGroupedByCurrency;
final Map<String,Double> maximunShareOfSisitGroupedByCurrency;

//PATRONAGE DECLARACION
final AdministratorDashboard result;
Expand Down Expand Up @@ -105,11 +105,11 @@ public AdministratorDashboard findOne(final Request<AdministratorDashboard> requ
maximunBudgetOfToolGroupedByCurrency = this.parseTool(this.repository.maximunBudgetOfToolGroupedByCurrency());

//TOOL INICIALIZACION
ratioOfItemsWithChimpum = this.repository.getRatioOfItemsWithChimpum();
averageBudgetOfChimpumGroupedByCurrency = this.parseTool(this.repository.getAverageBudgetOfChimpumGroupedByCurrency());
deviationBudgetOfChimpumGroupedByCurrency = this.parseTool(this.repository.getDeviationBudgetOfChimpumGroupedByCurrency());
minimunBudgetOfChimpumGroupedByCurrency = this.parseTool(this.repository.getMinimunBudgetOfChimpumGroupedByCurrency());
maximunBudgetOfChimpumGroupedByCurrency = this.parseTool(this.repository.getMaximunBudgetOfChimpumGroupedByCurrency());
ratioOfToolsWithSisit= this.repository.getRatioOfToolsWithSisit();
averageShareOfSisitGroupedByCurrency = this.parseTool(this.repository.getAverageShareOfSisitGroupedByCurrency());
deviationShareOfSisitGroupedByCurrency = this.parseTool(this.repository.getDeviationShareOfSisitGroupedByCurrency());
minimunShareOfSisitGroupedByCurrency = this.parseTool(this.repository.getDeviationShareOfSisitGroupedByCurrency());
maximunShareOfSisitGroupedByCurrency = this.parseTool(this.repository.getMaximunShareOfSisitGroupedByCurrency());

//PATRONAGE INICIALIZACION
totalNumberOfProposedPatronages = this.repository.totalNumberOfProposedPatronages();
Expand Down Expand Up @@ -145,11 +145,11 @@ public AdministratorDashboard findOne(final Request<AdministratorDashboard> requ
result.setMaximunBudgetOfToolGroupedByCurrency(maximunBudgetOfToolGroupedByCurrency);

//CHIMPUM ASIGNACION
result.setRatioOfItemsWithChimpum(ratioOfItemsWithChimpum);;
result.setAverageBudgetOfChimpumGroupedByCurrency(averageBudgetOfChimpumGroupedByCurrency);
result.setDeviationBudgetOfChimpumGroupedByCurrency(deviationBudgetOfChimpumGroupedByCurrency);
result.setMinimunBudgetOfChimpumGroupedByCurrency(minimunBudgetOfChimpumGroupedByCurrency);
result.setMaximunBudgetOfChimpumGroupedByCurrency(maximunBudgetOfChimpumGroupedByCurrency);
result.setRatioOfToolsWithSisit(ratioOfToolsWithSisit);;
result.setAverageBudgetOfSisitGroupedByCurrency(averageShareOfSisitGroupedByCurrency);
result.setDeviationBudgetOfSisitGroupedByCurrency(deviationShareOfSisitGroupedByCurrency);
result.setMinimunBudgetOfSisitGroupedByCurrency(minimunShareOfSisitGroupedByCurrency);
result.setMaximunBudgetOfSisitGroupedByCurrency(maximunShareOfSisitGroupedByCurrency);

//PATRONAGE ASIGNACION

Expand Down Expand Up @@ -189,8 +189,8 @@ public void unbind(final Request<AdministratorDashboard> request, final Administ
"totalNumberOfTools", "averageBudgetOfToolGroupedByCurrency", "deviationBudgetOfToolGroupedByCurrency",
"minimunBudgetOfToolGroupedByCurrency", "maximunBudgetOfToolGroupedByCurrency",

"ratioOfItemsWithChimpum", "averageBudgetOfChimpumGroupedByCurrency", "deviationBudgetOfChimpumGroupedByCurrency",
"minimunBudgetOfChimpumGroupedByCurrency", "maximunBudgetOfChimpumGroupedByCurrency",
"ratioOfToolsWithSisit", "averageBudgetOfSisitGroupedByCurrency", "deviationBudgetOfSisitGroupedByCurrency",
"minimunBudgetOfSisitGroupedByCurrency", "maximunBudgetOfSisitGroupedByCurrency",

"totalNumberOfProposedPatronages", "totalNumberOfAcceptedPatronages", "totalNumberOfDeniedPatronages",
"averageBudgetOfPatronagesGroupedByStatusAndCurrency", "deviationBudgetOfPatronagesGroupedByStatusAndCurrency",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
package acme.features.inventor.chimpum;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import acme.entities.chimpums.Chimpum;
import acme.framework.controllers.AbstractController;
import acme.roles.Inventor;

@Controller
public class InventorChimpumController extends AbstractController<Inventor, Chimpum>{

@Autowired
protected InventorChimpumListService listService;

@Autowired
protected InventorChimpumShowService showService;

@Autowired
protected InventorChimpumCreateService createService;

@Autowired
protected InventorChimpumUpdateService updateService;

@Autowired
protected InventorChimpumDeleteService deleteService;

@PostConstruct
protected void initialise() {
super.addCommand("show", this.showService);
super.addCommand("list", this.listService);
super.addCommand("create", this.createService);
super.addCommand("update", this.updateService);
super.addCommand("delete", this.deleteService);
}

}
//package acme.features.inventor.chimpum;
//
//import javax.annotation.PostConstruct;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//
//import acme.entities.chimpums.Chimpum;
//import acme.framework.controllers.AbstractController;
//import acme.roles.Inventor;
//
//@Controller
//public class InventorChimpumController extends AbstractController<Inventor, Chimpum>{
//
// @Autowired
// protected InventorChimpumListService listService;
//
// @Autowired
// protected InventorChimpumShowService showService;
//
// @Autowired
// protected InventorChimpumCreateService createService;
//
// @Autowired
// protected InventorChimpumUpdateService updateService;
//
// @Autowired
// protected InventorChimpumDeleteService deleteService;
//
// @PostConstruct
// protected void initialise() {
// super.addCommand("show", this.showService);
// super.addCommand("list", this.listService);
// super.addCommand("create", this.createService);
// super.addCommand("update", this.updateService);
// super.addCommand("delete", this.deleteService);
// }
//
//}
Loading

0 comments on commit cdc7414

Please sign in to comment.