00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef QOFBOOKMERGE_H
00025 #define QOFBOOKMERGE_H
00026
00027 #define QOF_MOD_MERGE "qof-merge"
00028
00081 #include "qofutil.h"
00082 #include "qofbook.h"
00083 #include "qofclass.h"
00084 #include "qofobject.h"
00085 #include "qofinstance.h"
00086 #include "qoflog.h"
00087
00125 typedef enum
00126 {
00127 MERGE_UNDEF,
00128 MERGE_ABSOLUTE,
00129 MERGE_NEW,
00131 MERGE_REPORT,
00132 MERGE_DUPLICATE,
00134 MERGE_UPDATE,
00136 MERGE_INVALID
00138 } QofBookMergeResult;
00139
00164 typedef struct
00165 {
00166
00167 gboolean mergeAbsolute;
00169 double difference;
00171 gboolean updated;
00173
00174 QofIdType mergeType;
00176 const gchar *mergeLabel;
00178 GSList *mergeParam;
00179 GSList *linkedEntList;
00188 QofBookMergeResult mergeResult;
00189 QofEntity *importEnt;
00190 QofEntity *targetEnt;
00192 } QofBookMergeRule;
00193
00194
00209 typedef struct
00210 {
00211 GSList *mergeObjectParams;
00213 GList *mergeList;
00215 GSList *targetList;
00217 QofBook *mergeBook;
00219 QofBook *targetBook;
00221 gboolean abort;
00222 QofBookMergeRule *currentRule;
00224 GSList *orphan_list;
00232 GHashTable *target_table;
00235 } QofBookMergeData;
00236
00237
00238
00274 QofBookMergeData *qof_book_merge_init (QofBook * importBook,
00275 QofBook * targetBook);
00276
00277
00321 typedef void (*QofBookMergeRuleForeachCB) (QofBookMergeData *,
00322 QofBookMergeRule *, guint);
00323
00348 void qof_book_merge_rule_foreach (QofBookMergeData * mergeData,
00349 QofBookMergeRuleForeachCB callback,
00350 QofBookMergeResult mergeResult);
00351
00366 gchar *qof_book_merge_param_as_string (QofParam * qtparam, QofEntity * qtEnt);
00367
00447 QofBookMergeData *qof_book_merge_update_result (QofBookMergeData * mergeData,
00448 QofBookMergeResult tag);
00449
00483 gint qof_book_merge_commit (QofBookMergeData * mergeData);
00484
00492 void qof_book_merge_abort (QofBookMergeData * mergeData);
00493
00494 #endif // QOFBOOKMERGE_H
00495