@ -0,0 +1,60 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<classpath> | |||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | |||
<attributes> | |||
<attribute name="optional" value="true"/> | |||
<attribute name="maven.pomderived" value="true"/> | |||
</attributes> | |||
</classpathentry> | |||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | |||
<attributes> | |||
<attribute name="maven.pomderived" value="true"/> | |||
</attributes> | |||
</classpathentry> | |||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | |||
<attributes> | |||
<attribute name="optional" value="true"/> | |||
<attribute name="maven.pomderived" value="true"/> | |||
<attribute name="test" value="true"/> | |||
</attributes> | |||
</classpathentry> | |||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> | |||
<attributes> | |||
<attribute name="maven.pomderived" value="true"/> | |||
<attribute name="test" value="true"/> | |||
</attributes> | |||
</classpathentry> | |||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | |||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | |||
<attributes> | |||
<attribute name="maven.pomderived" value="true"/> | |||
</attributes> | |||
</classpathentry> | |||
<classpathentry kind="src" path="target/generated-sources/annotations"> | |||
<attributes> | |||
<attribute name="optional" value="true"/> | |||
<attribute name="maven.pomderived" value="true"/> | |||
<attribute name="ignore_optional_problems" value="true"/> | |||
<attribute name="m2e-apt" value="true"/> | |||
</attributes> | |||
</classpathentry> | |||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> | |||
<attributes> | |||
<attribute name="optional" value="true"/> | |||
<attribute name="maven.pomderived" value="true"/> | |||
<attribute name="ignore_optional_problems" value="true"/> | |||
<attribute name="m2e-apt" value="true"/> | |||
<attribute name="test" value="true"/> | |||
</attributes> | |||
</classpathentry> | |||
<classpathentry kind="lib" path="C:/Users/usuario/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar" sourcepath="C:/Users/yaros/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5-sources.jar"> | |||
<attributes> | |||
<attribute name="maven.pomderived" value="true"/> | |||
<attribute name="maven.groupId" value="jakarta.annotation"/> | |||
<attribute name="maven.artifactId" value="jakarta.annotation-api"/> | |||
<attribute name="maven.version" value="1.3.5"/> | |||
<attribute name="maven.scope" value="compile"/> | |||
</attributes> | |||
</classpathentry> | |||
<classpathentry kind="output" path="target/classes"/> | |||
</classpath> |
@ -0,0 +1,23 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<projectDescription> | |||
<name>almacen</name> | |||
<comment></comment> | |||
<projects> | |||
</projects> | |||
<buildSpec> | |||
<buildCommand> | |||
<name>org.eclipse.jdt.core.javabuilder</name> | |||
<arguments> | |||
</arguments> | |||
</buildCommand> | |||
<buildCommand> | |||
<name>org.eclipse.m2e.core.maven2Builder</name> | |||
<arguments> | |||
</arguments> | |||
</buildCommand> | |||
</buildSpec> | |||
<natures> | |||
<nature>org.eclipse.jdt.core.javanature</nature> | |||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | |||
</natures> | |||
</projectDescription> |
@ -0,0 +1,2 @@ | |||
eclipse.preferences.version=1 | |||
org.eclipse.jdt.apt.aptEnabled=false |
@ -0,0 +1,12 @@ | |||
eclipse.preferences.version=1 | |||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | |||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | |||
org.eclipse.jdt.core.compiler.compliance=1.8 | |||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | |||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | |||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | |||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | |||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore | |||
org.eclipse.jdt.core.compiler.processAnnotations=disabled | |||
org.eclipse.jdt.core.compiler.release=enabled | |||
org.eclipse.jdt.core.compiler.source=1.8 |
@ -0,0 +1,4 @@ | |||
activeProfiles= | |||
eclipse.preferences.version=1 | |||
resolveWorkspaceProjects=true | |||
version=1 |
@ -0,0 +1,16 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>com.yaros</groupId> | |||
<artifactId>almacen</artifactId> | |||
<version>0.0.1-SNAPSHOT</version> | |||
<name>GestorAlmacen</name> | |||
<description>Ua aplicacion que gestiona un almacen</description> | |||
<dependencies> | |||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context --> | |||
<dependency> | |||
<groupId>org.springframework</groupId> | |||
<artifactId>spring-context</artifactId> | |||
<version>5.3.24</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@ -0,0 +1,17 @@ | |||
package com.yaros.almacen; | |||
import org.springframework.context.ApplicationContext; | |||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | |||
import com.yaros.almacen.config.AppConfig; | |||
public class AlmacenApp { | |||
public static void main(String[] args) { | |||
ApplicationContext appContext = new AnnotationConfigApplicationContext(AppConfig.class); | |||
AlmacenRunApp runApp = appContext.getBean(AlmacenRunApp.class); | |||
runApp.run(args); | |||
((AnnotationConfigApplicationContext) appContext).close(); | |||
} | |||
} |
@ -0,0 +1,35 @@ | |||
package com.yaros.almacen; | |||
import java.io.IOException; | |||
import java.nio.file.Files; | |||
import java.nio.file.Paths; | |||
import java.util.stream.Collectors; | |||
import javax.annotation.PostConstruct; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.util.ResourceUtils; | |||
@Component | |||
public class AlmacenHelp { | |||
private String help; | |||
@PostConstruct | |||
public void init() { | |||
try { | |||
// @formatter:off | |||
help = Files.lines(Paths.get(ResourceUtils.getFile("classpath:ayuda.txt").toURI())) | |||
.collect(Collectors.joining("\n")); | |||
// @formatter:on | |||
} catch (IOException e) { | |||
System.out.println("Error cargando el texto de ayuda"); | |||
System.exit(-1); | |||
} | |||
} | |||
public String getHelp() { | |||
return help; | |||
} | |||
} |
@ -0,0 +1,92 @@ | |||
package com.yaros.almacen; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Component; | |||
import com.yaros.almacen.model.Product; | |||
import com.yaros.almacen.service.ProductQueryService; | |||
import com.yaros.almacen.service.ProductService; | |||
@Component | |||
public class AlmacenRunApp { | |||
@Autowired | |||
private ProductService productService; | |||
@Autowired | |||
private ProductQueryService productQueryService; | |||
@Autowired | |||
private AlmacenHelp help; | |||
public void run(String[] args) { | |||
if(args.length < 1) { | |||
System.out.println("Error de Sintaxis"); | |||
System.out.println(help.getHelp()); | |||
} else if(args.length == 1){ | |||
switch(args[0].toLowerCase()) { | |||
case "-la": | |||
System.out.printf("%s\t%-10s\t%-10s\t%s\t%s\t%s\t%s\t%s\n", "ID", "Name", "Manufacturer", "Shelf", "Weight", "Size", "Num", "Notes"); | |||
productService.findAll().forEach(f -> System.out.printf("%s\t%-10s\t%-10s\t%s\t%s\t%s\t%s\t%s\n", | |||
f.getId(), f.getName(), f.getManufacturer(), f.getShelf(), f.getWeight(), f.getSize(), f.getNum(), | |||
f.getNotes().stream().collect(Collectors.joining(", ")))); | |||
break; | |||
case "-lm": | |||
productService.findAllManufacturers().forEach(System.out::println); | |||
break; | |||
case "-ln": | |||
productService.findAllNotes().forEach(System.out::println); | |||
break; | |||
default: | |||
System.out.println("Error de sintaxis"); | |||
System.out.println(help.getHelp()); | |||
} | |||
} else if (args.length % 2 != 0) { | |||
System.out.println("Error de sintaxis"); | |||
System.out.println(help.getHelp()); | |||
} else if (args.length > 8) { | |||
System.out.println("Error de sintaxis"); | |||
System.out.println(help.getHelp()); | |||
} else { | |||
List<String[]> argumentos = new ArrayList<>(); | |||
for(int i = 0; i < args.length; i += 2) { | |||
argumentos.add(new String[] {args[i], args[i + 1]}); | |||
}; | |||
boolean error = false; | |||
for(String[] argumento : argumentos) { | |||
switch(argumento[0].toLowerCase()) { | |||
/*case "-gi": | |||
filmQueryService. (argumento[1].split(",")); | |||
break;*/ | |||
case "-gm": | |||
productQueryService.anyManufacturer(argumento[1].split(",")); | |||
break; | |||
case "-gn": | |||
productQueryService.anyNote(argumento[1]); | |||
break; | |||
case "-t": | |||
productQueryService.nameContains(argumento[1]); | |||
break; | |||
default: error = true; | |||
System.out.println("Error de sintaxis"); | |||
System.out.println(help.getHelp()); | |||
} | |||
} | |||
if(!error) { | |||
Collection<Product> result = productQueryService.exec(); | |||
System.out.printf("%s\t%-10s\t%-10s\t%s\t%s\t%s\t%s\t%s\n", "ID", "Name", "Manufacturer", "Shelf", "Weight", "Size", "Num", "Notes"); | |||
if(result != null) { | |||
result.forEach(f -> System.out.printf("%s\t%-10s\t%-10s\t%s\t%s\t%s\t%s\t%s\n", | |||
f.getId(), f.getName(), f.getManufacturer(), f.getShelf(), f.getWeight(), f.getSize(), f.getNum(), | |||
f.getNotes().stream().collect(Collectors.joining(", ")))); | |||
} else { | |||
System.out.println("No hay peliculas que cumplan esos critetios. Lo sentimos"); | |||
} | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,28 @@ | |||
package com.yaros.almacen.config; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.ComponentScan; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.context.annotation.PropertySource; | |||
@Configuration | |||
@ComponentScan(basePackages="com.yaros.almacen") | |||
@PropertySource("classpath:/almacen.properties") | |||
public class AppConfig { | |||
@Value("${file.path}") | |||
private String file; | |||
@Value("${file.csv.separator}") | |||
private String separator; | |||
@Value("${file.csv.list.separator}") | |||
private String listSeparator; | |||
public String getFile() { | |||
return file; | |||
} | |||
public String getSeparator() { | |||
return separator; | |||
} | |||
public String getListSeparator() { | |||
return listSeparator; | |||
} | |||
} |
@ -0,0 +1,14 @@ | |||
package com.yaros.almacen.dao; | |||
import java.util.Collection; | |||
import com.yaros.almacen.model.Product; | |||
public interface ProductDao { | |||
public Product findById(long id); | |||
public Collection<Product> findAll(); | |||
public void insert(Product product); | |||
public void edit(Product product); | |||
public void delete(long id); | |||
} |
@ -0,0 +1,71 @@ | |||
package com.yaros.almacen.dao; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import java.util.Optional; | |||
import javax.annotation.PostConstruct; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Repository; | |||
import com.yaros.almacen.config.AppConfig; | |||
import com.yaros.almacen.model.Product; | |||
@Repository | |||
public class ProductDaoImplMemory implements ProductDao { | |||
public List<Product> peliculas = new ArrayList<>(); | |||
@Autowired | |||
private AppConfig appConfig; | |||
@PostConstruct | |||
public void init() { | |||
peliculas = UtilProductFileReader.readFile(appConfig.getFile(), appConfig.getSeparator(), appConfig.getListSeparator()); | |||
} | |||
public Product findById(long id) { | |||
// TODO Auto-generated method stub | |||
// @formatter:off | |||
Optional<Product> result = peliculas.stream().filter(f -> f.getId() == id).findFirst(); | |||
// @formatter:on | |||
return result.orElse(null); | |||
} | |||
public Collection<Product> findAll() { | |||
// TODO Auto-generated method stub | |||
return peliculas; | |||
} | |||
public void insert(Product product) { | |||
// TODO Auto-generated method stub | |||
peliculas.add(product); | |||
} | |||
public void edit(Product product) { | |||
// TODO Auto-generated method stub | |||
int index = getIndexOf(product.getId()); | |||
if(index != -1) | |||
peliculas.set(index, product); | |||
} | |||
public void delete(long id) { | |||
// TODO Auto-generated method stub | |||
int index = getIndexOf(id); | |||
if(index != -1) | |||
peliculas.remove(index); | |||
} | |||
private int getIndexOf(long id) { | |||
boolean encontrado = false; | |||
int index = 0; | |||
while(!encontrado && index < peliculas.size()) { | |||
if(peliculas.get(index).getId() == id) | |||
encontrado = true; | |||
else | |||
index++; | |||
} | |||
return (encontrado) ? index : -1; | |||
} | |||
} |
@ -0,0 +1,40 @@ | |||
package com.yaros.almacen.dao; | |||
import java.io.IOException; | |||
import java.nio.file.Files; | |||
import java.nio.file.Paths; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
import org.springframework.util.ResourceUtils; | |||
import com.yaros.almacen.model.Product; | |||
public class UtilProductFileReader { | |||
public static List<Product> readFile(final String path, final String separator, final String listSeparator){ | |||
System.out.println(path); | |||
System.out.println(separator); | |||
System.out.println(listSeparator); | |||
List<Product> result = new ArrayList<>(); | |||
System.out.println(result); | |||
// @formatter:off | |||
try { | |||
result = Files.lines(Paths.get(ResourceUtils.getFile(path).toURI())) | |||
.skip(1) | |||
.map(line -> { | |||
String[] values = line.split(separator); | |||
return new Product(Long.parseLong(values[0]), values[1], values[2], values[3], values[4], values[5], Integer.parseInt(values[6]), | |||
Arrays.asList(values[7].split(listSeparator))); | |||
}).collect(Collectors.toList()); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
/*System.err.println("Error de lectura del fichero de datos: imdb_data"); | |||
System.exit(-1);*/ | |||
} | |||
// @formatter:on | |||
return result; | |||
} | |||
} |
@ -0,0 +1,123 @@ | |||
package com.yaros.almacen.model; | |||
import java.util.List; | |||
import java.util.Objects; | |||
public class Product { | |||
private long id; | |||
private String name; | |||
private String manufacturer; | |||
private String shelf; | |||
private String weight; | |||
private String size; | |||
private int num; | |||
private List<String> notes; | |||
public Product() { | |||
} | |||
public Product(long id, String name, String manufacturer, String shelf, String weight, String size, int num, | |||
List<String> notes) { | |||
super(); | |||
this.id = id; | |||
this.name = name; | |||
this.manufacturer = manufacturer; | |||
this.shelf = shelf; | |||
this.weight = weight; | |||
this.size = size; | |||
this.num = num; | |||
this.notes = notes; | |||
} | |||
public long getId() { | |||
return id; | |||
} | |||
public void setId(long id) { | |||
this.id = id; | |||
} | |||
public String getName() { | |||
return name; | |||
} | |||
public void setName(String name) { | |||
this.name = name; | |||
} | |||
public String getManufacturer() { | |||
return manufacturer; | |||
} | |||
public void setManufacturer(String manufacturer) { | |||
this.manufacturer = manufacturer; | |||
} | |||
public String getShelf() { | |||
return shelf; | |||
} | |||
public void setShelf(String shelf) { | |||
this.shelf = shelf; | |||
} | |||
public String getWeight() { | |||
return weight; | |||
} | |||
public void setWeight(String weight) { | |||
this.weight = weight; | |||
} | |||
public String getSize() { | |||
return size; | |||
} | |||
public void setSize(String size) { | |||
this.size = size; | |||
} | |||
public int getNum() { | |||
return num; | |||
} | |||
public void setNum(int num) { | |||
this.num = num; | |||
} | |||
public List<String> getNotes() { | |||
return notes; | |||
} | |||
public void setNotes(List<String> notes) { | |||
this.notes = notes; | |||
} | |||
@Override | |||
public int hashCode() { | |||
return Objects.hash(id, manufacturer, name, notes, num, shelf, size, weight); | |||
} | |||
@Override | |||
public boolean equals(Object obj) { | |||
if (this == obj) | |||
return true; | |||
if (obj == null) | |||
return false; | |||
if (getClass() != obj.getClass()) | |||
return false; | |||
Product other = (Product) obj; | |||
return id == other.id && Objects.equals(manufacturer, other.manufacturer) && Objects.equals(name, other.name) | |||
&& Objects.equals(notes, other.notes) && num == other.num && Objects.equals(shelf, other.shelf) | |||
&& Objects.equals(size, other.size) && Objects.equals(weight, other.weight); | |||
} | |||
@Override | |||
public String toString() { | |||
return "Producto [id=" + id + ", name=" + name + ", manufacturer=" + manufacturer + ", shelf=" + shelf | |||
+ ", weight=" + weight + ", size=" + size + ", num=" + num + ", notes=" + notes + "]"; | |||
} | |||
} |
@ -0,0 +1,66 @@ | |||
package com.yaros.almacen.service; | |||
import java.time.LocalDate; | |||
import java.util.Arrays; | |||
import java.util.Collection; | |||
import java.util.function.Predicate; | |||
import java.util.stream.Collectors; | |||
import javax.annotation.PostConstruct; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import com.yaros.almacen.dao.ProductDao; | |||
import com.yaros.almacen.model.Product; | |||
@Service | |||
public class ProductQuearyServiceImpl implements ProductQueryService { | |||
@Autowired | |||
private ProductDao dao; | |||
private Predicate<Product> predicate; | |||
//DE DONDE COÑO SALE EL POSTCONSTRUCT | |||
@PostConstruct | |||
public void init() { | |||
predicate = null; | |||
} | |||
@Override | |||
public Collection<Product> exec() { | |||
// @formatter:off | |||
return dao.findAll().stream().filter(predicate).collect(Collectors.toList()); | |||
// @formatter:on | |||
} | |||
/*@Override | |||
public ProductQueryService anyId(String... id) { | |||
Predicate<Product> pAnyGenere = (product -> Arrays.stream(id).anyMatch(product.getId()::contains)); | |||
predicate = (predicate == null) ? pAnyGenere : predicate.and(pAnyGenere); | |||
return this; | |||
}*/ | |||
@Override | |||
public ProductQueryService anyManufacturer(String... manufacturers) { | |||
Predicate<Product> pAnyGenere = (product -> Arrays.stream(manufacturers).anyMatch(product.getManufacturer()::contains)); | |||
predicate = (predicate == null) ? pAnyGenere : predicate.and(pAnyGenere); | |||
return this; | |||
} | |||
@Override | |||
public ProductQueryService nameContains(String name) { | |||
Predicate<Product> pTitleContains = (product -> product.getName().toLowerCase().contains(name.toLowerCase())); | |||
predicate = (predicate == null) ? pTitleContains : predicate.and(pTitleContains); | |||
return this; | |||
} | |||
@Override | |||
public ProductQueryService anyNote(String... notes) { | |||
Predicate<Product> pAllGeneres = (product -> Arrays.stream(notes).allMatch(product.getNotes()::contains)); | |||
predicate = (predicate == null) ? pAllGeneres : predicate.and(pAllGeneres); | |||
return this; | |||
} | |||
} |
@ -0,0 +1,15 @@ | |||
package com.yaros.almacen.service; | |||
import java.util.Collection; | |||
import com.yaros.almacen.model.Product; | |||
public interface ProductQueryService { | |||
public Collection<Product> exec(); | |||
public ProductQueryService anyManufacturer(String... manufacturers); | |||
public ProductQueryService anyNote(String... notes); | |||
public ProductQueryService nameContains(String note); | |||
//public ProductQueryService anyId(String... id); | |||
} |
@ -0,0 +1,59 @@ | |||
package com.yaros.almacen.service; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import com.yaros.almacen.dao.ProductDao; | |||
import com.yaros.almacen.model.Product; | |||
@Service | |||
public class ProductService { | |||
@Autowired | |||
ProductDao productDao; | |||
@Autowired | |||
ProductQueryService queryService; | |||
public Collection <String> findAllNotes(){ | |||
List<String> result = null; | |||
// @formatter:off | |||
result = productDao.findAll().stream().map(f -> f.getNotes()) | |||
.flatMap(lista -> lista.stream()) | |||
.distinct().sorted().collect(Collectors.toList()); | |||
// @formatter:on | |||
return result; | |||
} | |||
public Collection <String> findAllManufacturers(){ | |||
List<String> result = null; | |||
// @formatter:off | |||
result = productDao.findAll().stream().map(f -> f.getManufacturer()) | |||
.distinct().sorted().collect(Collectors.toList()); | |||
// @formatter:on | |||
return result; | |||
} | |||
public Collection<Product> findAll(){ | |||
return productDao.findAll(); | |||
} | |||
public Collection<Product> findByAnyNote(String... notes){ | |||
return queryService.anyNote(notes).exec(); | |||
} | |||
public Collection<Product> findByAnyManufacturer(String... manufacturer){ | |||
return queryService.anyManufacturer(manufacturer).exec(); | |||
} | |||
public Collection<Product> findByTitleContains(String name){ | |||
return queryService.nameContains(name).exec(); | |||
} | |||
} |
@ -0,0 +1,28 @@ | |||
Sintaxis: java -jar almacen.jar [OPCIONES] | |||
-la | |||
Lista todos los productos. | |||
No se pueden utilizar parametros | |||
-lm | |||
Lista todos los fabricantes | |||
No se pueden utilizar parametros | |||
-ln | |||
Lista toads las notas | |||
No se pueden utilizar parametros | |||
-gi id | |||
Busca al producto por id | |||
id = id del producto | |||
-gm manufacturer | |||
Busca al producto por fabricante | |||
fabricante = fabricante del producto | |||
-gn nota | |||
Busca al producto por notas | |||
notas = notas del producto | |||
@ -0,0 +1,3 @@ | |||
file.path=classpath:products.csv | |||
file.csv.separator=; | |||
file.csv.list.separator=, |
@ -0,0 +1,28 @@ | |||
Porfavor utiliza los siguentes comandos: | |||
-la | |||
Lista todos los productos. | |||
No se pueden utilizar parametros | |||
-lm | |||
Lista todos los fabricantes | |||
No se pueden utilizar parametros | |||
-ln | |||
Lista toads las notas | |||
No se pueden utilizar parametros | |||
-gi id | |||
Busca al producto por id | |||
id = id del producto | |||
-gm manufacturer | |||
Busca al producto por fabricante | |||
fabricante = fabricante del producto | |||
-gn nota | |||
Busca al producto por notas | |||
notas = notas del producto | |||
-t algo | |||
Busca el producto si contiene el 'algo' | |||
algo = texto que tiene que incluir |
@ -0,0 +1,12 @@ | |||
id;name;manufaturer;shelf;weight;size;num;notes | |||
1;Dobojorn;Ikea;A2;20;XL;2;furniture | |||
2;Nintendo Swich;Nintendo;B4;0.2;XS;1;entertainment,gaming | |||
3;SuperChair;Secret Lab;B3;2;L;3;furniture,gaming | |||
4;Ender 3 V2;Creality;C1;6;M;4;printer | |||
5;Ender 3 S1;Creality;C8;8;M;4;printer | |||
6;Mario Kart 8;Nintendo;B1;0.1;XXS;22;entertainment,gaming,videogames | |||
7;Milkentron;Ikea;A2;2;L;1;furniture | |||
8;Kobra;Anycubic;A5;8;M;5;printer,entry-level | |||
9;Airfriyer;Xaomi;B2;4;M;1;appliance,cooking | |||
10;Mars 2;Elogoo;B5;10;XL;2;printer,resin | |||
11;OLED TV;Samsung;A8;20;XXL;1;entertainment,expensive |
@ -0,0 +1,5 @@ | |||
Manifest-Version: 1.0 | |||
Built-By: usuario | |||
Build-Jdk: 17.0.4.1 | |||
Created-By: Maven Integration for Eclipse | |||
@ -0,0 +1,7 @@ | |||
#Generated by Maven Integration for Eclipse | |||
#Sun Nov 27 02:29:17 CET 2022 | |||
m2e.projectLocation=C\:\\Users\\usuario\\Documents\\workspace-spring-tool-suite-4-4.16.1.RELEASE\\almacen | |||
m2e.projectName=almacen | |||
groupId=com.yaros | |||
artifactId=almacen | |||
version=0.0.1-SNAPSHOT |
@ -0,0 +1,16 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>com.yaros</groupId> | |||
<artifactId>almacen</artifactId> | |||
<version>0.0.1-SNAPSHOT</version> | |||
<name>GestorAlmacen</name> | |||
<description>Ua aplicacion que gestiona un almacen</description> | |||
<dependencies> | |||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context --> | |||
<dependency> | |||
<groupId>org.springframework</groupId> | |||
<artifactId>spring-context</artifactId> | |||
<version>5.3.24</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@ -0,0 +1,3 @@ | |||
file.path=classpath:products.csv | |||
file.csv.separator=; | |||
file.csv.list.separator=, |
@ -0,0 +1,28 @@ | |||
Porfavor utiliza los siguentes comandos: | |||
-la | |||
Lista todos los productos. | |||
No se pueden utilizar parametros | |||
-lm | |||
Lista todos los fabricantes | |||
No se pueden utilizar parametros | |||
-ln | |||
Lista toads las notas | |||
No se pueden utilizar parametros | |||
-gi id | |||
Busca al producto por id | |||
id = id del producto | |||
-gm manufacturer | |||
Busca al producto por fabricante | |||
fabricante = fabricante del producto | |||
-gn nota | |||
Busca al producto por notas | |||
notas = notas del producto | |||
-t algo | |||
Busca el producto si contiene el 'algo' | |||
algo = texto que tiene que incluir |
@ -0,0 +1,28 @@ | |||
Sintaxis: java -jar almacen.jar [OPCIONES] | |||
-la | |||
Lista todos los productos. | |||
No se pueden utilizar parametros | |||
-lm | |||
Lista todos los fabricantes | |||
No se pueden utilizar parametros | |||
-ln | |||
Lista toads las notas | |||
No se pueden utilizar parametros | |||
-gi id | |||
Busca al producto por id | |||
id = id del producto | |||
-gm manufacturer | |||
Busca al producto por fabricante | |||
fabricante = fabricante del producto | |||
-gn nota | |||
Busca al producto por notas | |||
notas = notas del producto | |||
@ -0,0 +1,12 @@ | |||
id;name;manufaturer;shelf;weight;size;num;notes | |||
1;Dobojorn;Ikea;A2;20;XL;2;furniture | |||
2;Nintendo Swich;Nintendo;B4;0.2;XS;1;entertainment,gaming | |||
3;SuperChair;Secret Lab;B3;2;L;3;furniture,gaming | |||
4;Ender 3 V2;Creality;C1;6;M;4;printer | |||
5;Ender 3 S1;Creality;C8;8;M;4;printer | |||
6;Mario Kart 8;Nintendo;B1;0.1;XXS;22;entertainment,gaming,videogames | |||
7;Milkentron;Ikea;A2;2;L;1;furniture | |||
8;Kobra;Anycubic;A5;8;M;5;printer,entry-level | |||
9;Airfriyer;Xaomi;B2;4;M;1;appliance,cooking | |||
10;Mars 2;Elogoo;B5;10;XL;2;printer,resin | |||
11;OLED TV;Samsung;A8;20;XXL;1;entertainment,expensive |