ing
This commit is contained in:
parent
c4704d6210
commit
de27bebe66
11
pom.xml
11
pom.xml
|
@ -13,13 +13,13 @@
|
|||
<groupId>com.loafle.overflow</groupId>
|
||||
<artifactId>commons-java</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.83-SNAPSHOT</version>
|
||||
<version>1.0.84-SNAPSHOT</version>
|
||||
<name>com.loafle.overflow.commons-java</name>
|
||||
|
||||
<properties>
|
||||
<commons.rpc-java.version>1.0.0-SNAPSHOT</commons.rpc-java.version>
|
||||
|
||||
<gson.version>2.8.2</gson.version>
|
||||
<jackson-databind.version>2.9.5</jackson-databind.version>
|
||||
<spring.version>5.0.6.RELEASE</spring.version>
|
||||
<spring-data-commons.version>2.0.7.RELEASE</spring-data-commons.version>
|
||||
<hibernate.version>5.3.1.Final</hibernate.version>
|
||||
|
@ -32,10 +32,11 @@
|
|||
<version>${commons.rpc-java.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson.version}</version>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-databind.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.loafle.overflow.core.json;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
||||
import com.loafle.overflow.model.infra.InfraHostIP;
|
||||
|
||||
/**
|
||||
* InfraHostIPsSerializer
|
||||
*/
|
||||
public class InfraHostIPsSerializer extends StdSerializer<List<InfraHostIP>> {
|
||||
|
||||
private static final long serialVersionUID = -7842189644539038488L;
|
||||
|
||||
public InfraHostIPsSerializer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public InfraHostIPsSerializer(Class<List<InfraHostIP>> t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(List<InfraHostIP> infraHostIPs, JsonGenerator gen, SerializerProvider provider)
|
||||
throws IOException {
|
||||
if (null == infraHostIPs) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (InfraHostIP infraHostIP : infraHostIPs) {
|
||||
infraHostIP.setInfraHost(null);
|
||||
}
|
||||
|
||||
gen.writeObject(infraHostIPs);
|
||||
}
|
||||
|
||||
}
|
|
@ -4,9 +4,10 @@ import java.util.List;
|
|||
|
||||
import javax.persistence.*;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.loafle.overflow.core.json.InfraHostIPsSerializer;
|
||||
import com.loafle.overflow.model.meta.MetaTargetHostType;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonManagedReference;
|
||||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
|
||||
|
@ -23,7 +24,7 @@ public class InfraHost extends Infra {
|
|||
private InfraHostMachine infraHostMachine;
|
||||
private InfraHostOS infraHostOS;
|
||||
|
||||
@JsonManagedReference
|
||||
@JsonSerialize(using = InfraHostIPsSerializer.class)
|
||||
private List<InfraHostIP> infraHostIPs;
|
||||
|
||||
private InfraHost containerInfraHost;
|
||||
|
|
|
@ -4,9 +4,6 @@ import javax.persistence.*;
|
|||
|
||||
import com.loafle.overflow.model.meta.MetaIPType;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonBackReference;
|
||||
import org.codehaus.jackson.annotate.JsonManagedReference;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
@ -16,8 +13,6 @@ import java.util.Date;
|
|||
@Table(name = "INFRA_HOST_IP", schema = "public")
|
||||
public class InfraHostIP {
|
||||
private Long id;
|
||||
@JsonBackReference
|
||||
@JsonManagedReference
|
||||
private InfraHost infraHost;
|
||||
private MetaIPType metaIPType;
|
||||
private String address;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package com.loafle.overflow.model.member;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.loafle.overflow.model.meta.MetaMemberStatus;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user