Ejemplo n.º 1
0
 def add_agent(self, identifier_value):
     sequence_insert(
         self.root,
         P.agent(
             P.agentIdentifier(P.agentIdentifierType('LOCAL'),
                               P.agentIdentifierValue(identifier_value)),
             P.agentName('E-ARK AIP to DIP Converter'),
             P.agentType('Software')), self.premis_successor_sections)
Ejemplo n.º 2
0
 def add_object(self, identifier_value):
     sequence_insert(
         self.root,
         P.object({q(XSI_NS, 'type'): 'file'},
                  P.objectIdentifier(
                      P.objectIdentifierType('LOCAL'),
                      P.objectIdentifierValue(identifier_value)),
                  P.objectCharacteristics(
                      P.compositionLevel(0),
                      P.format(
                          P.formatRegistry(P.formatRegistryName(),
                                           P.formatRegistryKey)))),
         self.premis_successor_sections)
Ejemplo n.º 3
0
    def add_related_aips(self,
                         related_aips,
                         related_event_name,
                         identifier=None):
        """
        Add relationship information of AIPs which were used to create the DIP to the premis object of the package.
        @type       related_aips: list[string]
        @param      related_aips: List of related AIP identifiers
        @type       related_event_name: string
        @param      related_event_name: Name of the related event
        @type       identifier: string
        @param      identifier: Identifier of the object to which the elements are added (first object if none given)
        @rtype:     bool
        @return:    Success/failure of adding the related AIP identifiers
        """
        object_node = self.get_object_by_identifier(identifier)

        find = objectify.ObjectPath(
            "object.objectIdentifier.objectIdentifierValue")
        print(find(object_node).text)

        dip_acquire_aips_id = self.get_event_identifier_by_name(
            related_event_name)
        sequence_number = 1
        for related_aip in related_aips:
            sequence_insert(
                object_node,
                P.relationship(
                    P.relationshipType('derivation'),
                    P.relationshipSubType('AIP to DIP conversion'),
                    P.relatedObjectIdentification(
                        P.relatedObjectIdentifierType("repository"),
                        P.relatedObjectIdentifierValue(related_aip),
                        P.relatedObjectSequence(str(sequence_number)),
                    ),
                    P.relatedEventIdentification(
                        P.relatedEventIdentifierType("local"),
                        P.relatedEventIdentifierValue(dip_acquire_aips_id),
                    ),
                ), self.premis_successor_sections)
            sequence_number += 1
        return True
Ejemplo n.º 4
0
 def add_event(self,
               identifier_value,
               outcome,
               linking_agent,
               linking_object=None):
     sequence_insert(
         self.root,
         P.event(
             P.eventIdentifier(P.eventIdentifierType('LOCAL'),
                               P.eventIdentifierValue(identifier_value)),
             P.eventType, P.eventDateTime(datetime.utcnow().isoformat()),
             P.eventOutcomeInformation(P.eventOutcome(outcome)),
             P.linkingAgentIdentifier(
                 P.linkingAgentIdentifierType('LOCAL'),
                 P.linkingAgentIdentifierValue(linking_agent)),
             P.linkingAgentIdentifier(
                 P.linkingAgentIdentifierType('LOCAL'),
                 P.linkingAgentIdentifierValue(linking_object))
             if linking_object is not None else None),
         self.premis_successor_sections)