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

Merging develop with master for 2023-Q4 1.2.0-SNAPSHOT release #8

Merged
merged 14 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.source=17
30 changes: 12 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.openslice</groupId>
<artifactId>io.openslice.main</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<relativePath>../io.openslice.main</relativePath>
</parent>

Expand Down Expand Up @@ -34,13 +34,12 @@
<version>${spring.boot-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-consul-dependencies</artifactId>
<version>${spring.cloud-consul-version}</version>
<type>pom</type>
<scope>import</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Camel BOM -->
<dependency>
Expand All @@ -56,8 +55,8 @@

<dependencies>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>

<dependency>
Expand All @@ -69,12 +68,7 @@
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>


</dependencies>


Expand All @@ -85,8 +79,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
Expand Down
280 changes: 141 additions & 139 deletions src/main/java/io/openslice/model/Category.java
Original file line number Diff line number Diff line change
@@ -1,139 +1,141 @@
/*-
* ========================LICENSE_START=================================
* io.openslice.model
* %%
* Copyright (C) 2019 openslice.io
* %%
* 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.
* =========================LICENSE_END==================================
*/

package io.openslice.model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Entity(name = "Category")
@JsonIgnoreProperties(value = { "products" }, ignoreUnknown = true )
public class Category {

private static final transient Log logger = LogFactory.getLog(Category.class.getName());


@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id = 0;

@Basic()
private String name=null;



@ManyToMany(cascade = { CascadeType.ALL })
@JoinTable(
name = "CATEGORY_PRODUCTS",
joinColumns = { @JoinColumn(name = "CAT_ID") },
inverseJoinColumns = { @JoinColumn(name = "PROD_ID") }
)
private Set<Product> products = new HashSet<Product>();



public Set<Product> getProducts() {
return products;
}

public void setProducts(Set<Product> products) {
this.products = products;
}



public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}


public void addProduct(Product product) {
if (!products.contains(product)) {
logger.info("ACTUALLY add into category "+ this.getName()+" product "+product.getId());
products.add(product);
//product.addCategory(this);
}
}


public void removeProduct(Product p) {
if (products.contains(p)) {
products.remove(p);
//p.removeCategory(this);
}
}

public int getAppscount() {
int c = 0;
for (Product p : products) {
if ( p instanceof ExperimentMetadata)
c++;
}
return c;
}

public int getVxFscount() {
int c = 0;
for (Product p : products) {
if ( p instanceof VxFMetadata)
c++;
}

return c;
}



public int getProductsCount() {
return products.size();
}


}
/*-
* ========================LICENSE_START=================================
* io.openslice.model
* %%
* Copyright (C) 2019 openslice.io
* %%
* 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.
* =========================LICENSE_END==================================
*/

package io.openslice.model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import jakarta.persistence.Basic;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.ManyToMany;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Entity(name = "Category")
@JsonIgnoreProperties(value = { "products" }, ignoreUnknown = true )
public class Category {

private static final transient Logger logger = LoggerFactory.getLogger(Category.class.getName());


@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id = 0;

@Basic()
private String name=null;



@ManyToMany(cascade = { CascadeType.ALL })
@JoinTable(
name = "CATEGORY_PRODUCTS",
joinColumns = { @JoinColumn(name = "CAT_ID") },
inverseJoinColumns = { @JoinColumn(name = "PROD_ID") }
)
private Set<Product> products = new HashSet<Product>();



public Set<Product> getProducts() {
return products;
}

public void setProducts(Set<Product> products) {
this.products = products;
}



public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}


public void addProduct(Product product) {
if (!products.contains(product)) {
logger.info("ACTUALLY add into category "+ this.getName()+" product "+product.getId());
products.add(product);
//product.addCategory(this);
}
}


public void removeProduct(Product p) {
if (products.contains(p)) {
products.remove(p);
//p.removeCategory(this);
}
}

@JsonIgnore
public int getAppscount() {
int c = 0;
for (Product p : products) {
if ( p instanceof ExperimentMetadata)
c++;
}
return c;
}
@JsonIgnore
public int getVxFscount() {
int c = 0;
for (Product p : products) {
if ( p instanceof VxFMetadata)
c++;
}

return c;
}


@JsonIgnore
public int getProductsCount() {
return products.size();
}


}
Loading