Skip to content

Commit

Permalink
Merge pull request #271 from netgrif/NAE-2008
Browse files Browse the repository at this point in the history
[NAE-2008] Serialisation of classes
  • Loading branch information
machacjozef authored Oct 22, 2024
2 parents 87fe6b9 + 38a4fc0 commit e6387fa
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.netgrif.application.engine.petrinet.domain.events.DataEventType
import com.querydsl.core.annotations.PropertyType
import com.querydsl.core.annotations.QueryType
import org.bson.types.ObjectId
import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl
import org.springframework.data.annotation.Id
import org.springframework.data.annotation.Transient
import org.springframework.data.mongodb.core.mapping.Document
Expand Down Expand Up @@ -313,7 +314,7 @@ abstract class Field<T> extends Imported {
@Override
@QueryType(PropertyType.NONE)
MetaClass getMetaClass() {
return this.metaClass
return this.metaClass != null ? this.metaClass : ((MetaClassRegistryImpl) GroovySystem.getMetaClassRegistry()).getMetaClass(this)
}

void clone(Field clone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package com.netgrif.application.engine.petrinet.domain.dataset
import com.querydsl.core.annotations.PropertyType
import com.querydsl.core.annotations.QueryType

class Storage {
class Storage implements Serializable {
static final long serialVersionUID = 9172755427878929926L
private StorageType type
private String host

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.netgrif.application.engine.petrinet.domain.dataset.logic.validation

class LocalizedValidation {
class LocalizedValidation implements Serializable {

static final long serialVersionUID = 412530951556364618L

private String validationRule

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CaseSearchRequest {
public class CaseSearchRequest implements Serializable {

private static final long serialVersionUID = 5468800723081186371L;

@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
public List<PetriNet> process;
Expand Down Expand Up @@ -94,7 +97,9 @@ public CaseSearchRequest(Map<String, Object> request) {
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class PetriNet {
public static class PetriNet implements Serializable {

private static final long serialVersionUID = 4251438418424494690L;

public String identifier;

Expand All @@ -108,7 +113,9 @@ public PetriNet(String identifier) {
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class Author {
public static class Author implements Serializable {

private static final long serialVersionUID = -4013905721499512553L;

public String id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

@NoArgsConstructor
@AllArgsConstructor
public class TaskSearchRequest {
public class TaskSearchRequest implements Serializable {

private static final long serialVersionUID = -6170395213624655037L;

@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
public List<String> role;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@NoArgsConstructor
@AllArgsConstructor
public class TaskSearchCaseRequest {
public class TaskSearchCaseRequest implements Serializable {

private static final long serialVersionUID = 757156715249997075L;

public String id;
public String title;
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
package com.netgrif.application.engine.workflow.web.responsebodies;

import com.netgrif.application.engine.petrinet.domain.dataset.Field;
import lombok.Getter;
import lombok.Setter;
import org.springframework.hateoas.CollectionModel;

import java.util.ArrayList;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;
import java.util.stream.Collectors;

public class DataFieldsResource extends CollectionModel<LocalisedField> {
@Setter
@Getter
public class DataFieldsResource extends CollectionModel<LocalisedField> implements Serializable, Iterable<LocalisedField> {

private static final long serialVersionUID = 73213276016133399L;

private Collection<LocalisedField> content;

public DataFieldsResource(Collection<Field> content, Locale locale) {
super(content.stream()
super();
this.content = content.stream()
.map(f -> LocalisedFieldFactory.from(f, locale))
.collect(Collectors.toList()), new ArrayList<>(), null);
.collect(Collectors.toList());
}

@Override
public Iterator<LocalisedField> iterator() {
return this.content.iterator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
import com.netgrif.application.engine.petrinet.domain.dataset.logic.validation.Validation;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

@Data
public class LocalisedField {
public class LocalisedField implements Serializable {

private static final long serialVersionUID = 412530951556364614L;
private String stringId;

private FieldType type;
Expand Down

0 comments on commit e6387fa

Please sign in to comment.