Merge branch 'main' of https://dev.azure.com/asfinag/Tech-Supporting.ITSM/_git/Tech-Supporting.ITSM.ChangeKalender
commit
d23cdea1c8
|
|
@ -17,7 +17,23 @@
|
|||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.8</version>
|
||||
</parent>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>local</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<spring.profiles.active>local</spring.profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>container</id>
|
||||
<properties>
|
||||
<spring.profiles.active>container</spring.profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
</properties>
|
||||
|
|
@ -173,5 +189,6 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -8,10 +8,14 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
|||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.session.MapSessionRepository;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ApiApplication extends SpringBootServletInitializer {
|
||||
|
||||
// @org.springframework.beans.factory.annotation.Value("${greeting.message}")
|
||||
// private String greetingMessage;
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApiApplication.class, args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.nttdata.calender;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
/**
|
||||
* Java API for Remedy
|
||||
*/
|
||||
@Service
|
||||
public class ApplicationConfig {
|
||||
|
||||
@Value("${rssoActive}")
|
||||
private Boolean rssoActive;
|
||||
|
||||
public Boolean getRssoActive() {
|
||||
if(this.rssoActive==null)
|
||||
return true;
|
||||
|
||||
return rssoActive;
|
||||
}
|
||||
|
||||
@Value("${arserver}")
|
||||
private String arserver;
|
||||
|
||||
public String getArserver() {
|
||||
return arserver;
|
||||
}
|
||||
|
||||
@Value("${arport}")
|
||||
private Integer arport;
|
||||
|
||||
public Integer getArport() {
|
||||
return arport;
|
||||
}
|
||||
|
||||
@Value("${aruser}")
|
||||
private String aruser;
|
||||
|
||||
public String getAruser() {
|
||||
return aruser;
|
||||
}
|
||||
|
||||
@Value("${arpassword}")
|
||||
private String arpassword;
|
||||
|
||||
public String getArpassword() {
|
||||
return arpassword;
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,9 @@ import com.nttdata.calender.errorhandling.ErrorTypes.NotFoundError;
|
|||
import com.nttdata.calender.states.State;
|
||||
import com.nttdata.calender.supportgroup.SupportGroup;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.nttdata.calender.ApplicationConfig;
|
||||
|
||||
/**
|
||||
* Java API for Remedy
|
||||
*/
|
||||
|
|
@ -35,17 +38,24 @@ public class RemedyJavaAPI {
|
|||
private static Logger applicationLogger = LogManager.getLogger("application");
|
||||
// TODO: work with form CTM:Support Group
|
||||
private static final String QUALSTR = "\'Request ID\' != \"\"";
|
||||
private ApplicationConfig appConfig;
|
||||
|
||||
// @org.springframework.beans.factory.annotation.Value("${greeting.message}")
|
||||
// private String greetingMessage;
|
||||
|
||||
/**
|
||||
* Sets up the Remedy API with the server and admin user/password.
|
||||
*/
|
||||
public RemedyJavaAPI() throws ARException, NotFoundError {
|
||||
|
||||
public RemedyJavaAPI(ApplicationConfig appConfig) throws ARException, NotFoundError {
|
||||
this.appConfig=appConfig;
|
||||
System.out.println(appConfig.getRssoActive());
|
||||
server = new ARServerUser();
|
||||
// server.setServer("itsm-app-dev.asfinag.at");
|
||||
server.setServer("itsm-app-dev-neu.asfinag.at");
|
||||
server.setUser("changecalender_integration");
|
||||
server.setPassword("VXrvLm4q#8P#MXthfZNc");
|
||||
server.setPort(46262);
|
||||
server.setServer(this.appConfig.getArserver());
|
||||
server.setUser(this.appConfig.getAruser());
|
||||
server.setPassword(this.appConfig.getArpassword());
|
||||
server.setPort(this.appConfig.getArport());
|
||||
// server.setPort(50000);
|
||||
this.connect();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nttdata.calender.api;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
|
|
@ -27,14 +28,21 @@ import java.util.List;
|
|||
|
||||
@Component
|
||||
public class RequestInterceptor implements HandlerInterceptor {
|
||||
|
||||
|
||||
// @org.springframework.beans.factory.annotation.Value("${greeting.message}")
|
||||
// private String greetingMessage;
|
||||
|
||||
@Autowired
|
||||
private RemedyJavaAPI api;
|
||||
|
||||
private static final String FORM_NAME = "ASF:CHG_CAL_Transactions";
|
||||
private static final Logger logger = LogManager.getLogger("application");
|
||||
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
api = new RemedyJavaAPI();
|
||||
//api = new RemedyJavaAPI(greetingMessage);
|
||||
String currentDateTime = LocalDateTime.now().format(dateTimeFormatter);
|
||||
long transactionId = System.currentTimeMillis();
|
||||
String out = String.format("Transaction ID = %d %s - handling request: %s", transactionId, currentDateTime, request.getRequestURI());
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
|||
|
||||
import com.bmc.thirdparty.org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.nttdata.calender.ApplicationConfig;
|
||||
import com.nttdata.calender.api.RemedyJavaAPI;
|
||||
/**
|
||||
* Interceptor for handling Rsso related operations.
|
||||
*/
|
||||
|
|
@ -17,10 +19,15 @@ public class RssoInterceptor implements HandlerInterceptor {
|
|||
private final static boolean DEBUG = true;
|
||||
private final Rsso rsso;
|
||||
private static final Logger applicationLogger = LogManager.getLogger("application");
|
||||
private ApplicationConfig appConfig;
|
||||
//EW env Fix
|
||||
private final RemedyJavaAPI javaAPI;
|
||||
|
||||
@Autowired
|
||||
public RssoInterceptor(Rsso rsso) {
|
||||
public RssoInterceptor(Rsso rsso, ApplicationConfig appConfig, RemedyJavaAPI javaAPI) {
|
||||
this.rsso = rsso;
|
||||
this.appConfig=appConfig;
|
||||
this.javaAPI=javaAPI;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,7 +46,8 @@ public class RssoInterceptor implements HandlerInterceptor {
|
|||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
// Check if a session exists, create one if not
|
||||
if (DEBUG) {
|
||||
if (!this.appConfig.getRssoActive()) {
|
||||
this.javaAPI.impersonateUser("WuiQualityKV");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ public class Approval {
|
|||
public String update(ApprovalUpdateRequest request) throws ARException {
|
||||
// Clear the list before processing a new request
|
||||
listOfFieldValues.clear();
|
||||
|
||||
remedyJavaAPI.impersonateUser("WuiQualityKV");
|
||||
|
||||
//remedyJavaAPI.impersonateUser("WuiQualityKV");
|
||||
String action = "APPROVAL";
|
||||
|
||||
var queryUpdate = new Query.QueryBuilder("ASF:CHG_CAL_Interactions")
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class Presets {
|
|||
this.presets = new ArrayList<>();
|
||||
this.listOfFieldValues = new ArrayList<>();
|
||||
|
||||
api.impersonateUser("WuiQualityKV");
|
||||
//api.impersonateUser("WuiQualityKV");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class SupportGroup {
|
|||
*/
|
||||
public void querySupportGroups(RemedyJavaAPI api) throws ARException, NotFoundError {
|
||||
|
||||
api.impersonateUser("WuiQualityKV");
|
||||
//api.impersonateUser("WuiQualityKV");
|
||||
|
||||
applicationLogger.info("\n\n\nRequest: querySupportGroups (Initial)\nUser: " + api.getUser() + "\nAdmin? "
|
||||
+ (api.isAdministrator() ? "Yes" : "No"));
|
||||
|
|
@ -112,7 +112,7 @@ public class SupportGroup {
|
|||
* @throws ARException if an error occurs during the query
|
||||
*/
|
||||
public void queryUserSupportGroup(RemedyJavaAPI api) throws ARException {
|
||||
api.impersonateUser("WuiQualityKV");
|
||||
//api.impersonateUser("WuiQualityKV");
|
||||
|
||||
var querySupportGroups = new Query.QueryBuilder("CTM:Support Group Association")
|
||||
.addFieldId("SupportGroupId", 1000000079).build();
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
rssoActive=true
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
rssoActive=false
|
||||
arserver=itsm-app-dev-neu.asfinag.at
|
||||
# arserver=${test}
|
||||
arport=46262
|
||||
aruser=changecalender_integration
|
||||
arpassword=VXrvLm4q#8P#MXthfZNc
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
#server.servlet.context-path=/test
|
||||
server.servlet.session.timeout=24h
|
||||
# server.port=${PROBE_PORT:8080}
|
||||
spring.profiles.active=@spring.profiles.active@
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import { GanttModule, ResizeService } from '@syncfusion/ej2-angular-gantt';
|
|||
import { DateAdapter } from '@angular/material/core';
|
||||
import { MAT_DATE_LOCALE } from '@angular/material/core';
|
||||
import * as WebFont from 'webfontloader'; // Verwende import * as
|
||||
import { AppConfig } from 'src/environments/models/environment.model';
|
||||
import { APP_CONFIG } from '../app.config';
|
||||
|
||||
|
||||
export const MY_DATE_FORMATS = {
|
||||
|
|
@ -188,6 +190,7 @@ export class NttGanttComponent implements OnInit {
|
|||
public cancelButton: boolean = false;
|
||||
public reApproveButton: boolean = false;
|
||||
public implementerButton: boolean = false;
|
||||
private config: AppConfig;
|
||||
|
||||
|
||||
|
||||
|
|
@ -200,7 +203,8 @@ export class NttGanttComponent implements OnInit {
|
|||
* @param dataService injects the dataService for data management and backend communication
|
||||
* @param matDialog injects the matDialog
|
||||
*/
|
||||
constructor(public languageService: LanguageService, public dataService: DataService, public matDialog: MatDialog, private _snackBar: MatSnackBar, public errorService: ErrorService, private location: Location, private dateAdapter: DateAdapter<Date>) {
|
||||
constructor(@Inject(APP_CONFIG) config: AppConfig, public languageService: LanguageService, public dataService: DataService, public matDialog: MatDialog, private _snackBar: MatSnackBar, public errorService: ErrorService, private location: Location, private dateAdapter: DateAdapter<Date>) {
|
||||
this.config=config;
|
||||
this.initLanguge(true);
|
||||
}
|
||||
|
||||
|
|
@ -1026,7 +1030,7 @@ export class NttGanttComponent implements OnInit {
|
|||
args.milestoneColor = "#bababa";
|
||||
}
|
||||
} else {
|
||||
console.log(args);
|
||||
// console.log(args);
|
||||
args.taskbarElement.innerHTML = null;
|
||||
args.taskbarElement.classlist = null;
|
||||
|
||||
|
|
@ -1043,6 +1047,8 @@ export class NttGanttComponent implements OnInit {
|
|||
* @param args event arguments from the syncfusion gantt chart.
|
||||
*/
|
||||
public taskbarEdited(args: any) {
|
||||
console.log(args);
|
||||
let data = args.data;
|
||||
if (args.data.taskData.isFixed !== false) {
|
||||
args.cancel = true;
|
||||
} else {
|
||||
|
|
@ -1061,7 +1067,8 @@ export class NttGanttComponent implements OnInit {
|
|||
);
|
||||
elem.scrollLeft = this.planTimeScrollLeft;
|
||||
}
|
||||
|
||||
console.log(found);
|
||||
this.ganttDefault.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1224,9 +1231,9 @@ export class NttGanttComponent implements OnInit {
|
|||
if (args.dialogModel) {
|
||||
args.cancel = true;
|
||||
if (args.rowData.taskData.resources[0].state == 0) {
|
||||
window.open("https://itsm-"+environment+"-neu-smartit.asfinag.at/smartit/app/#/paketPV/" + args.rowData.taskData.resources[0].packageInstanceId, "_blank");
|
||||
window.open(this.config.consoleUrl + "/smartit/app/#/paketPV/" + args.rowData.taskData.resources[0].packageInstanceId, "_blank");
|
||||
} else {
|
||||
window.open("https://itsm-"+environment+"-neu-smartit.asfinag.at/smartit/app/#/changePV/" + args.rowData.taskData.resources[0].packageInstanceId, "_blank");
|
||||
window.open(this.config.consoleUrl + "/smartit/app/#/changePV/" + args.rowData.taskData.resources[0].packageInstanceId, "_blank");
|
||||
}
|
||||
this.ganttDefault.hideSpinner();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"production":false,"rssoUrl":"http://orf.at","backendUrl":"http://localhost:8080/api"}
|
||||
{"production":false,"rssoUrl":"http://orf.at","backendUrl":"http://localhost:8080/api", "consoleUrl": "https://itsm-dev-neu-smartit.asfinag.at"}
|
||||
|
|
|
|||
|
|
@ -3,5 +3,6 @@ import { AppConfig } from './models/environment.model';
|
|||
export const environment: AppConfig = {
|
||||
production: true,
|
||||
rssoUrl: "RSSO_URL",
|
||||
backendUrl: "BACKEND_API_URL"
|
||||
backendUrl: "BACKEND_API_URL",
|
||||
consoleUrl: "CONSOLE_URL"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@ import { AppConfig } from './models/environment.model';
|
|||
export const environment: AppConfig = {
|
||||
production: false,
|
||||
rssoUrl: "#",
|
||||
backendUrl: "http://localhost:8080/api"
|
||||
};
|
||||
backendUrl: "http://localhost:8080/api",
|
||||
consoleUrl: "https://itsm-dev-neu-smartit.asfinag.at"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@ export interface AppConfig {
|
|||
production: boolean;
|
||||
rssoUrl: string;
|
||||
backendUrl: string;
|
||||
}
|
||||
consoleUrl: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue