Hi!
Up to now, I’ve been using this method to create java classes from the template opt
I’ve been using DefinitionAPI through PostMan to define the template, because if not I got an error that the ID template does not exist. Is there any way to define a template, with its template ID through OpenEhr_SDK?
Using the Definition API is a perfectly correct way (IMO) to upload a template to the CDR. What is the problem with that approach?
Hi @Alex_Paris ,
there is an interface TemplateProvider which can be used to implement different ways of managing templates using the SDK. However, the SDK is not capable to build an openEHR Template from scratch (in an ad-hoc way) but merely to parse and further process any OPT.
Does this help?
Birger
1 Like
Hi @birger.haarbrandt ,
But, if for example I have an opt of a template that is not uploaded, it is not possible to upload it from the SDK, right? First I should upload it for example with PostMan and then I can manage it in the SDK, right?
Hi @ian.mcnicoll ,
My question is whether you can upload a template directly through the SDK.
@Alex_Paris ,
please see the following for an upload function (class + test):
/*
* Copyright (c) 2019 vitasystems GmbH and Hannover Medical School.
*
* This file is part of project openEHR_SDK
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ehrbase.client.openehrclient.defaultrestclient;
import static org.ehrbase.client.openehrclient.defaultrestclient.DefaultRestClient.OBJECT_MAPPER;
This file has been truncated. show original
/*
* Copyright (c) 2019 vitasystems GmbH and Hannover Medical School.
*
* This file is part of project openEHR_SDK
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ehrbase.client.openehrclient.defaultrestclient;
import static org.assertj.core.api.Assertions.assertThat;
This file has been truncated. show original
Be aware that the example sets some values in the OPT which is for test purposes only.
Yes, I have already seen that this upload function exists, but I am using the client module and as is a private method I can not access.
1 Like
yampeku
(Diego Bosca)
13 May 2024 10:08
8
Was trying to use it and the upload function seems to be not accessible as a public method in the java client
vidi42
(Alex Vidrean)
13 May 2024 10:12
9
I will check what’s the reason for the method being private.
1 Like