Skip to content

Commit

Permalink
Merge branch 'release/4.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
zambrovski committed Jul 1, 2024
2 parents 5f08e5c + f53513a commit 81d445b
Show file tree
Hide file tree
Showing 73 changed files with 2,861 additions and 124 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
env:
OSS_CENTRAL_USERNAME: "${{ secrets.SONATYPE_USERNAME }}"
OSS_CENTRAL_PASSWORD: "${{ secrets.SONATYPE_PASSWORD }}"
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/snapshot-producer'

- name: Upload coverage information to CodeCov
uses: codecov/codecov-action@v4
Expand Down
2 changes: 1 addition & 1 deletion bom/datapool-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

Expand Down
14 changes: 7 additions & 7 deletions bom/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-root</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -420,7 +420,7 @@
<!-- jar -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
Expand All @@ -435,7 +435,7 @@
<!-- for loading and unpacking artifacts -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.0</version>
<version>3.7.1</version>
</plugin>

<plugin>
Expand Down Expand Up @@ -519,7 +519,7 @@

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<version>3.3.0</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<runOrder>random</runOrder>
Expand All @@ -530,7 +530,7 @@
</excludes>
<!-- Sets the VM argument line used when unit tests are run. -->
<!-- prevent the annoying ForkedBooter process from stealing window focus on Mac OS -->
<argLine>-Djava.awt.headless=true @{surefireArgLine} -XX:+StartAttachListener</argLine>
<argLine>-Djava.awt.headless=true @{surefireArgLine} -XX:+StartAttachListener --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</argLine>
<systemPropertyVariables>
<jgiven.report.dir>${project.build.directory}/jgiven-reports</jgiven.report.dir>
</systemPropertyVariables>
Expand All @@ -540,7 +540,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.2.5</version>
<version>3.3.0</version>
<executions>
<execution>
<goals>
Expand All @@ -557,7 +557,7 @@
<!-- Sets the VM argument line used when integration tests are run. -->
<!-- prevent the annoying ForkedBooter process from stealing window focus on Mac OS -->
<!-- the add-opens is required for XStream -->
<argLine>-Djava.awt.headless=true @{failsafeArgLine} -XX:+StartAttachListener --add-opens java.base/java.util=ALL-UNNAMED</argLine>
<argLine>-Djava.awt.headless=true @{failsafeArgLine} -XX:+StartAttachListener --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</argLine>
</configuration>
</plugin>

Expand Down
2 changes: 1 addition & 1 deletion bom/taskpool-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/bus-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
<relativePath>../../bom/parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/datapool/datapool-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-datapool-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
</parent>

<artifactId>polyflow-datapool-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,39 @@ data class DeleteDataEntryCommand(
@TargetAggregateIdentifier
val dataIdentity: String = dataIdentityString(entryType = entryType, entryId = entryId),
)

/**
* Command to anonymize the aggregate.
*/
data class AnonymizeDataEntryCommand(
/**
* Entry id.
*/
val entryId: EntryId,

/**
* Entry type.
*/
val entryType: EntryType,

/**
* The username that will replace the current username(s) in the protocol of the data entry
*/
val anonymizedUsername: String,

/**
* Usernames that should be excluded from the anonymization. For example "SYSTEM"
*/
val excludedUsernames: List<String> = listOf(),

/**
* Modification information.
*/
val anonymizeModification: Modification = Modification.NONE,

/**
* Addressing information.
*/
@TargetAggregateIdentifier
val dataIdentity: String = dataIdentityString(entryType = entryType, entryId = entryId),
)
2 changes: 1 addition & 1 deletion core/datapool/datapool-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-datapool-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
</parent>

<artifactId>polyflow-datapool-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ class DataEntryAggregate() {
)
}

/**
* Handle anonymize.
*/
@CommandHandler
fun handle(command: AnonymizeDataEntryCommand, @Autowired deletionStrategy: DeletionStrategy) {
if (deletionStrategy.strictMode()) {
if (deleted) {
throw AggregateDeletedException(this.dataIdentity, "The data entry has already been deleted")
}
}
AggregateLifecycle.apply(
command.anonymizeEvent()
)
}

/**
* React on created event.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package io.holunda.polyflow.datapool.core.business

import com.fasterxml.jackson.databind.ObjectMapper
import io.holunda.camunda.taskpool.api.business.*
import io.holunda.polyflow.bus.jackson.JsonAutoDetectAnyVisibility
import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper
import io.holunda.polyflow.datapool.core.DeletionStrategy
import io.holunda.polyflow.datapool.core.configurePolyflowJacksonObjectMapperForDatapool
import org.assertj.core.api.Assertions
import org.assertj.core.api.Assertions.assertThat
import org.axonframework.eventsourcing.AggregateDeletedException
import org.axonframework.test.aggregate.AggregateTestFixture
Expand Down Expand Up @@ -164,6 +162,113 @@ class DataEntryAggregateTest {
)
}

@Test
fun `should anonymize aggregate`() {

val dataEntryChange = DataEntryChange(
entryType = "io.holunda.My",
entryId = UUID.randomUUID().toString(),
applicationName = "myApp",
name = "My Entry 4711",
type = "My",
payload = Variables.createVariables(),
correlations = newCorrelations()
)

val command = AnonymizeDataEntryCommand(
entryType = dataEntryChange.entryType,
entryId = dataEntryChange.entryId,
anonymizedUsername = "ANONYMOUS",
excludedUsernames = listOf("SYSTEM"),
anonymizeModification = Modification(OffsetDateTime.now(), "kermit", "kermit decided to anonymize", logNotes = "Let us anonymize this item")
)

fixture
.registerInjectableResource(LAX_POLICY)
.given(
DataEntryCreatedEvent(
entryId = dataEntryChange.entryId,
entryType = dataEntryChange.entryType,
name = "Some name",
type = "Another",
applicationName = "Different application",
state = dataEntryChange.state,
description = dataEntryChange.description,
payload = dataEntryChange.payload,
correlations = dataEntryChange.correlations,
createModification = dataEntryChange.modification,
authorizations = dataEntryChange.authorizationChanges,
formKey = dataEntryChange.formKey
)
)
.`when`(command)
.expectEvents(
DataEntryAnonymizedEvent(
entryId = command.entryId,
entryType = command.entryType,
anonymizedUsername = command.anonymizedUsername,
excludedUsernames = command.excludedUsernames,
anonymizeModification = command.anonymizeModification,
)
)
}

@Test
fun `should not anonymize deleted aggregate in strict mode`() {

val dataEntryChange = DataEntryChange(
entryType = "io.holunda.My",
entryId = UUID.randomUUID().toString(),
applicationName = "myApp",
name = "My Entry 4711",
type = "My",
payload = Variables.createVariables(),
correlations = newCorrelations()
)

val deleteCommand = DeleteDataEntryCommand(
entryType = dataEntryChange.entryType,
entryId = dataEntryChange.entryId,
modification = Modification(OffsetDateTime.now(), "kermit", "kermit decided to delete", logNotes = "Let us delete this item"),
state = ProcessingType.DELETED.of("deleted as irrelevant")
)

val anonymizeCommand = AnonymizeDataEntryCommand(
entryType = dataEntryChange.entryType,
entryId = dataEntryChange.entryId,
anonymizedUsername = "ANONYMOUS",
excludedUsernames = listOf("SYSTEM"),
anonymizeModification = Modification(OffsetDateTime.now(), "kermit", "kermit decided to anonymize", logNotes = "Let us anonymize this item")
)

fixture
.registerInjectableResource(STRICT_POLICY)
.given(
DataEntryCreatedEvent(
entryId = dataEntryChange.entryId,
entryType = dataEntryChange.entryType,
name = "Some name",
type = "Another",
applicationName = "Different application",
state = dataEntryChange.state,
description = dataEntryChange.description,
payload = dataEntryChange.payload,
correlations = dataEntryChange.correlations,
createModification = dataEntryChange.modification,
authorizations = dataEntryChange.authorizationChanges,
formKey = dataEntryChange.formKey
),
DataEntryDeletedEvent(
entryId = deleteCommand.entryId,
entryType = deleteCommand.entryType,
deleteModification = deleteCommand.modification,
state = deleteCommand.state
)
)
.`when`(anonymizeCommand)
.expectException(AggregateDeletedException::class.java)
}

@Test
fun `should not delete deleted aggregate in strict mode`() {

Expand Down
2 changes: 1 addition & 1 deletion core/datapool/datapool-event/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-datapool-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
</parent>

<artifactId>polyflow-datapool-event</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,35 @@ data class DataEntryDeletedEvent(
*/
val state: DataEntryState = ProcessingType.UNDEFINED.of("")
)

/**
* Data entry anonymized.
*/
@Revision("1")
data class DataEntryAnonymizedEvent(
/**
* Entry type
*/
val entryType: EntryType,

/**
* Entry id.
*/
val entryId: EntryId,

/**
* The username that will replace the current username(s) in the protocol of the data entry
*/
val anonymizedUsername: String,

/**
* Usernames that should be excluded from the anonymization. For example "SYSTEM"
*/
val excludedUsernames: List<String> = listOf(),

/**
* Modification information.
*/
val anonymizeModification: Modification = Modification.now(),

)
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,15 @@ fun DeleteDataEntryCommand.deletedEvent() = DataEntryDeletedEvent(
entryType = this.entryType,
deleteModification = this.modification,
state = this.state
)

/**
* Maps command to event.
*/
fun AnonymizeDataEntryCommand.anonymizeEvent() = DataEntryAnonymizedEvent(
entryId = this.entryId,
entryType = this.entryType,
anonymizedUsername = this.anonymizedUsername,
excludedUsernames = this.excludedUsernames,
anonymizeModification = this.anonymizeModification
)
2 changes: 1 addition & 1 deletion core/datapool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
<relativePath>../../bom/parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/spring-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
<relativePath>../../bom/parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/taskpool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.holunda.polyflow</groupId>
<artifactId>polyflow-parent</artifactId>
<version>4.1.6</version>
<version>4.2.0</version>
<relativePath>../../bom/parent/pom.xml</relativePath>
</parent>

Expand Down
Loading

0 comments on commit 81d445b

Please sign in to comment.