Mobile API Reference  MicroStrategy 2019
DeferExecCommon.h
Go to the documentation of this file.
1 //
2 // DeferExecCommon.h
3 // MicroStrategyMobile
4 //
5 // Created by dali on 1/17/12.
6 // Copyright (c) 2012 MicroStrategy Inc. All rights reserved.
7 //
8 
9 
10 #include <CoreFoundation/CoreFoundation.h>
11 #import <Foundation/Foundation.h>
12 #import "MSIProjectInfo.h"
13 #import "MSTRError.h"
14 #import "MSIReportDisplayInfo.h"
15 
16 #ifndef ASYNCEXC_ENABLED
17 #define ASYNCEXC_ENABLED true
18 #endif
19 
20 #ifndef ASYNCEXC_DEBUG
21 //#define ASYNCEXC_DEBUG
22 #endif
23 
24 
25 #ifndef ASYNCEXC_ASSERT
26 //#define ASYNCEXC_ASSERT(condition, desc) NSAssert(condition, desc)
27 #define ASYNCEXC_ASSERT(condition, desc)
28 #endif
29 
30 //reconcile refresh timeinterval
31 #ifdef ASYNCEXC_DEBUG
32 #define ASYNCEXC_RECONCILE_MINTIMEINTERVAL 10
33 #else
34 #define ASYNCEXC_RECONCILE_MINTIMEINTERVAL 3
35 #endif
36 
37 #ifndef ASYNCEXC_LOG_ENABLED
38 
39  // Enable or disable all that extra logging in the console.
40  //#define ASYNCEXC_LOG_ENABLED
41 #endif
42 
43 
44 
45 #ifdef ASYNCEXC_LOG_ENABLED
46 #define ASYNCEXC_LOG(message, ...) NSLog((@"ASYNCEXC: csfid %s [ln %d] [th %@] [self %p] " message), \
47 __PRETTY_FUNCTION__, __LINE__, [NSThread currentThread], self, ## __VA_ARGS__);
48 #else
49 #define ASYNCEXC_LOG(message, ...)
50 #endif
51 
52 
53 /*for error messages*/
54 #define DEFERRED_EXECUTION_ERROR_DOMAIN @"deferred execution"
55 
56 //use one error code for deferred executions
57 #define DEFERRED_EXECUTION_ERROR_CODE 100100
58 #define DEFERRED_EXECUTION_ERROR_CODE_FAILED_TO_DEFER 100101
59 #define DEFERRED_EXECUTION_ERROR_CODE_DEFERRED_INBOX_IS_FULL 100102
60 #define DEFERRED_EXECUTION_ERROR_CODE_FAILE_TO_DOWNLOAD 100103
61 #define DEFERRED_EXECUTION_ERROR_CODE_CLIENT_CACHE_LOST 100104
62 
63 #define DEFERRED_EXECUTION_COMP @"AsyncExecution"
64 
65 #define DEFER_EXEC_BASEMESSAGEID_PREFIX @"DEFEREXEC_BASEMESSAGEID_"
66 
67 
68 
69 /*protocol for dataController*/
70 //DeferExecService need call [DeferExecCandidateReportStatusListener deferExecCandidateReport:deferExecCandidateReportStatusValue] when report status is changed
71 //dataController need cancel report's running job by calling [DeferExecService cancelForDefferedExecution] when user choose to defer/cacel a report
79 
81 @required
82 -(void) deferExecCandidateReport:(MSIReportDisplayInfo*)report statusChanged:(NSNumber*)deferExecCandidateReportStatusValue ;
83 -(bool) isDeferredExecution;
84 @optional
85 -(void) setDeferredExecution:(bool)isDeferredExecution;
86 @end
87 
88 @interface DeferExecCommon :NSObject
89 
90 +(bool) isDeferExecSupported;
91 
92 +(NSString*) deferExecStoreHome;
93 
94 +(bool) isProjectSupported:(MSIProjectInfo*)project;
95 
96 +(void) deferExecCandidateReport:(MSIReportDisplayInfo*)report statusChanged:(DeferExecCandidateReportStatus)deferExecCandidateReportStatusValue handler:(id) handler;
97 
98 +(bool) isDeferredExecution:(id) handler;
99 
100 
101 +(void) deferExecCandidateReport:(MSIReportDisplayInfo*)report statusChanged2:(NSNumber*)deferExecCandidateReportStatusValue handler:(id) handler;
102 
103 //Error handlings
104 +(MSTRError*) createMSTRErrorWithCode:(int)errorCode errMsg:(NSString*) errMsg;
105 +(MSTRError*) createMSTRErrorWithError:(id)error;
106 +(MSTRError*) createMSTRErrorWithErrorInfoAttDict:(NSDictionary *)attributeDict;
107 @end
108 
109 //protocol for service supports deferred execution, not applied
111 //cacel current running job for deferred execution
112 -(void) cancelForDefferedExecution:(MSTRError **)err;
113 @end
114 
115 
Definition: DeferExecCommon.h:110
Definition: MSIReportDisplayInfo.h:91
_DeferExecCandidateReportStatus
Definition: DeferExecCommon.h:72
Definition: MSTRError.h:19
Definition: DeferExecCommon.h:80
bool isDeferExecSupported()
Definition: DeferExecCommon.h:88
Definition: DeferExecCommon.h:75
Definition: MSIProjectInfo.h:17
Definition: DeferExecCommon.h:77
NSString * deferExecStoreHome()
enum _DeferExecCandidateReportStatus DeferExecCandidateReportStatus