예제 #1
0
def create_remote_oio(io_url: str,
                      object_url: str,
                      object_type: str = "zaak") -> dict:
    if settings.CMIS_ENABLED:
        if object_type == "zaak":
            oio = ObjectInformatieObject.objects.create(
                informatieobject=io_url,
                zaak=object_url,
                object_type=object_type)
        elif object_type == "besluit":
            oio = ObjectInformatieObject.objects.create(
                informatieobject=io_url,
                besluit=object_url,
                object_type=object_type)

        response = {"url": oio.get_url()}
    else:
        client = Service.get_client(io_url)
        if client is None:
            raise UnknownService(
                f"{io_url} API should be added to Service model")

        body = {
            "informatieobject": io_url,
            "object": object_url,
            "objectType": object_type,
        }

        response = client.create("objectinformatieobject", data=body)
    return response
예제 #2
0
def delete_remote_zaakbesluit(zaakbesluit_url: str) -> None:
    client = Service.get_client(zaakbesluit_url)
    if client is None:
        raise UnknownService(
            f"{zaakbesluit_url} API should be added to Service model")

    client.delete("zaakbesluit", zaakbesluit_url)
예제 #3
0
def create_remote_oio(io_url: str, object_url: str, object_type: str = "zaak") -> dict:
    client = Service.get_client(io_url)
    if client is None:
        raise UnknownService(f"{io_url} API should be added to Service model")

    body = {"informatieobject": io_url, "object": object_url, "objectType": object_type}

    response = client.create("objectinformatieobject", data=body)
    return response
예제 #4
0
def fetch_object(resource: str, url: str) -> dict:
    """
    Fetch a remote object by URL.
    """
    client = Service.get_client(url)
    if not client:
        raise UnknownService(f"{url} API should be added to Service model")
    obj = client.retrieve(resource, url=url)
    return obj
예제 #5
0
def create_remote_zaakbesluit(besluit_url: str, zaak_url: str) -> dict:
    client = Service.get_client(zaak_url)
    if client is None:
        raise UnknownService(f"{zaak_url} API should be added to Service model")

    zaak_uuid = get_uuid_from_path(zaak_url)
    body = {"besluit": besluit_url}

    response = client.create("zaakbesluit", data=body, zaak_uuid=zaak_uuid)

    return response
예제 #6
0
def delete_remote_oio(oio_url: str) -> None:
    client = Service.get_client(oio_url)
    if client is None:
        raise UnknownService(f"{oio_url} API should be added to Service model")

    client.delete("objectinformatieobject", oio_url)