Merge branch 'main' of https://dev.azure.com/asfinag/Tech-Supporting.ITSM/_git/Tech-Supporting.ITSM.ChangeKalender
commit
f603a5ff1b
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.nttdata.calender;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ApplicationStartupListener implements ApplicationListener<ApplicationReadyEvent> {
|
||||||
|
|
||||||
|
private static boolean applicationReady = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(ApplicationReadyEvent event) {
|
||||||
|
System.out.println("Application is ready to service requests.");
|
||||||
|
applicationReady = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isApplicationReady() {
|
||||||
|
return applicationReady;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.nttdata.calender;
|
||||||
|
|
||||||
|
public class ReadyStatus {
|
||||||
|
private boolean ready;
|
||||||
|
|
||||||
|
public ReadyStatus(boolean ready) {
|
||||||
|
this.ready = ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReady() {
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReady(boolean ready) {
|
||||||
|
this.ready = ready;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,7 @@ import org.apache.logging.log4j.Logger;
|
||||||
import org.checkerframework.common.util.report.qual.ReportCall;
|
import org.checkerframework.common.util.report.qual.ReportCall;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
@ -17,7 +18,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.bmc.arsys.api.ARException;
|
import com.bmc.arsys.api.ARException;
|
||||||
import com.bmc.arsys.api.Value;
|
import com.bmc.arsys.api.Value;
|
||||||
|
import com.bmc.thirdparty.org.springframework.context.ApplicationListener;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.nttdata.calender.ApplicationStartupListener;
|
||||||
|
import com.nttdata.calender.ReadyStatus;
|
||||||
import com.nttdata.calender.approval.Approval;
|
import com.nttdata.calender.approval.Approval;
|
||||||
import com.nttdata.calender.approval.ApprovalUpdateRequest;
|
import com.nttdata.calender.approval.ApprovalUpdateRequest;
|
||||||
import com.nttdata.calender.changes.Change;
|
import com.nttdata.calender.changes.Change;
|
||||||
|
|
@ -80,6 +84,13 @@ public class KalenderRestController {
|
||||||
this.stateChange = stateChange;
|
this.stateChange = stateChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@PostMapping("/setReady")
|
||||||
|
@ResponseBody
|
||||||
|
public ReadyStatus setReady() {
|
||||||
|
return new ReadyStatus(ApplicationStartupListener.isApplicationReady());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles GET request to retrieve all the states and their actual and possible
|
* Handles GET request to retrieve all the states and their actual and possible
|
||||||
* states and results a JSON array.
|
* states and results a JSON array.
|
||||||
|
|
@ -102,7 +113,7 @@ public class KalenderRestController {
|
||||||
*
|
*
|
||||||
* @return JSON Array of states with actualState, possibleStates, stateNameEN,
|
* @return JSON Array of states with actualState, possibleStates, stateNameEN,
|
||||||
* stateNameDE
|
* stateNameDE
|
||||||
* @throws ARException
|
* @throws ARException
|
||||||
* @throws JsonProcessingException if an exception occurs during JSON processing
|
* @throws JsonProcessingException if an exception occurs during JSON processing
|
||||||
*/
|
*/
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
||||||
|
|
@ -114,7 +125,8 @@ public class KalenderRestController {
|
||||||
.addFieldId("Name", 1000000017)
|
.addFieldId("Name", 1000000017)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
var name = this.javaAPI.queryFieldsById("\'4\'==\"" + javaAPI.getUser() + "\"", query.getFieldIds(), query.getFormName(), null, 0, 0).get(0);
|
var name = this.javaAPI.queryFieldsById("\'4\'==\"" + javaAPI.getUser() + "\"", query.getFieldIds(),
|
||||||
|
query.getFormName(), null, 0, 0).get(0);
|
||||||
String jsonString = "{\"userId\": \"" + name.get(query.getFieldId("Name")) + "\"}";
|
String jsonString = "{\"userId\": \"" + name.get(query.getFieldId("Name")) + "\"}";
|
||||||
return jsonString;
|
return jsonString;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
#server.servlet.context-path=/test
|
#server.servlet.context-path=/test
|
||||||
server.servlet.session.timeout=24h
|
server.servlet.session.timeout=24h
|
||||||
|
# server.port=${PROBE_PORT:8080}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue