username instead of loginid

main
Said Gedik 2024-05-07 14:51:48 +02:00
parent 542eb6a324
commit 874ad5d216
1 changed files with 16 additions and 10 deletions

View File

@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.bmc.arsys.api.ARException;
import com.bmc.arsys.api.Value;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.nttdata.calender.approval.Approval;
import com.nttdata.calender.approval.ApprovalUpdateRequest;
@ -95,21 +96,27 @@ public class KalenderRestController {
return state.get();
}
/**
* Handles GET request to retrieve all the states and their actual and possible
* states and results a JSON array.
*
* @return JSON Array of states with actualState, possibleStates, stateNameEN,
* stateNameDE
* @throws ARException
* @throws JsonProcessingException if an exception occurs during JSON processing
*/
@CrossOrigin("*")
@GetMapping("/api/getUser")
@ResponseBody
public String getUserId() {
String jsonString = "{\"userId\": \""+this.javaAPI.getUser()+"\"}";
return jsonString;
public String getUserId() throws ARException {
var query = new Query.QueryBuilder("CTM:People LookUp")
.addFieldId("Name", 1000000017)
.build();
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")) + "\"}";
return jsonString;
}
/**
@ -181,8 +188,8 @@ public class KalenderRestController {
* Handles GET request to retrieve a list of all contracts.
*
* @return {@link ArrayList} of {@link ContractGetResponse} objects
* @throws ARException if an AR exception occurs
* @throws NotFoundError
* @throws ARException if an AR exception occurs
* @throws NotFoundError
*/
@CrossOrigin("*")
@GetMapping("/api/getContracts")
@ -323,7 +330,6 @@ public class KalenderRestController {
return implementer.get(request);
}
// Preset HANDLERS
@CrossOrigin("*")
@PostMapping("/api/savePreset")
@ -339,9 +345,9 @@ public class KalenderRestController {
@PostMapping("/api/selectPreset")
@ResponseBody
public boolean selectPreset(@RequestBody SelectPresetRequest guid) throws ARException,
NotFoundError {
Presets presets = new Presets(javaAPI);
return presets.selectPreset(guid);
NotFoundError {
Presets presets = new Presets(javaAPI);
return presets.selectPreset(guid);
}
@CrossOrigin("*")