1  



package
 hudsonfog.voc.model;

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.system.changeHistory
.*;

19 



import

hudsonfog.voc.model.company
.*;

20 



import

hudsonfog.voc.system.classusage
.*;

21 



import

hudsonfog.voc.system.primitiveTypes
.*;

22 



import

hudsonfog.voc.model.recurrence
.*;

23 



import

hudsonfog.voc.model.portal
.*;

24 



import

hudsonfog.voc.system.parse
.*;

25 



import

hudsonfog.voc.model.top
.*;

26 



import

hudsonfog.voc.system.XMLSchema
.*;

27 



28 



import

hudsonfog.voc.system.fog
.*;

29 



30 



31 



public

abstract

class
 top {

32 



33 



/**

34 


 * Demand defines a call for activity cased by some need or an opportunity.

35 


 */

36 


  @DavClass._viewCols(
"synopsis, priority, description, submittedBy, dateSubmitted, lastModified, lastCommentTime, touched, myUnreadMessages, myFlaggedMessages, sizeOfAttachments, attachments"
)

37 


  @DavClass._largeIcon(
"icons/classes/Demand-large.gif"
)

38 


  @DavClass._gridCols(
"synopsis, submittedBy, dateSubmitted"
)

39 


  @DavClass._editCols(
"synopsis, priority, description"
)

40 


  @DavClass._icon(
"icons/classes/Demand.gif"
)

41 



public

static

class
 Demand 
implements
 CollaborationPoint, ModificationHistory, FileSystem, FolderItem {

42 


         @_displayNameElm

43 


         @_displaySize(
35
)

44 


         @_cloneOf(
"subject"
)

45 


    @k@c 
public
 String                        synopsis; 
//* brief summary - keep it brief please

46 



    @k@c 
public
 ComplexDate                   dateSubmitted; 
//* when this message entered the system

47 



         @_colorCoding(
"'Normal' icons/priority_normal.gif; 'High' icons/priority_major.gif; 'Critical' icons/priority_critical.gif; 'Lowest' icons/priority_trivial.gif; 'Low' icons/priority_minor.gif"
)

48 


         @_onCreate

49 



public
 Priority                      priority = writeJS(
"(priority == null) ? 'Normal' : priority"
);

50 


      @c 
public
 String                        description; 
//* detailed description

51 



      @c 
public
 Contact                       submittedBy;

52 


         @_dateFormat(
"~MMM-dd, yyyy"
)

53 


         @_icon(
"icons/deadline.gif"
)

54 



public
 ComplexDate                   deadline; 
//* e.g. "must have by this time", "expiration date", etc.

55 



         @_backLink(
"forResource"
)

56 


      @c 
public
 SharedFile[]                  attachments;

57 


         @_cloneOf(
"attachmentsUrl"
)

58 


      @c 
public
 String                        url;

59 


      @c 
public
 fileSize                      sizeOfAttachments; 
//* total size of attachments

60 



      @c 
public
 Integer                       attachmentsCount; 
//* total number of attachments

61 



         @_avoidDisplaying

62 


         @_backLink(
"forum"
)

63 


         @_cloneOf(
"members"
)

64 


      @c 
public
 Subscription[]                subscription;

65 


         @_avoidDisplaying

66 


         @_backLink(
"forum"
)

67 


      @c 
public
 Subscription[]                mySubscription;

68 


         @_notSearchable

69 


         @_backLink(
"forum"
)

70 



public
 Subscribed[]                  subscribers;

71 


         @_backLink(
"invitedTo"
)

72 


         @_cloneOf(
"invited"
)

73 


      @c 
public
 Invitation[]                  invitedSubscribers;

74 


         @_backLink(
"forum"
)

75 


         @_cloneOf(
"pending"
)

76 


      @c 
public
 PendingSubscription[]         pendingSubscribers; 
//* permission to subscribe requests

77 



         @_notifyContainer

78 


         @_cloneOf(
"folder"
)

79 


         @_delegatedAccessControl 
// those who can see forum can see this

80 



      @c 
public
 CollaborationPoint            forum; 
//* the forum, like Task, for which this item was registered

81 



         @_containerMember(
false
)

82 


         @_notifyContainer

83 


         @_cloneOf(
"rootFolder"
)

84 


         @_delegatedAccessControl 
// those who can see forum can see this

85 



      @c 
public
 CollaborationPoint            mainForum; 
//* the main forum, like Project, for which this item was registered

86 



         @_backLink(
"forum"
)

87 


         @_displayInline

88 


      @c 
public
 Comment[]                     comments;

89 


      @c 
public
 Integer                       commentsCount;

90 


      @c 
public
 Comment                       lastComment;

91 


         @_backLink(
"forResource"
)

92 


         @_displayInline

93 


      @c 
public
 ChatHistoryFile[]             chatHistory;

94 


         @_dateFormat(
"~MMM-dd, yyyy HH:mm"
)

95 


         @_icon(
"icons/classes/Comment.gif"
)

96 


         @_readOnly

97 



public
 ComplexDate                   lastCommentTime = formula(
"lastComment.submitTime"
);

98 


         @_backLink(
"associatedWith"
)

99 


      @c 
public
 Message[]                     myUnreadMessages;

100


         @_backLink(
"associatedWith"
)

101


      @c 
public
 Message[]                     myFlaggedMessages;

102


      @c 
public
 Modification                  lastModification;

103


      @c 
public
 dateTime                      lastModified;

104


      @c 
public
 dateTime                      touched;

105


         @_avoidDisplayingInControlPanel(
false
)

106


         @_backLink(
"forResource"
)

107


         @_displayInline

108


      @c 
public
 Modification[]                changeHistory; 
//* list of modifications for this resource

109



      @c 
public
 String                        editNotes; 
//*? important: notes explaining your changes

110



  }

111



112



/**

113


 * The recorded need to do something, like produce a product or deliver a service.

114


 */

115



public

static

class
 Need 
extends
 Demand {

116


    @k@s 
public
 String                        synopsis;

117


    @k@s 
public
 ComplexDate                   dateSubmitted;

118


  }

119



120



/**

121


 * The commitment to have the need fulfilled.

122


 */

123


  @DavClass._delegatedAccessControl

124


  @DavClass._largeIcon(
"icons/classes/Order-large.gif"
)

125


  @DavClass._icon(
"icons/classes/Order.gif"
)

126



public

static

class
 Order 
extends
 Demand 
implements
 WorkItem, Folder {

127


         @_backLink(
"order"
)

128


         @_cloneOf(
"folderItems"
)

129


      @c 
public
 Fulfillment[]                 fulfillment;

130


    @k@s 
public
 String                        synopsis;

131


    @k@s 
public
 ComplexDate                   dateSubmitted;

132


         @_colorCoding(
"'Open' icons/status_open.gif; 'Confirmed' icons/status_resolved.gif; 'Partially filled' icons/status_inprogress.gif; 'Fulfilled' icons/status_postponed.gif; 'Cancelled' icons/status_cancelled.gif; 'Confirmed by email' icons/email.gif"
)

133


         @_onCreate

134


      @c 
public
 OrderStatus                   status = writeJS(
"(status == null) ? 'Open' : status"
);

135


      @s 
public
 String                        url;

136


  }

137



138



public

static
 enum OrderStatus {

139


    Open, Confirmed, Fulfilled, @_label(
"Partially filled"
) PartiallyFilled, Canceled, @_label(
"Confirmed by email"
) ConfirmedByEmail;

140


  }

141



142



/**

143


 * An event within the organization that fulfills a one or several needs.

144


 */

145


  @DavClass._notSiteSharable

146


  @DavClass._abstract

147



public

static

abstract

class
 BusinessEvent {

148


      @k 
public
 BusinessEventType             eventType;

149


      @k 
public
 ComplexDate                   date; 
//* date this event was recorded

150



      @k 
public
 PartyAddress                  location;

151



public
 BusinessEvent                 nextEvent; 
//* next event in an order fulfillment chain of events (e.g loading -> unloading)

152




public
 BusinessEvent                 previousEvent; 
//* link back to a previous event in order filfillment chain of events

153




public
 Document                      document; 
//* A link to a Parent event, e.g. 'Container' on board of a Vessel -> 'Bill of lading' associated with this Vessel

154



         @_backLink(
"event"
)

155



public
 Fulfillment[]                 fulfills; 
//* one event may fulfill several orders

156



  }

157



158


  @DavClass._dataLocationIndexServer

159



public

static

class
 BusinessEventType 
extends

hudsonfog.voc.system.fog.ListItem
 {

160


         @_maxSize(
50
)

161


      @k 
public
 String                        code;

162



public
 Integer                       ordinal;

163


         @_maxSize(
200
)

164



public
 String                        description;

165


  }

166



167



/**

168


 * A fulfillment of a specific order via a specific act (business event).

169


 */

170


  @DavClass._notSiteSharable

171


  @DavClass._abstract

172


  @DavClass._derived

173


  @DavClass._aggregationAllowed

174



public

static

abstract

class
 Fulfillment 
implements
 Folder {

175


         @_cloneOf(
"parentFolder"
)

176


    @k@c 
public
 Order                         order; 
//* Order that is being fulfilled

177



      @k 
public
 BusinessEvent                 event; 
//* Event which fulfills this Order

178



         @_backLink(
"fulfillment"
)

179


         @_cloneOf(
"folderItems"
)

180


      @c 
public
 FulfillmentItem[]             items; 
//* Items (e.g. order items) that are being fulfilled

181



  }

182



183



/*

184


 * + A fulfillment is/was often represented by some paper document, e.g. Packing List

185


 */

186


  @DavClass._largeIcon(
"icons/classes/PackingList-large.gif"
)

187


  @DavClass._printableList

188


  @DavClass._icon(
"icons/classes/PackingList.gif"
)

189


  @DavClass._abstract

190



public

static

abstract

class
 Document 
extends
 Fulfillment {

191


    @k@s 
public
 Order                         order;

192


    @k@s 
public
 BusinessEvent                 event;

193


         @_backLink(
"document"
)

194



public
 BusinessEvent[]               events; 
//* Events that are connected to this Document, but themselves fulfill other orders

195



  }

196



197


  @DavClass._avoidIndexing

198


  @DavClass._largeIcon(
"icons/classes/PackingListItem-large.gif"
)

199


  @DavClass._notSiteSharable

200


  @DavClass._icon(
"icons/classes/PackingListItem.gif"
)

201


  @DavClass._abstract

202


  @DavClass._aggregationAllowed

203



public

static

abstract

class
 FulfillmentItem {

204


      @k 
public
 Fulfillment                   fulfillment;

205


      @k 
public
 Integer                       seq;

206



public
 DavResource                   unit;

207



public
 Integer                       quantity; 
// this has to change to allow any numeric type

208



  }

209



210


  @DavClass._avoidIndexing

211


  @DavClass._largeIcon(
"icons/classes/PackingListItem-large.gif"
)

212


  @DavClass._notSiteSharable

213


  @DavClass._icon(
"icons/classes/PackingListItem.gif"
)

214


  @DavClass._aggregationAllowed

215


  @DavClass._abstract

216



public

static

abstract

class
 AggregatedFulfillmentItem {

217


      @k 
public
 Fulfillment                   fulfillment;

218


      @k 
public
 Integer                       seq;

219



public
 DavResource                   unit;

220


         @_makeTotal

221



public
 Integer                       quantity; 
// this has to change to allow any numeric type

222



  }

223



224


  @DavClass._avoidIndexing

225



public

static

class
 DailyFulfillment 
extends
 Fulfillment {

226


    @k@s 
public
 Order                         order; 
//* Order that is being fulfilled

227



    @k@s 
public
 BusinessEvent                 event; 
//* Event which fulfills this Order

228



         @_sortAscending(
false
)

229


      @r 
public
 Long                          date;

230


      @s 
public
 FulfillmentItem               items;

231


  }

232



233


  @DavClass._avoidIndexing

234


  @DavClass._notSiteSharable

235


  @DavClass._aggregationAllowed

236



public

static

class
 DailyFulfillmentItem {

237


      @k 
public
 Order                         order;

238


         @_sortAscending(
false
)

239


      @k 
public
 Long                          date;

240


  }

241



242



/**

243


 * Helps track duplicate leads, duplicate defect reports.

244


 * This claims to be a duplicate of the one specified in dulicateOf.

245


 */

246


  @DavClass._largeIcon(
"icons/classes/Duplicate-large.gif"
)

247


  @DavClass._icon(
"icons/classes/Duplicate.gif"
)

248



public

static

class
 Duplicate {

249


         @_delegatedAccessControl

250


      @k 
public
 Demand                        duplicate;

251


         @_displayNameElm

252


         @_sameTypeAs(
"duplicate"
)

253


         @_delegatedAccessControl

254


      @k 
public
 Demand                        duplicateOf;

255


         @_maxSize(
1000
)

256



public
 String                        notes;

257


  }

258



259


  @DavClass._aView

260


  @DavClass._largeIcon(
"icons/classes/DuplicateOfMe-large.gif"
)

261


  @DavClass._icon(
"icons/classes/DuplicateOfMe.gif"
)

262


  @DavClass._filterView

263



public

static

class
 DuplicateOfMe 
extends
 Duplicate {

264


         @_displayNameElm

265


         @_delegatedAccessControl

266


      @s 
public
 Demand                        duplicate;

267


         @_delegatedAccessControl

268


      @s 
public
 Demand                        duplicateOf;

269


      @s 
public
 String                        notes;

270


  }

271


}

272