--- /dev/null
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.spi.entities;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+/**
+ * Entity to store a dataspace.
+ */
+@Getter
+@Setter
+@Entity
+@AllArgsConstructor
+@NoArgsConstructor
+@Table(name = "dataspace")
+public class Dataspace {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+
+ @NotNull
+ @Column(columnDefinition = "text")
+ private String name;
+}
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * Copyright (C) 2020 Nordix Foundation. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * SPDX-License-Identifier: Apache-2.0\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.onap.cps.spi.entities;\r
+\r
+import com.vladmihalcea.hibernate.type.json.JsonBinaryType;\r
+import javax.persistence.Column;\r
+import javax.persistence.Entity;\r
+import javax.persistence.FetchType;\r
+import javax.persistence.GeneratedValue;\r
+import javax.persistence.GenerationType;\r
+import javax.persistence.Id;\r
+import javax.persistence.JoinColumn;\r
+import javax.persistence.ManyToOne;\r
+import javax.persistence.OneToOne;\r
+import javax.validation.constraints.NotNull;\r
+import lombok.AllArgsConstructor;\r
+import lombok.Getter;\r
+import lombok.NoArgsConstructor;\r
+import lombok.Setter;\r
+import org.hibernate.annotations.Type;\r
+import org.hibernate.annotations.TypeDef;\r
+import org.hibernate.annotations.TypeDefs;\r
+\r
+/**\r
+ * Entity to store a fragment.\r
+ */\r
+@Getter\r
+@Setter\r
+@Entity\r
+@AllArgsConstructor\r
+@NoArgsConstructor\r
+@TypeDefs({@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)})\r
+public class Fragment {\r
+\r
+ @Id\r
+ @GeneratedValue(strategy = GenerationType.IDENTITY)\r
+ private Long id;\r
+\r
+ @NotNull\r
+ @Column(columnDefinition = "text")\r
+ private String xpath;\r
+\r
+ @Type(type = "jsonb")\r
+ @Column(columnDefinition = "jsonb")\r
+ private String attributes;\r
+\r
+ @ManyToOne(fetch = FetchType.LAZY)\r
+ @JoinColumn(name = "dataspace_id")\r
+ private Dataspace dataspace;\r
+\r
+ @OneToOne(fetch = FetchType.LAZY)\r
+ @JoinColumn(name = "anchor_id")\r
+ private Fragment anchorFragment;\r
+\r
+ @OneToOne(fetch = FetchType.LAZY)\r
+ @JoinColumn(name = "parent_id")\r
+ private Fragment parentFragment;\r
+}\r
<project xmlns="http://maven.apache.org/POM/4.0.0"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">\r
- <modelVersion>4.0.0</modelVersion>\r
- <parent>\r
- <groupId>org.onap.oparent</groupId>\r
- <artifactId>oparent</artifactId>\r
- <version>3.1.0</version>\r
- </parent>\r
- <groupId>org.onap.cps</groupId>\r
- <artifactId>cps</artifactId>\r
- <version>0.0.1-SNAPSHOT</version>\r
- <packaging>pom</packaging>\r
- <name>cps</name>\r
- <description>ONAP Configuration and Persistency Service</description>\r
- <organization>\r
- <name>ONAP - CPS</name>\r
- <url>http://www.onap.org/</url>\r
- </organization>\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <parent>\r
+ <groupId>org.onap.oparent</groupId>\r
+ <artifactId>oparent</artifactId>\r
+ <version>3.1.0</version>\r
+ </parent>\r
+ <groupId>org.onap.cps</groupId>\r
+ <artifactId>cps</artifactId>\r
+ <version>0.0.1-SNAPSHOT</version>\r
+ <packaging>pom</packaging>\r
+ <name>cps</name>\r
+ <description>ONAP Configuration and Persistency Service</description>\r
+ <organization>\r
+ <name>ONAP - CPS</name>\r
+ <url>http://www.onap.org/</url>\r
+ </organization>\r
\r
- <properties>\r
- <java.version>11</java.version>\r
- <springboot.version>2.3.3.RELEASE</springboot.version>\r
- <oparent.version>3.1.0</oparent.version>\r
- <yangtools.version>5.0.6</yangtools.version>\r
- <swagger.version>2.1.4</swagger.version>\r
- <groovy.version>3.0.6</groovy.version>\r
- <spock-core.version>2.0-M2-groovy-3.0</spock-core.version>\r
- <maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>\r
- <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>\r
- <maven-replacer-plugin.version>1.5.3</maven-replacer-plugin.version>\r
- <swagger-ui.version>3.35.0</swagger-ui.version>\r
- </properties>\r
+ <properties>\r
+ <java.version>11</java.version>\r
+ <springboot.version>2.3.3.RELEASE</springboot.version>\r
+ <oparent.version>3.1.0</oparent.version>\r
+ <yangtools.version>5.0.6</yangtools.version>\r
+ <swagger.version>2.1.4</swagger.version>\r
+ <groovy.version>3.0.6</groovy.version>\r
+ <spock-core.version>2.0-M2-groovy-3.0</spock-core.version>\r
+ <maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>\r
+ <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>\r
+ <maven-replacer-plugin.version>1.5.3</maven-replacer-plugin.version>\r
+ <swagger-ui.version>3.35.0</swagger-ui.version>\r
+ <hibernate-types.version>2.10.0</hibernate-types.version>\r
+ </properties>\r
\r
- <dependencyManagement>\r
- <dependencies>\r
- <dependency>\r
- <groupId>org.springframework.boot</groupId>\r
- <artifactId>spring-boot-dependencies</artifactId>\r
- <version>${springboot.version}</version>\r
- <type>pom</type>\r
- <scope>import</scope>\r
- </dependency>\r
- </dependencies>\r
- </dependencyManagement>\r
+ <dependencyManagement>\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.springframework.boot</groupId>\r
+ <artifactId>spring-boot-dependencies</artifactId>\r
+ <version>${springboot.version}</version>\r
+ <type>pom</type>\r
+ <scope>import</scope>\r
+ </dependency>\r
+ </dependencies>\r
+ </dependencyManagement>\r
\r
- <build>\r
- <resources>\r
- <resource>\r
- <directory>src/main/resources</directory>\r
- <filtering>true</filtering>\r
- </resource>\r
+ <build>\r
+ <resources>\r
+ <resource>\r
+ <directory>src/main/resources</directory>\r
+ <filtering>true</filtering>\r
+ </resource>\r
\r
- <resource>\r
- <directory>target/generated-sources/license</directory>\r
- <includes>\r
- <include>third-party-licenses.txt</include>\r
- </includes>\r
- </resource>\r
+ <resource>\r
+ <directory>target/generated-sources/license</directory>\r
+ <includes>\r
+ <include>third-party-licenses.txt</include>\r
+ </includes>\r
+ </resource>\r
\r
- <resource>\r
- <directory>target/generated-resources/licenses</directory>\r
- <includes>\r
- <include>*.*</include>\r
- </includes>\r
- <targetPath>third-party-licenses</targetPath>\r
- </resource>\r
- </resources>\r
+ <resource>\r
+ <directory>target/generated-resources/licenses</directory>\r
+ <includes>\r
+ <include>*.*</include>\r
+ </includes>\r
+ <targetPath>third-party-licenses</targetPath>\r
+ </resource>\r
+ </resources>\r
\r
- <plugins>\r
- <plugin>\r
- <groupId>org.apache.maven.plugins</groupId>\r
- <artifactId>maven-compiler-plugin</artifactId>\r
- <configuration>\r
- <source>${java.version}</source>\r
- <target>${java.version}</target>\r
- </configuration>\r
- </plugin>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-compiler-plugin</artifactId>\r
+ <configuration>\r
+ <source>${java.version}</source>\r
+ <target>${java.version}</target>\r
+ </configuration>\r
+ </plugin>\r
\r
- <plugin>\r
- <groupId>org.apache.maven.plugins</groupId>\r
- <artifactId>maven-checkstyle-plugin</artifactId>\r
- <executions>\r
- <execution>\r
- <id>onap-java-style</id>\r
- <goals>\r
- <goal>check</goal>\r
- </goals>\r
- <phase>process-sources</phase>\r
- <configuration>\r
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>\r
- <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>\r
- <includeResources>true</includeResources>\r
- <includeTestSourceDirectory>true</includeTestSourceDirectory>\r
- <includeTestResources>true</includeTestResources>\r
- <consoleOutput>false</consoleOutput>\r
- <violationSeverity>warning</violationSeverity>\r
- <failOnViolation>true</failOnViolation>\r
- </configuration>\r
- </execution>\r
- </executions>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-checkstyle-plugin</artifactId>\r
+ <executions>\r
+ <execution>\r
+ <id>onap-java-style</id>\r
+ <goals>\r
+ <goal>check</goal>\r
+ </goals>\r
+ <phase>process-sources</phase>\r
+ <configuration>\r
+ <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>\r
+ <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>\r
+ <includeResources>true</includeResources>\r
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>\r
+ <includeTestResources>true</includeTestResources>\r
+ <consoleOutput>false</consoleOutput>\r
+ <violationSeverity>warning</violationSeverity>\r
+ <failOnViolation>true</failOnViolation>\r
+ </configuration>\r
+ </execution>\r
+ </executions>\r
\r
- <dependencies>\r
- <dependency>\r
- <groupId>org.onap.oparent</groupId>\r
- <artifactId>checkstyle</artifactId>\r
- <version>${oparent.version}</version>\r
- </dependency>\r
- </dependencies>\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.onap.oparent</groupId>\r
+ <artifactId>checkstyle</artifactId>\r
+ <version>${oparent.version}</version>\r
+ </dependency>\r
+ </dependencies>\r
\r
- </plugin>\r
+ </plugin>\r
\r
- <!-- Mandatory plugins for using Spock -->\r
- <plugin>\r
- <!-- The gmavenplus plugin is used to compile Groovy code. To learn more about this plugin,\r
- visit https://github.com/groovy/GMavenPlus/wiki -->\r
- <groupId>org.codehaus.gmavenplus</groupId>\r
- <artifactId>gmavenplus-plugin</artifactId>\r
- <version>1.9.0</version>\r
- <executions>\r
- <execution>\r
- <goals>\r
- <goal>compileTests</goal>\r
- </goals>\r
- </execution>\r
- </executions>\r
- </plugin>\r
- <!-- Required because names of spec classes don't match default Surefire patterns (`*Test` etc.) -->\r
- <plugin>\r
- <groupId>org.apache.maven.plugins</groupId>\r
- <artifactId>maven-surefire-plugin</artifactId>\r
- <version>3.0.0-M5</version>\r
- <configuration>\r
- <useFile>false</useFile>\r
- <includes>\r
- <include>**/*Spec.java</include>\r
- <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->\r
- </includes>\r
- </configuration>\r
- </plugin>\r
+ <!-- Mandatory plugins for using Spock -->\r
+ <plugin>\r
+ <!-- The gmavenplus plugin is used to compile Groovy code. \r
+ To learn more about this plugin, visit https://github.com/groovy/GMavenPlus/wiki -->\r
+ <groupId>org.codehaus.gmavenplus</groupId>\r
+ <artifactId>gmavenplus-plugin</artifactId>\r
+ <version>1.9.0</version>\r
+ <executions>\r
+ <execution>\r
+ <goals>\r
+ <goal>compileTests</goal>\r
+ </goals>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ <!-- Required because names of spec classes don't match default \r
+ Surefire patterns (`*Test` etc.) -->\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-surefire-plugin</artifactId>\r
+ <version>3.0.0-M5</version>\r
+ <configuration>\r
+ <useFile>false</useFile>\r
+ <includes>\r
+ <include>**/*Spec.java</include>\r
+ <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->\r
+ </includes>\r
+ </configuration>\r
+ </plugin>\r
\r
- </plugins>\r
- </build>\r
+ </plugins>\r
+ </build>\r
\r
- <modules>\r
- <module>cps-service</module>\r
- <module>cps-rest</module>\r
- <module>cps-ri</module>\r
- </modules>\r
+ <modules>\r
+ <module>cps-service</module>\r
+ <module>cps-rest</module>\r
+ <module>cps-ri</module>\r
+ </modules>\r
\r
</project>\r