Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-9062] Switch to ACS Event Model 1.0.2 #763

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion live-ingester/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>acs-enterprise-event-model</artifactId>
<artifactId>acs-event-model</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.alfresco.enterprise.repo.event.databind.EnterpriseObjectMapperFactory;
import org.alfresco.hxi_connector.live_ingester.adapters.config.jackson.DeleteNodeEventSerializer;
import org.alfresco.hxi_connector.live_ingester.adapters.config.jackson.UpdateNodeEventSerializer;
import org.alfresco.hxi_connector.live_ingester.domain.ports.ingestion_engine.DeleteNodeEvent;
import org.alfresco.hxi_connector.live_ingester.domain.ports.ingestion_engine.UpdateNodeEvent;
import org.alfresco.repo.event.databind.ObjectMapperFactory;

@Configuration
public class MappingConfig
Expand All @@ -44,7 +44,7 @@ public class MappingConfig
@Bean
public ObjectMapper objectMapper()
{
ObjectMapper objectMapper = EnterpriseObjectMapperFactory.createInstance();
ObjectMapper objectMapper = ObjectMapperFactory.createInstance();
objectMapper.registerModule(new JavaTimeModule());
objectMapper.registerModule(createModuleWithCustomSerializers());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@

import lombok.NoArgsConstructor;

import org.alfresco.enterprise.repo.event.v1.model.EnterpriseEventData;
import org.alfresco.hxi_connector.live_ingester.domain.usecase.metadata.model.PropertyDelta;
import org.alfresco.repo.event.v1.model.ContentInfo;
import org.alfresco.repo.event.v1.model.DataAttributes;
import org.alfresco.repo.event.v1.model.EventData;
import org.alfresco.repo.event.v1.model.NodeResource;
import org.alfresco.repo.event.v1.model.RepoEvent;
import org.alfresco.repo.event.v1.model.UserInfo;
Expand Down Expand Up @@ -107,26 +107,26 @@ public static Optional<PropertyDelta<?>> calculateModifiedAtDelta(RepoEvent<Data

public static Optional<PropertyDelta<?>> calculateAllowAccessDelta(RepoEvent<DataAttributes<NodeResource>> event)
{
EnterpriseEventData enterpriseEventData = (EnterpriseEventData) event.getData();
EventData eventData = (EventData) event.getData();

if (enterpriseEventData.getResourceReaderAuthorities() == null)
if (eventData.getResourceReaderAuthorities() == null)
{
return Optional.of(PropertyDelta.updated(ALLOW_ACCESS, Set.of(GROUP_EVERYONE)));
}

return Optional.of(PropertyDelta.updated(ALLOW_ACCESS, enterpriseEventData.getResourceReaderAuthorities()));
return Optional.of(PropertyDelta.updated(ALLOW_ACCESS, eventData.getResourceReaderAuthorities()));
}

public static Optional<PropertyDelta<?>> calculateDenyAccessDelta(RepoEvent<DataAttributes<NodeResource>> event)
{
EnterpriseEventData enterpriseEventData = (EnterpriseEventData) event.getData();
EventData eventData = (EventData) event.getData();

if (enterpriseEventData.getResourceDeniedAuthorities() == null)
if (eventData.getResourceDeniedAuthorities() == null)
{
return Optional.of(PropertyDelta.updated(DENY_ACCESS, Set.of()));
}

return Optional.of(PropertyDelta.updated(DENY_ACCESS, enterpriseEventData.getResourceDeniedAuthorities()));
return Optional.of(PropertyDelta.updated(DENY_ACCESS, eventData.getResourceDeniedAuthorities()));
}

private static Long toMilliseconds(ZonedDateTime time)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@

import org.junit.jupiter.api.Test;

import org.alfresco.enterprise.repo.event.v1.model.EnterpriseEventData;
import org.alfresco.hxi_connector.live_ingester.domain.usecase.metadata.model.PropertyDelta;
import org.alfresco.repo.event.v1.model.ContentInfo;
import org.alfresco.repo.event.v1.model.DataAttributes;
import org.alfresco.repo.event.v1.model.EventData;
import org.alfresco.repo.event.v1.model.EventType;
import org.alfresco.repo.event.v1.model.NodeResource;
import org.alfresco.repo.event.v1.model.RepoEvent;
Expand Down Expand Up @@ -373,12 +373,12 @@ void shouldAddACLInfo_NodeCreated()

setType(event, NODE_CREATED);

given(event.getData()).willReturn(mock(EnterpriseEventData.class));
given(event.getData()).willReturn(mock(EventData.class));
given(event.getData().getResource()).willReturn(nodeResourceWithRequiredFields().build());
given(event.getData().getResourceBefore()).willReturn(NodeResource.builder().build());

given(((EnterpriseEventData) event.getData()).getResourceReaderAuthorities()).willReturn(Set.of(groupEveryone));
given(((EnterpriseEventData) event.getData()).getResourceDeniedAuthorities()).willReturn(Set.of(bob));
given(((EventData) event.getData()).getResourceReaderAuthorities()).willReturn(Set.of(groupEveryone));
given(((EventData) event.getData()).getResourceDeniedAuthorities()).willReturn(Set.of(bob));
// when
Set<PropertyDelta<?>> propertyDeltas = propertiesMapper.mapToPropertyDeltas(event);

Expand All @@ -399,12 +399,12 @@ void shouldAddDefaultACLInfoIfNotPresent_NodeCreated()

setType(event, NODE_CREATED);

given(event.getData()).willReturn(mock(EnterpriseEventData.class));
given(event.getData()).willReturn(mock(EventData.class));
given(event.getData().getResource()).willReturn(nodeResourceWithRequiredFields().build());
given(event.getData().getResourceBefore()).willReturn(NodeResource.builder().build());

given(((EnterpriseEventData) event.getData()).getResourceReaderAuthorities()).willReturn(null);
given(((EnterpriseEventData) event.getData()).getResourceDeniedAuthorities()).willReturn(null);
given(((EventData) event.getData()).getResourceReaderAuthorities()).willReturn(null);
given(((EventData) event.getData()).getResourceDeniedAuthorities()).willReturn(null);
// when
Set<PropertyDelta<?>> propertyDeltas = propertiesMapper.mapToPropertyDeltas(event);

Expand All @@ -426,12 +426,12 @@ void shouldAddACLInfo_NodePermissionsUpdated()

setType(event, PERMISSION_UPDATED);

given(event.getData()).willReturn(mock(EnterpriseEventData.class));
given(event.getData()).willReturn(mock(EventData.class));
given(event.getData().getResource()).willReturn(nodeResourceWithRequiredFields().build());
given(event.getData().getResourceBefore()).willReturn(NodeResource.builder().build());

given(((EnterpriseEventData) event.getData()).getResourceReaderAuthorities()).willReturn(Set.of(groupEveryone));
given(((EnterpriseEventData) event.getData()).getResourceDeniedAuthorities()).willReturn(Set.of(bob));
given(((EventData) event.getData()).getResourceReaderAuthorities()).willReturn(Set.of(groupEveryone));
given(((EventData) event.getData()).getResourceDeniedAuthorities()).willReturn(Set.of(bob));
// when
Set<PropertyDelta<?>> propertyDeltas = propertiesMapper.mapToPropertyDeltas(event);

Expand Down Expand Up @@ -469,7 +469,7 @@ private static DataAttributes<NodeResource> mockData(RepoEvent<DataAttributes<No
return event.getData();
}

EnterpriseEventData<NodeResource> data = mock();
EventData<NodeResource> data = mock();

given(event.getData()).willReturn(data);

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<alfresco-platform.version>23.4.0-M1</alfresco-platform.version>
<alfresco-sdk.version>4.9.0</alfresco-sdk.version>
<alfresco-db-connector.version>4.1.0</alfresco-db-connector.version>
<alfresco-event-model.version>0.0.68</alfresco-event-model.version>
<alfresco-event-model.version>1.0.2</alfresco-event-model.version>
<spring-boot.version>3.3.5</spring-boot.version>
<spring-camel.version>4.8.1</spring-camel.version>
<commons-lang.version>3.17.0</commons-lang.version>
Expand Down Expand Up @@ -223,7 +223,7 @@
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>acs-enterprise-event-model</artifactId>
<artifactId>acs-event-model</artifactId>
<version>${alfresco-event-model.version}</version>
</dependency>
<dependency>
Expand Down
Loading