-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ee39f2
commit fd02bd4
Showing
18 changed files
with
663 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
...ntial/model/GenerateDocumentProperties.kt → ...tial/domain/GenerateDocumentProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package com.ritense.valtimo.xential.model | ||
package com.ritense.valtimo.xential.domain | ||
|
||
import java.util.UUID | ||
|
||
data class GenerateDocumentProperties( | ||
val templateId: String, | ||
val templateId: UUID, | ||
val fileFormat: FileFormat, | ||
val documentId: String, | ||
val templateData: Map<String, String> | ||
) | ||
|
||
enum class FileFormat { | ||
DOCX, HTML, PDF, XML | ||
WORD, PDF | ||
} |
20 changes: 20 additions & 0 deletions
20
backend/plugin/src/main/kotlin/com/ritense/valtimo/xential/domain/XentialToken.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.ritense.valtimo.xential.domain | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.Table | ||
import java.net.URI | ||
import java.util.UUID | ||
|
||
@Entity | ||
@Table(name = "xential_tokens") | ||
data class XentialToken ( | ||
@Id | ||
@Column(name = "token", nullable = false, updatable = false) | ||
val token: UUID, | ||
@Column(name = "process_id", nullable = false, updatable = false) | ||
val processId: UUID, | ||
@Column(name = "resume_url", nullable = true, updatable = false) | ||
val resumeUrl: URI?, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...d/plugin/src/main/kotlin/com/ritense/valtimo/xential/repository/XentialTokenRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.ritense.valtimo.xential.repository | ||
|
||
import com.ritense.valtimo.xential.domain.XentialToken | ||
import org.springframework.data.repository.CrudRepository | ||
import java.util.UUID | ||
|
||
interface XentialTokenRepository : CrudRepository<XentialToken, UUID> |
45 changes: 45 additions & 0 deletions
45
...d/plugin/src/main/kotlin/com/ritense/valtimo/xential/service/DocumentGenerationService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.ritense.valtimo.xential.service | ||
|
||
import com.ritense.valtimo.xential.domain.GenerateDocumentProperties | ||
import com.ritense.valtimo.xential.domain.XentialToken | ||
import com.ritense.valtimo.xential.repository.XentialTokenRepository | ||
import com.rotterdam.xential.api.DefaultApi | ||
import com.rotterdam.xential.model.Sjabloondata | ||
import org.openapitools.client.infrastructure.ApiClient | ||
import java.util.UUID | ||
|
||
class DocumentGenerationService( | ||
val defaultApi: DefaultApi, | ||
val xentialTokenRepository: XentialTokenRepository, | ||
) { | ||
|
||
fun generateDocument( | ||
processId: UUID, | ||
generateDocumentProperties: GenerateDocumentProperties, | ||
clientId: String, | ||
clientPassword: String, | ||
) { | ||
val sjabloonVulData = generateDocumentProperties.templateData.entries.map { "<${it.key}>${it.value}</${it.key}>" }.joinToString() | ||
|
||
ApiClient.username = clientId | ||
ApiClient.password = clientPassword | ||
val result = defaultApi.creeerDocument( | ||
gebruikersId = clientId, | ||
accepteerOnbekend = false, | ||
sjabloondata = Sjabloondata( | ||
sjabloonId = generateDocumentProperties.templateId.toString(), | ||
bestandsFormaat = Sjabloondata.BestandsFormaat.valueOf(generateDocumentProperties.fileFormat.name), | ||
documentkenmerk = generateDocumentProperties.documentId, | ||
sjabloonVulData = "<root>$sjabloonVulData</root>" | ||
) | ||
) | ||
|
||
val xentialToken = XentialToken( | ||
token = UUID.fromString(result.documentCreatieSessieId), | ||
processId = processId, | ||
resumeUrl = result.resumeUrl | ||
) | ||
|
||
xentialTokenRepository.save(xentialToken) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
backend/plugin/src/main/resources/config/liquibase/changelog/20241010-add-xential_tokens.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
<!-- | ||
~ Copyright 2015-2024 Ritense BV, the Netherlands. | ||
~ | ||
~ Licensed under EUPL, Version 1.2 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 | ||
~ | ||
~ 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. | ||
--> | ||
|
||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd"> | ||
|
||
<changeSet id="1" author="Ritense"> | ||
<preConditions onFail="CONTINUE"> | ||
<tableExists tableName="xential_tokens"/> | ||
</preConditions> | ||
<createTable tableName="xential_tokens"> | ||
<column name="token" type="uuid"/> | ||
<column name="process_id" type="uuid"/> | ||
<column name="resume_url" type="VARCHAR(2083)"/> | ||
</createTable> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
25 changes: 25 additions & 0 deletions
25
backend/plugin/src/main/resources/config/liquibase/xential-plugin-master.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Copyright 2015-2024 Ritense BV, the Netherlands. | ||
~ | ||
~ Licensed under EUPL, Version 1.2 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 | ||
~ | ||
~ 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. | ||
--> | ||
|
||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"> | ||
|
||
<include file="changelog/20241010-add-xential_tokens.xml" relativeToChangelogFile="true"/> | ||
|
||
</databaseChangeLog> |
Oops, something went wrong.