Source:
<code>public Response fetchInitialData(@PathParam("USERID") String userId) { MatriculationExamInitialData result = new MatriculationExamInitialData(); SchoolDataIdentifier identifier = SchoolDataIdentifier.fromId(userId); if (identifier == null) { return Response.status(Status.BAD_REQUEST).entity("Invalid user id").build(); } <START> long studentId = Long.valueOf(identifier.getIdentifier().split("-")[1]); <END> User user = userController.findUserByIdentifier(identifier); if (user == null) { return Response.status(Status.NOT_FOUND).entity("User not found").build(); } UserEntity userEntity = userEntityController.findUserEntityByUserIdentifier(identifier); List<UserAddress> userAddresses = userController.listUserAddresses(user); List<UserPhoneNumber> phoneNumbers = userController.listUserPhoneNumbers(user); String address = ""; String postalCode = ""; String locality = ""; String phoneNumber = ""; String emailAddress = userEmailEntityController.getUserDefaultEmailAddress(userEntity, false); String name = ""; if (user.getFirstName() != null) { name += user.getFirstName(); } if (user.getLastName() != null) { name += " " + user.getLastName(); } for (UserAddress userAddress : userAddresses) { if (userAddress.getDefaultAddress()) { address = userAddress.getStreet(); postalCode = userAddress.getPostalCode(); locality = userAddress.getCity(); } } for (UserPhoneNumber userPhoneNumber : phoneNumbers) { if (userPhoneNumber.getDefaultNumber()) { phoneNumber = userPhoneNumber.getNumber(); } } result.setName(name); result.setSsn(user.getSsn()); result.setEmail(emailAddress); result.setPhone(phoneNumber); result.setAddress(address); result.setPostalCode(postalCode); result.setLocality(locality); result.setGuidanceCounselor(""); result.setStudentId(studentId); try { VopsLister.Result listerResult = torController.listVopsCourses( userId, identifier); result.setMandatoryCourses(listerResult.getNumMandatoryCourses()); } catch (EducationTypeMappingNotSetException ex) { result.setMandatoryCourses(0); } return Response.ok(result).build(); }</code><technical_language>Parsing studentId this is making bit assumptions identifier. moved PyramusSchoolDataBridge identifierMapper decoding</technical_language>

Target:
public Response fetchInitialData(@PathParam("USERID") String userId) { MatriculationExamInitialData result = new MatriculationExamInitialData(); SchoolDataIdentifier identifier = SchoolDataIdentifier.fromId(userId); if (identifier == null) { return Response.status(Status.BAD_REQUEST).entity("Invalid user id").build(); } SchoolDataIdentifier loggedUserIdentifier = sessionController.getLoggedUser(); if (!identifier.equals(loggedUserIdentifier)) { return Response.status(Status.FORBIDDEN).entity("Student is not logged in").build(); } User user = userController.findUserByIdentifier(identifier); if (user == null) { return Response.status(Status.NOT_FOUND).entity("User not found").build(); } SentMatriculationEnrollment sentEnrollment = sentMatriculationEnrollmentDAO.findByUser(identifier); if (sentEnrollment != null) { result.setEnrollmentSent(true); } UserEntity userEntity = userEntityController.findUserEntityByUserIdentifier(identifier); List<UserAddress> userAddresses = userController.listUserAddresses(user); List<UserPhoneNumber> phoneNumbers = userController.listUserPhoneNumbers(user); String address = ""; String postalCode = ""; String locality = ""; String phoneNumber = ""; String emailAddress = userEmailEntityController.getUserDefaultEmailAddress(userEntity, false); String name = ""; if (user.getFirstName() != null) { name += user.getFirstName(); } if (user.getLastName() != null) { name += " " + user.getLastName(); } for (UserAddress userAddress : userAddresses) { if (userAddress.getDefaultAddress()) { address = userAddress.getStreet(); postalCode = userAddress.getPostalCode(); locality = userAddress.getCity(); } } for (UserPhoneNumber userPhoneNumber : phoneNumbers) { if (userPhoneNumber.getDefaultNumber()) { phoneNumber = userPhoneNumber.getNumber(); } } result.setName(name); result.setSsn(user.getSsn()); result.setEmail(emailAddress); result.setPhone(phoneNumber); result.setAddress(address); result.setPostalCode(postalCode); result.setLocality(locality); result.setGuidanceCounselor(""); result.setStudentIdentifier(identifier.toId()); return Response.ok(result).build(); }