@Autowired
private APIFactory apiFactory;
@Autowired
private MapComposer mapComposer;
/**
* Performs a get for a user with id for the given targetsystem
* @param targetsystem
* @param id
* @return
*/
@GetMapping(path="/provisionmap/{id}", produces = "application/json; charset=UTF-8")
public ResponseEntity<String> get(@PathVariable String id) {
Query query = new Query(new Criterium("id", id));
PagedModel<EntityModel<Identity>> result = apiFactory.getIdentityAPI().getIdentities(0, 1, null, query);
if ( result.getContent().size() == 1) {
CollectionModel<EntityModel<Transformer>> allTransformers = apiFactory.getTransformerAPI().getTransformers(0, 0, null, null);
Map<String, Object> map = (Map)mapComposer.composeProvisonMap(result.getContent().iterator().next(), allTransformers);
System.out.println(pretty(map));
return new ResponseEntity<String>(pretty(map), HttpStatus.FOUND);
}
return new ResponseEntity<String>(HttpStatus.NOT_FOUND);
}