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,21 +96,27 @@ 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()+"\"}";
return jsonString; 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. * Handles GET request to retrieve a list of all contracts.
* *
* @return {@link ArrayList} of {@link ContractGetResponse} objects * @return {@link ArrayList} of {@link ContractGetResponse} objects
* @throws ARException if an AR exception occurs * @throws ARException if an AR exception occurs
* @throws NotFoundError * @throws NotFoundError
*/ */
@CrossOrigin("*") @CrossOrigin("*")
@GetMapping("/api/getContracts") @GetMapping("/api/getContracts")
@ -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")
@ -339,9 +345,9 @@ public class KalenderRestController {
@PostMapping("/api/selectPreset") @PostMapping("/api/selectPreset")
@ResponseBody @ResponseBody
public boolean selectPreset(@RequestBody SelectPresetRequest guid) throws ARException, public boolean selectPreset(@RequestBody SelectPresetRequest guid) throws ARException,
NotFoundError { NotFoundError {
Presets presets = new Presets(javaAPI); Presets presets = new Presets(javaAPI);
return presets.selectPreset(guid); return presets.selectPreset(guid);
} }
@CrossOrigin("*") @CrossOrigin("*")