1
package
hudsonfog.voc.system;
2
3
import
com.fogx.webdav.DavResource;
4
import
com.fogx.webdav.DavClass;
5
import
com.fogx.webdav.DavBean;
6
import
com.fogx.webdav.DavProperty;
7
import
static
com.fogx.webdav.DavProperty.*;
8
import
com.fogx.webdav.packages.DavBeanPackage;
9
import
com.fogx.webdav.util.DavResourceSupport;
10
import
com.fogx.webdav.util.UrlUtil;
11
import
java.util.Date;
12
import
java.util.Map;
13
import
java.util.HashMap;
14
import
java.util.List;
15
import
java.util.Collections;
16
import
java.util.Arrays;
17
18
import
hudsonfog.voc.aspects.ui
.*;
19
import
hudsonfog.voc.model.company
.*;
20
import
hudsonfog.voc.system.primitiveTypes
.*;
21
import
hudsonfog.voc.system.session
.*;
22
import
hudsonfog.voc.system.behavior
.*;
23
import
hudsonfog.voc.model.portal
.*;
24
import
hudsonfog.voc.system.parse
.*;
25
import
hudsonfog.voc.system.XMLSchema
.*;
26
27
import
hudsonfog.voc.system.fog
.*;
28
29
30
public
abstract
class
readHistory {
31
32
/**
33
* Reads for Trackable will be automatically recorded.
34
* This allows to do audit, access statistics analysis and calculate
35
* 'people who read this resource also read these resources'.
36
*/
37
public
static
interface
Trackable
extends
Styled {
38
@_avoidModificationTracking
39
@_notSearchable
40
@_backLink(
"forResource"
)
41
@_allowRoles(
"admin"
)
42
public
TrackedRead[] readHistory =
null
;
//* who looked at this resource
43
@_label(
"viewed"
)
44
@_avoidModificationTracking
45
@_readOnly
46
public
Integer readHistoryCount = writeJS(
"getThisChange().readHistory ? readHistory.COUNT() : readHistoryCount"
);
47
@_avoidDisplaying
// no need to show this property - we need it only to calculate alreadyViewedByMe
48
@_icon(
"icons/classes/TrackedRead.gif"
)
49
@_backLink(
"forResource"
)
50
@_where(
"contact == 'self'"
)
// we create only one TrackRead per person, but change date it was last viewed
51
@_avoidDisplayingInControlPanel
52
@_avoidModificationTracking
53
@_readOnly
54
@_notSearchable
55
public
TrackedRead[] myLastRead =
null
;
//* my last look at this resource
56
@_avoidDisplayingInView
57
@_colorCoding(
"1 icons/classes/TrackedRead.gif; 0 icons/blank.gif"
)
58
@_icon(
"icons/classes/TrackedRead2.gif"
)
59
@_avoidModificationTracking
60
@_readOnly
61
@_notSearchable
// hack. remove after we calculate viewcount in onChange()
62
public
Integer alreadyViewedByMe = formula(
"myLastRead.COUNT()"
);
//* marked if I opened to view this resource at least once
63
@s
public
styleSheet styleSheet = formulaJS(
"getStyle()"
);
64
}
65
66
/**
67
* TrackedRead is created when Trackable resources is read by the User.
68
*/
69
@DavClass._notClonable
70
@DavClass._avoidIndexing
71
@DavClass._largeIcon(
"icons/classes/TrackedRead-large.gif"
)
72
@DavClass._avoidEditing
73
@DavClass._icon(
"icons/classes/TrackedRead.gif"
)
74
@DavClass._nonTransactional
75
public
static
class
TrackedRead
implements
Delegator, ImageResource {
76
@_containerMember
77
@_delegatedAccessControl
78
@_skipLabelInGrid
79
@_alwaysReturnToClient
80
@_notifyContainer(
false
)
81
@k@c
public
Trackable forResource;
//* resource being tracked
82
@_containerMember
83
@_notifyContainer(
false
)
84
@k
public
Contact contact;
//* contact who accessed the resource
85
@_allowRoles(
"admin"
)
86
@s
public
Session partOf;
//* Session, during which this resource was accessed
87
@_dateFormat(
"~MMM-dd, yyyy HH:mm"
)
88
@_sortAscending(
false
)
89
public
dateTime dateAccessed;
90
@_displayNameElm
91
@_skipLabelInGrid
92
@c
public
String resourceDisplayName;
//* display name of the resource to which we delegate
93
@_cloneOf(
"smallImage"
)
94
@c
public
Image resourceImage;
//* small enough to be displayed in a grid
95
@_cloneOf(
"forClass"
)
96
@c
public
DavClass application;
//* application in which query was issued (like employment, movies)
97
}
98
99
/**
100
* Shows resources that I recently viewed
101
*/
102
@DavClass._aView
103
@DavClass._where(
"contact == 'self'"
)
104
@DavClass._suppressClassIcon
105
@DavClass._filterView
106
public
static
class
MyTrackedRead
extends
TrackedRead {
107
@_displayNameElm
108
@s
public
String resourceDisplayName;
109
@s
public
Image resourceImage;
110
@s
public
Trackable forResource;
111
@s
public
Contact contact;
112
@s
public
dateTime dateAccessed;
113
@h@s
public
Session partOf;
114
@h@s
public
DavClass application;
115
}
116
}
117