Skip to content

Commit de28543

Browse files
committed
Merge branch 'master' into test-pipeline
2 parents f13bce3 + 6cf6fdc commit de28543

File tree

72 files changed

+5760
-1092
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+5760
-1092
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,13 @@ src/main/resources/fasp - db design2.mwb.bak
3838
/target/
3939
docs/
4040
HELP.md
41-
README.md
41+
README.md
42+
43+
# Mac
44+
.DS_Store
45+
46+
# JEnv
47+
.java-version
48+
49+
# VS Code
50+
.vscode

pom.xml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>cc.altius.FASP.rest.webservice</groupId>
1212
<artifactId>FASP</artifactId>
13-
<version>2.94[5233]</version>
13+
<version>2.95[5545]</version>
1414
<name>QAT</name>
1515
<description>Quantification Analytics Tool</description>
1616
<packaging>jar</packaging>
@@ -102,13 +102,8 @@
102102
</dependency>
103103
<dependency>
104104
<groupId>org.springdoc</groupId>
105-
<artifactId>springdoc-openapi-ui</artifactId>
106-
<version>1.3.1</version>
107-
</dependency>
108-
<dependency>
109-
<groupId>org.springdoc</groupId>
110-
<artifactId>springdoc-openapi-data-rest</artifactId>
111-
<version>1.3.1</version>
105+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
106+
<version>2.3.0</version>
112107
</dependency>
113108
<!-- API, java.xml.bind module -->
114109
<dependency>

src/main/java/cc/altius/FASP/ARTMIS/controller/ExportOrderIdsCsv.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@
2626
import org.springframework.stereotype.Controller;
2727
import org.springframework.web.bind.annotation.RequestMapping;
2828
import org.springframework.web.bind.annotation.ResponseBody;
29+
import io.swagger.v3.oas.annotations.tags.Tag;
30+
import io.swagger.v3.oas.annotations.Operation;
2931

3032
/**
3133
*
3234
* @author altius
3335
*/
3436
@Controller
37+
@Tag(
38+
name = "Export Order IDs",
39+
description = "Export Order IDs to CSV"
40+
)
3541
public class ExportOrderIdsCsv {
3642

3743
@Autowired
@@ -50,6 +56,7 @@ public class ExportOrderIdsCsv {
5056

5157
@RequestMapping(value = "/exportOrderData")
5258
@ResponseBody
59+
@Operation(summary = "Export order data", description = "Export order data")
5360
// @Scheduled(cron = "0 0 21 * * MON-FRI",zone="EST")
5461
// @Scheduled(cron = "00 */02 * * * *")
5562
public String exportOrderData() {

src/main/java/cc/altius/FASP/ARTMIS/controller/ExportProgramCsv.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,17 @@
2626
import org.springframework.stereotype.Controller;
2727
import org.springframework.web.bind.annotation.RequestMapping;
2828
import org.springframework.web.bind.annotation.ResponseBody;
29-
29+
import io.swagger.v3.oas.annotations.tags.Tag;
30+
import io.swagger.v3.oas.annotations.Operation;
3031
/**
3132
*
3233
* @author altius
3334
*/
3435
@Controller
36+
@Tag(
37+
name = "Export Programs",
38+
description = "Export Programs to CSV"
39+
)
3540
public class ExportProgramCsv {
3641

3742
@Autowired
@@ -50,6 +55,7 @@ public class ExportProgramCsv {
5055

5156
@RequestMapping(value = "/exportProgramData")
5257
@ResponseBody
58+
@Operation(summary = "Export program data", description = "Export program data")
5359
// @Scheduled(cron = "0 0 21 * * MON-FRI",zone="EST")
5460
// @Scheduled(cron = "00 */02 * * * *")
5561
public String exportProgramCsv() {

src/main/java/cc/altius/FASP/ARTMIS/controller/ExportShipmentLinkingCsv.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package cc.altius.FASP.ARTMIS.controller;
77

88
import cc.altius.FASP.ARTMIS.service.ExportArtmisDataService;
9-
import cc.altius.FASP.model.DTO.ExportOrderDataDTO;
109
import cc.altius.FASP.model.DTO.ExportShipmentLinkingDTO;
1110
import cc.altius.FASP.model.EmailTemplate;
1211
import cc.altius.FASP.model.Emailer;
@@ -27,12 +26,18 @@
2726
import org.springframework.stereotype.Controller;
2827
import org.springframework.web.bind.annotation.RequestMapping;
2928
import org.springframework.web.bind.annotation.ResponseBody;
29+
import io.swagger.v3.oas.annotations.tags.Tag;
30+
import io.swagger.v3.oas.annotations.Operation;
3031

3132
/**
3233
*
3334
* @author altius
3435
*/
3536
@Controller
37+
@Tag(
38+
name = "Export Shipment Linking",
39+
description = "Export Shipment Linking to CSV"
40+
)
3641
public class ExportShipmentLinkingCsv {
3742

3843
@Autowired
@@ -51,6 +56,7 @@ public class ExportShipmentLinkingCsv {
5156

5257
@RequestMapping(value = "/exportShipmentLinkingData")
5358
@ResponseBody
59+
@Operation(summary = "Export shipment linking data", description = "Export shipment linking data")
5460
// @Scheduled(cron = "0 0 21 * * MON-FRI",zone="EST")
5561
// @Scheduled(cron = "00 */02 * * * *")
5662
public String exportOrderData() {

src/main/java/cc/altius/FASP/ARTMIS/controller/ExportSupplyPlanJson.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@
3434
import org.springframework.stereotype.Controller;
3535
import org.springframework.web.bind.annotation.GetMapping;
3636
import org.springframework.web.bind.annotation.ResponseBody;
37+
import io.swagger.v3.oas.annotations.tags.Tag;
38+
import io.swagger.v3.oas.annotations.Operation;
3739

3840
/**
3941
*
4042
* @author akil
4143
*/
4244
@Controller
45+
@Tag(
46+
name = "Export Supply Plan",
47+
description = "Export Supply Plan to JSON"
48+
)
4349
public class ExportSupplyPlanJson {
4450

4551
@Autowired
@@ -62,6 +68,7 @@ public class ExportSupplyPlanJson {
6268

6369
@GetMapping("/exportSupplyPlan")
6470
@ResponseBody
71+
@Operation(summary = "Export supply plan", description = "Export supply plan")
6572
public String exportSupplyPlan(Authentication auth) {
6673
logger.info(" ################ Going to start Supply Plan export process ############## ");
6774
String newLine = "<br/>\n";
@@ -174,6 +181,7 @@ public String exportSupplyPlan(Authentication auth) {
174181

175182
@GetMapping("/exportManualJson")
176183
@ResponseBody
184+
@Operation(summary = "Export manual supply plan json", description = "Export manual supply plan json")
177185
public String exportManualJson(Authentication auth) {
178186
logger.info(" ################ Going to start Manual Json export process ############## ");
179187
String newLine = "<br/>\n";

src/main/java/cc/altius/FASP/ARTMIS/controller/ImportArtmisDataController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@
1212
import cc.altius.FASP.ARTMIS.service.ImportArtmisDataService;
1313
import org.springframework.web.bind.annotation.GetMapping;
1414
import org.springframework.web.bind.annotation.RestController;
15+
import io.swagger.v3.oas.annotations.tags.Tag;
1516

1617
/**
1718
*
1819
* @author altius
1920
*/
2021
@RestController
22+
@Tag(
23+
name = "Import Shipment Data",
24+
description = "Import Shipment Data from ARTMIS"
25+
)
2126
public class ImportArtmisDataController {
2227

2328
@Autowired

src/main/java/cc/altius/FASP/ARTMIS/controller/ImportProductCatalogueController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@
1313
import org.springframework.web.bind.annotation.RequestMapping;
1414
import org.springframework.web.bind.annotation.ResponseBody;
1515
import org.xml.sax.SAXException;
16+
import io.swagger.v3.oas.annotations.tags.Tag;
1617

1718
/**
1819
*
1920
* @author altius
2021
*/
2122
@Controller
23+
@Tag(
24+
name = "Import Product Catalogue",
25+
description = "Import Product Catalogue from ARTMIS"
26+
)
2227
public class ImportProductCatalogueController {
2328

2429
@Autowired
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package cc.altius.FASP;
2+
3+
import io.swagger.v3.oas.models.Components;
4+
import io.swagger.v3.oas.models.OpenAPI;
5+
import io.swagger.v3.oas.models.info.Info;
6+
import io.swagger.v3.oas.models.info.License;
7+
import io.swagger.v3.oas.models.security.SecurityRequirement;
8+
import io.swagger.v3.oas.models.security.SecurityScheme;
9+
10+
import org.springframework.beans.factory.annotation.Value;
11+
import org.springframework.context.annotation.Bean;
12+
import org.springframework.context.annotation.Configuration;
13+
14+
@Configuration
15+
public class OpenApiConfig {
16+
17+
private final String appName;
18+
private final String appVersion;
19+
private final String appDescription;
20+
21+
public OpenApiConfig(
22+
@Value("${info.app.name}") String appName,
23+
@Value("${info.app.version}") String appVersion,
24+
@Value("${info.app.description}") String appDescription) {
25+
this.appName = appName;
26+
this.appVersion = appVersion;
27+
this.appDescription = appDescription;
28+
}
29+
30+
@Bean
31+
public OpenAPI faspOpenAPI() {
32+
final String securitySchemeName = "bearerAuth";
33+
return new OpenAPI()
34+
.addSecurityItem(new SecurityRequirement()
35+
.addList(securitySchemeName))
36+
.components(new Components()
37+
.addSecuritySchemes(securitySchemeName,
38+
new SecurityScheme()
39+
.name(securitySchemeName)
40+
.type(SecurityScheme.Type.HTTP)
41+
.scheme("bearer")
42+
.bearerFormat("JWT")
43+
.description(
44+
"Enter the JWT token in the format: Bearer <token>")))
45+
46+
.info(new Info()
47+
.title(appName)
48+
.description(appDescription)
49+
.version(appVersion)
50+
.license(new License()
51+
.name("Apache License Version 2.0")
52+
.url("https://www.apache.org/licenses/LICENSE-2.0")));
53+
}
54+
}

src/main/java/cc/altius/FASP/dao/impl/DashboardDaoImpl.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -345,31 +345,8 @@ public DashboardForLoadProgram getDashboardForLoadProgram(int programId, int ver
345345

346346
@Override
347347
public int getUserCount(CustomUserDetails curUser) {
348-
String showInternalUsersString = "SELECT IF(COUNT(*)>0,1,0) `showInternalUsers` FROM us_user_role ur WHERE ur.ROLE_ID IN ('ROLE_INTERNAL_USER', 'ROLE_APPLICATION_ADMIN', 'ROLE_REALM_ADMIN') AND ur.USER_ID=:curUser ";
349-
Map<String, Object> params = new HashMap<>();
350-
params.put("curUser", curUser.getUserId());
351-
boolean showInternalUsers = this.namedParameterJdbcTemplate.queryForObject(showInternalUsersString, params, Boolean.class);
352-
params.put("showInternalUsers", showInternalUsers);
353-
354-
StringBuilder sb1 = new StringBuilder("SELECT COUNT(DISTINCT(ul.USER_ID)) FROM "
355-
+ " ("
356-
+ " SELECT u.`USER_ID`, u.`REALM_ID`, GROUP_CONCAT(ur.`ROLE_ID`) `ROLE_LIST`"
357-
+ " FROM us_user u "
358-
+ " LEFT JOIN us_user_role ur ON u.`USER_ID`=ur.`USER_ID` "
359-
+ " GROUP BY u.`USER_ID` "
360-
+ " ) ul"
361-
+ " LEFT JOIN us_user_role ur ON ul.`USER_ID`=ur.`USER_ID` "
362-
+ " LEFT JOIN us_user_acl acl ON ul.`USER_ID`=acl.`USER_ID` AND ur.`ROLE_ID`=acl.`ROLE_ID` "
363-
+ " WHERE "
364-
+ " (("
365-
+ " :showInternalUsers = 0"
366-
+ " AND NOT FIND_IN_SET('ROLE_INTERNAL_USER', ul.`ROLE_LIST`) "
367-
+ " AND NOT FIND_IN_SET('ROLE_APPLICATION_ADMIN', ul.`ROLE_LIST`) "
368-
+ " ) OR "
369-
+ " (:showInternalUsers)) ");
370-
this.aclService.addUserAclForRealm(sb1, params, "ul", curUser);
371-
this.aclService.addFullAclAtUserLevel(sb1, params, "acl", curUser);
372-
return this.namedParameterJdbcTemplate.queryForObject(sb1.toString(), params, Integer.class);
348+
String sql="SELECT COUNT(u.USER_ID) FROM us_user u WHERE u.ACTIVE ";
349+
return this.jdbcTemplate.queryForObject(sql, Integer.class);
373350
}
374351

375352
@Override

0 commit comments

Comments
 (0)