public static Map < String , String > newApp ( String appid , String name , boolean sharedTable , boolean sharedIndex ) { Map < String , String > creds = new TreeMap <> ( ) ; creds . put ( "message" , "All set!" ) ; if ( StringUtils . isBlank ( appid ) ) { return creds ; } App app = new App ( appid ) ; if ( ! app . exists ( ) ) { app . setName ( name ) ; app . setSharingTable ( sharedTable ) ; app . setSharingIndex ( sharedIndex ) ; app . setActive ( true ) ; String id = app . create ( ) ; if ( id != null ) { logger . info ( "Created {} app '{}', sharingTable = {}, sharingIndex = {}." , app . isRootApp ( ) ? "root" : "new" , app . getAppIdentifier ( ) , sharedTable , sharedIndex ) ; creds . putAll ( app . getCredentials ( ) ) ; creds . put ( "message" , "Save the secret key - it is shown only once!" ) ; } else { logger . error ( "Failed to create app '{}'!" , appid ) ; creds . put ( "message" , "Error - app was not created." ) ; } } return creds ; }
Creates a new application and returns the credentials for it .