Esempio n. 1
0
    def __create_colls(self):
        '''Private method to fill the collections
        '''
        xml_collections = []
        for key in self.policy.keys():
            if self.config.get('SOURCES_SCHEMA', 'type') in key:
                xml_collection = policy_lib.locationPoint()
                index = key.split(self.config.get('SOURCES_SCHEMA', 'type'))[1]

                if self.policy[key] == 'pid':
                    identifier_key = "%s%s" % \
                        (self.config.get('SOURCES_SCHEMA', 'identifier'),
                         index)
                    xml_persistent_identifier = \
                        policy_lib.persistentIdentifierType7()
                    xml_persistent_identifier.valueOf_ = \
                        self.policy[identifier_key]
                    xml_persistent_identifier.type_ = self.policy[key]
                    xml_collection.persistentIdentifier = \
                        xml_persistent_identifier
                elif self.policy[key] == 'collection':
                    xml_source_location = self.__create_src_location(index)
                    xml_collection.location = xml_source_location

                xml_collection.id = int(index.split('_')[1])
                xml_collections.append(xml_collection)
        return xml_collections
Esempio n. 2
0
    def __create_targets(self):
        '''Private method to build the target nodes
        '''
        xml_targets = []
        for key in self.policy.keys():
            if self.config.get('TARGETS_SCHEMA', 'type') in key:
                xml_target = policy_lib.locationPoint()
                index = key.split(self.config.get('TARGETS_SCHEMA', 'type'))[1]

                if self.policy[key] == 'pid':
                    identifier_key = '%s%s' % \
                        (self.config.get('TARGETS_SCHEMA', 'identifier'),
                         index)
                    xml_persistent_identifier = \
                        policy_lib.persistentIdentifierType7()
                    xml_persistent_identifier.valueOf_ = \
                        self.policy[identifier_key]
                    xml_persistent_identifier.type_ = self.policy[key]
                    xml_target.persistentIdentifier = xml_persistent_identifier
                elif self.policy[key] == 'collection':
                    xml_target_location = self.__create_tgt_location(index)
                    xml_target.location = xml_target_location

                xml_target.id = int(index.split('_')[1])
                xml_targets.append(xml_target)
        return xml_targets
 def __createTargets(self, formdata):
     '''Private method to build the target nodes
     '''
     xml_targets = []
     tgt_idx = 0
     # Currently we don't have more than one target so we just
     # use that. 
     xml_target = policy_lib.locationPoint()
     xml_target.location = self.__createLocation(formdata)
     xml_targets.append(xml_target)
     return xml_targets
 def __createColls(self, formdata):
     '''Private method to fill the collections
     '''
     xml_collections = []
     col_idx = 0
     for acoll in formdata['collections']:
         xml_collection = policy_lib.locationPoint()
         xml_persistentIdentifier = policy_lib.persistentIdentifierType7()
         xml_persistentIdentifier.valueOf_ = acoll['name']
         xml_persistentIdentifier.type_ = acoll['type']
         xml_collection.id = col_idx
         xml_collection.persistentIdentifier = xml_persistentIdentifier
         xml_collections.append(xml_collection)
         col_idx += 1
     return xml_collections