|
1 #include <QDebug> |
|
2 #include "smfSns.h" |
|
3 #include <QString> |
|
4 #include "smfUserProfile.h" |
|
5 #include "smfSocialProfile.h" |
|
6 #include "dsm.h" |
|
7 |
|
8 |
|
9 int main(){ |
|
10 |
|
11 QString sns_name = "facebook"; |
|
12 QString sns_url = "http://www.facebook.com"; |
|
13 SMFSocialNetworkingSite mySns (sns_name, sns_url); |
|
14 |
|
15 qDebug() << "Name of my SNS: " << mySns.snsName(); |
|
16 qDebug() << "URL of my SNS: " << mySns.snsURL(); |
|
17 qDebug() << "ID of my SNS(should be negative): " << mySns.snsID(); |
|
18 |
|
19 QString user_name = "Test User"; |
|
20 QString user_contact_id = "1234567890"; |
|
21 SMFUserProfile myUser(user_name, user_contact_id); |
|
22 |
|
23 qDebug() << "Name of my user: " << myUser.name(); |
|
24 qDebug() << "Contact ID of my user: " << myUser.contactID(); |
|
25 qDebug() << "User ID of my user: " << myUser.userID(); |
|
26 |
|
27 DataStoreManager* dsm_p = DataStoreManager::getDataStoreManager(); |
|
28 if(dsm_p != NULL){ |
|
29 dsm_p->addUserProfile(myUser); |
|
30 dsm_p->addSNSEntry(mySns); |
|
31 // dsm_p->deleteUserProfile(myUser); |
|
32 qDebug() << "----------------\nState: " << dsm_p->getState(); |
|
33 qDebug() << "Error Message: " << dsm_p->getError() << "\n----------------"; |
|
34 } |
|
35 else |
|
36 qDebug() << "Error getting database handle"; |
|
37 |
|
38 qDebug() << "Name of my user: " << myUser.name(); |
|
39 qDebug() << "Contact ID of my user: " << myUser.contactID(); |
|
40 qDebug() << "User ID of my user: " << myUser.userID(); |
|
41 |
|
42 qDebug() << "Name of my SNS: " << mySns.snsName(); |
|
43 qDebug() << "URL of my SNS: " << mySns.snsURL(); |
|
44 qDebug() << "ID of my SNS(should be negative): " << mySns.snsID(); |
|
45 |
|
46 QString profile_url = sns_url + "/test_user"; |
|
47 QString screen_alias = "scrnALIAS"; |
|
48 SMFSocialProfile mySocPrfl(mySns,profile_url, screen_alias); |
|
49 |
|
50 qDebug() << "My Social Profile's associated SNS ID: " << mySocPrfl.associatedSnsID(); |
|
51 qDebug() << "My social Profile's associated User ID: " << mySocPrfl.associatedUserID(); |
|
52 qDebug() << "ProfileURL: " << mySocPrfl.profileURL(); |
|
53 qDebug() << "Screen Alias: " << mySocPrfl.screenAlias(); |
|
54 qDebug() << "My Social Profile's ID: " << mySocPrfl.profileID(); |
|
55 |
|
56 DataStoreManager* dsm2 = DataStoreManager::getDataStoreManager(); // jsut to test that only one object is created. |
|
57 if (dsm_p == dsm2) |
|
58 qDebug() << "true"; |
|
59 |
|
60 if(dsm2 != NULL){ |
|
61 dsm2->createRelation(myUser, mySocPrfl); |
|
62 dsm2->addSocialProfile(mySocPrfl); |
|
63 |
|
64 //dsm2->deleteSocialProfile(mySocPrfl); |
|
65 } |
|
66 |
|
67 qDebug() << "My Social Profile's associated SNS ID: " << mySocPrfl.associatedSnsID(); |
|
68 qDebug() << "My social Profile's associated User ID: " << mySocPrfl.associatedUserID(); |
|
69 qDebug() << "ProfileURL: " << mySocPrfl.profileURL(); |
|
70 qDebug() << "Screen Alias: " << mySocPrfl.screenAlias(); |
|
71 qDebug() << "My Social Profile's ID: " << mySocPrfl.profileID(); |
|
72 |
|
73 dsm2->getAllRelated(myUser); |
|
74 dsm2->getRelatedByService(myUser,mySns); |
|
75 |
|
76 return 0; |
|
77 } |
|
78 |