@eui/cli 15.4.0 → 15.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.version.properties +1 -1
- package/LICENSE +296 -296
- package/README.md +26 -26
- package/bin/eui-cli.js +70 -70
- package/lib/build.js +153 -153
- package/lib/cli.js +111 -111
- package/lib/config.js +54 -54
- package/lib/generators.js +64 -64
- package/lib/install.js +54 -54
- package/lib/maven-build/build.xml +115 -115
- package/lib/maven-build/pom.xml +64 -64
- package/lib/post-build.js +33 -33
- package/lib/skeletons/_angular/base/.browserslistrc +16 -16
- package/lib/skeletons/_angular/base/.editorconfig +16 -16
- package/lib/skeletons/_angular/base/.euirc.json +8 -8
- package/lib/skeletons/_angular/base/.stylelintrc +24 -24
- package/lib/skeletons/_angular/base/README.md +26 -26
- package/lib/skeletons/_angular/base/angular.json +176 -175
- package/lib/skeletons/_angular/base/gitignore_TO_REPLACE +50 -50
- package/lib/skeletons/_angular/base/mock/app/models/user.js +8 -8
- package/lib/skeletons/_angular/base/mock/app/routes/index.js +5 -5
- package/lib/skeletons/_angular/base/mock/app/routes/user_routes.js +24 -24
- package/lib/skeletons/_angular/base/mock/db/db.json +12 -12
- package/lib/skeletons/_angular/base/mock/server.js +21 -21
- package/lib/skeletons/_angular/base/package.json +24 -24
- package/lib/skeletons/_angular/base/proxy-mock.conf.json +6 -6
- package/lib/skeletons/_angular/base/proxy.conf.json +6 -6
- package/lib/skeletons/_angular/base/src/.eslintrc.json +118 -118
- package/lib/skeletons/_angular/base/src/app/app-routing.module.ts +17 -17
- package/lib/skeletons/_angular/base/src/app/app-starter.service.ts +66 -66
- package/lib/skeletons/_angular/base/src/app/app.component.html +29 -29
- package/lib/skeletons/_angular/base/src/app/app.component.ts +51 -51
- package/lib/skeletons/_angular/base/src/app/app.module.ts +35 -35
- package/lib/skeletons/_angular/base/src/app/core/core.module.ts +87 -87
- package/lib/skeletons/_angular/base/src/app/core/reducers/index.ts +31 -31
- package/lib/skeletons/_angular/base/src/app/features/home/home-routing.module.ts +15 -15
- package/lib/skeletons/_angular/base/src/app/features/home/home.component.html +39 -39
- package/lib/skeletons/_angular/base/src/app/features/home/home.component.ts +11 -11
- package/lib/skeletons/_angular/base/src/app/features/home/home.module.ts +18 -18
- package/lib/skeletons/_angular/base/src/app/features/module1/components/page1/page1.component.html +7 -7
- package/lib/skeletons/_angular/base/src/app/features/module1/components/page1/page1.component.ts +7 -7
- package/lib/skeletons/_angular/base/src/app/features/module1/components/page2/page2.component.html +7 -7
- package/lib/skeletons/_angular/base/src/app/features/module1/components/page2/page2.component.ts +7 -7
- package/lib/skeletons/_angular/base/src/app/features/module1/module1-routing.module.ts +18 -18
- package/lib/skeletons/_angular/base/src/app/features/module1/module1.component.html +7 -7
- package/lib/skeletons/_angular/base/src/app/features/module1/module1.component.ts +8 -8
- package/lib/skeletons/_angular/base/src/app/features/module1/module1.module.ts +21 -21
- package/lib/skeletons/_angular/base/src/app/features/module2/module2-routing.module.ts +16 -16
- package/lib/skeletons/_angular/base/src/app/features/module2/module2.component.html +7 -7
- package/lib/skeletons/_angular/base/src/app/features/module2/module2.component.ts +7 -7
- package/lib/skeletons/_angular/base/src/app/features/module2/module2.module.ts +17 -17
- package/lib/skeletons/_angular/base/src/app/shared/shared.module.ts +45 -45
- package/lib/skeletons/_angular/base/src/app/shared/testing/router.mock.ts +18 -18
- package/lib/skeletons/_angular/base/src/assets/config/env-json-config-dev.json +8 -8
- package/lib/skeletons/_angular/base/src/assets/config/env-json-config-prod.json +8 -8
- package/lib/skeletons/_angular/base/src/assets/config/env-json-config.json +7 -7
- package/lib/skeletons/_angular/base/src/assets/i18n/en.json +6 -6
- package/lib/skeletons/_angular/base/src/assets/i18n/fr.json +6 -6
- package/lib/skeletons/_angular/base/src/config/global.ts +20 -20
- package/lib/skeletons/_angular/base/src/config/index.ts +8 -8
- package/lib/skeletons/_angular/base/src/config/modules.ts +7 -7
- package/lib/skeletons/_angular/base/src/dummy.spec.ts +6 -6
- package/lib/skeletons/_angular/base/src/environments/environment.prod.ts +11 -11
- package/lib/skeletons/_angular/base/src/environments/environment.ts +11 -11
- package/lib/skeletons/_angular/base/src/index.html +21 -21
- package/lib/skeletons/_angular/base/src/karma.conf.js +7 -7
- package/lib/skeletons/_angular/base/src/main.ts +14 -14
- package/lib/skeletons/_angular/base/src/polyfills.ts +89 -89
- package/lib/skeletons/_angular/base/src/styles.scss +1 -1
- package/lib/skeletons/_angular/base/src/tsconfig.app.json +18 -18
- package/lib/skeletons/_angular/base/src/tsconfig.spec.json +14 -14
- package/lib/skeletons/_angular/base/tsconfig.json +27 -27
- package/lib/skeletons/_angular/base-mobile/angular.json +160 -160
- package/lib/skeletons/_angular/base-mobile/ionic.config.json +5 -5
- package/lib/skeletons/_angular/base-mobile/ngsw-config.json +33 -33
- package/lib/skeletons/_angular/base-mobile/package.json +28 -28
- package/lib/skeletons/_angular/base-mobile/src/app/app-routing.module.ts +17 -17
- package/lib/skeletons/_angular/base-mobile/src/app/app-starter.service.ts +73 -73
- package/lib/skeletons/_angular/base-mobile/src/app/app.component.html +27 -27
- package/lib/skeletons/_angular/base-mobile/src/app/app.component.ts +55 -55
- package/lib/skeletons/_angular/base-mobile/src/app/app.module.ts +44 -44
- package/lib/skeletons/_angular/base-mobile/src/app/core/core.module.ts +89 -89
- package/lib/skeletons/_angular/base-mobile/src/app/core/reducers/index.ts +31 -31
- package/lib/skeletons/_angular/base-mobile/src/app/features/home/home-routing.module.ts +15 -15
- package/lib/skeletons/_angular/base-mobile/src/app/features/home/home.component.html +14 -14
- package/lib/skeletons/_angular/base-mobile/src/app/features/home/home.component.ts +11 -11
- package/lib/skeletons/_angular/base-mobile/src/app/features/home/home.module.ts +18 -18
- package/lib/skeletons/_angular/base-mobile/src/app/features/module1/components/page1/page1.component.html +11 -11
- package/lib/skeletons/_angular/base-mobile/src/app/features/module1/components/page1/page1.component.ts +7 -7
- package/lib/skeletons/_angular/base-mobile/src/app/features/module1/components/page2/page2.component.html +11 -11
- package/lib/skeletons/_angular/base-mobile/src/app/features/module1/components/page2/page2.component.ts +7 -7
- package/lib/skeletons/_angular/base-mobile/src/app/features/module1/module1-routing.module.ts +18 -18
- package/lib/skeletons/_angular/base-mobile/src/app/features/module1/module1.component.html +15 -15
- package/lib/skeletons/_angular/base-mobile/src/app/features/module1/module1.component.ts +17 -17
- package/lib/skeletons/_angular/base-mobile/src/app/features/module1/module1.module.ts +21 -21
- package/lib/skeletons/_angular/base-mobile/src/app/features/module2/module2-routing.module.ts +16 -16
- package/lib/skeletons/_angular/base-mobile/src/app/features/module2/module2.component.html +11 -11
- package/lib/skeletons/_angular/base-mobile/src/app/features/module2/module2.component.ts +7 -7
- package/lib/skeletons/_angular/base-mobile/src/app/features/module2/module2.module.ts +17 -17
- package/lib/skeletons/_angular/base-mobile/src/app/shared/shared.module.ts +16 -16
- package/lib/skeletons/_angular/base-mobile/src/app/shared/testing/router.mock.ts +18 -18
- package/lib/skeletons/_angular/base-mobile/src/index.html +27 -27
- package/lib/skeletons/_angular/base-mobile/src/manifest.webmanifest +51 -51
- package/lib/skeletons/_angular/base-mobile/src/tsconfig.app.json +19 -19
- package/lib/skeletons/_angular/options/ecl/angular.json +193 -193
- package/lib/skeletons/_angular/options/ecl/src/app/app.component.html +262 -262
- package/lib/skeletons/_angular/options/ecl/src/app/app.component.ts +59 -59
- package/lib/skeletons/_angular/options/ecl/src/app/features/home/home.component.html +70 -70
- package/lib/skeletons/_angular/options/ecl/src/app/features/module1/components/page1/page1.component.html +1 -1
- package/lib/skeletons/_angular/options/ecl/src/app/features/module1/components/page2/page2.component.html +1 -1
- package/lib/skeletons/_angular/options/ecl/src/app/features/module1/module1.component.html +1 -1
- package/lib/skeletons/_angular/options/ecl/src/app/features/module2/module2.component.html +1 -1
- package/lib/skeletons/_angular/options/ecl/src/app/shared/shared.module.ts +19 -19
- package/lib/skeletons/_angular/options/ecl/src/config/global.ts +20 -20
- package/lib/skeletons/_angular/options/openid-jwt/package.json +22 -22
- package/lib/skeletons/_angular/options/openid-jwt/src/app/core/core.module.ts +94 -94
- package/lib/skeletons/_angular/options/openid-jwt/src/assets/config/env-json-config-dev.json +24 -24
- package/lib/skeletons/_angular/options/openid-jwt/src/assets/config/env-json-config-local-mock.json +10 -10
- package/lib/skeletons/_angular/options/openid-jwt/src/assets/config/env-json-config-local.json +23 -23
- package/lib/skeletons/_angular/options/openid-jwt/src/assets/config/env-json-config-prod.json +23 -23
- package/lib/skeletons/_angular/options/openid-jwt/src/assets/config/env-json-config.json +10 -10
- package/lib/skeletons/_angular/options/openid-jwt/src/environments/environment.prod.ts +11 -11
- package/lib/skeletons/_angular/options/openid-jwt/src/environments/environment.ts +11 -11
- package/lib/skeletons/_angular/options/openid-jwt/src/index.html +21 -21
- package/lib/skeletons/web-maven/package.json +17 -17
- package/lib/skeletons/web-maven/pom.xml +55 -55
- package/lib/skeletons/web-maven/src/main/java/eu/europa/ec/digit/eui/angular2clistarter/servlet/SpringWebApplicationInitializer.java +22 -22
- package/lib/skeletons/web-maven/src/main/java/eu/europa/ec/digit/eui/angular2clistarter/spring/SpringRestConfiguration.java +24 -24
- package/lib/skeletons/web-maven/src/main/java/eu/europa/ec/digit/eui/angular2clistarter/spring/rest/UserDetailsResource.java +23 -23
- package/lib/skeletons/web-maven/src/main/resources/ecas-config-application-name.xml +7 -7
- package/lib/skeletons/web-maven/src/main/webapp/WEB-INF/dispatcher-servlet.xml +10 -10
- package/lib/skeletons/web-maven/src/main/webapp/WEB-INF/web.xml +38 -38
- package/lib/skeletons/web-maven/src/main/webapp/WEB-INF/weblogic.xml +15 -15
- package/lib/skeletons/web-maven/src/main/webapp/index.jsp +29 -29
- package/lib/skeletons/web-spring-boot/myapp-web/pom.xml +77 -77
- package/lib/skeletons/web-spring-boot/myapp-web-rest/pom.xml +84 -84
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/MyappApplication.java +46 -46
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/domain/Address.java +65 -65
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/domain/Building.java +44 -44
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/repositories/BuildingRepository.java +10 -10
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/BuildingResource.java +26 -26
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/SwaggerConfig.java +20 -20
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/support/HateoasPageableHandlerMethodArgumentResolver.java +45 -45
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/support/HypermediaSupport.java +25 -25
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/support/PageJsonSerializer.java +17 -17
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/CachingPreventionFilter.java +29 -29
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/CsrfPreventionFilter.java +35 -35
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/FakeAuthenticationFilter.java +372 -372
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/SecurityConfig.java +47 -47
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/services/BuildingSearchCriteria.java +25 -25
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/services/BuildingService.java +9 -9
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/services/BuildingServiceImpl.java +25 -25
- package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/resources/data.sql +10 -10
- package/lib/skeletons/web-spring-boot/pom.xml +30 -30
- package/lib/skeletons/web-symfony/myapp-web/angular.json +170 -170
- package/lib/skeletons/web-symfony/myapp-web/package.json +23 -23
- package/lib/skeletons/web-symfony/myapp-web/src/app/app-routing.module.ts +18 -18
- package/lib/skeletons/web-symfony/myapp-web/src/app/app.component.ts +77 -77
- package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/components/products.component.html +160 -160
- package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/components/products.component.ts +104 -104
- package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/models/product.model.ts +6 -6
- package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/products-routing.module.ts +16 -16
- package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/products.module.ts +16 -16
- package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/services/products.service.ts +29 -29
- package/lib/skeletons/web-symfony/myapp-web/src/environments/environment.ts +17 -17
- package/lib/skeletons/web-symfony/myapp-web-rest/.env +28 -28
- package/lib/skeletons/web-symfony/myapp-web-rest/bin/console +42 -42
- package/lib/skeletons/web-symfony/myapp-web-rest/composer.json +67 -67
- package/lib/skeletons/web-symfony/myapp-web-rest/composer.lock +3572 -3572
- package/lib/skeletons/web-symfony/myapp-web-rest/config/bootstrap.php +21 -21
- package/lib/skeletons/web-symfony/myapp-web-rest/config/bundles.php +12 -12
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/cache.yaml +19 -19
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/dev/routing.yaml +3 -3
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/doctrine.yaml +29 -29
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/doctrine_migrations.yaml +5 -5
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/framework.yaml +17 -17
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/prod/doctrine.yaml +32 -32
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/routing.yaml +4 -4
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/sensio_framework_extra.yaml +3 -3
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/test/framework.yaml +4 -4
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/test/routing.yaml +3 -3
- package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/twig.yaml +4 -4
- package/lib/skeletons/web-symfony/myapp-web-rest/config/routes/annotations.yaml +3 -3
- package/lib/skeletons/web-symfony/myapp-web-rest/config/routes/dev/twig.yaml +3 -3
- package/lib/skeletons/web-symfony/myapp-web-rest/config/routes.yaml +3 -3
- package/lib/skeletons/web-symfony/myapp-web-rest/config/services.yaml +27 -27
- package/lib/skeletons/web-symfony/myapp-web-rest/public/index.php +27 -27
- package/lib/skeletons/web-symfony/myapp-web-rest/src/Controller/ProductController.php +196 -196
- package/lib/skeletons/web-symfony/myapp-web-rest/src/Entity/Product.php +99 -99
- package/lib/skeletons/web-symfony/myapp-web-rest/src/Kernel.php +53 -53
- package/lib/skeletons/web-symfony/myapp-web-rest/src/Migrations/Version20190604101623.php +31 -31
- package/lib/skeletons/web-symfony/myapp-web-rest/src/Migrations/Version20190604101638.php +35 -35
- package/lib/skeletons/web-symfony/myapp-web-rest/src/Repository/ProductRepository.php +51 -51
- package/lib/skeletons/web-symfony/myapp-web-rest/symfony.lock +274 -274
- package/lib/skeletons/web-symfony/myapp-web-rest/templates/base.html.twig +12 -12
- package/lib/skeletons/web-symfony/myapp-web-rest/templates/product/index.html.twig +20 -20
- package/lib/utils.js +17 -17
- package/package.json +2 -2
package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/domain/Building.java
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.domain;
|
|
2
|
-
|
|
3
|
-
import jakarta.persistence.*;
|
|
4
|
-
import java.io.Serializable;
|
|
5
|
-
|
|
6
|
-
@Entity(name = "t_building")
|
|
7
|
-
public class Building implements Serializable {
|
|
8
|
-
@Id
|
|
9
|
-
@SequenceGenerator(name="building_generator", sequenceName="seq_building")
|
|
10
|
-
@GeneratedValue(generator = "building_generator")
|
|
11
|
-
private Long buildingId;
|
|
12
|
-
|
|
13
|
-
@Column(nullable = false)
|
|
14
|
-
private String name;
|
|
15
|
-
|
|
16
|
-
@OneToOne()
|
|
17
|
-
@JoinColumn(name = "address_id")
|
|
18
|
-
private Address address;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
public Long getBuildingId() {
|
|
22
|
-
return buildingId;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public void setBuildingId(Long buildingId) {
|
|
26
|
-
this.buildingId = buildingId;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public String getName() {
|
|
30
|
-
return name;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public void setName(String name) {
|
|
34
|
-
this.name = name;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public Address getAddress() {
|
|
38
|
-
return address;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public void setAddress(Address address) {
|
|
42
|
-
this.address = address;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
package @app.group.id@.@app.name@.domain;
|
|
2
|
+
|
|
3
|
+
import jakarta.persistence.*;
|
|
4
|
+
import java.io.Serializable;
|
|
5
|
+
|
|
6
|
+
@Entity(name = "t_building")
|
|
7
|
+
public class Building implements Serializable {
|
|
8
|
+
@Id
|
|
9
|
+
@SequenceGenerator(name="building_generator", sequenceName="seq_building")
|
|
10
|
+
@GeneratedValue(generator = "building_generator")
|
|
11
|
+
private Long buildingId;
|
|
12
|
+
|
|
13
|
+
@Column(nullable = false)
|
|
14
|
+
private String name;
|
|
15
|
+
|
|
16
|
+
@OneToOne()
|
|
17
|
+
@JoinColumn(name = "address_id")
|
|
18
|
+
private Address address;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
public Long getBuildingId() {
|
|
22
|
+
return buildingId;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public void setBuildingId(Long buildingId) {
|
|
26
|
+
this.buildingId = buildingId;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public String getName() {
|
|
30
|
+
return name;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public void setName(String name) {
|
|
34
|
+
this.name = name;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public Address getAddress() {
|
|
38
|
+
return address;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public void setAddress(Address address) {
|
|
42
|
+
this.address = address;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.repositories;
|
|
2
|
-
|
|
3
|
-
import @app.group.id@.@app.name@.domain.Building;
|
|
4
|
-
import org.springframework.data.domain.Page;
|
|
5
|
-
import org.springframework.data.domain.Pageable;
|
|
6
|
-
import org.springframework.data.repository.PagingAndSortingRepository;
|
|
7
|
-
|
|
8
|
-
public interface BuildingRepository extends PagingAndSortingRepository<Building, Long> {
|
|
9
|
-
Page<Building> findAll(Pageable pageable);
|
|
10
|
-
Page<Building> findByNameContainingAllIgnoringCase(String name, Pageable pageable);
|
|
1
|
+
package @app.group.id@.@app.name@.repositories;
|
|
2
|
+
|
|
3
|
+
import @app.group.id@.@app.name@.domain.Building;
|
|
4
|
+
import org.springframework.data.domain.Page;
|
|
5
|
+
import org.springframework.data.domain.Pageable;
|
|
6
|
+
import org.springframework.data.repository.PagingAndSortingRepository;
|
|
7
|
+
|
|
8
|
+
public interface BuildingRepository extends PagingAndSortingRepository<Building, Long> {
|
|
9
|
+
Page<Building> findAll(Pageable pageable);
|
|
10
|
+
Page<Building> findByNameContainingAllIgnoringCase(String name, Pageable pageable);
|
|
11
11
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.resources;
|
|
2
|
-
|
|
3
|
-
import @app.group.id@.@app.name@.resources.support.HypermediaSupport;
|
|
4
|
-
import @app.group.id@.@app.name@.services.BuildingService;
|
|
5
|
-
import org.springframework.data.domain.Pageable;
|
|
6
|
-
import org.springframework.http.ResponseEntity;
|
|
7
|
-
import org.springframework.web.bind.annotation.GetMapping;
|
|
8
|
-
import org.springframework.web.bind.annotation.RequestMapping;
|
|
9
|
-
import org.springframework.web.bind.annotation.RestController;
|
|
10
|
-
|
|
11
|
-
@RestController
|
|
12
|
-
@RequestMapping("api/buildings")
|
|
13
|
-
public class BuildingResource {
|
|
14
|
-
private BuildingService buildingService;
|
|
15
|
-
private HypermediaSupport hateoasPageSupport;
|
|
16
|
-
|
|
17
|
-
public BuildingResource(BuildingService buildingService, HypermediaSupport hateoasPageSupport) {
|
|
18
|
-
this.buildingService = buildingService;
|
|
19
|
-
this.hateoasPageSupport = hateoasPageSupport;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@GetMapping()
|
|
23
|
-
public ResponseEntity getAllBuildings(Pageable pageable) {
|
|
24
|
-
return hateoasPageSupport.wrap(buildingService.findAll(pageable), pageable);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
package @app.group.id@.@app.name@.resources;
|
|
2
|
+
|
|
3
|
+
import @app.group.id@.@app.name@.resources.support.HypermediaSupport;
|
|
4
|
+
import @app.group.id@.@app.name@.services.BuildingService;
|
|
5
|
+
import org.springframework.data.domain.Pageable;
|
|
6
|
+
import org.springframework.http.ResponseEntity;
|
|
7
|
+
import org.springframework.web.bind.annotation.GetMapping;
|
|
8
|
+
import org.springframework.web.bind.annotation.RequestMapping;
|
|
9
|
+
import org.springframework.web.bind.annotation.RestController;
|
|
10
|
+
|
|
11
|
+
@RestController
|
|
12
|
+
@RequestMapping("api/buildings")
|
|
13
|
+
public class BuildingResource {
|
|
14
|
+
private BuildingService buildingService;
|
|
15
|
+
private HypermediaSupport hateoasPageSupport;
|
|
16
|
+
|
|
17
|
+
public BuildingResource(BuildingService buildingService, HypermediaSupport hateoasPageSupport) {
|
|
18
|
+
this.buildingService = buildingService;
|
|
19
|
+
this.hateoasPageSupport = hateoasPageSupport;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@GetMapping()
|
|
23
|
+
public ResponseEntity getAllBuildings(Pageable pageable) {
|
|
24
|
+
return hateoasPageSupport.wrap(buildingService.findAll(pageable), pageable);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.resources;
|
|
2
|
-
|
|
3
|
-
import org.springframework.context.annotation.Bean;
|
|
4
|
-
import org.springframework.context.annotation.Configuration;
|
|
5
|
-
import springfox.documentation.builders.RequestHandlerSelectors;
|
|
6
|
-
import springfox.documentation.spi.DocumentationType;
|
|
7
|
-
import springfox.documentation.spring.web.plugins.Docket;
|
|
8
|
-
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
9
|
-
|
|
10
|
-
@Configuration
|
|
11
|
-
@EnableSwagger2
|
|
12
|
-
public class SwaggerConfig {
|
|
13
|
-
@Bean
|
|
14
|
-
public Docket labelApi() {
|
|
15
|
-
return new Docket(DocumentationType.SWAGGER_2).
|
|
16
|
-
select().
|
|
17
|
-
apis(RequestHandlerSelectors.basePackage("@app.group.id@.@app.name@.resources")).
|
|
18
|
-
build().
|
|
19
|
-
useDefaultResponseMessages(false);
|
|
20
|
-
}
|
|
1
|
+
package @app.group.id@.@app.name@.resources;
|
|
2
|
+
|
|
3
|
+
import org.springframework.context.annotation.Bean;
|
|
4
|
+
import org.springframework.context.annotation.Configuration;
|
|
5
|
+
import springfox.documentation.builders.RequestHandlerSelectors;
|
|
6
|
+
import springfox.documentation.spi.DocumentationType;
|
|
7
|
+
import springfox.documentation.spring.web.plugins.Docket;
|
|
8
|
+
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
9
|
+
|
|
10
|
+
@Configuration
|
|
11
|
+
@EnableSwagger2
|
|
12
|
+
public class SwaggerConfig {
|
|
13
|
+
@Bean
|
|
14
|
+
public Docket labelApi() {
|
|
15
|
+
return new Docket(DocumentationType.SWAGGER_2).
|
|
16
|
+
select().
|
|
17
|
+
apis(RequestHandlerSelectors.basePackage("@app.group.id@.@app.name@.resources")).
|
|
18
|
+
build().
|
|
19
|
+
useDefaultResponseMessages(false);
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.resources.support;
|
|
2
|
-
|
|
3
|
-
import org.springframework.core.MethodParameter;
|
|
4
|
-
import org.springframework.data.domain.PageRequest;
|
|
5
|
-
import org.springframework.data.domain.Pageable;
|
|
6
|
-
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
|
|
7
|
-
import org.springframework.web.bind.support.WebDataBinderFactory;
|
|
8
|
-
import org.springframework.web.context.request.NativeWebRequest;
|
|
9
|
-
import org.springframework.web.method.support.ModelAndViewContainer;
|
|
10
|
-
|
|
11
|
-
public class HateoasPageableHandlerMethodArgumentResolver extends PageableHandlerMethodArgumentResolver {
|
|
12
|
-
protected int defaultPageSize = 10;
|
|
13
|
-
|
|
14
|
-
@Override
|
|
15
|
-
public Pageable resolveArgument(MethodParameter methodParameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
|
|
16
|
-
String contentRange = webRequest.getHeader("Content-Range");
|
|
17
|
-
if (contentRange != null && contentRange.length() > 0) {
|
|
18
|
-
contentRange = contentRange.trim();
|
|
19
|
-
if (contentRange.startsWith("item ")) {
|
|
20
|
-
int index = contentRange.indexOf("/");
|
|
21
|
-
String [] range = null;
|
|
22
|
-
if (index > 0) {
|
|
23
|
-
range = contentRange.substring("item ".length(), index).split("-");
|
|
24
|
-
} else {
|
|
25
|
-
range = contentRange.substring("item ".length()).split("-");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
int from = Integer.parseInt(range [0]);
|
|
29
|
-
int to = defaultPageSize;
|
|
30
|
-
if (range.length > 1) {
|
|
31
|
-
to = Integer.parseInt(range [1]);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Page size is never <= 0:
|
|
35
|
-
int pageSize = Math.max(to - from + 1, 1);
|
|
36
|
-
// Page is zero-based:
|
|
37
|
-
int page = from / pageSize;
|
|
38
|
-
|
|
39
|
-
return PageRequest.of(page, pageSize);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return super.resolveArgument(methodParameter, mavContainer, webRequest, binderFactory);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
package @app.group.id@.@app.name@.resources.support;
|
|
2
|
+
|
|
3
|
+
import org.springframework.core.MethodParameter;
|
|
4
|
+
import org.springframework.data.domain.PageRequest;
|
|
5
|
+
import org.springframework.data.domain.Pageable;
|
|
6
|
+
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
|
|
7
|
+
import org.springframework.web.bind.support.WebDataBinderFactory;
|
|
8
|
+
import org.springframework.web.context.request.NativeWebRequest;
|
|
9
|
+
import org.springframework.web.method.support.ModelAndViewContainer;
|
|
10
|
+
|
|
11
|
+
public class HateoasPageableHandlerMethodArgumentResolver extends PageableHandlerMethodArgumentResolver {
|
|
12
|
+
protected int defaultPageSize = 10;
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public Pageable resolveArgument(MethodParameter methodParameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
|
|
16
|
+
String contentRange = webRequest.getHeader("Content-Range");
|
|
17
|
+
if (contentRange != null && contentRange.length() > 0) {
|
|
18
|
+
contentRange = contentRange.trim();
|
|
19
|
+
if (contentRange.startsWith("item ")) {
|
|
20
|
+
int index = contentRange.indexOf("/");
|
|
21
|
+
String [] range = null;
|
|
22
|
+
if (index > 0) {
|
|
23
|
+
range = contentRange.substring("item ".length(), index).split("-");
|
|
24
|
+
} else {
|
|
25
|
+
range = contentRange.substring("item ".length()).split("-");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
int from = Integer.parseInt(range [0]);
|
|
29
|
+
int to = defaultPageSize;
|
|
30
|
+
if (range.length > 1) {
|
|
31
|
+
to = Integer.parseInt(range [1]);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Page size is never <= 0:
|
|
35
|
+
int pageSize = Math.max(to - from + 1, 1);
|
|
36
|
+
// Page is zero-based:
|
|
37
|
+
int page = from / pageSize;
|
|
38
|
+
|
|
39
|
+
return PageRequest.of(page, pageSize);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return super.resolveArgument(methodParameter, mavContainer, webRequest, binderFactory);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.resources.support;
|
|
2
|
-
|
|
3
|
-
import org.springframework.data.domain.Page;
|
|
4
|
-
import org.springframework.data.domain.Pageable;
|
|
5
|
-
import org.springframework.http.HttpHeaders;
|
|
6
|
-
import org.springframework.http.HttpStatus;
|
|
7
|
-
import org.springframework.http.ResponseEntity;
|
|
8
|
-
import org.springframework.stereotype.Component;
|
|
9
|
-
|
|
10
|
-
@Component
|
|
11
|
-
public class HypermediaSupport {
|
|
12
|
-
public ResponseEntity<Page> wrap(Page page, Pageable pageable) {
|
|
13
|
-
HttpHeaders headers = new HttpHeaders();
|
|
14
|
-
|
|
15
|
-
long total = page.getTotalElements();
|
|
16
|
-
// Page and range are zero-based:
|
|
17
|
-
long from = page.getNumber() * page.getSize();
|
|
18
|
-
long to = from + pageable.getPageSize() - 1;
|
|
19
|
-
|
|
20
|
-
headers.add("Accept-Ranges", "item");
|
|
21
|
-
headers.add("Content-Range", "item " + from + "-" + to + "/" + total);
|
|
22
|
-
|
|
23
|
-
return new ResponseEntity<Page>(page, headers, HttpStatus.PARTIAL_CONTENT);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
package @app.group.id@.@app.name@.resources.support;
|
|
2
|
+
|
|
3
|
+
import org.springframework.data.domain.Page;
|
|
4
|
+
import org.springframework.data.domain.Pageable;
|
|
5
|
+
import org.springframework.http.HttpHeaders;
|
|
6
|
+
import org.springframework.http.HttpStatus;
|
|
7
|
+
import org.springframework.http.ResponseEntity;
|
|
8
|
+
import org.springframework.stereotype.Component;
|
|
9
|
+
|
|
10
|
+
@Component
|
|
11
|
+
public class HypermediaSupport {
|
|
12
|
+
public ResponseEntity<Page> wrap(Page page, Pageable pageable) {
|
|
13
|
+
HttpHeaders headers = new HttpHeaders();
|
|
14
|
+
|
|
15
|
+
long total = page.getTotalElements();
|
|
16
|
+
// Page and range are zero-based:
|
|
17
|
+
long from = page.getNumber() * page.getSize();
|
|
18
|
+
long to = from + pageable.getPageSize() - 1;
|
|
19
|
+
|
|
20
|
+
headers.add("Accept-Ranges", "item");
|
|
21
|
+
headers.add("Content-Range", "item " + from + "-" + to + "/" + total);
|
|
22
|
+
|
|
23
|
+
return new ResponseEntity<Page>(page, headers, HttpStatus.PARTIAL_CONTENT);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.resources.support;
|
|
2
|
-
|
|
3
|
-
import com.fasterxml.jackson.core.JsonGenerator;
|
|
4
|
-
import com.fasterxml.jackson.databind.JsonSerializer;
|
|
5
|
-
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
6
|
-
import org.springframework.data.domain.Page;
|
|
7
|
-
|
|
8
|
-
import java.io.IOException;
|
|
9
|
-
|
|
10
|
-
public class PageJsonSerializer extends JsonSerializer {
|
|
11
|
-
@Override
|
|
12
|
-
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
|
13
|
-
// Remove the page information that will be serialized to the HTTP headers instead:
|
|
14
|
-
Page page = (Page) o;
|
|
15
|
-
jsonGenerator.writeObject(page.getContent());
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
package @app.group.id@.@app.name@.resources.support;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.core.JsonGenerator;
|
|
4
|
+
import com.fasterxml.jackson.databind.JsonSerializer;
|
|
5
|
+
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
6
|
+
import org.springframework.data.domain.Page;
|
|
7
|
+
|
|
8
|
+
import java.io.IOException;
|
|
9
|
+
|
|
10
|
+
public class PageJsonSerializer extends JsonSerializer {
|
|
11
|
+
@Override
|
|
12
|
+
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
|
13
|
+
// Remove the page information that will be serialized to the HTTP headers instead:
|
|
14
|
+
Page page = (Page) o;
|
|
15
|
+
jsonGenerator.writeObject(page.getContent());
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.security;
|
|
2
|
-
|
|
3
|
-
import jakarta.servlet.*;
|
|
4
|
-
import jakarta.servlet.http.HttpServletResponse;
|
|
5
|
-
import java.io.IOException;
|
|
6
|
-
|
|
7
|
-
// Prevents caching of REST service responses.
|
|
8
|
-
public class CachingPreventionFilter implements Filter {
|
|
9
|
-
public void init(FilterConfig filterConfig) throws ServletException {
|
|
10
|
-
// do nothing
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
|
14
|
-
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
|
15
|
-
response.addIntHeader("Age", 0);
|
|
16
|
-
response.addHeader("Cache-Control", "no-cache,no-store,no-transform,must-revalidate");
|
|
17
|
-
response.addHeader("Expires", "Wed, 31 Dec 1969 23:59:59 GMT");
|
|
18
|
-
response.addHeader("Pragma", "no-cache");
|
|
19
|
-
response.addHeader("X-Robots-Tag", "noindex, nofollow");
|
|
20
|
-
|
|
21
|
-
if (filterChain != null) {
|
|
22
|
-
filterChain.doFilter(servletRequest, servletResponse);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public void destroy() {
|
|
27
|
-
// do nothing
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
package @app.group.id@.@app.name@.security;
|
|
2
|
+
|
|
3
|
+
import jakarta.servlet.*;
|
|
4
|
+
import jakarta.servlet.http.HttpServletResponse;
|
|
5
|
+
import java.io.IOException;
|
|
6
|
+
|
|
7
|
+
// Prevents caching of REST service responses.
|
|
8
|
+
public class CachingPreventionFilter implements Filter {
|
|
9
|
+
public void init(FilterConfig filterConfig) throws ServletException {
|
|
10
|
+
// do nothing
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
|
14
|
+
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
|
15
|
+
response.addIntHeader("Age", 0);
|
|
16
|
+
response.addHeader("Cache-Control", "no-cache,no-store,no-transform,must-revalidate");
|
|
17
|
+
response.addHeader("Expires", "Wed, 31 Dec 1969 23:59:59 GMT");
|
|
18
|
+
response.addHeader("Pragma", "no-cache");
|
|
19
|
+
response.addHeader("X-Robots-Tag", "noindex, nofollow");
|
|
20
|
+
|
|
21
|
+
if (filterChain != null) {
|
|
22
|
+
filterChain.doFilter(servletRequest, servletResponse);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public void destroy() {
|
|
27
|
+
// do nothing
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
package @app.group.id@.@app.name@.security;
|
|
2
|
-
|
|
3
|
-
import jakarta.servlet.*;
|
|
4
|
-
import jakarta.servlet.http.HttpServletRequest;
|
|
5
|
-
import jakarta.servlet.http.HttpServletResponse;
|
|
6
|
-
import java.io.IOException;
|
|
7
|
-
|
|
8
|
-
// Prevents non-ajax requests for REST services. This is to prevent Cross-Site Request Forgery (CSRF) attacks.
|
|
9
|
-
public class CsrfPreventionFilter implements Filter {
|
|
10
|
-
public void init(FilterConfig filterConfig) throws ServletException {
|
|
11
|
-
// do nothing
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
|
15
|
-
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
|
16
|
-
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
|
17
|
-
|
|
18
|
-
String origin = request.getHeader("Origin");
|
|
19
|
-
if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With")) || "OPTIONS".equalsIgnoreCase(request.getMethod()) || (origin != null && origin.trim().length() > 0)) {
|
|
20
|
-
response.addHeader("Content-Security-Policy", "default-src 'self'; connect-src 'self'; font-src 'none'; img-src 'self'; media-src 'self'; object-src 'self'; plugin-types application/pdf audio/x-wav; referrer no-referrer; reflected-xss block; script-src 'self'; style-src 'self'");
|
|
21
|
-
response.addHeader("X-Content-Security-Policy", "default-src 'self'; connect-src 'self'; font-src 'none'; img-src 'self'; media-src 'self'; object-src 'self'; plugin-types application/pdf audio/x-wav; referrer no-referrer; reflected-xss block; script-src 'self'; style-src 'self'");
|
|
22
|
-
response.addHeader("X-Content-Type-Options", "nosniff");
|
|
23
|
-
if (filterChain != null) {
|
|
24
|
-
filterChain.doFilter(servletRequest, servletResponse);
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
|
28
|
-
response.getWriter().write("The REST service can only be accessed programmatically.");
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public void destroy() {
|
|
33
|
-
// do nothing
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
package @app.group.id@.@app.name@.security;
|
|
2
|
+
|
|
3
|
+
import jakarta.servlet.*;
|
|
4
|
+
import jakarta.servlet.http.HttpServletRequest;
|
|
5
|
+
import jakarta.servlet.http.HttpServletResponse;
|
|
6
|
+
import java.io.IOException;
|
|
7
|
+
|
|
8
|
+
// Prevents non-ajax requests for REST services. This is to prevent Cross-Site Request Forgery (CSRF) attacks.
|
|
9
|
+
public class CsrfPreventionFilter implements Filter {
|
|
10
|
+
public void init(FilterConfig filterConfig) throws ServletException {
|
|
11
|
+
// do nothing
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
|
15
|
+
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
|
16
|
+
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
|
17
|
+
|
|
18
|
+
String origin = request.getHeader("Origin");
|
|
19
|
+
if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With")) || "OPTIONS".equalsIgnoreCase(request.getMethod()) || (origin != null && origin.trim().length() > 0)) {
|
|
20
|
+
response.addHeader("Content-Security-Policy", "default-src 'self'; connect-src 'self'; font-src 'none'; img-src 'self'; media-src 'self'; object-src 'self'; plugin-types application/pdf audio/x-wav; referrer no-referrer; reflected-xss block; script-src 'self'; style-src 'self'");
|
|
21
|
+
response.addHeader("X-Content-Security-Policy", "default-src 'self'; connect-src 'self'; font-src 'none'; img-src 'self'; media-src 'self'; object-src 'self'; plugin-types application/pdf audio/x-wav; referrer no-referrer; reflected-xss block; script-src 'self'; style-src 'self'");
|
|
22
|
+
response.addHeader("X-Content-Type-Options", "nosniff");
|
|
23
|
+
if (filterChain != null) {
|
|
24
|
+
filterChain.doFilter(servletRequest, servletResponse);
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
|
28
|
+
response.getWriter().write("The REST service can only be accessed programmatically.");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public void destroy() {
|
|
33
|
+
// do nothing
|
|
34
|
+
}
|
|
35
|
+
}
|