ooiservices/app/alfresco/utils.py
def make_alfresco_cruise_query(self, array,cruise):
        '''
        query the alfresco server for all documents relating to a cruise
        '''
        # create the cmis client
        client = CmisClient(self.ALFRESCO_URL, self.ALFRESCO_UN, self.ALFRESCO_PW)

        # connect to the alfresco server and return the repo object
        repo = client.getRepository(self.ALFRESCO_ID)
        # use this files connection method

        doc = repo.getObjectByPath("/OOI/"+array+" Array/Cruise Data")
        folder_query = "IN_FOLDER('"+doc.id+"')"

        array_cruises = repo.query("select * FROM cmis:folder  WHERE "+folder_query)

        #setup the cruise information
        results = []
        cruise_id = None
        if len(cruise) > 0:
            cruise_split = re.split('\s|-|;|,|\*|\n',cruise)
            cruise = "-".join(cruise_split)
            #unique case...
            if cruise == "Scarlett-Isabella":
                cruise = "SI"

            for r in array_cruises:
                cruise_str = r.getName().split("_")[1]
                if cruise in cruise_str:
                    cruise_id = r
                    break

            #only should the cruise information if its availablep
            if cruise_id is not None:
                cruise_results = repo.query("select * FROM cmis:document where IN_FOLDER('"+cruise_id.id+"')")
                for c in cruise_results:
                    c.type = "cruise"
                #add the cruise link
                cruise_id.type = "link"
                return cruise_results,cruise_id

        #return the defaults if not available
        return results,cruise_id

        query the alfresco server for all documents relating to a cruise
        
query the alfresco server for all documents relating to a cruise
query the alfresco server for all documents relating to a cruise
def make_alfresco_cruise_query(self, array,cruise):
        client = CmisClient(self.ALFRESCO_URL, self.ALFRESCO_UN, self.ALFRESCO_PW)
        repo = client.getRepository(self.ALFRESCO_ID)
        doc = repo.getObjectByPath("/OOI/"+array+" Array/Cruise Data")
        folder_query = "IN_FOLDER('"+doc.id+"')"
        array_cruises = repo.query("select * FROM cmis:folder  WHERE "+folder_query)
        results = []
        cruise_id = None
        if len(cruise) > 0:
            cruise_split = re.split('\s|-|;|,|\*|\n',cruise)
            cruise = "-".join(cruise_split)
            if cruise == "Scarlett-Isabella":
                cruise = "SI"
            for r in array_cruises:
                cruise_str = r.getName().split("_")[1]
                if cruise in cruise_str:
                    cruise_id = r
                    break
            if cruise_id is not None:
                cruise_results = repo.query("select * FROM cmis:document where IN_FOLDER('"+cruise_id.id+"')")
                for c in cruise_results:
                    c.type = "cruise"
                cruise_id.type = "link"
                return cruise_results,cruise_id
        return results,cruise_id
def make_alfresco_cruise_query ( self , array , cruise ) : client = CmisClient ( self . ALFRESCO_URL , self . ALFRESCO_UN , self . ALFRESCO_PW ) repo = client . getRepository ( self . ALFRESCO_ID ) doc = repo . getObjectByPath ( "/OOI/" + array + " Array/Cruise Data" ) folder_query = "IN_FOLDER('" + doc . id + "')" array_cruises = repo . query ( "select * FROM cmis:folder  WHERE " + folder_query ) results = [ ] cruise_id = None if len ( cruise ) > 0 : cruise_split = re . split ( '\s|-|;|,|\*|\n' , cruise ) cruise = "-" . join ( cruise_split ) if cruise == "Scarlett-Isabella" : cruise = "SI" for r in array_cruises : cruise_str = r . getName ( ) . split ( "_" ) [ 1 ] if cruise in cruise_str : cruise_id = r break if cruise_id is not None : cruise_results = repo . query ( "select * FROM cmis:document where IN_FOLDER('" + cruise_id . id + "')" ) for c in cruise_results : c . type = "cruise" cruise_id . type = "link" return cruise_results , cruise_id return results , cruise_id
query the alfresco server for all documents relating to a cruise
query the alfresco server for all documents relating to a cruise
'''
        query the alfresco server for all documents relating to a cruise
        ''' # create the cmis client # connect to the alfresco server and return the repo object # use this files connection method #setup the cruise information #unique case... #only should the cruise information if its availablep #add the cruise link #return the defaults if not available
self
array
cruise