This repository has been archived by the owner on Sep 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Filter.m
85 lines (66 loc) · 2.27 KB
/
Filter.m
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// Filter.m
// JiraBuddy
//
// Created by Will Ronco on 1/8/10.
// Copyright 2010 Awesome Software. All rights reserved.
//
#import "Filter.h"
#import "Issue.h"
@implementation Filter
- (NSNumber *)nid
{
NSNumber * tmpValue;
[self willAccessValueForKey:@"nid"];
tmpValue = [self primitiveValueForKey:@"nid"];
[self didAccessValueForKey:@"nid"];
return tmpValue;
}
- (void)setNid:(NSNumber *)value
{
[self willChangeValueForKey:@"nid"];
[self setPrimitiveValue:value forKey:@"nid"];
[self didChangeValueForKey:@"nid"];
}
- (NSString *)name
{
NSString * tmpValue;
[self willAccessValueForKey:@"name"];
tmpValue = [self primitiveValueForKey:@"name"];
[self didAccessValueForKey:@"name"];
return tmpValue;
}
- (void)setName:(NSString *)value
{
[self willChangeValueForKey:@"name"];
[self setPrimitiveValue:value forKey:@"name"];
[self didChangeValueForKey:@"name"];
}
- (void)addIssuesObject:(Issue *)value
{
NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
[self willChangeValueForKey:@"issues" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
[[self primitiveValueForKey:@"issues"] addObject:value];
[self didChangeValueForKey:@"issues" withSetMutation:NSKeyValueUnionSetMutation usingObjects:changedObjects];
[changedObjects release];
}
- (void)removeIssuesObject:(Issue *)value
{
NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
[self willChangeValueForKey:@"issues" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
[[self primitiveValueForKey:@"issues"] removeObject:value];
[self didChangeValueForKey:@"issues" withSetMutation:NSKeyValueMinusSetMutation usingObjects:changedObjects];
[changedObjects release];
}
- (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues{
//NSLog(@"Updating filter from dictionary: %@", keyedValues);
for (id key in keyedValues) {
if ([key isEqual:@"nid"]) {
[self setNid:[NSNumber numberWithInt:[[keyedValues valueForKey:key] intValue]]];
}
else if([key isEqual:@"name"]){
[self setName:[keyedValues valueForKey:key]];
}
}
}
@end