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.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.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.nttdata.calender.approval.Approval; import com.nttdata.calender.approval.Approval;
import com.nttdata.calender.approval.ApprovalUpdateRequest; import com.nttdata.calender.approval.ApprovalUpdateRequest;
@ -95,20 +96,26 @@ public class KalenderRestController {
return state.get(); return state.get();
} }
/** /**
* 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.
* *
* @return JSON Array of states with actualState, possibleStates, stateNameEN, * @return JSON Array of states with actualState, possibleStates, stateNameEN,
* stateNameDE * stateNameDE
* @throws ARException
* @throws JsonProcessingException if an exception occurs during JSON processing * @throws JsonProcessingException if an exception occurs during JSON processing
*/ */
@CrossOrigin("*") @CrossOrigin("*")
@GetMapping("/api/getUser") @GetMapping("/api/getUser")
@ResponseBody @ResponseBody
public String getUserId() { public String getUserId() throws ARException {
String jsonString = "{\"userId\": \""+this.javaAPI.getUser()+"\"}";
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; return jsonString;
} }
@ -323,7 +330,6 @@ public class KalenderRestController {
return implementer.get(request); return implementer.get(request);
} }
// Preset HANDLERS // Preset HANDLERS
@CrossOrigin("*") @CrossOrigin("*")
@PostMapping("/api/savePreset") @PostMapping("/api/savePreset")