You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Jeff Potts (JIRA)" <ji...@apache.org> on 2010/03/23 00:07:27 UTC

[jira] Resolved: (CMIS-159) Ordered queries are not ordered

     [ https://issues.apache.org/jira/browse/CMIS-159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Potts resolved CMIS-159.
-----------------------------

    Resolution: Fixed

Checked in. Thanks for the patch.

> Ordered queries are not ordered
> -------------------------------
>
>                 Key: CMIS-159
>                 URL: https://issues.apache.org/jira/browse/CMIS-159
>             Project: Chemistry
>          Issue Type: Bug
>          Components: cmislib
>            Reporter: Stefane Fermigier
>            Assignee: Jeff Potts
>
> When running an ordered SELECT query, the results are not ordered.
> I believe the following patch is needed:
> {noformat}
> SFs-macbook% svn diff
> Index: cmislib/model.py
> ===================================================================
> --- cmislib/model.py    (revision 923892)
> +++ cmislib/model.py    (working copy)
> @@ -1337,11 +1337,11 @@
>  
>      def __iter__(self):
>          ''' Iterator for the result set '''
> -        return self.getResults().itervalues()
> +        return iter(self.getResults())
>  
>      def __getitem__(self, index):
>          ''' Getter for the result set '''
> -        return self.getResults().values()[index]
> +        return self.getResults()[index]
>  
>      def __len__(self):
>          ''' Len method for the result set '''
> @@ -1411,16 +1411,23 @@
>  
>          if self._xmlDoc:
>              entryElements = self._xmlDoc.getElementsByTagNameNS(ATOM_NS, 'entry')
> -            entries = {}
> +            entries = []
>              for entryElement in entryElements:
>                  cmisObject = getSpecializedObject(CmisObject(self._cmisClient,
>                                                               self._repository,
>                                                               xmlDoc=entryElement))
> -                entries[cmisObject.getObjectId()] = cmisObject
> +                entries.append(cmisObject)
>  
>              self._results = entries
>  
>          return self._results
> +        
> +    def hasObject(self, objectId):
> +        for obj in self.getResults():
> +            if obj.id == objectId:
> +                return True
> +        return False
>  
>      def getFirst(self):
>  
> Index: tests/cmislibtest.py
> ===================================================================
> --- tests/cmislibtest.py        (revision 923892)
> +++ tests/cmislibtest.py        (working copy)
> @@ -1159,7 +1159,7 @@
>      """
>      done = False
>      while not done:
> -        if resultSet.getResults().has_key(targetDoc.getObjectId()):
> +        if resultSet.hasObject(targetDoc.getObjectId()):
>              return True
>          if resultSet.hasNext():
>              resultSet.getNext(){noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.