1   package hudsonfog.voc.aspects;
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.model.company.*;
19  import hudsonfog.voc.system.primitiveTypes.*;
20  import hudsonfog.voc.system.behavior.*;
21  import hudsonfog.voc.model.portal.*;
22  import hudsonfog.voc.system.parse.*;
23  import hudsonfog.voc.system.XMLSchema.*;
24  
25  import hudsonfog.voc.system.fog.*;
26  
27  
28  public abstract class tags {
29  
30    /**
31   *  keywords that describe resource. Used to tag resources for search purposes.
32   *  Used in FS and filter(s) to locate resources with same keywords
33   */
34    public static interface Taggable extends ApplicationAspect {
35           @_maxSize(2000)
36           public tags                          tags = null;
37           @_mustImplement
38           @_avoidDisplayingInControlPanel // hack - avoidDisplaying did not hide this prop in control panel
39           @_avoidDisplaying
40           @_backLink("taggable")
41           public TagUse[]                      tagUse = null;
42    }
43  
44    /**
45   *  Created for each key in Taggable.tags for particular application.
46   *  Used in FS and filter(s) to locate resources with same keywords
47   */
48    @DavClass._largeIcon("icons/classes/Tag-large.gif")
49    @DavClass._viewCols("tag, tagUse")
50    @DavClass._icon("icons/classes/Tag.gif")
51    @DavClass._skipAccessControl
52    @DavClass._resourceIcon("application")
53    public static class Tag implements Folder {
54           @_displayNameElm
55           @_setLinkTo("tagUse")
56           @_propertyEditor("FolderResourcePropertyEditor")
57        @k public String                        tag;
58           @_alwaysReturnToClient
59        @k public DavClass                      application;
60           @_alwaysReturnToClient
61           @_backLink("tag")
62           @_displayInline
63           public TagUse[]                      tagUse; //    :: f.folderItems;
64           @_cloneOf("parentFolder")
65        @c public Tag                           parentTag;
66           public Integer                       tagUseCount = writeJS("getThisChange().tagUse ? tagUse.COUNT() : tagUseCount");
67    }
68  
69    /**
70   *  Created for each key in Taggable.tags for particular Taggable resource.
71   *  Used to retrieve info of tag usability(dateTagged) and contact that did tagging
72   *  My Tags;
73   *  Top taggers for this Tag ex. (People who tagged their photos with potcast most)
74   */
75    @DavClass._avoidIndexing
76    @DavClass._viewCols("resourceDisplayName")
77    @DavClass._largeIcon("icons/classes/Tag-large.gif")
78    @DavClass._gridCols("resourceDisplayName")
79    @DavClass._icon("icons/classes/Tag.gif")
80    public static class TagUse implements Delegator, ImageResource {
81           @_containerMember
82        @k public Tag                           tag; //                 :: fi.folder;
83           @_avoidDisplaying
84           @_containerMember
85           @_cloneOf("forResource")
86           @_alwaysReturnToClient
87           @_notifyContainer(false) // for optimization purposes since changing TagUse does not change Taggable there is no need to notify it
88      @k@c public Taggable                      taggable; //* resource to which we delegate
89           @_cloneOf("forClass")
90        @c public DavClass                      application = formula("tag.application"); //* class of the resource to which we delegate
91           @_avoidDisplaying
92           public Contact                       taggedBy;
93           public ComplexDate                   dateTagged;
94           @_autoCreateFromOriginalImage(false)
95           @_cloneOf("smallImage")
96        @c public Image                         resourceImage; //* small enough to be displayed in a grid
97           @_displayNameElm
98        @c public String                        resourceDisplayName; //* display name of the resource to which we delegate
99    }
100 }
101