@Test(expected = TokenNotFoundException.class) public void updateNonExistingTokenFriendlyName() throws Exception { tokenService.updateTokenFriendlyName(TOKEN_NOT_FOUND_TOKEN_ID, "new-name"); }
public TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName) throws TokenNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = getToken(tokenId); auditDataHelper.put(tokenInfo); auditDataHelper.put(TOKEN_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleTokenAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo); try { signerProxyFacade.setTokenFriendlyName(tokenId, friendlyName); tokenInfo = signerProxyFacade.getToken(tokenId); } catch (CodedException e) { if (isCausedByTokenNotFound(e)) { throw new TokenNotFoundException(e); } else { throw e; } } catch (Exception other) { throw new SignerNotReachableException("update token friendly name failed", other); } return tokenInfo; }
TokenService { public TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName) throws TokenNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = getToken(tokenId); auditDataHelper.put(tokenInfo); auditDataHelper.put(TOKEN_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleTokenAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo); try { signerProxyFacade.setTokenFriendlyName(tokenId, friendlyName); tokenInfo = signerProxyFacade.getToken(tokenId); } catch (CodedException e) { if (isCausedByTokenNotFound(e)) { throw new TokenNotFoundException(e); } else { throw e; } } catch (Exception other) { throw new SignerNotReachableException("update token friendly name failed", other); } return tokenInfo; } }
TokenService { public TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName) throws TokenNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = getToken(tokenId); auditDataHelper.put(tokenInfo); auditDataHelper.put(TOKEN_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleTokenAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo); try { signerProxyFacade.setTokenFriendlyName(tokenId, friendlyName); tokenInfo = signerProxyFacade.getToken(tokenId); } catch (CodedException e) { if (isCausedByTokenNotFound(e)) { throw new TokenNotFoundException(e); } else { throw e; } } catch (Exception other) { throw new SignerNotReachableException("update token friendly name failed", other); } return tokenInfo; } @Autowired  TokenService(SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            AuditDataHelper auditDataHelper); }
TokenService { public TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName) throws TokenNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = getToken(tokenId); auditDataHelper.put(tokenInfo); auditDataHelper.put(TOKEN_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleTokenAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo); try { signerProxyFacade.setTokenFriendlyName(tokenId, friendlyName); tokenInfo = signerProxyFacade.getToken(tokenId); } catch (CodedException e) { if (isCausedByTokenNotFound(e)) { throw new TokenNotFoundException(e); } else { throw e; } } catch (Exception other) { throw new SignerNotReachableException("update token friendly name failed", other); } return tokenInfo; } @Autowired  TokenService(SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            AuditDataHelper auditDataHelper); List<TokenInfo> getAllTokens(); List<CertificateInfo> getSignCertificates(ClientType clientType); List<CertificateInfo> getAllCertificates(ClientType clientType); void activateToken(String id, char[] password); void deactivateToken(String id); TokenInfo getToken(String id); TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName); TokenInfo getTokenForKeyId(String keyId); TokenInfoAndKeyId getTokenAndKeyIdForCertificateHash(String hash); boolean isSoftwareTokenInitialized(); TokenInitStatusInfo getSoftwareTokenInitStatus(); TokenInfoAndKeyId getTokenAndKeyIdForCertificateRequestId(String csrId); boolean hasHardwareTokens(); }
TokenService { public TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName) throws TokenNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = getToken(tokenId); auditDataHelper.put(tokenInfo); auditDataHelper.put(TOKEN_FRIENDLY_NAME, friendlyName); possibleActionsRuleEngine.requirePossibleTokenAction(PossibleActionEnum.EDIT_FRIENDLY_NAME, tokenInfo); try { signerProxyFacade.setTokenFriendlyName(tokenId, friendlyName); tokenInfo = signerProxyFacade.getToken(tokenId); } catch (CodedException e) { if (isCausedByTokenNotFound(e)) { throw new TokenNotFoundException(e); } else { throw e; } } catch (Exception other) { throw new SignerNotReachableException("update token friendly name failed", other); } return tokenInfo; } @Autowired  TokenService(SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            AuditDataHelper auditDataHelper); List<TokenInfo> getAllTokens(); List<CertificateInfo> getSignCertificates(ClientType clientType); List<CertificateInfo> getAllCertificates(ClientType clientType); void activateToken(String id, char[] password); void deactivateToken(String id); TokenInfo getToken(String id); TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName); TokenInfo getTokenForKeyId(String keyId); TokenInfoAndKeyId getTokenAndKeyIdForCertificateHash(String hash); boolean isSoftwareTokenInitialized(); TokenInitStatusInfo getSoftwareTokenInitStatus(); TokenInfoAndKeyId getTokenAndKeyIdForCertificateRequestId(String csrId); boolean hasHardwareTokens();  }