diff --git a/pom.xml b/pom.xml
index 84a0dc2..7fde442 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,26 +59,82 @@
2.2.1
provided
+
+
+ com.j256.ormlite
+ ormlite-core
+ jar
+ 4.40
+ compile
+
+
+
+ com.j256.ormlite
+ ormlite-android
+ jar
+ 4.40
+ compile
+
+
+
+ org.simpleframework
+ simple-xml
+ 2.6.4
+ jar
+ compile
+
+
+
+ stax
+ stax
+
+
+ stax-api
+ stax
+
+
+
+ xpp3
+ xpp3
+
+
+
+
+
+
+
-
-
- com.jayway.maven.plugins.android.generation2
- android-maven-plugin
- 3.2.0
-
-
- 7
-
-
- android-7
-
- true
- true
-
- true
-
-
+
+
+
+
+ maven-compiler-plugin
+ 2.3
+
+ 1.6
+ 1.6
+
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+ 3.2.0
+
+
+ 7
+
+
+ android-7
+
+ true
+ true
+
+ true
+
+
+
diff --git a/xwiki-android-client/default.properties b/xwiki-android-client/default.properties
deleted file mode 100644
index 1dfaa5b..0000000
--- a/xwiki-android-client/default.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-7
-
diff --git a/xwiki-android-client/project.properties b/xwiki-android-client/project.properties
index 999ef01..e206d00 100644
--- a/xwiki-android-client/project.properties
+++ b/xwiki-android-client/project.properties
@@ -8,11 +8,10 @@
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
-
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-7
-android.library.reference.1=..\\xwiki-android-components
-android.library.reference.2=..\\xwiki-android-rest
android.library.reference.3=../xwiki-android-core
+android.library.reference.1=../xwiki-android-rest
+android.library.reference.2=../xwiki-android-components
diff --git a/xwiki-android-client/res/layout/blog_editor_dialog.xml b/xwiki-android-client/res/layout/blog_editor_dialog.xml
index e3a8087..12bf7bc 100644
--- a/xwiki-android-client/res/layout/blog_editor_dialog.xml
+++ b/xwiki-android-client/res/layout/blog_editor_dialog.xml
@@ -15,13 +15,14 @@
android:layout_weight="2"
android:text="Title"
android:textAppearance="?android:attr/textAppearanceMedium" />
-
+
+ android:inputType="textPersonName"
+ android:text="demoPage" >
@@ -40,13 +41,13 @@
android:layout_weight="2"
android:text="Category"
android:textAppearance="?android:attr/textAppearanceMedium" />
-
+
+ android:text="Blog.Personal" />
diff --git a/xwiki-android-client/src/demo_tutorials/_01_CreateDocument.java b/xwiki-android-client/src/demo_tutorials/_01_CreateDocument.java
new file mode 100644
index 0000000..b3ed5bc
--- /dev/null
+++ b/xwiki-android-client/src/demo_tutorials/_01_CreateDocument.java
@@ -0,0 +1,50 @@
+package demo_tutorials;
+
+import org.xwiki.android.blog.xobj.XBlogPost;
+import org.xwiki.android.ral.RaoException;
+import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.svc.DocumentRemoteSvcCallbacks;
+import org.xwiki.android.xmodel.svc.DocumentRemoteSvcs;
+import org.xwiki.android.xmodel.svc.DocumentSvcImpl;
+
+
+public class _01_CreateDocument
+{
+ public void demo(){
+
+ Document mydoc=new Document("wikiName", "spaceName", "pageName");//create empty document
+ //lets make a Blog.BlogPostClass object to put into mydoc.
+ // in XA all model objects,classes, properties are prefixed with X.
+ XBlogPost blgpstObj=new XBlogPost(); // Blog.BlogPostClass is know as ...blog.xobj.XBlogPost. Here we have removed
+ // the suffix Class and added a prefix X.
+
+ //lets edit some properties of the XBlogPost object
+ blgpstObj.setContent("This blog post is created with Xwiki Android");
+ mydoc.addObject(blgpstObj);
+
+ DocumentRemoteSvcs docsvc=new DocumentSvcImpl();// the current implementation for DocumentRemoteSvcs is this.
+
+ //docsvc can be used to creat the document on the server. The service uses a seperate thread to do all the work.
+ //The results are given through a callback.
+
+ DocumentRemoteSvcCallbacks clbk=new DocumentRemoteSvcCallbacks()
+ {
+ @Override
+ public void onCreated(Document res, boolean success, RaoException ex)
+ {
+ if(success){
+ // update ui here. You can notify the user that the doc was created in the server.
+ }else{
+ //you can check what the exception is and try to rectify.
+ //Most probably this same document is already existing in the server. So you should delete
+ //the already existing one and recreate. Or you can do a simple update by docsvc.update(mydoc, clbk);
+ }
+ }
+ };
+ docsvc.create(mydoc,clbk); //ok the docsvc does all the work of creating a page for the document and then adding
+ // all those objects,tags,comments and attachments in the document.
+
+
+ }
+}
diff --git a/xwiki-android-client/src/demo_tutorials/_02_AdvancedObjectEditing.java b/xwiki-android-client/src/demo_tutorials/_02_AdvancedObjectEditing.java
new file mode 100644
index 0000000..c13fd63
--- /dev/null
+++ b/xwiki-android-client/src/demo_tutorials/_02_AdvancedObjectEditing.java
@@ -0,0 +1,26 @@
+package demo_tutorials;
+
+import org.xwiki.android.blog.xobj.XBlogPost;
+import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.xobjects.XBooleanProperty;
+
+
+public class _02_AdvancedObjectEditing
+{
+ public void demo(){
+
+ Document mydoc=new Document("wikiName", "spaceName", "pageName");//create empty document
+ XBlogPost blgpstObj=new XBlogPost();
+ blgpstObj.setHidden(true);//simple way to edit the value of "hidden" property of XBlogPost.
+
+ //say, now we want to do some advanced stuff with that property.
+ XBooleanProperty hiddenP= blgpstObj.getpHidden();// use getp, setp methods to get the property.
+ //lets change hidden again.
+ hiddenP.setValue(false);
+ //change an attribute of the property.
+ hiddenP.setPrettyName("Hidden pretty name");
+
+ //Since a reference is passed, you do not have to blgpstObj.setpHidden(hiddenP) to commit the effects.
+
+ }
+}
diff --git a/xwiki-android-client/src/demo_tutorials/_03_SaveDocument.java b/xwiki-android-client/src/demo_tutorials/_03_SaveDocument.java
new file mode 100644
index 0000000..ed2101d
--- /dev/null
+++ b/xwiki-android-client/src/demo_tutorials/_03_SaveDocument.java
@@ -0,0 +1,23 @@
+package demo_tutorials;
+
+import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.svc.DocumentLocalSvcs;
+import org.xwiki.android.xmodel.svc.DocumentSvcImpl;
+
+public class _03_SaveDocument
+{
+ public void demo(){
+
+ Document mydoc=new Document("wikiName", "spaceName", "pageName");//create empty document
+ // ... edit mydoc
+
+ //lets save it!
+
+ DocumentLocalSvcs docsvcl=new DocumentSvcImpl();
+
+ docsvcl.save(mydoc, "My tag to identify this easily", null);//docsvcl.save(doc, tag, clbk). we pass null for clbk
+ // since we do not want to know wether the doc was sucessfully
+ // saved or not.
+
+ }
+}
diff --git a/xwiki-android-client/src/demo_tutorials/_04_SaveDocumentAdv.java b/xwiki-android-client/src/demo_tutorials/_04_SaveDocumentAdv.java
new file mode 100644
index 0000000..dc9e666
--- /dev/null
+++ b/xwiki-android-client/src/demo_tutorials/_04_SaveDocumentAdv.java
@@ -0,0 +1,35 @@
+package demo_tutorials;
+
+import java.io.File;
+
+import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.svc.DocumentLocalSvcCallbacks;
+import org.xwiki.android.xmodel.svc.DocumentLocalSvcs;
+import org.xwiki.android.xmodel.svc.DocumentSvcImpl;
+
+public class _04_SaveDocumentAdv
+{
+ public void demo(){
+
+ Document mydoc=new Document("wikiName", "spaceName", "pageName");//create empty document
+ // ... edit mydoc
+
+
+ DocumentLocalSvcs docsvcl=new DocumentSvcImpl();
+ DocumentLocalSvcCallbacks clbk=new DocumentLocalSvcCallbacks()
+ {
+ @Override
+ public void onSaveComplete(File savedto)
+ {
+ if(savedto!=null){
+ //success. Edit UI to notify user here.
+ }else{
+ //oops problem. May be the device storage is full.
+ }
+
+ }
+ };
+ docsvcl.save(mydoc, "My tag to identify this easily", null);
+
+ }
+}
diff --git a/xwiki-android-client/src/demo_tutorials/_05_ListAndLoadDocuments.java b/xwiki-android-client/src/demo_tutorials/_05_ListAndLoadDocuments.java
new file mode 100644
index 0000000..f23305b
--- /dev/null
+++ b/xwiki-android-client/src/demo_tutorials/_05_ListAndLoadDocuments.java
@@ -0,0 +1,53 @@
+package demo_tutorials;
+
+import java.util.List;
+import java.util.Map;
+
+import org.xwiki.android.fileStore.FSDocumentReference;
+import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.svc.DocumentLocalSvcCallbacks;
+import org.xwiki.android.xmodel.svc.DocumentLocalSvcs;
+import org.xwiki.android.xmodel.svc.DocumentSvcImpl;
+
+import android.app.Activity;
+
+public class _05_ListAndLoadDocuments extends Activity
+{
+
+ FSDocumentReference loadMe;
+ DocumentLocalSvcs ds;
+
+ protected void onCreate(android.os.Bundle savedInstanceState)
+ {
+
+ ds = new DocumentSvcImpl();
+
+ DocumentLocalSvcCallbacks clbk1 = new DocumentLocalSvcCallbacks()
+ {
+ @Override
+ public void onListingComplete(List rslts, Map matchedby)
+ {
+ // matched by will contain entry ("space", "MySpace")
+ loadMe = rslts.get(0);
+ loadThis(loadMe);
+ }
+ };
+
+ ds.listBySpace("MySpace", clbk1);
+ // after the listing is complete you will be notified in the onListingComplete.
+ }
+
+ private void loadThis(FSDocumentReference ref)
+ {
+ DocumentLocalSvcCallbacks clbk2 = new DocumentLocalSvcCallbacks()
+ {
+ @Override
+ public void onLoadComplete(Document entity)
+ {
+ //entity is the loaded document.
+ }
+ };
+ ds.load(ref, clbk2);
+ }
+
+}
diff --git a/xwiki-android-client/src/demo_tutorials/remove package from production b/xwiki-android-client/src/demo_tutorials/remove package from production
new file mode 100644
index 0000000..e69de29
diff --git a/xwiki-android-client/src/org/xwiki/android/client/blog/EditPostActivity.java b/xwiki-android-client/src/org/xwiki/android/client/blog/EditPostActivity.java
index bdc761e..d897dfa 100644
--- a/xwiki-android-client/src/org/xwiki/android/client/blog/EditPostActivity.java
+++ b/xwiki-android-client/src/org/xwiki/android/client/blog/EditPostActivity.java
@@ -20,6 +20,7 @@
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
+import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
@@ -35,7 +36,10 @@ public class EditPostActivity extends Activity implements OnClickListener {
private EditText etPost;
private String title;
private String category;
-
+ ProgressDialog progressDialog;
+ Dialog dialog;
+ EditText etTitle;
+ AutoCompleteTextView actvCategory;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -54,14 +58,14 @@ protected void onCreate(Bundle savedInstanceState) {
//show dialog to get page name, category
showDialog();
- mydoc=new BlogDocument("xwiki", "Blog", title);
+
}
private void showDialog(){
- final Dialog dialog = new Dialog(this);
+ dialog = new Dialog(this);
dialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
@@ -72,22 +76,27 @@ private void showDialog(){
dialog.show();
Button okBtn = (Button) dialogView.findViewById(R.id.btn_blog_ok);
- final EditText etTitle=(EditText) dialogView.findViewById(R.id.et_blog_title);
- final AutoCompleteTextView actvCategory=(AutoCompleteTextView) dialogView.findViewById(R.id.actv_blog_category);
-
+ etTitle=(EditText) dialogView.findViewById(R.id.et_blog_title);
+ actvCategory=(AutoCompleteTextView) dialogView.findViewById(R.id.actv_blog_category);
+
+ String[] categories={"Blog.Personal","Blog.News","Blog.Other"};
+ ArrayAdapter adapterCts=new ArrayAdapter(this, R.layout.searchresults_list_item, categories);
+ actvCategory.setAdapter(adapterCts);
+
okBtn.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- title=etTitle.getText().toString();
- category=actvCategory.getText().toString();
- if(title==null || category==null || title.equals("") || category.equals("")){
- Toast.makeText(getBaseContext(), "Please fill data",
- Toast.LENGTH_LONG).show();
- }else{
- dialog.dismiss();
- }
- }
- });
+ @Override
+ public void onClick(View v) {
+ title=etTitle.getText().toString();
+ category=actvCategory.getText().toString();
+ if(title==null || category==null || title.equals("") || category.equals("")){
+ Toast.makeText(getBaseContext(), "Please fill data",
+ Toast.LENGTH_LONG).show();
+ }else{
+ mydoc=new BlogDocument("xwiki", "Blog", title, category);
+ dialog.dismiss();
+ }
+ }
+ });
}
@Override
@@ -113,26 +122,24 @@ public void onClick(View v) {
ctx.put("blgDoc", mydoc);
startActivityForResult(i,REQUEST_CODE_LOADSAVEDPOSTS);
- }else if(v.getId()==R.id.btnPost){
- final ProgressDialog myProgressDialog;
- myProgressDialog =ProgressDialog.show(this, "Posting", "Please wait...", true);
+ }else if(v.getId()==R.id.btnPost){
+ progressDialog =progressDialog.show(this, "Posting", "Please wait...", true);
myRmtClbks=mydoc.new BlogDocumentRemoteCallbacks() {
@Override
public void onBlogPostSent(boolean success) {
- myProgressDialog.dismiss();
+ progressDialog.dismiss();
finish();
}
};
mydoc.setContent(etPost.getText().toString());
mydoc.post(myRmtClbks);
- }else if(v.getId()==R.id.btnPublish){
- final ProgressDialog myProgressDialog;
- myProgressDialog =ProgressDialog.show(this, "Publishing", "Please wait...", true);
+ }else if(v.getId()==R.id.btnPublish){
+ progressDialog =progressDialog.show(this, "Publishing", "Please wait...", true);
myRmtClbks=mydoc.new BlogDocumentRemoteCallbacks(){
@Override
public void onBlogPostSent(boolean success) {
- myProgressDialog.dismiss();
+ progressDialog.dismiss();
finish();
}
};
diff --git a/xwiki-android-client/src/org/xwiki/android/client/dev/QuickTest.java b/xwiki-android-client/src/org/xwiki/android/client/dev/QuickTest.java
index 768df20..561bed8 100644
--- a/xwiki-android-client/src/org/xwiki/android/client/dev/QuickTest.java
+++ b/xwiki-android-client/src/org/xwiki/android/client/dev/QuickTest.java
@@ -10,7 +10,6 @@
import org.xwiki.android.ral.RESTfulManager;
import org.xwiki.android.ral.XmlRESTFulManager;
import org.xwiki.android.xmodel.entity.Document;
-import org.xwiki.android.xmodel.entity.SimpleDocument;
import com.j256.ormlite.dao.Dao;
diff --git a/xwiki-android-components/pom.xml b/xwiki-android-components/pom.xml
index 7bcc688..05bbdea 100644
--- a/xwiki-android-components/pom.xml
+++ b/xwiki-android-components/pom.xml
@@ -41,8 +41,7 @@
xwiki-android-core
apklib
${project.version}
-
-
+
diff --git a/xwiki-android-core/pom.xml b/xwiki-android-core/pom.xml
index 9c96259..887a553 100644
--- a/xwiki-android-core/pom.xml
+++ b/xwiki-android-core/pom.xml
@@ -46,14 +46,15 @@
com.j256.ormlite
ormlite-core
jar
- 4.40
+ 4.40
+ compile
com.j256.ormlite
ormlite-android
jar
4.40
-
+ compile
diff --git a/xwiki-android-core/src/org/xwiki/android/blog/svc/BlogDocument.java b/xwiki-android-core/src/org/xwiki/android/blog/svc/BlogDocument.java
index 552504b..b8cd57f 100644
--- a/xwiki-android-core/src/org/xwiki/android/blog/svc/BlogDocument.java
+++ b/xwiki-android-core/src/org/xwiki/android/blog/svc/BlogDocument.java
@@ -10,7 +10,7 @@
import org.xwiki.android.fileStore.FSDocumentReference;
import org.xwiki.android.ral.RaoException;
import org.xwiki.android.xmodel.entity.Document;
-import org.xwiki.android.xmodel.entity.SimpleDocument;
+import org.xwiki.android.xmodel.entity.Document;
import org.xwiki.android.xmodel.svc.DocumentLocalSvcCallbacks;
import org.xwiki.android.xmodel.svc.DocumentSvc;
import org.xwiki.android.xmodel.svc.DocumentRemoteSvcCallbacks;
@@ -24,19 +24,23 @@
public class BlogDocument implements Serializable
{
public static final String SAVE_TAG="svdBlgPst";
- SimpleDocument doc;
+ Document doc;
XBlogPost blgPost;
- String xBlogPostType="Blog.BlogPostClass";
-
- boolean docInitialized;
-
+ String xBlogPostType="Blog.BlogPostClass";
DocumentSvc docsvc;
- public BlogDocument(String wikiName, String spaceName, String pageName)
+ public BlogDocument(String wikiName, String spaceName, String pageName, String category)
{
- doc = new SimpleDocument(wikiName, spaceName, pageName);
- docInitialized = false;
+ doc = new Document(wikiName, spaceName, pageName);
+ blgPost = new XBlogPost();
+ doc.addObject(blgPost);
+ doc.setTitle(doc.getSimpleName());
+ blgPost.setTitle(doc.getTitle());
+ blgPost.setCategory(category);
+ blgPost.setHidden(false);
+
+
docsvc = new DocumentSvcImpl();
// DocumentSvc construction code was not sent to XWikiApplication Context. Rationale: We will eventually go to
// Android native Bind Services.
@@ -48,10 +52,7 @@ public BlogDocument(String wikiName, String spaceName, String pageName)
// It is the blog svc layers knowledge that the content should go to a XBlogPost(-->BlogPostClass in Xwiki
// Enterprise) object.
public void setContent(String content)
- {
- if (!docInitialized) {
- initializeDoc();
- }
+ {
blgPost.setContent(content);// blgPost is the XBlogPost obj in the doc.
}
@@ -100,12 +101,7 @@ public void listBlogDocuments(BlogDocumentLocalCallbacks clbk)
*/
private void initializeDoc()
{
- blgPost = new XBlogPost();
- doc.addObject(blgPost);
- doc.setTitle(doc.getSimpleName());
- blgPost.setTitle(doc.getTitle());
- blgPost.setCategory("Blog.Personal");
- blgPost.setHidden(false);
+
}
/**
@@ -171,7 +167,7 @@ public void onListingComplete(List rslts, Map keys= doc.getAllObjects().keySet();
for(String key:keys){
diff --git a/xwiki-android-core/src/org/xwiki/android/dal/EntityManager.java b/xwiki-android-core/src/org/xwiki/android/dal/EntityManager.java
index 886cb45..15fbfd6 100644
--- a/xwiki-android-core/src/org/xwiki/android/dal/EntityManager.java
+++ b/xwiki-android-core/src/org/xwiki/android/dal/EntityManager.java
@@ -12,7 +12,7 @@
import org.xwiki.android.entity.User;
import org.xwiki.android.fileStore.FSDocumentReference;
import org.xwiki.android.ral.reference.DocumentReference;
-import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.entity.DocumentBase;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.support.ConnectionSource;
diff --git a/xwiki-android-core/src/org/xwiki/android/fileStore/FSDocumentReference.java b/xwiki-android-core/src/org/xwiki/android/fileStore/FSDocumentReference.java
index 05d4502..f6f4ce8 100644
--- a/xwiki-android-core/src/org/xwiki/android/fileStore/FSDocumentReference.java
+++ b/xwiki-android-core/src/org/xwiki/android/fileStore/FSDocumentReference.java
@@ -10,7 +10,7 @@
@DatabaseTable(tableName = "FS_DOC_REF")
public class FSDocumentReference extends DocumentReference
{
- @DatabaseField(id = true)
+ @DatabaseField(generatedId=true)
private int _id;// local id for persistence. "_" to comply with android adapters. No need to set. Set by ORMlite
/**
@@ -18,7 +18,7 @@ public class FSDocumentReference extends DocumentReference
*/
protected File file;
- @DatabaseField()
+ @DatabaseField(unique=true)
protected String filePath;
@DatabaseField
diff --git a/xwiki-android-core/src/org/xwiki/android/fileStore/FileStoreManager.java b/xwiki-android-core/src/org/xwiki/android/fileStore/FileStoreManager.java
index 430729b..42c98a8 100644
--- a/xwiki-android-core/src/org/xwiki/android/fileStore/FileStoreManager.java
+++ b/xwiki-android-core/src/org/xwiki/android/fileStore/FileStoreManager.java
@@ -2,7 +2,7 @@
import java.io.File;
-import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.entity.DocumentBase;
public interface FileStoreManager
{
diff --git a/xwiki-android-core/src/org/xwiki/android/fileStore/FileStoreManagerImpl.java b/xwiki-android-core/src/org/xwiki/android/fileStore/FileStoreManagerImpl.java
index 1938154..cfbe7a4 100644
--- a/xwiki-android-core/src/org/xwiki/android/fileStore/FileStoreManagerImpl.java
+++ b/xwiki-android-core/src/org/xwiki/android/fileStore/FileStoreManagerImpl.java
@@ -3,7 +3,7 @@
import java.io.File;
import org.xwiki.android.context.XWikiApplicationContext;
-import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.entity.DocumentBase;
import android.content.Context;
diff --git a/xwiki-android-core/src/org/xwiki/android/ral/RaoCallback.java b/xwiki-android-core/src/org/xwiki/android/ral/RaoCallback.java
index ab16417..50f71c9 100644
--- a/xwiki-android-core/src/org/xwiki/android/ral/RaoCallback.java
+++ b/xwiki-android-core/src/org/xwiki/android/ral/RaoCallback.java
@@ -3,7 +3,7 @@
import java.io.IOException;
import java.util.List;
-import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.entity.DocumentBase;
public interface RaoCallback
{
diff --git a/xwiki-android-core/src/org/xwiki/android/ral/XmlDocumentRao.java b/xwiki-android-core/src/org/xwiki/android/ral/XmlDocumentRao.java
index a223c23..47fabd6 100644
--- a/xwiki-android-core/src/org/xwiki/android/ral/XmlDocumentRao.java
+++ b/xwiki-android-core/src/org/xwiki/android/ral/XmlDocumentRao.java
@@ -16,7 +16,7 @@
import org.xwiki.android.rest.Requests;
import org.xwiki.android.rest.XWikiRestfulAPI;
import org.xwiki.android.xmodel.entity.Document;
-import org.xwiki.android.xmodel.entity.SimpleDocument;
+import org.xwiki.android.xmodel.entity.Document;
/**
* @author xwiki gsoc 2012
@@ -48,7 +48,7 @@ public XmlDocumentRao(RaoCallbackForDocument callback)
public void create(Document res)
{// Only simpleDocument is supported yet.
// TODO:multiple connections can be handled at HTTPClient also.Research needed.
- ConnectionThread con1 = new ConnectionThread((SimpleDocument) res)
+ ConnectionThread con1 = new ConnectionThread(res)
{
public void run()
{
@@ -127,7 +127,7 @@ public void run()
private abstract class ConnectionThread extends Thread
{
- SimpleDocument doc;
+ Document doc;
DocumentReference dref;
@@ -136,7 +136,7 @@ private abstract class ConnectionThread extends Thread
dref = docref;
}
- ConnectionThread(SimpleDocument d)
+ ConnectionThread(Document d)
{
doc = d;
}
diff --git a/xwiki-android-core/src/org/xwiki/android/ral/transformation/XMdlToSmplConverter.java b/xwiki-android-core/src/org/xwiki/android/ral/transformation/XMdlToSmplConverter.java
index 4b05bdc..93fb469 100644
--- a/xwiki-android-core/src/org/xwiki/android/ral/transformation/XMdlToSmplConverter.java
+++ b/xwiki-android-core/src/org/xwiki/android/ral/transformation/XMdlToSmplConverter.java
@@ -13,7 +13,7 @@
import org.xwiki.android.resources.Property;
import org.xwiki.android.resources.Translation;
import org.xwiki.android.resources.Translations;
-import org.xwiki.android.xmodel.entity.SimpleDocument;
+import org.xwiki.android.xmodel.entity.Document;
import org.xwiki.android.xmodel.xobjects.XProperty;
import org.xwiki.android.xmodel.xobjects.XSimpleObject;
@@ -53,7 +53,7 @@ public XMdlToSmplConverter()
parts = PAGE + OBJECTS;
}
- public SimpleXmlDocpad convertDocument(SimpleDocument doc)
+ public SimpleXmlDocpad convertDocument(Document doc)
{
SimpleXmlDocpad pad = new SimpleXmlDocpad();
// save coordinates
diff --git a/xwiki-android-core/src/org/xwiki/android/ral/wrappers/DocumentWrapper.java b/xwiki-android-core/src/org/xwiki/android/ral/wrappers/DocumentWrapper.java
index e12ad92..c79f961 100644
--- a/xwiki-android-core/src/org/xwiki/android/ral/wrappers/DocumentWrapper.java
+++ b/xwiki-android-core/src/org/xwiki/android/ral/wrappers/DocumentWrapper.java
@@ -1,10 +1,10 @@
package org.xwiki.android.ral.wrappers;
-import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.entity.DocumentBase;
public interface DocumentWrapper // extends DocumentInterface
{
- Document unWrap();
+ DocumentBase unWrap();
DocumentWrapper unWrapOnce();
}
diff --git a/xwiki-android-core/src/org/xwiki/android/xmodel/entity/Document.java b/xwiki-android-core/src/org/xwiki/android/xmodel/entity/Document.java
index bbf8070..8581b39 100644
--- a/xwiki-android-core/src/org/xwiki/android/xmodel/entity/Document.java
+++ b/xwiki-android-core/src/org/xwiki/android/xmodel/entity/Document.java
@@ -1,561 +1,257 @@
package org.xwiki.android.xmodel.entity;
-import java.io.InputStream;
-import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Hashtable;
import java.util.List;
import java.util.Map;
-import org.xwiki.android.ral.RestAPIUsageException;
import org.xwiki.android.ral.reference.DocumentReference;
-import org.xwiki.android.ral.reference.Link;
import org.xwiki.android.xmodel.xobjects.XObject;
import org.xwiki.android.xmodel.xobjects.XSimpleObject;
-import com.j256.ormlite.field.DatabaseField;
-import com.j256.ormlite.table.DatabaseTable;
+import android.text.AlteredCharSequence;
/**
- * Contains the properties of a Page +Additional methods for Document.
- *
- * @author xwiki dev: not saved to DB. Only the DocumentReference is saved.
+ * @author xwiki gsoc 2012 A document that supports only SimpleObjects. Simple Objects are shallow objects that can have
+ * only XProperties for property fields.
*/
-
-public abstract class Document extends Resource
+public class Document extends DocumentBase
{
- // Resource fields
- //
- protected List links;
-
- protected String remoteId;// id field in the resource representation. Mobile apps normally use ReSTful URL to
- // identify a resource.Not this.
-
- protected String fullName;
-
- protected String wikiName;// wiki in page element
-
- protected String spaceName;// space in page element
-
- protected String name; // name in page element (same)
-
- protected String title;
+ // things in a retreived document.
+ private DocumentBase parent;
- protected String parentFullName;// parent in resoruce repr.
+ private List children;
- protected String parentId;
+ private Map objects; // key= ClassName/number
- protected String xwikiRelativeUrl;
+ private List comments; // key = int index in the list
- protected String xwikiAbsoluteUrl;
+ private Map attatchments;// key = resource id. ex: xwiki:Blog.BlogPost1@mypic can have space.png
- protected List translations;
+ private List tags; // search by key not needed
- protected String defalutTranslation;
+ // resources that get newly added.
+ // no keys. These are to be posted to server.Server will define the keys after these resources are posted.
+ private List newObjects;
- protected String syntax;
+ private List newComments;
- protected String language;
+ private List newAttachments;
- protected String version;
+ private List newTags;
- protected int majorVersion;
+ // resources to update
- protected int minorVersion;
+ private Map editedObjects; // key= ClassName/number
- protected String created; // Date string //TODO: convert to Type Date. Or introduce another var to hold Date obj.
+ private List editedComments; // key = int index in the list
- protected String creator; // user string
+ private Map editedAttachments;// key = resource id. ex: xwiki:Blog.BlogPost1@mypic can have
+ // space.png
- protected String modified; // Date string
+ private List editedTags; // search by key not needed
- protected String modifier; // user string
+ // resources to delete
+ private List deletedObjects; // value= of the deleted obj. ClassName/number
- protected String content;
+ private List deletedComments; // key = int index in the list
- // other fields
- protected DocumentReference docRef;
+ private List deletedAttachments;// key = resource id. ex: xwiki:Blog.BlogPost1@mypic can have space.png
- protected boolean offlineMode;
-
-
+ private List deletedTags; // search by key not needed
public Document(String wikiName, String spaceName, String pageName)
{
- docRef = new DocumentReference(wikiName, spaceName, pageName);
- this.name = pageName;
- this.wikiName = wikiName;
- this.spaceName = spaceName;
- }
-
- /**
- * @return
- */
- public DocumentReference getDocumentReference()
- {
- return docRef;
- }
-
- /**
- * @param
- */
- public void setDocumentReference(DocumentReference docRef)
- {
- this.docRef = docRef;
- }
-
- /**
- * if in offline mode the create(), update ... methods will use the save method to save a local copy. The delete
- * method will mark the document for deletion. The sync service will take the responsibilities after internet
- * connection is available. *
- *
- * @param val
- */
- public void setOfflineMode(boolean val)
- {
- this.offlineMode = val;
- }
-
- public boolean isOfflineMode()
- {
- return offlineMode;
- }
-
- // /**
- // * valid for only Documents retreived from server.
- // * @return
- // */
- // public boolean isCachedCopy(){
- // return offlineMode;
- // }
-
- /**
- * moved away to SimpleDocument. If XWiki introduces CompoundDocuments with Compound objects defining them here
- * might lead to probs public abstract XObject getObject(String key); public abstract void setObject(String key,
- * XObject object); public abstract void addObject(XObject obj); public abstract void deleteObject(String key);
- **/
- // TODO: Implement similar methods for Comments...
-
- // TODO: public abstract InputStream getAttachmentData(Attachment a);
- // TODO: public abstract ... setAttachmentData(byte[]);
-
- // resource value getter setters
- // -----------------------------
-
- /**
- * Gets the value of the id property.
- *
- * @return possible object is {@link String }
- */
- public String getRemoteId()
- {
- return remoteId;
- }
-
- /**
- * Sets the value of the id property.
- *
- * @param value allowed object is {@link String }
- */
- public void setRemoteId(String value)
- {
- this.remoteId = value;
- }
-
- /**
- * Gets the value of the fullName property. *
- *
- * @return possible object is {@link String }
- */
- public String getFullName()
- {
- return fullName;
- }
-
- /**
- * Sets the value of the fullName property. *
- *
- * @param value allowed object is {@link String }
- */
- public void setFullName(String value)
- {
- this.fullName = value;
- }
-
- /**
- * Gets the value of the wiki property.
- *
- * @return possible object is {@link String }
- */
- public String getWikiName()
- {
- return wikiName;
- }
-
- /**
- * Sets the value of the wiki property.
- *
- * @param value allowed object is {@link String }
- */
- public void setWikiName(String value)
- {
- this.wikiName = value;
- }
-
- /**
- * Gets the value of the space property.
- *
- * @return possible object is {@link String }
- */
- public String getSpaceName()
- {
- return spaceName;
- }
+ super(wikiName, spaceName, pageName);
- /**
- * Sets the value of the space property.
- *
- * @param value allowed object is {@link String }
- */
- public void setSpaceName(String value)
- {
- this.spaceName = value;
- }
+ objects = new Hashtable();
+ newObjects = new ArrayList();
+ editedObjects = new Hashtable();
+ deletedObjects = new ArrayList();
- // TODO:Consider refactor rename back to getName() ? confuse with name,fullName ?
- /**
- * @return the value of the name property in the Rest model "Page" element..
- */
- public String getSimpleName()
- {
- return name;
- }
+ // TODO: implement
+ comments = new ArrayList();
+ newComments = new ArrayList();
- /**
- * Sets the value of the name property.
- *
- * @param value allowed object is {@link String }
- */
- public void setSimpleName(String value)
- {
- this.name = value;
- }
-
- /**
- * Gets the value of the title property.
- *
- * @return possible object is {@link String }
- */
- public String getTitle()
- {
- return title;
- }
-
- /**
- * Sets the value of the title property.
- *
- * @param value allowed object is {@link String }
- */
- public void setTitle(String value)
- {
- this.title = value;
}
/**
- * Gets the value of the parent property.
+ * When retrieving the object through get it will return the reference to the object in the list. Warning! For the
+ * current implementation, alterations done to the object will not get affected in the server unless the edited
+ * object is reset explicitly through setObject(String key, XSimpleObject object).
*
- * @return possible object is {@link String }
+ * @param key
+ * @return
*/
- public String getParentFullName()
+ public XSimpleObject getObject(String key)
{
- return parentFullName;
+ // TODO: When retreived by a RAL layer obj::- use isAltered method in Resource. use this to automatically
+ // identify altered objects
+ // and add them to editedObjects Map at the "ral.transformation" package.
+ XSimpleObject obj = objects.get(key);
+ obj.setAltered(true);
+ return obj;
}
/**
- * Sets the value of the parent property.
+ * Update a existing object in the doc. The update is done if the Object.isAltered returns true. This property is
+ * set by defalut, when the object is retrieved using getObject(key)
*
- * @param value allowed object is {@link String }
+ * @param key
+ * @param object
*/
- public void setParentFullName(String value)
+ public void setObject(String key, XSimpleObject object)
{
- this.parentFullName = value;
+ if (!objects.containsKey(key)) {
+ throw new IllegalArgumentException("you can only set objects which already exist in the map");
+ }
+ if (object.isAltered()) {
+ editedObjects.put(key, object);
+ }
+ objects.put(key, object);
}
- /**
- * Gets the value of the parentId property.
- *
- * @return possible object is {@link String }
- */
- public String getParentId()
- {
- return parentId;
- }
+ private int _addNum = 0;
/**
- * Sets the value of the parentId property.
- *
- * @param value allowed object is {@link String }
+ * @param obj
+ * @return the auto generated key for this object. key is /new/
*/
- public void setParentId(String value)
+ public String addObject(XSimpleObject obj)
{
- this.parentId = value;
+ String key = obj.getType() + "/new/" + _addNum++;
+ obj.setNew(true);
+ objects.put(key, obj);
+ newObjects.add(obj);
+ return key;
}
- /**
- * Gets the value of the xwikiRelativeUrl property.
- *
- * @return possible object is {@link String }
- */
- public String getXwikiRelativeUrl()
+ public void deleteObject(String key)
{
- return xwikiRelativeUrl;
- }
+ XSimpleObject obj = objects.get(key);
+ if (obj.isNew()) {
+ newObjects.remove(obj);
+ } else {
+ deletedObjects.add(key);
+ }
+ if (obj.isAltered()) {
+ editedObjects.remove(key);
+ }
+ objects.remove(key);
- /**
- * Sets the value of the xwikiRelativeUrl property.
- *
- * @param value allowed object is {@link String }
- */
- public void setXwikiRelativeUrl(String value)
- {
- this.xwikiRelativeUrl = value;
}
- /**
- * Gets the value of the xwikiAbsoluteUrl property.
- *
- * @return possible object is {@link String }
- */
- public String getXwikiAbsoluteUrl()
+ public Map getAllObjects()
{
- return xwikiAbsoluteUrl;
+ return objects;
}
- /**
- * Sets the value of the xwikiAbsoluteUrl property.
- *
- * @param value allowed object is {@link String }
- */
- public void setXwikiAbsoluteUrl(String value)
+ public DocumentBase getParentDocument()
{
- this.xwikiAbsoluteUrl = value;
+ return parent;
}
- /**
- * Gets the value of the translations property.
- *
- * @return possible object is {@link Translations }
- */
- public List getTranslations()
+ public List getChildrenDocuments()
{
- return translations;
+ return children;
}
- /**
- * Sets the value of the translations property.
- *
- * @param value allowed object is {@link Translations }
- */
- public void setTranslations(List translations)
+ public List getAllComments()
{
- this.translations = translations;
+ return comments;
}
- public String getDefalutTranslation()
+ public Map getAllAttatchments()
{
- return defalutTranslation;
+ return attatchments;
}
- public void setDefalutTranslation(String defalutTranslation)
+ public List getAllTags()
{
- this.defalutTranslation = defalutTranslation;
+ return tags;
}
- /**
- * Gets the value of the syntax property.
- *
- * @return possible object is {@link String }
- */
- public String getSyntax()
+ public List getAllNewObjects()
{
- return syntax;
+ return newObjects;
}
- /**
- * Sets the value of the syntax property.
- *
- * @param value allowed object is {@link String }
- */
- public void setSyntax(String value)
+ public List getAllNewComments()
{
- this.syntax = value;
+ return newComments;
}
- public String getLanguage()
+ public List getAllNewAttachments()
{
- return language;
+ return newAttachments;
}
- /**
- * Sets the value of the language property.
- *
- * @param value allowed object is {@link String }
- */
- public void setLanguage(String value)
+ public List getAllNewTags()
{
- this.language = value;
-
+ return newTags;
}
- /**
- * Gets the value of the version property.
- *
- * @return possible object is {@link String }
- */
- public String getVersion()
+ public Map getAllEditedObjects()
{
- return version;
+ return editedObjects;
}
- /**
- * Sets the value of the version property.
- *
- * @param value allowed object is {@link String }
- */
- public void setVersion(String value)
+ public List getAllEditedComments()
{
- this.version = value;
+ return editedComments;
}
- /**
- * Gets the value of the majorVersion property.
- */
- public int getMajorVersion()
+ public Map getAllEditedAttachments()
{
- return majorVersion;
+ return editedAttachments;
}
- /**
- * Sets the value of the majorVersion property.
- */
- public void setMajorVersion(int value)
+ public List getAllEditedTags()
{
- this.majorVersion = value;
+ return editedTags;
}
- /**
- * Gets the value of the minorVersion property.
- */
- public int getMinorVersion()
+ public List getAllDeletedObjects()
{
- return minorVersion;
+ return deletedObjects;
}
- /**
- * Sets the value of the minorVersion property.
- */
- public void setMinorVersion(int value)
+ public List getAllDeletedComments()
{
- this.minorVersion = value;
+ return deletedComments;
}
- /**
- * Gets the value of the created property.
- *
- * @return possible object is {@link String }
- */
- public String getCreated()
+ public List getAllDeletedAttachments()
{
- return created;
+ return deletedAttachments;
}
- /**
- * Sets the value of the created property.
- *
- * @param value allowed object is {@link String }
- */
- public void setCreated(String value)
+ public List getAllDeletedTags()
{
- this.created = value;
+ return deletedTags;
}
- /**
- * Gets the value of the creator property.
- *
- * @return possible object is {@link String }
- */
- public String getCreator()
- {
- return creator;
- }
+ // setters
- /**
- * Sets the value of the creator property.
- *
- * @param value allowed object is {@link String }
- */
- public void setCreator(String value)
+ public void setParent(DocumentBase parent)
{
- this.creator = value;
- }
+ if (parentFullName == null) {
+ parentFullName = parent.fullName;
+ }
+ if (parentId == null) {
- /**
- * Gets the value of the modified property.
- *
- * @return possible object is {@link String }
- */
- public String getModified()
- {
- return modified;
+ }
+ this.parent = parent;
}
- /**
- * Sets the value of the modified property.
- *
- * @param value allowed object is {@link String }
- */
- public void setModified(String value)
+ public void setChildren(List children)
{
- this.modified = value;
- }
-
- /**
- * Gets the value of the modifier property.
- *
- * @return possible object is {@link String }
- */
- public String getModifier()
- {
- return modifier;
- }
-
- /**
- * Sets the value of the modifier property.
- *
- * @param value allowed object is {@link String }
- */
- public void setModifier(String value)
- {
- this.modifier = value;
- }
-
- /**
- * Gets the value of the content property.
- *
- * @return possible object is {@link String }
- */
- public String getContent()
- {
- return content;
- }
-
- /**
- * Sets the value of the content property.
- *
- * @param value allowed object is {@link String }
- */
- public void setContent(String value)
- {
- this.content = value;
+ this.children = children;
}
}
+
+/**
+ * NOTE: TODO: extract interface Document.l Always use XWikiApplicationContext to create new.
+ **/
diff --git a/xwiki-android-core/src/org/xwiki/android/xmodel/entity/DocumentBase.java b/xwiki-android-core/src/org/xwiki/android/xmodel/entity/DocumentBase.java
new file mode 100644
index 0000000..431a4ea
--- /dev/null
+++ b/xwiki-android-core/src/org/xwiki/android/xmodel/entity/DocumentBase.java
@@ -0,0 +1,561 @@
+package org.xwiki.android.xmodel.entity;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import org.xwiki.android.ral.RestAPIUsageException;
+import org.xwiki.android.ral.reference.DocumentReference;
+import org.xwiki.android.ral.reference.Link;
+import org.xwiki.android.xmodel.xobjects.XObject;
+import org.xwiki.android.xmodel.xobjects.XSimpleObject;
+
+import com.j256.ormlite.field.DatabaseField;
+import com.j256.ormlite.table.DatabaseTable;
+
+/**
+ * Contains the properties of a Page +Additional methods for Document.
+ *
+ * @author xwiki dev: not saved to DB. Only the DocumentReference is saved.
+ */
+
+public abstract class DocumentBase extends Resource
+{
+
+ // Resource fields
+ //
+ protected List links;
+
+ protected String remoteId;// id field in the resource representation. Mobile apps normally use ReSTful URL to
+ // identify a resource.Not this.
+
+ protected String fullName;
+
+ protected String wikiName;// wiki in page element
+
+ protected String spaceName;// space in page element
+
+ protected String name; // name in page element (same)
+
+ protected String title;
+
+ protected String parentFullName;// parent in resoruce repr.
+
+ protected String parentId;
+
+ protected String xwikiRelativeUrl;
+
+ protected String xwikiAbsoluteUrl;
+
+ protected List translations;
+
+ protected String defalutTranslation;
+
+ protected String syntax;
+
+ protected String language;
+
+ protected String version;
+
+ protected int majorVersion;
+
+ protected int minorVersion;
+
+ protected String created; // Date string //TODO: convert to Type Date. Or introduce another var to hold Date obj.
+
+ protected String creator; // user string
+
+ protected String modified; // Date string
+
+ protected String modifier; // user string
+
+ protected String content;
+
+ // other fields
+ protected DocumentReference docRef;
+
+ protected boolean offlineMode;
+
+
+
+ public DocumentBase(String wikiName, String spaceName, String pageName)
+ {
+ docRef = new DocumentReference(wikiName, spaceName, pageName);
+ this.name = pageName;
+ this.wikiName = wikiName;
+ this.spaceName = spaceName;
+ }
+
+ /**
+ * @return
+ */
+ public DocumentReference getDocumentReference()
+ {
+ return docRef;
+ }
+
+ /**
+ * @param
+ */
+ public void setDocumentReference(DocumentReference docRef)
+ {
+ this.docRef = docRef;
+ }
+
+ /**
+ * if in offline mode the create(), update ... methods will use the save method to save a local copy. The delete
+ * method will mark the document for deletion. The sync service will take the responsibilities after internet
+ * connection is available. *
+ *
+ * @param val
+ */
+ public void setOfflineMode(boolean val)
+ {
+ this.offlineMode = val;
+ }
+
+ public boolean isOfflineMode()
+ {
+ return offlineMode;
+ }
+
+ // /**
+ // * valid for only Documents retreived from server.
+ // * @return
+ // */
+ // public boolean isCachedCopy(){
+ // return offlineMode;
+ // }
+
+ /**
+ * moved away to Document. If XWiki introduces CompoundDocuments with Compound objects defining them here
+ * might lead to probs public abstract XObject getObject(String key); public abstract void setObject(String key,
+ * XObject object); public abstract void addObject(XObject obj); public abstract void deleteObject(String key);
+ **/
+ // TODO: Implement similar methods for Comments...
+
+ // TODO: public abstract InputStream getAttachmentData(Attachment a);
+ // TODO: public abstract ... setAttachmentData(byte[]);
+
+ // resource value getter setters
+ // -----------------------------
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getRemoteId()
+ {
+ return remoteId;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setRemoteId(String value)
+ {
+ this.remoteId = value;
+ }
+
+ /**
+ * Gets the value of the fullName property. *
+ *
+ * @return possible object is {@link String }
+ */
+ public String getFullName()
+ {
+ return fullName;
+ }
+
+ /**
+ * Sets the value of the fullName property. *
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setFullName(String value)
+ {
+ this.fullName = value;
+ }
+
+ /**
+ * Gets the value of the wiki property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getWikiName()
+ {
+ return wikiName;
+ }
+
+ /**
+ * Sets the value of the wiki property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setWikiName(String value)
+ {
+ this.wikiName = value;
+ }
+
+ /**
+ * Gets the value of the space property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getSpaceName()
+ {
+ return spaceName;
+ }
+
+ /**
+ * Sets the value of the space property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setSpaceName(String value)
+ {
+ this.spaceName = value;
+ }
+
+ // TODO:Consider refactor rename back to getName() ? confuse with name,fullName ?
+ /**
+ * @return the value of the name property in the Rest model "Page" element..
+ */
+ public String getSimpleName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setSimpleName(String value)
+ {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the title property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+
+ /**
+ * Sets the value of the title property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setTitle(String value)
+ {
+ this.title = value;
+ }
+
+ /**
+ * Gets the value of the parent property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getParentFullName()
+ {
+ return parentFullName;
+ }
+
+ /**
+ * Sets the value of the parent property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setParentFullName(String value)
+ {
+ this.parentFullName = value;
+ }
+
+ /**
+ * Gets the value of the parentId property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getParentId()
+ {
+ return parentId;
+ }
+
+ /**
+ * Sets the value of the parentId property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setParentId(String value)
+ {
+ this.parentId = value;
+ }
+
+ /**
+ * Gets the value of the xwikiRelativeUrl property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getXwikiRelativeUrl()
+ {
+ return xwikiRelativeUrl;
+ }
+
+ /**
+ * Sets the value of the xwikiRelativeUrl property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setXwikiRelativeUrl(String value)
+ {
+ this.xwikiRelativeUrl = value;
+ }
+
+ /**
+ * Gets the value of the xwikiAbsoluteUrl property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getXwikiAbsoluteUrl()
+ {
+ return xwikiAbsoluteUrl;
+ }
+
+ /**
+ * Sets the value of the xwikiAbsoluteUrl property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setXwikiAbsoluteUrl(String value)
+ {
+ this.xwikiAbsoluteUrl = value;
+ }
+
+ /**
+ * Gets the value of the translations property.
+ *
+ * @return possible object is {@link Translations }
+ */
+ public List getTranslations()
+ {
+ return translations;
+ }
+
+ /**
+ * Sets the value of the translations property.
+ *
+ * @param value allowed object is {@link Translations }
+ */
+ public void setTranslations(List translations)
+ {
+ this.translations = translations;
+ }
+
+ public String getDefalutTranslation()
+ {
+ return defalutTranslation;
+ }
+
+ public void setDefalutTranslation(String defalutTranslation)
+ {
+ this.defalutTranslation = defalutTranslation;
+ }
+
+ /**
+ * Gets the value of the syntax property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getSyntax()
+ {
+ return syntax;
+ }
+
+ /**
+ * Sets the value of the syntax property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setSyntax(String value)
+ {
+ this.syntax = value;
+ }
+
+ public String getLanguage()
+ {
+ return language;
+ }
+
+ /**
+ * Sets the value of the language property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setLanguage(String value)
+ {
+ this.language = value;
+
+ }
+
+ /**
+ * Gets the value of the version property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Sets the value of the version property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setVersion(String value)
+ {
+ this.version = value;
+ }
+
+ /**
+ * Gets the value of the majorVersion property.
+ */
+ public int getMajorVersion()
+ {
+ return majorVersion;
+ }
+
+ /**
+ * Sets the value of the majorVersion property.
+ */
+ public void setMajorVersion(int value)
+ {
+ this.majorVersion = value;
+ }
+
+ /**
+ * Gets the value of the minorVersion property.
+ */
+ public int getMinorVersion()
+ {
+ return minorVersion;
+ }
+
+ /**
+ * Sets the value of the minorVersion property.
+ */
+ public void setMinorVersion(int value)
+ {
+ this.minorVersion = value;
+ }
+
+ /**
+ * Gets the value of the created property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getCreated()
+ {
+ return created;
+ }
+
+ /**
+ * Sets the value of the created property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setCreated(String value)
+ {
+ this.created = value;
+ }
+
+ /**
+ * Gets the value of the creator property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getCreator()
+ {
+ return creator;
+ }
+
+ /**
+ * Sets the value of the creator property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setCreator(String value)
+ {
+ this.creator = value;
+ }
+
+ /**
+ * Gets the value of the modified property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getModified()
+ {
+ return modified;
+ }
+
+ /**
+ * Sets the value of the modified property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setModified(String value)
+ {
+ this.modified = value;
+ }
+
+ /**
+ * Gets the value of the modifier property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getModifier()
+ {
+ return modifier;
+ }
+
+ /**
+ * Sets the value of the modifier property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setModifier(String value)
+ {
+ this.modifier = value;
+ }
+
+ /**
+ * Gets the value of the content property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+ /**
+ * Sets the value of the content property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setContent(String value)
+ {
+ this.content = value;
+ }
+
+}
diff --git a/xwiki-android-core/src/org/xwiki/android/xmodel/entity/SimpleDocument.java b/xwiki-android-core/src/org/xwiki/android/xmodel/entity/SimpleDocument.java
deleted file mode 100644
index fc67172..0000000
--- a/xwiki-android-core/src/org/xwiki/android/xmodel/entity/SimpleDocument.java
+++ /dev/null
@@ -1,257 +0,0 @@
-package org.xwiki.android.xmodel.entity;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.xwiki.android.ral.reference.DocumentReference;
-import org.xwiki.android.xmodel.xobjects.XObject;
-import org.xwiki.android.xmodel.xobjects.XSimpleObject;
-
-import android.text.AlteredCharSequence;
-
-/**
- * @author xwiki gsoc 2012 A document that supports only SimpleObjects. Simple Objects are shallow objects that can have
- * only XProperties for property fields.
- */
-public class SimpleDocument extends Document
-{
-
- // things in a retreived document.
- private Document parent;
-
- private List children;
-
- private Map objects; // key= ClassName/number
-
- private List comments; // key = int index in the list
-
- private Map attatchments;// key = resource id. ex: xwiki:Blog.BlogPost1@mypic can have space.png
-
- private List tags; // search by key not needed
-
- // resources that get newly added.
- // no keys. These are to be posted to server.Server will define the keys after these resources are posted.
- private List newObjects;
-
- private List newComments;
-
- private List newAttachments;
-
- private List newTags;
-
- // resources to update
-
- private Map editedObjects; // key= ClassName/number
-
- private List editedComments; // key = int index in the list
-
- private Map editedAttachments;// key = resource id. ex: xwiki:Blog.BlogPost1@mypic can have
- // space.png
-
- private List editedTags; // search by key not needed
-
- // resources to delete
- private List deletedObjects; // value= of the deleted obj. ClassName/number
-
- private List deletedComments; // key = int index in the list
-
- private List deletedAttachments;// key = resource id. ex: xwiki:Blog.BlogPost1@mypic can have space.png
-
- private List deletedTags; // search by key not needed
-
- public SimpleDocument(String wikiName, String spaceName, String pageName)
- {
- super(wikiName, spaceName, pageName);
-
- objects = new Hashtable();
- newObjects = new ArrayList();
- editedObjects = new Hashtable();
- deletedObjects = new ArrayList();
-
- // TODO: implement
- comments = new ArrayList();
- newComments = new ArrayList();
-
- }
-
- /**
- * When retrieving the object through get it will return the reference to the object in the list. Warning! For the
- * current implementation, alterations done to the object will not get affected in the server unless the edited
- * object is reset explicitly through setObject(String key, XSimpleObject object).
- *
- * @param key
- * @return
- */
- public XSimpleObject getObject(String key)
- {
- // TODO: When retreived by a RAL layer obj::- use isAltered method in Resource. use this to automatically
- // identify altered objects
- // and add them to editedObjects Map at the "ral.transformation" package.
- XSimpleObject obj = objects.get(key);
- obj.setAltered(true);
- return obj;
- }
-
- /**
- * Update a existing object in the doc. The update is done if the Object.isAltered returns true. This property is
- * set by defalut, when the object is retrieved using getObject(key)
- *
- * @param key
- * @param object
- */
- public void setObject(String key, XSimpleObject object)
- {
- if (!objects.containsKey(key)) {
- throw new IllegalArgumentException("you can only set objects which already exist in the map");
- }
- if (object.isAltered()) {
- editedObjects.put(key, object);
- }
- objects.put(key, object);
- }
-
- private int _addNum = 0;
-
- /**
- * @param obj
- * @return the auto generated key for this object. key is /new/
- */
- public String addObject(XSimpleObject obj)
- {
- String key = obj.getType() + "/new/" + _addNum++;
- obj.setNew(true);
- objects.put(key, obj);
- newObjects.add(obj);
- return key;
- }
-
- public void deleteObject(String key)
- {
- XSimpleObject obj = objects.get(key);
- if (obj.isNew()) {
- newObjects.remove(obj);
- } else {
- deletedObjects.add(key);
- }
- if (obj.isAltered()) {
- editedObjects.remove(key);
- }
- objects.remove(key);
-
- }
-
- public Map getAllObjects()
- {
- return objects;
- }
-
- public Document getParentDocument()
- {
- return parent;
- }
-
- public List getChildrenDocuments()
- {
- return children;
- }
-
- public List getAllComments()
- {
- return comments;
- }
-
- public Map getAllAttatchments()
- {
- return attatchments;
- }
-
- public List getAllTags()
- {
- return tags;
- }
-
- public List getAllNewObjects()
- {
- return newObjects;
- }
-
- public List getAllNewComments()
- {
- return newComments;
- }
-
- public List getAllNewAttachments()
- {
- return newAttachments;
- }
-
- public List getAllNewTags()
- {
- return newTags;
- }
-
- public Map getAllEditedObjects()
- {
- return editedObjects;
- }
-
- public List getAllEditedComments()
- {
- return editedComments;
- }
-
- public Map getAllEditedAttachments()
- {
- return editedAttachments;
- }
-
- public List getAllEditedTags()
- {
- return editedTags;
- }
-
- public List getAllDeletedObjects()
- {
- return deletedObjects;
- }
-
- public List getAllDeletedComments()
- {
- return deletedComments;
- }
-
- public List getAllDeletedAttachments()
- {
- return deletedAttachments;
- }
-
- public List getAllDeletedTags()
- {
- return deletedTags;
- }
-
- // setters
-
- public void setParent(Document parent)
- {
- if (parentFullName == null) {
- parentFullName = parent.fullName;
- }
- if (parentId == null) {
-
- }
- this.parent = parent;
- }
-
- public void setChildren(List children)
- {
- this.children = children;
- }
-
-}
-
-/**
- * NOTE: TODO: extract interface SimpleDocument.l Always use XWikiApplicationContext to create new.
- **/
diff --git a/xwiki-android-core/src/org/xwiki/android/xmodel/svc/DocumentSvc.java b/xwiki-android-core/src/org/xwiki/android/xmodel/svc/DocumentSvc.java
index 070272c..338edde 100644
--- a/xwiki-android-core/src/org/xwiki/android/xmodel/svc/DocumentSvc.java
+++ b/xwiki-android-core/src/org/xwiki/android/xmodel/svc/DocumentSvc.java
@@ -5,7 +5,7 @@
import org.xwiki.android.fileStore.FSDocumentReference;
import org.xwiki.android.ral.RestAPIUsageException;
import org.xwiki.android.ral.reference.DocumentReference;
-import org.xwiki.android.xmodel.entity.Document;
+import org.xwiki.android.xmodel.entity.DocumentBase;
/**
*
* Combines remote,local services.
diff --git a/xwiki-android-rest/pom.xml b/xwiki-android-rest/pom.xml
index b56e620..67cd28f 100644
--- a/xwiki-android-rest/pom.xml
+++ b/xwiki-android-rest/pom.xml
@@ -41,31 +41,8 @@
org.xwiki.android
xwiki-rest-simplexml-model
${project.version}
-
-
-
- org.simpleframework
- simple-xml
- jar
- 2.6
-
-
-
- stax
- stax
-
-
- stax-api
- stax
-
-
-
- xpp3
- xpp3
-
-
-
-
+ compile
+
diff --git a/xwiki-rest-model/xwiki-rest-model-simplexml/pom.xml b/xwiki-rest-model/xwiki-rest-model-simplexml/pom.xml
index de4f857..ef8f371 100644
--- a/xwiki-rest-model/xwiki-rest-model-simplexml/pom.xml
+++ b/xwiki-rest-model/xwiki-rest-model-simplexml/pom.xml
@@ -38,9 +38,10 @@
org.simpleframework
- simple-xml
+ simple-xml
+ 2.6.4
jar
- 2.6
+ compile