Sunday, March 25, 2012

Use Case and ACLs

These last two weeks I have been working mostly on the design of the application. This is what I currently have:

  • One activity where the user can select between two different google accounts - this has to be modified, so that the application can only use one account. 
  • One tab layout with two tabs, each of them being an activity.
    • The first tab allows the user to see what they have in the database - also has for each entry an ImageButton, which, when clicked, deletes the selected entry. 
    • The second tab allows the user to add an entry to the database. It contains of one simple EditText, one multiline EditText and one DatePicker
Next, I am going to demonstrate an Use Case - Add and Delete of a task. 
The user has in the database two tasks, a Meeting and an Exam. In the next step I add a task, named Conference.


The new Task is now visible in the first tab. Next I delete the task named Meeting by clicking on the ImageButton.

This what the user has in the database at the end.

I had a hard time creating a multiline EditText, but I realized the problem was that I was disabling the virtual keyboard:
/*Get the EditText for task description*/
note = (EditText) findViewById(R.id.note);
/*Hide virtual keyboard*/
note.setInputType(InputType.TYPE_NULL);
When the virtual keyboard is disabled, the EditText will be singleline (setting the inputType to textMultiLine has no effect in this case). I solved this by removing the code which disables the keyboard, and adding in the xml file android:editable="false".
<EditText
    android:id="@+id/note"
    android:hint="Description..."
    android:layout_width="fill_parent"
    android:layout_height="100dip"
    android:gravity="top|left"
    android:inputType="textMultiLine"
    android:editable="false">
</EditText>
For next week, I discussed with my colleague and we are going to start implementing Access Control Lists. On the server side, he currently has implemented namespaces, but only the basic approach - every user has one namespace. We are going to allow users to create groups and add other members to the group. For this, I am going to have an Administrator option in the menu, where the user can create new groups.

Another important thing about this approach is that the users must have assigned roles. For example, the owner of the group will be able to add and delete tasks from the common database of the group. He is going to be the group administrator. Simple members cannot delete or add tasks. In the future, we are thinking about enabling administrators to add another administrators to the group. 

All members of one group share the same namespace, so they share the data from the database. This feature is very important for companies for example, which prefer to have a common database for all employees. Monitoring the activity and maintenance is a lot easier.

Tuesday, March 13, 2012

This week's future work

Writing the goals for a week and then checking the result is a great way to monitor the progress of what I do. This is exactly what I am going to do, so that efficiency is maximum. What I want to accomplish this week is:

Finish the client application design. I currently have an application which displays the google accounts that the user has in his phone, and when one of them is clicked, an activity creates two tabs.

The first tab is selected by default, and here it should appear the user's database from the cloud. Currently this is not happening. When the second tab is selected, the user should be able to add a Task to his database (and the server database should be updated). This also is not yet available.
  • When the first tab is selected, the application displays the user's database from the cloud. 
    • Find a way to return to the main Activity the authenticated HttpClient (so I can use it then with GET, POST or any method that the user tries to make).
    • When setListAdapter is called, the result should be displayed in the first tab activity in a pleasant way.
  • Make the graphic design for the second tab
    • Add 3 EditTexts and a button to add the Task.
    • The user should be able to select the date in a familiar way, something like Date Picker
    • When the button is clicked, the server database should be updated and the server database should also contain the new added Task.
My biggest problem last week was Authentication. A client can only call the GET method if he is authenticated (my colleague did the authentication with google accounts for the server). I tried different methods to authenticate, not knowing the best one. I also had troubles finding the best approach:
  • At the beginning I tried to authenticate in a different activity, but I realized this is not appropriate for what I am trying to do ( I don't need a new Activity, as the work should be done in background, without interacting with the user )
  • Next, I tried using a Service, but as I found out, a Service should be used if the background job is  some CPU intensive time consuming job.
  • What I am trying now is with AsyncTask. I am having problems sending results from the new thread to the UI thread, though. 
This issue is first on my To Do list, I will let you know my results. 

Thursday, March 1, 2012

Work breakdown structure

A work breakdown structure (WBS) is a decomposition of a project into smaller parts. This kind of structure is useful because it helps you keep track of your progress, and also with every little step you make you feel more confident and closer to the expected result. My project can be divided into these components:
  1. An application which at initialization synchronizes the local database with the cloud database automatically. Each time one client modifies a data, the client database stored on the server is updated accordingly, copying the whole database on the server.
    • initialize the local database when the client application starts - 1 hour
    • implement all the methods (POST, PUT, DELETE, GET) with AsyncTask, so with different threads - 2 hours
    • change the application design - from adding contacts to adding tasks - 3 hours
    • redo the graphic design - 1 day
  2. The difference between this application and the one before is that when a client modifies a data on the local database, the server copy is updated only with Delta updates (so it copies only the data that was modified, not the whole database). This will significantly save time and bandwidth. - 2 days
  3. The Internet connection is not always available, so the client must support offline work. When the connection becomes available, the databases are synchronized. - 1 day
This is only for the near future. When I finish these tasks I will update the blog, writing the next steps.