protected ClientVersionBean createClientVersionInternal ( NewClientVersionBean bean , ClientBean client ) throws StorageException { if ( ! BeanUtils . isValidVersion ( bean . getVersion ( ) ) ) { throw new StorageException ( "Invalid/illegal client version: " + bean . getVersion ( ) ) ; //$NON-NLS-1$ } ClientVersionBean newVersion = new ClientVersionBean ( ) ; newVersion . setClient ( client ) ; newVersion . setCreatedBy ( securityContext . getCurrentUser ( ) ) ; newVersion . setCreatedOn ( new Date ( ) ) ; newVersion . setModifiedBy ( securityContext . getCurrentUser ( ) ) ; newVersion . setModifiedOn ( new Date ( ) ) ; newVersion . setStatus ( ClientStatus . Created ) ; newVersion . setVersion ( bean . getVersion ( ) ) ; newVersion . setApikey ( bean . getApiKey ( ) ) ; if ( newVersion . getApikey ( ) == null ) { newVersion . setApikey ( apiKeyGenerator . generate ( ) ) ; } storage . createClientVersion ( newVersion ) ; storage . createAuditEntry ( AuditUtils . clientVersionCreated ( newVersion , securityContext ) ) ; log . debug ( String . format ( "Created new client version %s: %s" , newVersion . getClient ( ) . getName ( ) , newVersion ) ) ; //$NON-NLS-1$ return newVersion ; }
Creates a new client version .