@ PUT @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) @ RequiresPermissions ( I18nPermissions . KEY_WRITE ) public Response updateKey ( KeyRepresentation representation ) throws URISyntaxException { WebAssertions . assertNotNull ( representation , THE_KEY_SHOULD_NOT_BE_NULL ) ; WebAssertions . assertNotBlank ( representation . getDefaultLocale ( ) , THE_KEY_SHOULD_CONTAINS_A_LOCALE ) ; Key key = loadKeyIfExistsOrFail ( ) ; key . setComment ( representation . getComment ( ) ) ; key . setOutdated ( ) ; // Updates the default translation key . addTranslation ( representation . getDefaultLocale ( ) , representation . getTranslation ( ) , representation . isApprox ( ) ) ; keyRepository . update ( key ) ; return Response . ok ( new URI ( uriInfo . getRequestUri ( ) + "/" + keyName ) ) . entity ( keyFinder . findKeyWithName ( keyName ) ) . build ( ) ; }
Updates a key with the translation in the default language .