diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationAnnotationRepresentationModelAssembler.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationAnnotationRepresentationModelAssembler.java deleted file mode 100644 index 664663af..00000000 --- a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationAnnotationRepresentationModelAssembler.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.contentgrid.automations.rest; - -import com.contentgrid.automations.rest.AutomationsModel.AutomationAnnotationModel; -import com.contentgrid.spring.data.rest.links.ContentGridLinkRelations; -import lombok.RequiredArgsConstructor; -import org.springframework.data.rest.core.config.RepositoryRestConfiguration; -import org.springframework.data.rest.core.mapping.RepositoryResourceMappings; -import org.springframework.data.rest.webmvc.ProfileController; -import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks; -import org.springframework.hateoas.Link; -import org.springframework.hateoas.server.RepresentationModelAssembler; -import org.springframework.stereotype.Component; - -@Component -@RequiredArgsConstructor -public class AutomationAnnotationRepresentationModelAssembler implements - RepresentationModelAssembler { - - private final RepositoryRestConfiguration repositoryRestConfiguration; - private final RepositoryResourceMappings mappings; - private final RepositoryEntityLinks entityLinks; - - @Override - public AutomationAnnotationRepresentationModel toModel(AutomationAnnotationModel annotation) { - return AutomationAnnotationRepresentationModel.from(annotation) - .add(getProfileLink(annotation)) - .add(getCollectionLink(annotation)); - } - - private Link getProfileLink(AutomationAnnotationModel annotation) { - var mapping = mappings.getMetadataFor(annotation.getEntityClass()); - return Link.of(ProfileController.getPath(repositoryRestConfiguration, mapping), - ContentGridLinkRelations.ENTITY_PROFILE); - } - - private Link getCollectionLink(AutomationAnnotationModel annotation) { - return entityLinks.linkToCollectionResource(annotation.getEntityClass()).withRel(ContentGridLinkRelations.ENTITY); - } -} diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/AutomationLinkRelations.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/AutomationLinkRelations.java new file mode 100644 index 00000000..8cbe2d9b --- /dev/null +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/AutomationLinkRelations.java @@ -0,0 +1,19 @@ +package com.contentgrid.spring.automations; + + +import lombok.experimental.UtilityClass; +import org.springframework.hateoas.LinkRelation; +import org.springframework.hateoas.UriTemplate; +import org.springframework.hateoas.mediatype.hal.HalLinkRelation; + +@UtilityClass +public class AutomationLinkRelations { + static final String CURIE = "automation"; + static final UriTemplate TEMPLATE = UriTemplate.of("https://contentgrid.cloud/rels/automation/{rel}"); + + public static final LinkRelation ANNOTATION = HalLinkRelation.curied(CURIE, "annotation"); + public static final String ANNOTATION_STRING = CURIE+":annotation"; + public static final LinkRelation TARGET_ENTITY = HalLinkRelation.curied(CURIE, "target-entity"); + public static final LinkRelation REGISTRATIONS = HalLinkRelation.curied(CURIE, "registrations"); + +} diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/ContentGridAutomationsConfiguration.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/ContentGridAutomationsConfiguration.java new file mode 100644 index 00000000..e59c776b --- /dev/null +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/ContentGridAutomationsConfiguration.java @@ -0,0 +1,59 @@ +package com.contentgrid.spring.automations; + +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; +import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; + +import com.contentgrid.spring.automations.rest.AutomationAnnotationRepresentationModelAssembler; +import com.contentgrid.spring.automations.rest.AutomationRepresentationModelAssembler; +import com.contentgrid.spring.automations.rest.AutomationsRestController; +import com.contentgrid.spring.data.rest.hal.CurieProviderCustomizer; +import com.contentgrid.thunx.spring.data.context.AbacContextSupplier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.core.io.ResourceLoader; +import org.springframework.data.rest.webmvc.RepositoryLinksResource; +import org.springframework.hateoas.server.RepresentationModelProcessor; + +@Import({ + AutomationRepresentationModelAssembler.class, + AutomationAnnotationRepresentationModelAssembler.class +}) +@Configuration(proxyBeanMethods = false) +public class ContentGridAutomationsConfiguration { + + private static final String AUTOMATIONS_RESOURCE = "classpath:automation/automations.json"; + + @Bean + AutomationsRestController automationsRestController( + ResourceLoader resourceLoader, + AutomationRepresentationModelAssembler assembler, + AbacContextSupplier abacContextSupplier + ) { + return new AutomationsRestController( + resourceLoader.getResource(AUTOMATIONS_RESOURCE), + assembler, + abacContextSupplier + ); + } + + @Bean + CurieProviderCustomizer automationCurieProvider() { + return CurieProviderCustomizer.register(AutomationLinkRelations.CURIE, AutomationLinkRelations.TEMPLATE); + } + + @Bean + RepresentationModelProcessor automationRepositoryLinksRepresentationModelProcessor() { + // This must be a class instead of a lambda so the generic parameter can be determined by spring-hateoas + return new RepresentationModelProcessor() { + @Override + public RepositoryLinksResource process(RepositoryLinksResource model) { + return model.add( + linkTo(methodOn(AutomationsRestController.class).getAutomations()) + .withRel(AutomationLinkRelations.REGISTRATIONS) + ); + } + }; + } + +} diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationAnnotationRepresentationModel.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationAnnotationRepresentationModel.java similarity index 85% rename from contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationAnnotationRepresentationModel.java rename to contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationAnnotationRepresentationModel.java index 3b3ef38e..14cdd02e 100644 --- a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationAnnotationRepresentationModel.java +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationAnnotationRepresentationModel.java @@ -1,5 +1,6 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; +import com.contentgrid.spring.automations.AutomationLinkRelations; import java.util.Map; import lombok.AccessLevel; import lombok.AllArgsConstructor; @@ -14,7 +15,7 @@ @Builder(access = AccessLevel.PRIVATE) @AllArgsConstructor(access = AccessLevel.PROTECTED) @EqualsAndHashCode(callSuper = true) -@Relation(collectionRelation = "cg:automation-annotation") +@Relation(collectionRelation = AutomationLinkRelations.ANNOTATION_STRING) public class AutomationAnnotationRepresentationModel extends RepresentationModel { diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationAnnotationRepresentationModelAssembler.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationAnnotationRepresentationModelAssembler.java new file mode 100644 index 00000000..b0cbcea0 --- /dev/null +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationAnnotationRepresentationModelAssembler.java @@ -0,0 +1,33 @@ +package com.contentgrid.spring.automations.rest; + +import com.contentgrid.spring.automations.AutomationLinkRelations; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationAnnotationModel; +import lombok.RequiredArgsConstructor; +import org.springframework.data.rest.core.config.RepositoryRestConfiguration; +import org.springframework.data.rest.core.mapping.ResourceMappings; +import org.springframework.data.rest.webmvc.ProfileController; +import org.springframework.hateoas.Link; +import org.springframework.hateoas.server.RepresentationModelAssembler; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class AutomationAnnotationRepresentationModelAssembler implements + RepresentationModelAssembler { + + private final RepositoryRestConfiguration repositoryRestConfiguration; + private final ResourceMappings mappings; + + @Override + public AutomationAnnotationRepresentationModel toModel(AutomationAnnotationModel annotation) { + return AutomationAnnotationRepresentationModel.from(annotation) + .add(getTargetEntityLink(annotation)); + } + + private Link getTargetEntityLink(AutomationAnnotationModel annotation) { + var profileUrl = ProfileController.getPath(repositoryRestConfiguration, + mappings.getMetadataFor(annotation.getEntityClass())); + + return Link.of(profileUrl, AutomationLinkRelations.TARGET_ENTITY); + } +} diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationModelVisitor.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationModelVisitor.java similarity index 97% rename from contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationModelVisitor.java rename to contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationModelVisitor.java index fb0c82ad..18a3b441 100644 --- a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationModelVisitor.java +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationModelVisitor.java @@ -1,6 +1,6 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; -import com.contentgrid.automations.rest.AutomationsModel.AutomationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationModel; import com.contentgrid.thunx.predicates.model.FunctionExpression; import com.contentgrid.thunx.predicates.model.Scalar; import com.contentgrid.thunx.predicates.model.SymbolicReference; diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationRepresentationModel.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationRepresentationModel.java similarity index 94% rename from contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationRepresentationModel.java rename to contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationRepresentationModel.java index 6bf0127a..6b0adde0 100644 --- a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationRepresentationModel.java +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationRepresentationModel.java @@ -1,6 +1,6 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; -import com.contentgrid.automations.rest.AutomationsModel.AutomationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationModel; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonUnwrapped; diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationRepresentationModelAssembler.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationRepresentationModelAssembler.java similarity index 93% rename from contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationRepresentationModelAssembler.java rename to contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationRepresentationModelAssembler.java index 54200018..2a43f67a 100644 --- a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationRepresentationModelAssembler.java +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationRepresentationModelAssembler.java @@ -1,9 +1,9 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; -import com.contentgrid.automations.rest.AutomationsModel.AutomationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationModel; import lombok.NonNull; import lombok.RequiredArgsConstructor; import org.springframework.hateoas.CollectionModel; diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationsModel.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationsModel.java similarity index 94% rename from contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationsModel.java rename to contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationsModel.java index 70da91c4..df0f2012 100644 --- a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationsModel.java +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationsModel.java @@ -1,4 +1,4 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; import java.util.List; import java.util.Map; diff --git a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationsRestController.java b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationsRestController.java similarity index 96% rename from contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationsRestController.java rename to contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationsRestController.java index 96ccf519..1591391e 100644 --- a/contentgrid-automations-rest/src/main/java/com/contentgrid/automations/rest/AutomationsRestController.java +++ b/contentgrid-automations-rest/src/main/java/com/contentgrid/spring/automations/rest/AutomationsRestController.java @@ -1,6 +1,6 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; -import com.contentgrid.automations.rest.AutomationsModel.AutomationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationModel; import com.contentgrid.thunx.spring.data.context.AbacContextSupplier; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationModelVisitorTest.java b/contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationModelVisitorTest.java similarity index 97% rename from contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationModelVisitorTest.java rename to contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationModelVisitorTest.java index bbc0e5a9..1462baf5 100644 --- a/contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationModelVisitorTest.java +++ b/contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationModelVisitorTest.java @@ -1,9 +1,9 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import com.contentgrid.automations.rest.AutomationsModel.AutomationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationModel; import com.contentgrid.thunx.predicates.model.Comparison; import com.contentgrid.thunx.predicates.model.LogicalOperation; import com.contentgrid.thunx.predicates.model.Scalar; diff --git a/contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationsModelTest.java b/contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationsModelTest.java similarity index 95% rename from contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationsModelTest.java rename to contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationsModelTest.java index dacaf7d8..5db223ff 100644 --- a/contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationsModelTest.java +++ b/contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationsModelTest.java @@ -1,9 +1,9 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; import static org.assertj.core.api.Assertions.assertThat; -import com.contentgrid.automations.rest.AutomationsModel.AutomationAnnotationModel; -import com.contentgrid.automations.rest.AutomationsModel.AutomationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationAnnotationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationModel; import com.contentgrid.spring.test.fixture.invoicing.model.Customer; import java.util.List; import java.util.Map; diff --git a/contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationsRestControllerTest.java b/contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationsRestControllerTest.java similarity index 91% rename from contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationsRestControllerTest.java rename to contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationsRestControllerTest.java index d42a6d51..beef767d 100644 --- a/contentgrid-automations-rest/src/test/java/com/contentgrid/automations/rest/AutomationsRestControllerTest.java +++ b/contentgrid-automations-rest/src/test/java/com/contentgrid/spring/automations/rest/AutomationsRestControllerTest.java @@ -1,4 +1,4 @@ -package com.contentgrid.automations.rest; +package com.contentgrid.spring.automations.rest; import static org.hamcrest.Matchers.hasSize; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -6,9 +6,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import com.contentgrid.automations.rest.AutomationsModel.AutomationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationModel; import com.contentgrid.spring.boot.autoconfigure.integration.EventsAutoConfiguration; -import com.contentgrid.automations.rest.AutomationsModel.AutomationAnnotationModel; +import com.contentgrid.spring.automations.rest.AutomationsModel.AutomationAnnotationModel; import com.contentgrid.spring.test.fixture.invoicing.InvoicingApplication; import com.contentgrid.spring.test.fixture.invoicing.model.Customer; import com.contentgrid.spring.test.security.WithMockJwt; @@ -27,6 +27,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.web.servlet.MockMvc; @@ -116,6 +117,23 @@ void setup() { .build()); } + @Test + void getRoot_containsLink() throws Exception { + mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON) + .header("X-ABAC-Context", headerEncode(DEFAULT_POLICY)) + ) + .andExpect(status().isOk()) + .andExpect(content().json(""" + { + _links: { + "automation:registrations": { + href: "http://localhost/.contentgrid/automations" + } + } + } + """)); + } + @Test void getAutomations_http200() throws Exception { mockMvc.perform(get("/.contentgrid/automations") @@ -192,7 +210,7 @@ void getAutomation_http200() throws Exception { foo: "bar" }, _embedded: { - "cg:automation-annotation": [ { + "automation:annotation": [ { id: "${ENTITY_ANNOTATION_ID}", subject: { type: "entity", @@ -202,12 +220,8 @@ void getAutomation_http200() throws Exception { color: "blue" }, _links: { - "cg:entity-profile": { + "automation:target-entity": { href: "http://localhost/profile/customers" - }, - "cg:entity": { - href: "http://localhost/customers{?page,size,sort*}", - templated: true } } }, @@ -222,12 +236,8 @@ void getAutomation_http200() throws Exception { type: "input" }, _links: { - "cg:entity-profile": { + "automation:target-entity": { href: "http://localhost/profile/customers" - }, - "cg:entity": { - href: "http://localhost/customers{?page,size,sort*}", - templated: true } } } ] @@ -256,4 +266,4 @@ void getAutomation_noAccess_http404() throws Exception { .andExpect(status().isNotFound()); } -} \ No newline at end of file +} diff --git a/contentgrid-spring-boot-autoconfigure/src/main/java/com/contentgrid/spring/boot/autoconfigure/automation/ContentGridAutomationAutoConfiguration.java b/contentgrid-spring-boot-autoconfigure/src/main/java/com/contentgrid/spring/boot/autoconfigure/automation/ContentGridAutomationAutoConfiguration.java index 820fb628..dfef970a 100644 --- a/contentgrid-spring-boot-autoconfigure/src/main/java/com/contentgrid/spring/boot/autoconfigure/automation/ContentGridAutomationAutoConfiguration.java +++ b/contentgrid-spring-boot-autoconfigure/src/main/java/com/contentgrid/spring/boot/autoconfigure/automation/ContentGridAutomationAutoConfiguration.java @@ -1,35 +1,20 @@ package com.contentgrid.spring.boot.autoconfigure.automation; -import com.contentgrid.automations.rest.AutomationAnnotationRepresentationModelAssembler; -import com.contentgrid.automations.rest.AutomationRepresentationModelAssembler; -import com.contentgrid.automations.rest.AutomationsRestController; +import com.contentgrid.spring.automations.ContentGridAutomationsConfiguration; +import com.contentgrid.spring.boot.autoconfigure.data.web.ContentGridSpringDataRestAutoConfiguration; import com.contentgrid.thunx.predicates.model.ThunkExpression; import com.contentgrid.thunx.spring.data.context.AbacContextSupplier; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; -@AutoConfiguration +@AutoConfiguration( + after = ContentGridSpringDataRestAutoConfiguration.class +) @ConditionalOnWebApplication -@ConditionalOnClass({ AutomationsRestController.class, AbacContextSupplier.class, ThunkExpression.class }) -@Import({ - AutomationRepresentationModelAssembler.class, - AutomationAnnotationRepresentationModelAssembler.class -}) +@ConditionalOnClass({ContentGridAutomationsConfiguration.class, AbacContextSupplier.class, ThunkExpression.class}) +@Import(ContentGridAutomationsConfiguration.class) public class ContentGridAutomationAutoConfiguration { - @Autowired - private ApplicationContext applicationContext; - - @Bean - AutomationsRestController automationsRestController(AutomationRepresentationModelAssembler assembler, - AbacContextSupplier abacContextSupplier) { - return new AutomationsRestController(applicationContext.getResource("classpath:automation/automations.json"), - assembler, abacContextSupplier); - } - } diff --git a/contentgrid-spring-data-rest/src/main/java/com/contentgrid/spring/data/rest/links/ContentGridLinkRelations.java b/contentgrid-spring-data-rest/src/main/java/com/contentgrid/spring/data/rest/links/ContentGridLinkRelations.java index 1aaef276..9124471c 100644 --- a/contentgrid-spring-data-rest/src/main/java/com/contentgrid/spring/data/rest/links/ContentGridLinkRelations.java +++ b/contentgrid-spring-data-rest/src/main/java/com/contentgrid/spring/data/rest/links/ContentGridLinkRelations.java @@ -13,7 +13,5 @@ public class ContentGridLinkRelations { public static final LinkRelation ENTITY = HalLinkRelation.curied(CURIE, "entity"); public static final LinkRelation RELATION = HalLinkRelation.curied(CURIE, "relation"); public static final LinkRelation CONTENT = HalLinkRelation.curied(CURIE, "content"); - public static final LinkRelation AUTOMATION_ANNOTATION = HalLinkRelation.curied(CURIE, "automation-annotation"); - public static final LinkRelation ENTITY_PROFILE = HalLinkRelation.curied(CURIE, "entity-profile"); } diff --git a/contentgrid-spring-integration-events/src/test/java/com/contentgrid/spring/integration/events/ChangeEventPublicationIntegrationTest.java b/contentgrid-spring-integration-events/src/test/java/com/contentgrid/spring/integration/events/ChangeEventPublicationIntegrationTest.java index 394b994d..94faf20e 100644 --- a/contentgrid-spring-integration-events/src/test/java/com/contentgrid/spring/integration/events/ChangeEventPublicationIntegrationTest.java +++ b/contentgrid-spring-integration-events/src/test/java/com/contentgrid/spring/integration/events/ChangeEventPublicationIntegrationTest.java @@ -69,6 +69,10 @@ public class ChangeEventPublicationIntegrationTest { { name: "cg", templated: true + }, + { + name: "automation", + templated: true } ] }