Class ProfileRestController

java.lang.Object
es.kukenan.smartfi.microservice.contracts.controller.ProfileRestController

@RestController public class ProfileRestController extends Object
Profiles Rest API controller.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Authority (role) required in order to be able to invoke greeting API.
    static final String
    Path for a profile.
    static final String
    Path for Profile Rest API.
    Connected Contract Cache Operation.
    Contract service.
    protected es.kukenan.smartfi.common.service.jwt.JwtService
    JWT service for create a bearer to call products.
    Product service.
    Profile service.
    private es.kukenan.smartfi.common.context.RequestContextManager
    Request context manager.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private String
    createBearerToken(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 EbContract
    getConnectedContract(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • API_PROFILES_PATH

      public static final String API_PROFILES_PATH
      Path for Profile Rest API.
      See Also:
    • API_PROFILE

      public static final String API_PROFILE
      Path for a profile.
      See Also:
    • API_AUTHORITIES

      public static final String 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 jwtService
      JWT service for create a bearer to call products.
    • contractService

      @Autowired private ContractService contractService
      Contract service.
    • productsService

      @Autowired private ProductsService productsService
      Product service.
    • profileService

      @Autowired private ProfileService profileService
      Profile service.
    • requestContextManager

      @Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManager
      Request context manager.
    • connectedContractCacheOperation

      @Autowired private ConnectedContractCacheOperation 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)