blob: cf261277ca94c98ee6265103faea1e4985d7968c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#import "ObjectHelper.h"
NS_ASSUME_NONNULL_BEGIN
@implementation ObjectHelper
#pragma mark - SQL Results to QSObjects
+ (QSObject *) areaFromSQLResult:(NSDictionary *)result usingPath:(NSString *)path {
NSMutableDictionary *configuration = [result mutableCopy];
[configuration setObject:path forKey:@"path"];
QSObject *area = [QSObject
makeObjectWithIdentifier:[result objectForKey:@"uuid"]];
[area setObject:configuration forType:kAreaType];
[area setName:[result objectForKey:@"title"]];
[area setPrimaryType:kAreaType];
return area;
}
+ (QSObject *) projectFromSQLResult:(NSDictionary *)result usingPath:(NSString *)path {
NSMutableDictionary *configuration = [result mutableCopy];
[configuration setObject:path forKey:@"path"];
QSObject *project = [QSObject
makeObjectWithIdentifier:[result objectForKey:@"uuid"]];
[project setObject:configuration forType:kProjectType];
[project setName:[result objectForKey:@"title"]];
[project setDetails:[result objectForKey:@"notes"]];
[project setPrimaryType:kProjectType];
return project;
}
+ (QSObject *) taskFromSQLResult:(NSDictionary *)result usingPath:(NSString *)path {
NSMutableDictionary *configuration = [result mutableCopy];
[configuration setObject:path forKey:@"path"];
QSObject *task = [QSObject
makeObjectWithIdentifier:[result objectForKey:@"uuid"]];
[task setObject:configuration forType:kTaskType];
[task setName:[result objectForKey:@"title"]];
[task setDetails:[result objectForKey:@"notes"]];
[task setPrimaryType:kTaskType];
return task;
}
+ (QSObject *) tagFromSQLResult:(NSDictionary *)result usingPath:(NSString *)path {
NSMutableDictionary *configuration = [result mutableCopy];
[configuration setObject:path forKey:@"path"];
QSObject *tag = [QSObject
makeObjectWithIdentifier:[result objectForKey:@"uuid"]];
[tag setObject:configuration forType:kTagType];
[tag setName:[result objectForKey:@"title"]];
[tag setPrimaryType:kTagType];
return tag;
}
@end
NS_ASSUME_NONNULL_END
|