Changeset 272


Ignore:
Timestamp:
Nov 20, 2009, 2:06:04 PM (11 years ago)
Author:
jjbot
Message:

Added filter to getItemlinks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • web/IbidasAtomicServices2.py

    r270 r272  
    9595        """Returns all the direct children of the provided items.
    9696        """
    97         self.logger.debug("getItemChildren")
     97        self.logger.debug("Called getItemChildren")
     98        self.logger.debug("Provided arguments: " + str(args.keys()))
    9899        assert args.has_key('items'), \
    99100                'No item_ids provided to search children with.'
     
    124125        """
    125126        self.logger.debug("getItemParents")
     127        self.logger.debug("Provided arguments: " + str(args.keys()))
    126128        assert args.has_key('items'), \
    127129                'No item_ids provided to search parents with.'
     
    148150        """
    149151        self.logger.debug("getItemNeighbours")
     152        self.logger.debug("Provided arguments: " + str(args.keys()))
    150153        print args
    151154        items = args['items']
     
    168171    def getItemLinks(self, args):
    169172        """Returns all the links between the provided items."""
    170         # FIXME: add constraints
    171173        self.logger.debug("Called getItemLinks")
     174        self.logger.debug("Provided arguments: " + str(args.keys()))
    172175        msg = IbidasSimpleMessage()
    173176        assert args.has_key('items'), \
     
    177180        links = self.cd.item_child_link.join(items, 'parent_id', 'item_id').up()
    178181        links = links.join(items, 'child_id', 'item_id').up()
    179         msg.addItemLinks(links)
    180 
    181         return msg.finalize()
    182 
    183     def getItemsByID(self, ids):
    184         pass
     182        links = self.__addItemlinkConstraints(links, args)
     183        msg.addItemLinks(links)
     184
     185        return msg.finalize()
     186
     187    def getItemsByID(self, args):
     188        # FIXME: should we still filter on constraints?
     189        self.logger.debug("Called getItemsByID")
     190        self.logger.debug("Provided arguments: " + str(args.keys()))
     191        msg = IbidasSimpleMessage()
     192        assert args.has_key('items'), \
     193                "No item_ids provided to fetch."
     194        item_ids = [int(x) for x in args['items']]
     195        items = self.cd.item[_.item_id.within(*item_ids)]
     196        msg.addItems(items)
     197        return msg.finalize()
    185198
    186199    def getItemrelationsByID(self, ids):
Note: See TracChangeset for help on using the changeset viewer.