k
This commit is contained in:
parent
b8e681f5be
commit
1f8027a97c
18
.idea/compiler.xml
Normal file
18
.idea/compiler.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="test" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
<component name="JavacSettings">
|
||||||
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
|
<module name="test" options="-parameters" />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/encodings.xml
Normal file
6
.idea/encodings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM">
|
||||||
|
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/inspectionProfiles/Project_Default.xml
Normal file
6
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Duplicates" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
17
.idea/misc.xml
Normal file
17
.idea/misc.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="JavaScriptSettings">
|
||||||
|
<option name="languageLevel" value="JS_1_8_5" />
|
||||||
|
</component>
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" project-jdk-name="10" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
124
.idea/uiDesigner.xml
Normal file
124
.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
3
package-lock.json
generated
Normal file
3
package-lock.json
generated
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"lockfileVersion": 1
|
||||||
|
}
|
121
pom.xml
Normal file
121
pom.xml
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>gs-mysql-data</artifactId>
|
||||||
|
<version>0.1.0</version>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.0.5.RELEASE</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Use MySQL Connector-J -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- tag::spring-hateoas[] -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-hateoas</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- end::spring-hateoas[] -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.github.eirslett</groupId>
|
||||||
|
<artifactId>frontend-maven-plugin</artifactId>
|
||||||
|
<version>1.6</version>
|
||||||
|
<configuration>
|
||||||
|
<installDirectory>target</installDirectory>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>install node and npm</id>
|
||||||
|
<goals>
|
||||||
|
<goal>install-node-and-npm</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<nodeVersion>v10.11.0</nodeVersion>
|
||||||
|
<npmVersion>6.4.1</npmVersion>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>npm install</id>
|
||||||
|
<goals>
|
||||||
|
<goal>npm</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<arguments>install</arguments>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>webpack build</id>
|
||||||
|
<goals>
|
||||||
|
<goal>webpack</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
10
readme_init.txt
Normal file
10
readme_init.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
https://spring.io/guides/gs/accessing-data-mysql/
|
||||||
|
|
||||||
|
service mysql start
|
||||||
|
service mysql status
|
||||||
|
|
||||||
|
database:
|
||||||
|
mysql --password
|
||||||
|
create database db_example;
|
||||||
|
create user 'springuser'@'%' identified by 'ThePassword';
|
||||||
|
grant all on db_example.* to 'springuser'@'%';
|
12
src/main/java/core/Application.java
Normal file
12
src/main/java/core/Application.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package core;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class Application {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(Application.class, args);
|
||||||
|
}
|
||||||
|
}
|
67
src/main/java/core/Payload.java
Normal file
67
src/main/java/core/Payload.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package core;
|
||||||
|
|
||||||
|
import core.address.Address;
|
||||||
|
import core.address.AddressRepository;
|
||||||
|
import core.citizens.Citizen;
|
||||||
|
import core.citizens.CitizenRepository;
|
||||||
|
|
||||||
|
import core.estate.Estate;
|
||||||
|
import core.estate.EstateRepository;
|
||||||
|
import core.firm.*;
|
||||||
|
import core.partners.Partners;
|
||||||
|
import core.partners.PartnersRepository;
|
||||||
|
import core.workers.Workers;
|
||||||
|
import core.workers.WorkersRepository;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Slf4j
|
||||||
|
|
||||||
|
public class Payload {
|
||||||
|
@Bean
|
||||||
|
CommandLineRunner initTableCitizens(CitizenRepository repository) {
|
||||||
|
return args -> {
|
||||||
|
log.info("Preloading " + repository.save(new Citizen("12345678910", "Karl", "Stefanovitsch", "01-01-1900", "M")));
|
||||||
|
log.info("Preloading " + repository.save(new Citizen("12345678911", "Mark", "Tarasov", "31-06-1951", "M")));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
CommandLineRunner initTableAddress(AddressRepository repository) {
|
||||||
|
return args -> {
|
||||||
|
log.info("Preloading " + repository.save(new Address("Poznan", "Marcinkowskiego", "18", "2")));
|
||||||
|
log.info("Preloading " + repository.save(new Address("Berlin", "Unter den Linden", "4", "11")));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
CommandLineRunner initTableEstate(EstateRepository repository) {
|
||||||
|
return args -> {
|
||||||
|
log.info("Preloading " + repository.save(new Estate("12345678910", 1)));
|
||||||
|
log.info("Preloading " + repository.save(new Estate("12345678911", 2)));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
CommandLineRunner initTableFirm(FirmRepository repository) {
|
||||||
|
return args -> {
|
||||||
|
log.info("Preloading " + repository.save(new Firm("123aa", "TEch", 1)));
|
||||||
|
log.info("Preloading " + repository.save(new Firm("444bb", "Ello", 2)));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
CommandLineRunner initTablePartners(PartnersRepository repository) {
|
||||||
|
return args -> {
|
||||||
|
log.info("Preloading " + repository.save(new Partners("12345678910", "12345678911")));
|
||||||
|
log.info("Preloading " + repository.save(new Partners("12345678911", "12345678910")));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
CommandLineRunner initTableWorkers (WorkersRepository repository) {
|
||||||
|
return args -> {
|
||||||
|
log.info("Preloading " + repository.save(new Workers("12345678910", "123aa")));
|
||||||
|
log.info("Preloading " + repository.save(new Workers("12345678911", "444bb")));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
58
src/main/java/core/address/Address.java
Normal file
58
src/main/java/core/address/Address.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package core.address;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity // This tells Hibernate to make a table out of this class
|
||||||
|
public class Address {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
@Column(nullable = false, unique = true)
|
||||||
|
private Integer addid;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String street;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String number;
|
||||||
|
|
||||||
|
private String apartment;
|
||||||
|
|
||||||
|
public Integer getAddid() { return addid; }
|
||||||
|
public void setAddid(Integer addid) { this.addid = addid; }
|
||||||
|
|
||||||
|
public String getCity() { return city; }
|
||||||
|
public void setCity(String city) { this.city = city; }
|
||||||
|
|
||||||
|
public String getStreet() {
|
||||||
|
return street;
|
||||||
|
}
|
||||||
|
public void setStreet (String street) { this.street = street; }
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
public void setNumber(String number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApartment() {
|
||||||
|
return apartment;
|
||||||
|
}
|
||||||
|
public void setApartment(String apartment) {
|
||||||
|
this.apartment = apartment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Address(String city, String street, String number, String apartment) {
|
||||||
|
this.city = city;
|
||||||
|
this.street = street;
|
||||||
|
this.number = number;
|
||||||
|
this.apartment = apartment;
|
||||||
|
}
|
||||||
|
}
|
80
src/main/java/core/address/AddressController.java
Normal file
80
src/main/java/core/address/AddressController.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package core.address;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller // This means that this class is a Controller
|
||||||
|
@RequestMapping(path="/address") // This means URL's start with /demo (after Application path)
|
||||||
|
public class AddressController {
|
||||||
|
@Autowired // This means to get the bean called userRepository
|
||||||
|
// Which is auto-generated by Spring, we will use it to handle the data
|
||||||
|
private AddressRepository addressRepository;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public @ResponseBody Iterable<Address> getAllAddresses() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return addressRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping () // Map ONLY POST Requests
|
||||||
|
public @ResponseBody String addNewAddress (
|
||||||
|
//@RequestParam String addid,
|
||||||
|
@RequestParam String city,
|
||||||
|
@RequestParam String street,
|
||||||
|
@RequestParam String number,
|
||||||
|
@RequestParam String apartment ) {
|
||||||
|
// @ResponseBody means the returned String is the response, not a view name
|
||||||
|
// @RequestParam means it is a parameter from the GET or POST request
|
||||||
|
|
||||||
|
Address n = new Address(city, street, number, apartment);
|
||||||
|
|
||||||
|
// add citizen to repository
|
||||||
|
addressRepository.save(n);
|
||||||
|
|
||||||
|
return "Address added\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public @ResponseBody String updateAddress(
|
||||||
|
@RequestParam Integer addid,
|
||||||
|
@RequestParam String city,
|
||||||
|
@RequestParam String street,
|
||||||
|
@RequestParam String number,
|
||||||
|
@RequestParam String apartment ) {
|
||||||
|
|
||||||
|
Address addressT = new Address(city, street, number, apartment);
|
||||||
|
addressT.setAddid(addid);
|
||||||
|
|
||||||
|
return addressRepository.findById(addressT.getAddid())
|
||||||
|
.map(estate -> {
|
||||||
|
estate.setCity(addressT.getCity());
|
||||||
|
estate.setStreet(addressT.getStreet());
|
||||||
|
estate.setNumber(addressT.getNumber());
|
||||||
|
estate.setApartment(addressT.getApartment());
|
||||||
|
addressRepository.save(estate);
|
||||||
|
return "Address updated\n";
|
||||||
|
})
|
||||||
|
.orElseGet(() -> {
|
||||||
|
// add new citizen if not found
|
||||||
|
addressRepository.save(addressT);
|
||||||
|
return "Address not found and added\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
public @ResponseBody String deleteAddress(
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
|
||||||
|
addressRepository.deleteById(addid);
|
||||||
|
|
||||||
|
return "Address deleted\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/stat")
|
||||||
|
public @ResponseBody Long getAddressCount() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return addressRepository.count();
|
||||||
|
}
|
||||||
|
}
|
10
src/main/java/core/address/AddressRepository.java
Normal file
10
src/main/java/core/address/AddressRepository.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package core.address;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||||
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
|
||||||
|
public interface AddressRepository extends JpaRepository<Address, Integer> {
|
||||||
|
|
||||||
|
}
|
77
src/main/java/core/citizens/Citizen.java
Normal file
77
src/main/java/core/citizens/Citizen.java
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package core.citizens;
|
||||||
|
|
||||||
|
import core.partners.Partners;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity // This tells Hibernate to make a table out of this class
|
||||||
|
@Table(name = "Citizen")
|
||||||
|
public class Citizen {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "PESEL1", length = 11, nullable = false, unique = true)
|
||||||
|
private String PESEL;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "name", nullable = false)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "surname", nullable = false)
|
||||||
|
private String surname;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "birthday", nullable = false)
|
||||||
|
private String birthday;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "sex", nullable = false)
|
||||||
|
private String sex;
|
||||||
|
/*
|
||||||
|
@OneToOne(fetch = FetchType.LAZY,
|
||||||
|
cascade = CascadeType.ALL,
|
||||||
|
mappedBy = "citizen1")
|
||||||
|
private Partners partners;*/
|
||||||
|
|
||||||
|
public String getPESEL() { return PESEL; }
|
||||||
|
public void setPESEL (String PESEL) { this.PESEL = PESEL; }
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBirthday() {
|
||||||
|
return birthday;
|
||||||
|
}
|
||||||
|
public void setBirthday(String birthday) {
|
||||||
|
this.birthday = birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSex() { return sex; }
|
||||||
|
public void setSex(String sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Citizen(String PESEL, String name, String surname, String birthday, String sex) {
|
||||||
|
this.PESEL = PESEL;
|
||||||
|
this.name = name;
|
||||||
|
this.surname = surname;
|
||||||
|
this.birthday = birthday;
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
80
src/main/java/core/citizens/CitizenController.java
Normal file
80
src/main/java/core/citizens/CitizenController.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package core.citizens;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller // This means that this class is a Controller
|
||||||
|
@RequestMapping(path="/citizens") // This means URL's start with /demo (after Application path)
|
||||||
|
public class CitizenController {
|
||||||
|
@Autowired // This means to get the bean called userRepository
|
||||||
|
// Which is auto-generated by Spring, we will use it to handle the data
|
||||||
|
private CitizenRepository citizenRepository;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public @ResponseBody Iterable<Citizen> getAllCitizens() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return citizenRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping () // Map ONLY POST Requests
|
||||||
|
public @ResponseBody String addNewCitizen (
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam String name,
|
||||||
|
@RequestParam String surname,
|
||||||
|
@RequestParam String birthday,
|
||||||
|
@RequestParam String sex ) {
|
||||||
|
// @ResponseBody means the returned String is the response, not a view name
|
||||||
|
// @RequestParam means it is a parameter from the GET or POST request
|
||||||
|
|
||||||
|
Citizen n = new Citizen(PESEL, name, surname, birthday, sex);
|
||||||
|
|
||||||
|
// add citizen to repository
|
||||||
|
citizenRepository.save(n);
|
||||||
|
|
||||||
|
return "Citizen added\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public @ResponseBody String updateCitizen(
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam String name,
|
||||||
|
@RequestParam String surname,
|
||||||
|
@RequestParam String birthday,
|
||||||
|
@RequestParam String sex ) {
|
||||||
|
|
||||||
|
Citizen citizenKane = new Citizen(PESEL, name, surname, birthday, sex);
|
||||||
|
|
||||||
|
return citizenRepository.findById(citizenKane.getPESEL())
|
||||||
|
.map(citizen -> {
|
||||||
|
citizen.setName(citizenKane.getName());
|
||||||
|
citizen.setSurname(citizenKane.getSurname());
|
||||||
|
citizen.setBirthday(citizenKane.getBirthday());
|
||||||
|
citizen.setSex(citizenKane.getSex());
|
||||||
|
citizenRepository.save(citizen);
|
||||||
|
return "Citizen updated\n";
|
||||||
|
})
|
||||||
|
.orElseGet(() -> {
|
||||||
|
// add new citizen if not found
|
||||||
|
citizenRepository.save(citizenKane);
|
||||||
|
return "Citizen not found and added\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
public @ResponseBody String deleteCitizen(
|
||||||
|
@RequestParam String PESEL) {
|
||||||
|
|
||||||
|
citizenRepository.deleteById(PESEL);
|
||||||
|
|
||||||
|
return "Citizen deleted\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/stat")
|
||||||
|
public @ResponseBody Long getCitizenCount() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return citizenRepository.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
10
src/main/java/core/citizens/CitizenRepository.java
Normal file
10
src/main/java/core/citizens/CitizenRepository.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package core.citizens;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||||
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
|
||||||
|
public interface CitizenRepository extends JpaRepository<Citizen, String> {
|
||||||
|
|
||||||
|
}
|
30
src/main/java/core/division/Division.java
Normal file
30
src/main/java/core/division/Division.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package core.division;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity // This tells Hibernate to make a table out of this class
|
||||||
|
public class Division {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String NIP;
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true)
|
||||||
|
private Integer addid;
|
||||||
|
|
||||||
|
public Integer getAddid() { return addid; }
|
||||||
|
public void setAddid(Integer addid) { this.addid = addid; }
|
||||||
|
|
||||||
|
public String getNIP() { return NIP; }
|
||||||
|
public void setNIP(String city) { this.NIP = NIP; }
|
||||||
|
|
||||||
|
public Division(String NIP, Integer addid) {
|
||||||
|
this.NIP = NIP;
|
||||||
|
this.addid = addid;
|
||||||
|
}
|
||||||
|
}
|
71
src/main/java/core/division/DivisionController.java
Normal file
71
src/main/java/core/division/DivisionController.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package core.division;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller // This means that this class is a Controller
|
||||||
|
@RequestMapping(path="/division") // This means URL's start with /demo (after Application path)
|
||||||
|
public class DivisionController {
|
||||||
|
@Autowired // This means to get the bean called userRepository
|
||||||
|
// Which is auto-generated by Spring, we will use it to handle the data
|
||||||
|
private DivisionRepository divisionRepository;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public @ResponseBody Iterable<Division> getAllDivisions() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return divisionRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping () // Map ONLY POST Requests
|
||||||
|
public @ResponseBody String addNewDivision (
|
||||||
|
@RequestParam String NIP,
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
// @ResponseBody means the returned String is the response, not a view name
|
||||||
|
// @RequestParam means it is a parameter from the GET or POST request
|
||||||
|
|
||||||
|
Division n = new Division(NIP, addid);
|
||||||
|
|
||||||
|
// add citizen to repository
|
||||||
|
divisionRepository.save(n);
|
||||||
|
|
||||||
|
return "Division added\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public @ResponseBody String updateDivision(
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
|
||||||
|
Division divisionReal = new Division(PESEL, addid);
|
||||||
|
|
||||||
|
return divisionRepository.findById(divisionReal.getNIP())
|
||||||
|
.map(division -> {
|
||||||
|
division.setNIP(divisionReal.getNIP());
|
||||||
|
division.setAddid(divisionReal.getAddid());
|
||||||
|
divisionRepository.save(division);
|
||||||
|
return "Division updated\n";
|
||||||
|
})
|
||||||
|
.orElseGet(() -> {
|
||||||
|
// add new citizen if not found
|
||||||
|
divisionRepository.save(divisionReal);
|
||||||
|
return "Division not found and added\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
public @ResponseBody String deleteDivision(
|
||||||
|
@RequestParam String NIP) {
|
||||||
|
|
||||||
|
divisionRepository.deleteById(NIP);
|
||||||
|
|
||||||
|
return "Division for NIP deleted\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/stat")
|
||||||
|
public @ResponseBody Long getAddressCount() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return divisionRepository.count();
|
||||||
|
}
|
||||||
|
}
|
10
src/main/java/core/division/DivisionRepository.java
Normal file
10
src/main/java/core/division/DivisionRepository.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package core.division;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||||
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
|
||||||
|
public interface DivisionRepository extends JpaRepository<Division, String> {
|
||||||
|
|
||||||
|
}
|
28
src/main/java/core/estate/Estate.java
Normal file
28
src/main/java/core/estate/Estate.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package core.estate;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity // This tells Hibernate to make a table out of this class
|
||||||
|
public class Estate {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(nullable = false, unique = true, length = 11)
|
||||||
|
private String PESEL;
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true)
|
||||||
|
private Integer addid;
|
||||||
|
|
||||||
|
public Integer getAddid() { return addid; }
|
||||||
|
public void setAddid(Integer addid) { this.addid = addid; }
|
||||||
|
|
||||||
|
public String getPESEL() { return PESEL; }
|
||||||
|
public void setPESEL(String city) { this.PESEL = PESEL; }
|
||||||
|
|
||||||
|
public Estate(String PESEL, Integer addid) {
|
||||||
|
this.PESEL = PESEL;
|
||||||
|
this.addid = addid;
|
||||||
|
}
|
||||||
|
}
|
71
src/main/java/core/estate/EstateController.java
Normal file
71
src/main/java/core/estate/EstateController.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package core.estate;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller // This means that this class is a Controller
|
||||||
|
@RequestMapping(path="/estate") // This means URL's start with /demo (after Application path)
|
||||||
|
public class EstateController {
|
||||||
|
@Autowired // This means to get the bean called userRepository
|
||||||
|
// Which is auto-generated by Spring, we will use it to handle the data
|
||||||
|
private EstateRepository estateRepository;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public @ResponseBody Iterable<Estate> getAllEstates() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return estateRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping () // Map ONLY POST Requests
|
||||||
|
public @ResponseBody String addNewEstate (
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
// @ResponseBody means the returned String is the response, not a view name
|
||||||
|
// @RequestParam means it is a parameter from the GET or POST request
|
||||||
|
|
||||||
|
Estate n = new Estate(PESEL, addid);
|
||||||
|
|
||||||
|
// add citizen to repository
|
||||||
|
estateRepository.save(n);
|
||||||
|
|
||||||
|
return "Estate added\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public @ResponseBody String updateEstate(
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
|
||||||
|
Estate estateReal = new Estate(PESEL, addid);
|
||||||
|
|
||||||
|
return estateRepository.findById(estateReal.getPESEL())
|
||||||
|
.map(estate -> {
|
||||||
|
estate.setPESEL(estateReal.getPESEL());
|
||||||
|
estate.setAddid(estateReal.getAddid());
|
||||||
|
estateRepository.save(estate);
|
||||||
|
return "Estate updated\n";
|
||||||
|
})
|
||||||
|
.orElseGet(() -> {
|
||||||
|
// add new citizen if not found
|
||||||
|
estateRepository.save(estateReal);
|
||||||
|
return "Estate not found and added\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
public @ResponseBody String deleteEstate(
|
||||||
|
@RequestParam String PESEL) {
|
||||||
|
|
||||||
|
estateRepository.deleteById(PESEL);
|
||||||
|
|
||||||
|
return "Estate for PESEL deleted\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/stat")
|
||||||
|
public @ResponseBody Long getAddressCount() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return estateRepository.count();
|
||||||
|
}
|
||||||
|
}
|
10
src/main/java/core/estate/EstateRepository.java
Normal file
10
src/main/java/core/estate/EstateRepository.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package core.estate;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||||
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
|
||||||
|
public interface EstateRepository extends JpaRepository<Estate, String> {
|
||||||
|
|
||||||
|
}
|
34
src/main/java/core/firm/Firm.java
Normal file
34
src/main/java/core/firm/Firm.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package core.firm;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity // This tells Hibernate to make a table out of this class
|
||||||
|
public class Firm {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(nullable = false, unique = true, length = 11)
|
||||||
|
private String NIP;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Integer addid;
|
||||||
|
|
||||||
|
public String getNIP() { return NIP; }
|
||||||
|
public void setNIP(String NIP) { this.NIP = NIP; }
|
||||||
|
|
||||||
|
public String getName() { return name; }
|
||||||
|
public void setName(String Name) { this.name = Name; }
|
||||||
|
|
||||||
|
public Integer getAddid() { return addid; }
|
||||||
|
public void setAddid(Integer addid) { this.addid = addid; }
|
||||||
|
|
||||||
|
public Firm(String NIP, String name, Integer addid) {
|
||||||
|
this.NIP = NIP;
|
||||||
|
this.name = name;
|
||||||
|
this.addid = addid;
|
||||||
|
}
|
||||||
|
}
|
77
src/main/java/core/firm/FirmController.java
Normal file
77
src/main/java/core/firm/FirmController.java
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package core.firm;
|
||||||
|
|
||||||
|
import core.firm.*;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller // This means that this class is a Controller
|
||||||
|
@RequestMapping(path="/firm") // This means URL's start with /demo (after Application path)
|
||||||
|
public class FirmController {
|
||||||
|
@Autowired // This means to get the bean called userRepository
|
||||||
|
// Which is auto-generated by Spring, we will use it to handle the data
|
||||||
|
private FirmRepository firmRepository;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public @ResponseBody Iterable<Firm> getAllFirms() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return firmRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping () // Map ONLY POST Requests
|
||||||
|
public @ResponseBody String addNewFirm (
|
||||||
|
@RequestParam String NIP,
|
||||||
|
@RequestParam String name,
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
// @ResponseBody means the returned String is the response, not a view name
|
||||||
|
// @RequestParam means it is a parameter from the GET or POST request
|
||||||
|
|
||||||
|
Firm firmT = new Firm(NIP, name, addid);
|
||||||
|
|
||||||
|
// add citizen to repository
|
||||||
|
firmRepository.save(firmT);
|
||||||
|
|
||||||
|
return "Firm added\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public @ResponseBody String updateFirm(
|
||||||
|
@RequestParam String NIP,
|
||||||
|
@RequestParam String name,
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
|
||||||
|
Firm firmT = new Firm(NIP, name, addid);
|
||||||
|
firmT.setAddid(addid);
|
||||||
|
|
||||||
|
return firmRepository.findById(firmT.getNIP())
|
||||||
|
.map(firm -> {
|
||||||
|
firm.setNIP(firmT.getNIP());
|
||||||
|
firm.setName(firmT.getName());
|
||||||
|
firm.setAddid(firmT.getAddid());
|
||||||
|
firmRepository.save(firm);
|
||||||
|
return "Firm updated\n";
|
||||||
|
})
|
||||||
|
.orElseGet(() -> {
|
||||||
|
// add new firm if not found
|
||||||
|
firmRepository.save(firmT);
|
||||||
|
return "Firm not found and added\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
public @ResponseBody String deleteFirm(
|
||||||
|
@RequestParam String NIP){
|
||||||
|
|
||||||
|
firmRepository.deleteById(NIP);
|
||||||
|
|
||||||
|
return "Firm deleted\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/stat")
|
||||||
|
public @ResponseBody Long getFirmCount() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return firmRepository.count();
|
||||||
|
}
|
||||||
|
}
|
10
src/main/java/core/firm/FirmRepository.java
Normal file
10
src/main/java/core/firm/FirmRepository.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package core.firm;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||||
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
|
||||||
|
public interface FirmRepository extends JpaRepository<Firm, String> {
|
||||||
|
|
||||||
|
}
|
30
src/main/java/core/location/Location.java
Normal file
30
src/main/java/core/location/Location.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package core.location;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity // This tells Hibernate to make a table out of this class
|
||||||
|
public class Location {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(nullable = false, unique = true, length = 11)
|
||||||
|
private String PESEL;
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true)
|
||||||
|
private Integer addid;
|
||||||
|
|
||||||
|
public Integer getAddid() { return addid; }
|
||||||
|
public void setAddid(Integer addid) { this.addid = addid; }
|
||||||
|
|
||||||
|
public String getPESEL() { return PESEL; }
|
||||||
|
public void setPESEL(String city) { this.PESEL = PESEL; }
|
||||||
|
|
||||||
|
public Location(String PESEL, Integer addid) {
|
||||||
|
this.PESEL = PESEL;
|
||||||
|
this.addid = addid;
|
||||||
|
}
|
||||||
|
}
|
71
src/main/java/core/location/LocationController.java
Normal file
71
src/main/java/core/location/LocationController.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package core.location;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller // This means that this class is a Controller
|
||||||
|
@RequestMapping(path="/location") // This means URL's start with /demo (after Application path)
|
||||||
|
public class LocationController {
|
||||||
|
@Autowired // This means to get the bean called userRepository
|
||||||
|
// Which is auto-generated by Spring, we will use it to handle the data
|
||||||
|
private LocationRepository locationRepository;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public @ResponseBody Iterable<Location> getAllLocations() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return locationRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping () // Map ONLY POST Requests
|
||||||
|
public @ResponseBody String addNewLocation (
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
// @ResponseBody means the returned String is the response, not a view name
|
||||||
|
// @RequestParam means it is a parameter from the GET or POST request
|
||||||
|
|
||||||
|
Location n = new Location(PESEL, addid);
|
||||||
|
|
||||||
|
// add citizen to repository
|
||||||
|
locationRepository.save(n);
|
||||||
|
|
||||||
|
return "Location added\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public @ResponseBody String updateLocation(
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam Integer addid) {
|
||||||
|
|
||||||
|
Location locationReal = new Location(PESEL, addid);
|
||||||
|
|
||||||
|
return locationRepository.findById(locationReal.getPESEL())
|
||||||
|
.map(location -> {
|
||||||
|
location.setPESEL(locationReal.getPESEL());
|
||||||
|
location.setAddid(locationReal.getAddid());
|
||||||
|
locationRepository.save(location);
|
||||||
|
return "Location updated\n";
|
||||||
|
})
|
||||||
|
.orElseGet(() -> {
|
||||||
|
// add new citizen if not found
|
||||||
|
locationRepository.save(locationReal);
|
||||||
|
return "Location not found and added\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
public @ResponseBody String deleteLocation(
|
||||||
|
@RequestParam String PESEL) {
|
||||||
|
|
||||||
|
locationRepository.deleteById(PESEL);
|
||||||
|
|
||||||
|
return "Location for PESEL deleted\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/stat")
|
||||||
|
public @ResponseBody Long getAddressCount() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return locationRepository.count();
|
||||||
|
}
|
||||||
|
}
|
10
src/main/java/core/location/LocationRepository.java
Normal file
10
src/main/java/core/location/LocationRepository.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package core.location;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||||
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
|
||||||
|
public interface LocationRepository extends JpaRepository<Location, String> {
|
||||||
|
|
||||||
|
}
|
37
src/main/java/core/partners/Partners.java
Normal file
37
src/main/java/core/partners/Partners.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package core.partners;
|
||||||
|
|
||||||
|
import core.citizens.Citizen;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity // This tells Hibernate to make a table out of this class
|
||||||
|
@Table(name = "Partners")
|
||||||
|
public class Partners {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "PESEL1", length = 11, nullable = false, unique = true)
|
||||||
|
private String PESEL1;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "PESEL2", length = 11, nullable = false, unique = true)
|
||||||
|
private String PESEL2;
|
||||||
|
/*
|
||||||
|
@OneToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
|
@JoinColumn(name = "PESEL1", nullable = false)
|
||||||
|
private Citizen citizen1;*/
|
||||||
|
|
||||||
|
public String getPESEL1() { return PESEL1; }
|
||||||
|
public void setPESEL1(String PESEL) { this.PESEL1 = PESEL; }
|
||||||
|
|
||||||
|
public String getPESEL2() { return PESEL2; }
|
||||||
|
public void setPESEL2(String PESEL) { this.PESEL2 = PESEL; }
|
||||||
|
|
||||||
|
public Partners(String PESEL1, String PESEL2) {
|
||||||
|
this.PESEL1 = PESEL1;
|
||||||
|
this.PESEL2 = PESEL2;
|
||||||
|
}
|
||||||
|
}
|
71
src/main/java/core/partners/PartnersController.java
Normal file
71
src/main/java/core/partners/PartnersController.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package core.partners;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller // This means that this class is a Controller
|
||||||
|
@RequestMapping(path="/partners") // This means URL's start with /demo (after Application path)
|
||||||
|
public class PartnersController {
|
||||||
|
@Autowired // This means to get the bean called userRepository
|
||||||
|
// Which is auto-generated by Spring, we will use it to handle the data
|
||||||
|
private PartnersRepository partnersRepository;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public @ResponseBody Iterable<Partners> getAllPartnerss() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return partnersRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping () // Map ONLY POST Requests
|
||||||
|
public @ResponseBody String addNewPartners (
|
||||||
|
@RequestParam String PESEL1,
|
||||||
|
@RequestParam String PESEL2) {
|
||||||
|
// @ResponseBody means the returned String is the response, not a view name
|
||||||
|
// @RequestParam means it is a parameter from the GET or POST request
|
||||||
|
|
||||||
|
Partners n = new Partners(PESEL1, PESEL2);
|
||||||
|
|
||||||
|
// add citizen to repository
|
||||||
|
partnersRepository.save(n);
|
||||||
|
|
||||||
|
return "Partners added\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public @ResponseBody String updatePartners(
|
||||||
|
@RequestParam String PESEL1,
|
||||||
|
@RequestParam String PESEL2) {
|
||||||
|
|
||||||
|
Partners partnersReal = new Partners(PESEL1, PESEL2);
|
||||||
|
|
||||||
|
return partnersRepository.findById(partnersReal.getPESEL1())
|
||||||
|
.map(partners -> {
|
||||||
|
partners.setPESEL1(partnersReal.getPESEL1());
|
||||||
|
partners.setPESEL2(partnersReal.getPESEL2());
|
||||||
|
partnersRepository.save(partners);
|
||||||
|
return "Partners updated\n";
|
||||||
|
})
|
||||||
|
.orElseGet(() -> {
|
||||||
|
// add new citizen if not found
|
||||||
|
partnersRepository.save(partnersReal);
|
||||||
|
return "Partners not found and added\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
public @ResponseBody String deletePartners(
|
||||||
|
@RequestParam String PESEL1) {
|
||||||
|
|
||||||
|
partnersRepository.deleteById(PESEL1);
|
||||||
|
|
||||||
|
return "Partners for PESEL deleted\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/stat")
|
||||||
|
public @ResponseBody Long getAddressCount() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return partnersRepository.count();
|
||||||
|
}
|
||||||
|
}
|
10
src/main/java/core/partners/PartnersRepository.java
Normal file
10
src/main/java/core/partners/PartnersRepository.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package core.partners;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||||
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
|
||||||
|
public interface PartnersRepository extends JpaRepository<Partners, String> {
|
||||||
|
|
||||||
|
}
|
30
src/main/java/core/workers/Workers.java
Normal file
30
src/main/java/core/workers/Workers.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package core.workers;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity // This tells Hibernate to make a table out of this class
|
||||||
|
public class Workers {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(nullable = false, unique = true, length = 11)
|
||||||
|
private String PESEL;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
private String NIP;
|
||||||
|
|
||||||
|
public String getPESEL() { return PESEL; }
|
||||||
|
public void setPESEL(String PESEL) { this.PESEL = PESEL; }
|
||||||
|
|
||||||
|
public String getNIP() { return NIP; }
|
||||||
|
public void setNIP(String NIP) { this.NIP = NIP; }
|
||||||
|
|
||||||
|
public Workers(String PESEL, String NIP) {
|
||||||
|
this.PESEL = PESEL;
|
||||||
|
this.NIP = NIP;
|
||||||
|
}
|
||||||
|
}
|
72
src/main/java/core/workers/WorkersController.java
Normal file
72
src/main/java/core/workers/WorkersController.java
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package core.workers;
|
||||||
|
|
||||||
|
import org.hibernate.validator.constraints.pl.PESEL;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller // This means that this class is a Controller
|
||||||
|
@RequestMapping(path="/workers") // This means URL's start with /demo (after Application path)
|
||||||
|
public class WorkersController {
|
||||||
|
@Autowired // This means to get the bean called userRepository
|
||||||
|
// Which is auto-generated by Spring, we will use it to handle the data
|
||||||
|
private WorkersRepository workersRepository;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
public @ResponseBody Iterable<Workers> getAllWorkerss() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return workersRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping () // Map ONLY POST Requests
|
||||||
|
public @ResponseBody String addNewWorkers (
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam String NIP) {
|
||||||
|
// @ResponseBody means the returned String is the response, not a view name
|
||||||
|
// @RequestParam means it is a parameter from the GET or POST request
|
||||||
|
|
||||||
|
Workers n = new Workers(PESEL, NIP);
|
||||||
|
|
||||||
|
// add citizen to repository
|
||||||
|
workersRepository.save(n);
|
||||||
|
|
||||||
|
return "Workers added\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping()
|
||||||
|
public @ResponseBody String updateWorkers(
|
||||||
|
@RequestParam String PESEL,
|
||||||
|
@RequestParam String NIP) {
|
||||||
|
|
||||||
|
Workers workersReal = new Workers(PESEL, NIP);
|
||||||
|
|
||||||
|
return workersRepository.findById(workersReal.getPESEL())
|
||||||
|
.map(workers -> {
|
||||||
|
workers.setPESEL(workersReal.getPESEL());
|
||||||
|
workers.setNIP(workersReal.getNIP());
|
||||||
|
workersRepository.save(workers);
|
||||||
|
return "Workers updated\n";
|
||||||
|
})
|
||||||
|
.orElseGet(() -> {
|
||||||
|
// add new citizen if not found
|
||||||
|
workersRepository.save(workersReal);
|
||||||
|
return "Workers not found and added\n";
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping()
|
||||||
|
public @ResponseBody String deleteWorkers(
|
||||||
|
@RequestParam String PESEL){
|
||||||
|
|
||||||
|
workersRepository.deleteById(PESEL);
|
||||||
|
|
||||||
|
return "Workers for PESEL deleted\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/stat")
|
||||||
|
public @ResponseBody Long getAddressCount() {
|
||||||
|
// This returns a JSON or XML with the users
|
||||||
|
return workersRepository.count();
|
||||||
|
}
|
||||||
|
}
|
10
src/main/java/core/workers/WorkersRepository.java
Normal file
10
src/main/java/core/workers/WorkersRepository.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package core.workers;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
|
||||||
|
// CRUD refers Create, Read, Update, Delete
|
||||||
|
|
||||||
|
public interface WorkersRepository extends JpaRepository<Workers, String> {
|
||||||
|
|
||||||
|
}
|
6
src/main/resources/application.properties
Normal file
6
src/main/resources/application.properties
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
spring.jpa.hibernate.ddl-auto=create-drop
|
||||||
|
spring.datasource.url=jdbc:mysql://localhost:3306/db_example
|
||||||
|
spring.datasource.username=springuser
|
||||||
|
spring.datasource.password=ThePassword
|
||||||
|
|
||||||
|
spring.data.rest.base-path=/api
|
36
src/main/resources/static/css/basic.css
Normal file
36
src/main/resources/static/css/basic.css
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
form {
|
||||||
|
display: inline-block; //Or display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
padding: 12px 20px;
|
||||||
|
margin: 8px 0;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #E6E6FA;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
div {
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #F0F8FF;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
position: relative;
|
||||||
|
height: 30px;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #E6E6FA;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.copyright {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
color: black;
|
||||||
|
line-height: 5px;
|
||||||
|
font-size: 15px;
|
||||||
|
text-align: center;
|
||||||
|
bottom:0;
|
||||||
|
top:0;
|
||||||
|
}
|
201
src/main/resources/static/index.html
Normal file
201
src/main/resources/static/index.html
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link href="css/basic.css" rel="stylesheet" media="screen">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div> <h1> Przyrost III Console </h1> </div>
|
||||||
|
<div>
|
||||||
|
<h2> Citizens </h2>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/citizens" method="get">
|
||||||
|
<input type="submit" value="Get all citizens"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/citizens/stat" method="get">
|
||||||
|
<input type="submit" value="Get citizens stat"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/citizens">
|
||||||
|
|
||||||
|
<input type="text" name="PESEL" value="12345678977" />
|
||||||
|
<input type="text" name="name" value="Patrick" />
|
||||||
|
<input type="text" name="surname" value="Star" />
|
||||||
|
<input type="text" name="birthday" value="1-2-2000" />
|
||||||
|
<input type="radio" name="sex" value="m" checked> Male
|
||||||
|
<input type="radio" name="sex" value="k"> Female<br>
|
||||||
|
|
||||||
|
<input type="submit" formmethod="post" value="Post citizen"/>
|
||||||
|
<input type="submit" formmethod="put" value="Put citizen"/>
|
||||||
|
<input type="submit" formmethod="delete" value="Delete citizen"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2> Address </h2>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/address" method="get">
|
||||||
|
<input type="submit" value="Get all addresses"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/address/stat" method="get">
|
||||||
|
<input type="submit" value="Get addresses stat"/>
|
||||||
|
</form><br>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/address">
|
||||||
|
|
||||||
|
<input type="text" name="city" value="Warszawa" />
|
||||||
|
<input type="text" name="street" value="Aleje Jerozolimskie" />
|
||||||
|
<input type="text" name="number" value="13" />
|
||||||
|
<input type="text" name="apartment" value="5" /><br>
|
||||||
|
|
||||||
|
<input type="submit" formmethod="post" value="Post address"/>
|
||||||
|
<input type="submit" formmethod="put" value="Put address"/>
|
||||||
|
<input type="submit" formmethod="delete" value="Delete address"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2> Partners </h2>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/partners" method="get">
|
||||||
|
<input type="submit" value="Get all partners"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/partners/stat" method="get">
|
||||||
|
<input type="submit" value="Get partners stat"/>
|
||||||
|
</form><br>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/partners">
|
||||||
|
|
||||||
|
<input type="text" name="PESEL1" value="12345678914" />
|
||||||
|
<input type="text" name="PESEL2" value="12345678915" /><br>
|
||||||
|
|
||||||
|
<input type="submit" formmethod="post" value="Post partners"/>
|
||||||
|
<input type="submit" formmethod="put" value="Put partners"/>
|
||||||
|
<input type="submit" formmethod="delete" value="Delete partners"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2> Estate </h2>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/estate" method="get">
|
||||||
|
<input type="submit" value="Get all estates"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/estate/stat" method="get">
|
||||||
|
<input type="submit" value="Get estates stat"/>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<form action="http://0.0.0.0:8080/estate">
|
||||||
|
|
||||||
|
<input type="text" name="PESEL" value="12345678910" />
|
||||||
|
<input type="text" name="addid" value="1" />
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<input type="submit" formmethod="post" value="Post estate"/>
|
||||||
|
<input type="submit" formmethod="put" value="Put estate"/>
|
||||||
|
<input type="submit" formmethod="delete" value="Delete estate"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2> Workers </h2>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/workers" method="get">
|
||||||
|
<input type="submit" value="Get all workers"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/workers/stat" method="get">
|
||||||
|
<input type="submit" value="Get workers stat"/>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<form action="http://0.0.0.0:8080/workers">
|
||||||
|
|
||||||
|
<input type="text" name="PESEL" value="12345678914" />
|
||||||
|
<input type="text" name="NIP" value="123aa" />
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<input type="submit" formmethod="post" value="Post workers"/>
|
||||||
|
<input type="submit" formmethod="put" value="Put workers"/>
|
||||||
|
<input type="submit" formmethod="delete" value="Delete workers"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2> Locations </h2>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/location" method="get">
|
||||||
|
<input type="submit" value="Get all locations"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/location/stat" method="get">
|
||||||
|
<input type="submit" value="Get locations stat"/>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<form action="http://0.0.0.0:8080/location">
|
||||||
|
|
||||||
|
<input type="text" name="PESEL" value="12345678914" />
|
||||||
|
<input type="text" name="addid" value="1" />
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<input type="submit" formmethod="post" value="Post location"/>
|
||||||
|
<input type="submit" formmethod="put" value="Put location"/>
|
||||||
|
<input type="submit" formmethod="delete" value="Delete location"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2> Firm </h2>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/firm" method="get">
|
||||||
|
<input type="submit" value="Get all firms"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/firm/stat" method="get">
|
||||||
|
<input type="submit" value="Get firms stat"/>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<form action="http://0.0.0.0:8080/firm">
|
||||||
|
|
||||||
|
<input type="text" name="NIP" value="123" />
|
||||||
|
<input type="text" name="name" value="CoolKids Company" />
|
||||||
|
<input type="text" name="addid" value="1" />
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<input type="submit" formmethod="post" value="Post firm"/>
|
||||||
|
<input type="submit" formmethod="put" value="Put firm"/>
|
||||||
|
<input type="submit" formmethod="delete" value="Delete firm"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2> Divisions </h2>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/divisions" method="get">
|
||||||
|
<input type="submit" value="Get all divisions"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="http://0.0.0.0:8080/divisions/stat" method="get">
|
||||||
|
<input type="submit" value="Get divisions stat"/>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<form action="http://0.0.0.0:8080/divisions">
|
||||||
|
|
||||||
|
<input type="text" name="NIP" value="123aa" />
|
||||||
|
<input type="text" name="addid" value="2" />
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<input type="submit" formmethod="post" value="Post division"/>
|
||||||
|
<input type="submit" formmethod="put" value="Put division"/>
|
||||||
|
<input type="submit" formmethod="delete" value="Delete division"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<footer><p class="copyright">@Adam Lewicki</p></footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user