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

[NAE-2008] Serialisation of classes #271

Merged
merged 4 commits into from
Oct 22, 2024
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
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
Loading