示例#1
0
    def setUpTestData(cls):
        super().setUpTestData()

        binding = os.getenv("CMIS_BINDING")
        if binding == "WEBSERVICE":
            config = CMISConfig.objects.get()
            config.client_url = "http://localhost:8082/alfresco/cmisws"
            config.binding = "WEBSERVICE"
            config.other_folder_path = "/DRC/"
            config.zaak_folder_path = "/ZRC/{{ zaaktype }}/{{ zaak }}"
            config.save()

            # Configure the main_repo_id
            client = get_cmis_client()
            config.main_repo_id = client.get_main_repo_id()
            config.save()
        elif binding == "BROWSER":
            config = CMISConfig.objects.get()
            config.client_url = "http://localhost:8082/alfresco/api/-default-/public/cmis/versions/1.1/browser"
            config.binding = "BROWSER"
            config.other_folder_path = "/DRC/"
            config.zaak_folder_path = "/ZRC/{{ zaaktype }}/{{ zaak }}/"
            config.save()
        else:
            raise Exception("No CMIS binding specified")

        if settings.CMIS_URL_MAPPING_ENABLED:
            UrlMapping.objects.create(
                long_pattern="http://testserver",
                short_pattern="http://ts",
                config=config,
            )
            UrlMapping.objects.create(
                long_pattern="http://example.com",
                short_pattern="http://ex.com",
                config=config,
            )
            UrlMapping.objects.create(
                long_pattern="http://openzaak.nl",
                short_pattern="http://oz.nl",
                config=config,
            )
示例#2
0
 def cmis_client(self):
     if self._cmis_client is None:
         self._cmis_client = client_builder.get_cmis_client()
     return self._cmis_client
示例#3
0
 def __init__(self, location=None, base_url=None, encoding=None):
     self._client = client_builder.get_cmis_client()
示例#4
0
 def _cleanup_alfresco(self) -> None:
     # Removes the created documents from alfresco
     client = get_cmis_client()
     client.delete_cmis_folders_in_base()
     self.adapter.stop()
示例#5
0
 def __init__(self):
     self.cmis_client = get_cmis_client()
示例#6
0
 def setUp(self):
     super().setUp()
     self.cmis_client = get_cmis_client()
     self.cmis_client.delete_cmis_folders_in_base()
示例#7
0
    def handle(self, *args, **options):
        if CMISConfig.objects.count() == 0:
            CMISConfig.objects.create(
                client_url=options["client_url"],
                binding=options["binding"],
                client_user=options["client_user"],
                client_password=options["client_password"],
                zaak_folder_path=options["zaak_folder_path"],
                other_folder_path=options["other_folder_path"],
            )
        else:
            config = CMISConfig.objects.get()
            config.client_url = options["client_url"]
            config.binding = options["binding"]
            config.client_user = options["client_user"]
            config.client_password = options["client_password"]
            config.other_folder_path = options["other_folder_path"]
            config.zaak_folder_path = options["zaak_folder_path"]
            config.save()

        # General
        cmis_client = get_cmis_client()
        cmis_client.get_repository_info()
        get_root_folder_id(cmis_client)
        get_other_base_folder(cmis_client)
        print("General: Success")

        try:
            # Folders
            get_folder(cmis_client)
            create_folder(cmis_client)
            delete_folder(cmis_client)
            get_or_create_folder(cmis_client)
            create_zaaktype_folder(cmis_client)
            create_zaak_folder(cmis_client)
            create_cmis_folder_in_zaaktype(cmis_client)
            create_cmis_folder_in_zaak(cmis_client)
            print("Folders: Success")

            # Content objects
            create_content_object_oio(cmis_client)
            create_content_object_gebruiksrechten(cmis_client)
            get_content_object_oio(cmis_client)
            get_content_object_gebruiksrechten(cmis_client)
            delete_content_object_oio(cmis_client)
            delete_content_object_gebruiksrechten(cmis_client)
            print("Content objects: Success")

            # Documents
            create_document(cmis_client)
            lock_unlock_document(cmis_client)
            get_pwc(cmis_client)
            update_document(cmis_client)
            create_document_copy(cmis_client)
            move_document(cmis_client)
            delete_document(cmis_client)
            print("Documents: Success")
        except Exception as exc:
            # Clean up
            cmis_client.get_or_create_other_folder().delete_tree()
            print("Cleaned up")
            raise exc

        # Clean up
        cmis_client.get_or_create_other_folder().delete_tree()
        print("Cleaned up")