...
...
Section | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Nothing. We have pre-created a simple application that shows the different usages of the API using an interactive command-line approach. Think of this app as the command-line version of the web-base based frevvo UI but stripped of all the irrelevant details, libraries, etc., so you can inspect the different API usages as simply as possible using live code with sources included.
Although this approach makes it a bit harder to piece together a given API usage since it will be comprised of a set of different paths through the sources, we believe it will provide for a better learning tool since you will be able to inspect the sources, which will be running sources, or even debug the app if needed, after all this is an API we are talking about. We have also chosen an interactive command-line application format so that we would be able to reduce the code footprint to a bare minimum increasing the clarity needed to understand it. Besides, this tutorial should be the guide through the different API usages that may not be obvious by simply inspecting the source code.
...
Code Block |
---|
usage: com.frevvo.forms.cli.Main -s,--server <arg> serverl url (e.g. http://localhost:8082) -t,--tenant <arg> tenant (optional, e.g. doe.com) |
So you if If you want to connect to a install frevvo install running on localhost you can do as follows, replacing 'forms-cli.jar' with the current jar filename.
...
This means that you are up and running, but not yet connected. First, you need to log in to a frevvo account. Be sure to create at least one tenant and one user for the tenant before you try to log in. See Connect to a Server and Log In below for instructions.
...
Some commands are not specific to a given shell , but are common across all shells. They are:
- ?list - This command will print out a list of all the currently available commands with a brief description and the number of arguments it expects , if it expects any.
- exit - This is how exit the current shell and 'back up' and and return to the previous one (some commands you execute may activate a new shell). Exiting from the last shell will exit the app.
...
If you inspect the sources for each of these classes you will notice some methods are annotated with a special Command metadata: this is where we specify what is the command's name in the command - prompt and it's its description (used by ?print described above).
...
The following topics show how to log in to the server frevvo server and use the command line API to interact with the server, projects, and forms and workflows.
Connect to a Server and Log In
The example below shows how to log in to a local serverfrevvo server. In this example, the login user name is david, the name of the tenant is monahan.com, and the user password is david (e.g., login david@monahan.com david).
Note |
---|
To login, you must first create a tenant on the server (other than the default d tenant). You should also create a user with the role frevvo.designer Designer who can create projects. |
Code Block |
---|
Directory of D:\frevvo v4.1.4 08/05/2011 08:59a <DIR> . 08/05/2011 08:59a <DIR> .. 08/05/2011 08:59a 3,044,609 com.frevvo.forms.cli.jar 07/12/2011 09:20a <DIR> frevvo 1 File(s) 3,044,609 bytes 3 Dir(s) 7,803,990,016 bytes free D:\frevvo v4.1.4>java -jar com.frevvo.forms.cli.jar usage: com.frevvo.forms.cli.Main -s,--server <arg> serverl url (e.g. http://localhost:8082) -t,--tenant tenant (optional, e.g. doe.com) D:\frevvo v4.1.4>java -jar com.frevvo.forms.cli.jar -s http://localhost:8082 localhost:8082> ?list Name Abbr ArgNum Descr login l 1 login(username:String) : String login l 2 login(username:String, password:String) : String login-as la 2 loginAs(username:String, tenantAdmin:String) : String login-as la 3 loginAs(username:String, tenantAdmin:String, tenantAdminPassword:String) : String print p 0 print() : String localhost:8082> login david@monahan.com david ---------------------------------------------------------------------------------------- ID | david URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/user/david UPDATED | 2011-08-05T09:52:45.510-04:00 NAME | david DESCRIPTION | null ---------------------------------------------------------------------------------------- |
...
Code Block |
---|
localhost:8082/david@monahan.com> ?list Name Abbr ArgNum Descr apps 0 SELECT apps for this user (e.g. 'apps') subs 0 SELECT subs for this user (e.g. 'subs') you tasks 0 SELECT tasks for this user (e.g. 'tasks') themes 0 SELECT themes for this user (e.g. 'themes') link l 1 OPEN a link in the browser (e.g. 'link {link#}') descr d 1 UPDATE this entry's description (e.g. 'descr {newDescription}') links l 0 SHOW all entry links (e.g. 'links') links li 1 SHOW feed links for given rel attr (e.g. 'links {relAttr}') name n 1 UPDATE this entry's name (e.g. 'name {newName}') print p 0 PRINT this entry (e.g. 'print') delete d 0 DELETE this entry (e.g. 'delete') refresh r 0 REFRESH this entry (e.g. 'refresh') |
The UI frevvo UI displays the projects belonging to the user david@monahan.com on the projects home page.
...
You can use the apps > down and up commands to download projects to a local drive and upload them to the serverfrevvo server.
Download
In the UIfrevvo UI, you can download projects individually, and select the destination directory.
In this example, down downloads all the projects in the tenant to a directory on the local machine. Since down takes no arguments, the target directory depends on your local machine settings.
...
Upload
In the UIfrevvo UI, you can upload projects from the projects page.
...
As with downloading projects, in the UIfrevvo UI, you can download individual forms and workflows and select the destination directory when you're editing a project on the projects home page.
...
Code Block |
---|
localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book> edit Editing form: http://localhost:8082/frevvo/web/tn/monahan.com/user/david/app/_W0jPga4rEeCMGZK99v93jw/formtype/_fNScEK4rE eCMGZK99v93jw?edit=true&embed=true&_method=post&apikey=IIGGTVxO1DtiDmUSnIiLzmXQjd6SGJ5c%252FpLVUNm%252FKE8AWzjV0xakncsLK l2aocCYxj3lHuYWNr5q4Su8O%252FQlyQ%253D%253D localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book> |
You can edit the form in the designer as if you had logged in through the UI. Make any changes you want to the form, and then click Finish or Cancel to exit the designer. You return to the UI login page.
...
Once you've selected a form, you can use it; this is, you can run the form as an end-user would. See the Editing a Form/Workflow topic above for instruction on selecting a form. Then simply type use at the command prompt and press Enter. opens frevvo opens the form or workflow in your browser.
...
Now, the purchaseorder.xsd has been upload uploaded and you can verify that this is the case by going directly to the UI frevvo UI in Projects→Schemas. Please copy the NAMESPACE shown in the result as you will use it in the next steps.
...
Now that we have a new form, we need to add a new XSD data source to the form using the API, which is the equivalent to adding a new data source in the designer by clicking the Data Sources panel and then clicking New from XSD as shown in the following screenshots.
displays frevvo displays the available schemas in the current project. You can then click to select the XSD you want to use. adds frevvo adds it to the Data Sources panel.
...
Click next to form to add all the controls to the new form, or click the individual controls you want. frevvo adds them to the form. Click Finish when you're done to exit the UI.
You can now use the new form from the command line.
...