Class ProfileRestController
java.lang.Object
es.kukenan.smartfi.microservice.contracts.controller.ProfileRestController
Profiles Rest API controller.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAuthority (role) required in order to be able to invoke greeting API.static final StringPath for a profile.static final StringPath for Profile Rest API.private ConnectedContractCacheOperationConnected Contract Cache Operation.private ContractServiceContract service.protected es.kukenan.smartfi.common.service.jwt.JwtServiceJWT service for create a bearer to call products.private ProductsServiceProduct service.private ProfileServiceProfile service.private es.kukenan.smartfi.common.context.RequestContextManagerRequest context manager. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringcreateBearerToken(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication) org.springframework.http.ResponseEntity<es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileDto>createProfile(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication, es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileRequestDto profileRequestDto) Create Profile endpoint.org.springframework.http.ResponseEntity<Void>deleteProfile(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication, String profileId) Delete Profile endpoint.private EbContractgetConnectedContract(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication) org.springframework.http.ResponseEntity<List<es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileResponseDto>>getProfiles(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication) Get Profiles endpoint.org.springframework.http.ResponseEntity<Void>modifyProfile(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication, String profileId, Map<String, String> updates) Modify Profile endpoint.org.springframework.http.ResponseEntity<es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileDto>updateProfile(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication, String profileId, es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileRequestDto profileRequestDto) Update Profile endpoint.
-
Field Details
-
API_PROFILES_PATH
Path for Profile Rest API.- See Also:
-
API_PROFILE
Path for a profile.- See Also:
-
API_AUTHORITIES
Authority (role) required in order to be able to invoke greeting API.- See Also:
-
jwtService
@Autowired protected es.kukenan.smartfi.common.service.jwt.JwtService jwtServiceJWT service for create a bearer to call products. -
contractService
Contract service. -
productsService
Product service. -
profileService
Profile service. -
requestContextManager
@Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManagerRequest context manager. -
connectedContractCacheOperation
Connected Contract Cache Operation.
-
-
Constructor Details
-
ProfileRestController
public ProfileRestController()
-
-
Method Details
-
createProfile
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @PostMapping(produces="application/json", path="/api/v1/profiles") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileDto> createProfile(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication, @RequestBody es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileRequestDto profileRequestDto) Create Profile endpoint.- Parameters:
walletAuthentication- user credentials.profileRequestDto- profile request DTO.- Returns:
- The created profile.
-
getProfiles
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @GetMapping(produces="application/json", path="/api/v1/profiles") public org.springframework.http.ResponseEntity<List<es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileResponseDto>> getProfiles(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication) Get Profiles endpoint.- Parameters:
walletAuthentication- user credentials.- Returns:
- List of profiles.
-
updateProfile
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @PutMapping(produces="application/json", path="/api/v1/profiles/{profileId}") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileDto> updateProfile(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication, @PathVariable(name="profileId") String profileId, @RequestBody es.kukenan.smartfi.microservice.contracts.api.profiles.ProfileRequestDto profileRequestDto) Update Profile endpoint.- Parameters:
walletAuthentication- user credentials.profileId- profile identifier.profileRequestDto- profile DTO- Returns:
- The created profile.
-
deleteProfile
@PreAuthorize("(hasRole(\'ROLE_ACCESS_USER\') or hasRole(\'ROLE_ACCESS_AGENT\') or hasRole(\'ROLE_ACCESS_SUPERVISOR\')) and (hasRole(\'ROLE_LEVEL_USER_PWD\') or hasRole(\'ROLE_LEVEL_USER_SCA\'))") @DeleteMapping(produces="application/json", path="/api/v1/profiles/{profileId}") public org.springframework.http.ResponseEntity<Void> deleteProfile(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication, @PathVariable(name="profileId") String profileId) Delete Profile endpoint.- Parameters:
walletAuthentication- user credentials.profileId- profile identifier.- Returns:
- The created profile.
-
modifyProfile
@PatchMapping(produces="application/json", path="/api/v1/profiles/{profileId}") public org.springframework.http.ResponseEntity<Void> modifyProfile(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication, @PathVariable(name="profileId") String profileId, @RequestBody Map<String, String> updates) Modify Profile endpoint.- Parameters:
walletAuthentication- user credentials.profileId- profile identifier.updates- updates to be made.- Returns:
- The created profile.
-
getConnectedContract
private EbContract getConnectedContract(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication) -
createBearerToken
private String createBearerToken(es.kukenan.smartfi.common.security.WalletAuthentication walletAuthentication)
-