collectionManager

A singleton to manage data backend access with Ajax requests and Bluebird promises. Responsible for the data synchronization listening to a websocket and updating collections.

class CollectionManager()

A singleton to manage lazy loading of server collections

CollectionManager._parseGroupStates(models, allIdeasCollection)
Arguments
  • models (Object) –

  • allIdeasCollection (Object) –

Returns

models

Return type

Object

CollectionManager.getAllAnnouncementCollectionPromise()

Returns the collection of annoucements

Return type

BaseCollection

CollectionManager.getAllExtractsCollectionPromise()

Returns the collection of extracts

Return type

BaseCollection

CollectionManager.getAllIdeaLinksCollectionPromise()

Returns the collection of idea links

Return type

BaseCollection

CollectionManager.getAllIdeasCollectionPromise()

Returns the collection of ideas

Return type

BaseCollection

CollectionManager.getAllMessageStructureCollectionPromise()

Returns the collection of message structures

Return type

BaseCollection

CollectionManager.getAllPartnerOrganizationCollectionPromise()

Returns the collection of partners

Return type

BaseCollection

CollectionManager.getAllPartnerOrganizationCollectionPromise()

Returns the collection of partners

Return type

BaseCollection

CollectionManager.getAllSynthesisCollectionPromise()

Returns the collection of synthesis

Return type

BaseCollection

CollectionManager.getAllUserAccountsPromise()

Returns the collection of user accounts

Return type

BaseCollection

CollectionManager.getAllUsersCollectionPromise()

Returns the collection of users and agents An exception, the collection is instanciated from json sent in the HTML of the frontend, not through an ajax request.

Return type

BaseCollection

CollectionManager.getAllUsersCollectionPromise()

Returns the idea publication flow. An exception, the flow is instanciated from json sent in the HTML of the frontend, not through an ajax request.

Return type

PublicationFlow

CollectionManager.getAllWidgetsPromise()

Returns the collection of publication flows

Return type

BaseCollection

CollectionManager.getAllWidgetsPromise()

Returns the collection of widgets

Return type

BaseCollection

CollectionManager.getCollectionPromiseByType(item, item['@type')

Returns the owning collection for the raw json of an object that doesn’t have a model yet. Primarily used when receiving an object on the websocket

Ex: A harvester changes the title of an idea. The updated idea will be put on the websocket by the backend. All frontends (all connected users) will recieve this json. It is fed in this function so that the corresponding model in the collection can be updated (this update does NOT happen in this method)

Arguments
  • item (BaseModel) –

  • item['@type' (string) – The model type

Return type

BaseCollection

CollectionManager.getDiscussionModelPromise()

Returns the model of discussions

Return type

BaseModel

CollectionManager.getDiscussionPreferencePromise()

Returns the collection of preferences for this discussion

Return type

BaseCollection

CollectionManager.getDiscussionSourceCollectionPromise()

Returns the collection of external sources for discussions

Return type

BaseCollection

CollectionManager.getDiscussionSourceCollectionPromise2()

Returns the collection of external sources for discussions

Return type

BaseCollection

CollectionManager.getFacebookAccessTokensPromise()

Returns the collection of tokens to access Facebook accounts

Return type

BaseCollection

CollectionManager.getGlobalPreferencePromise()

Returns the collection of preferences for all discussions

Return type

BaseCollection

CollectionManager.getGroupSpecsCollectionPromise(viewsFactory, url_structure_promise, skip_group_state)

Returns the stored configuration of groups and panels

Arguments
  • viewsFactory (Object) –

  • url_structure_promise (String) –

  • skip_group_state (Boolean) –

Return type

BaseCollection

CollectionManager.getIdeaContentLinkCollectionOnMessage(messageModel)

Creates a collection of IdeaContentLink for a message

Arguments
  • messageModel (Object) – The Backbone model of the message

Returns

The collection of ideaContentLinks

Return type

BaseCollection

CollectionManager.getIdeaPublicationStatesPromise()

Returns the collection of publication states for ideas

Return type

BaseCollection

CollectionManager.getLocalRoleCollectionPromise()

Returns the collection of all roles

Return type

BaseCollection

CollectionManager.getLocalRoleCollectionPromise()

Returns the collection of roles (a set of permissions)

Return type

BaseCollection

CollectionManager.getMessageFullModelPromise(id, messagesStructureCollectionPromise)

This returns a promise to a SINGLE model. In practice, this model is a member of the proper collection, and requests to the server are optimised and batched together. Primarily used by messages to get the actual body and other information we do not want to eagerly preload.

Arguments
  • id (String) –

  • messagesStructureCollectionPromise (Promise) – (optional) A promise containing a structure of messages (messages ids and how they are related to each other, but not necessarily their content), for which you want to download the message contents. Defaults to the general message structure collection promise (this.getAllMessageStructureCollectionPromise()), which contains all messages except deleted messages which removal does not break the structure. For example, if you want to show in the messageList the presence of all messages including all deleted messages, you need to set this parameter to a promise which contains the structure of absolutely all messages.

Return type

Promise

CollectionManager.getMessageFullModelRequestWorker(collectionManager, messagesStructureCollectionPromise)

This class is essentially a subprocess that receives requests for specific models and a specific viewdef and: - Combines them together to avoid swarming the server - Splits them to respect limits on http get url length - Dispaches the individual promises for each request even if they were actually processed together.

Arguments
  • collectionManager (Object) –

  • messagesStructureCollectionPromise (Promise) – (optional) A promise containing a structure of messages (messages ids and how they are related to each other, but not necessarily their content), for which you want to download the message contents. Defaults to the general message structure collection promise (collectionManager.getAllMessageStructureCollectionPromise()), which contains all messages except deleted messages which removal does not break the structure. For example, if you want to show in the messageList the presence of all messages including all deleted messages, you need to set this parameter to a promise which contains the structure of absolutely all messages.

Return type

Promise

CollectionManager.getMessageFullModelsPromise(ids)

TODO: This method seems to not be used anywhere in the code. Remove it or use it. If we use it, add a second parameter messagesStructureCollectionPromise like in getMessageFullModelPromise(). Retrieve fully populated models for the list of id’s given

Arguments
  • 'Array' ].<string> ids ([) – array of message id’s

Return type

MessageModel

CollectionManager.getNotificationsDiscussionCollectionPromise()

Returns the collection of discussion notifications

Return type

BaseCollection

CollectionManager.getUserLanguagePreferencesPromise()

Returns the collection of language preferences

Return type

BaseCollection

CollectionManager.getUserPreferencePromise()

Returns the collection of preferences for all users

Return type

BaseCollection

CollectionManager.getWidgetsForContextPromise(context, idea, liveupdate_keys)

Returns a subset of widgets according to the context and the idea

Arguments
  • context (Number) –

  • idea (Object) –

  • liveupdate_keys (Object) –

Return type

BackboneSubset

CollectionManager.getWidgetsForContextPromise()

Returns the connected socket

Return type

Socket