Skip to content
Open
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
@@ -1,11 +1,10 @@
package com.netgrif.application.engine.petrinet.service;

import com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs.InhibitorArc;
import com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs.ReadArc;
import com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs.ResetArc;
import com.netgrif.application.engine.objects.petrinet.domain.arcs.Arc;
import com.netgrif.application.engine.objects.petrinet.domain.arcs.InhibitorArc;
import com.netgrif.application.engine.objects.petrinet.domain.arcs.ReadArc;
import com.netgrif.application.engine.objects.petrinet.domain.arcs.ResetArc;
import com.netgrif.application.engine.objects.petrinet.domain.arcs.reference.Reference;
import com.netgrif.application.engine.objects.petrinet.domain.arcs.reference.Type;
import org.springframework.stereotype.Component;

@Component
Expand All @@ -14,15 +13,15 @@ public final class ArcFactory {
public Arc getArc(com.netgrif.application.engine.objects.importer.model.Arc arc) throws IllegalArgumentException {
switch (arc.getType()) {
case REGULAR:
return new Arc();
return new com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs.Arc();
case RESET:
return new ResetArc();
case INHIBITOR:
return new InhibitorArc();
case READ:
return new ReadArc();
case VARIABLE:
Arc varArc = new Arc();
Arc varArc = new com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs.Arc();
Reference ref = new Reference();
ref.setReference(String.valueOf(arc.getMultiplicity()));
varArc.setReference(ref);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
import org.springframework.data.mongodb.core.mapping.event.AfterDeleteEvent;
import org.springframework.data.mongodb.core.mapping.event.AfterLoadEvent;
import org.springframework.stereotype.Component;

@Slf4j
Expand All @@ -17,6 +18,11 @@ public class PetriNetEventHandler extends AbstractMongoEventListener<PetriNet> {
@Autowired
private IElasticPetriNetService service;

@Override
public void onAfterLoad(AfterLoadEvent<PetriNet> event) {

}
Comment on lines +21 to +24
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether this callback is intentionally used/covered elsewhere.
rg -n -C3 --type=java '\bonAfterLoad\s*\(\s*AfterLoadEvent<PetriNet>\s+event\s*\)'
rg -n -C3 --type=java '\bPetriNetEventHandler\b'
rg -n -C3 --type=java --iglob '*test*' 'AfterLoadEvent|PetriNetEventHandler|onAfterLoad\s*\('

Repository: netgrif/application-engine

Length of output: 1901


Remove the empty onAfterLoad callback.

The onAfterLoad method at lines 21–24 is a no-op Spring Data lifecycle hook that is never invoked or tested. Remove the method and its unused AfterLoadEvent import (line 11).

Cleanup diff
-import org.springframework.data.mongodb.core.mapping.event.AfterLoadEvent;
@@
-    `@Override`
-    public void onAfterLoad(AfterLoadEvent<PetriNet> event) {
-
-    }
-
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetEventHandler.java`
around lines 21 - 24, Remove the no-op Spring Data lifecycle hook by deleting
the onAfterLoad(AfterLoadEvent<PetriNet> event) method from the
PetriNetEventHandler class and also remove the unused AfterLoadEvent import;
ensure no other code references onAfterLoad so compilation remains clean.


@Override
public void onAfterDelete(AfterDeleteEvent<PetriNet> event) {
Document document = event.getDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.ArrayList;
import java.util.List;

public class Arc extends PetriNetObject {
public abstract class Arc extends PetriNetObject {

protected Node source;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* <b><i>m(p) &lt; w</i></b><br>
* <a href="https://books.google.sk/books?id=A45rCQAAQBAJ&dq=petri+net+read+arc&hl=sk">More info</a>
*/
public class InhibitorArc extends PTArc {
public abstract class InhibitorArc extends PTArc {

public InhibitorArc() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* <center><b><i>m(p) &ge; w</i></b><br></center>
* <a href="https://books.google.sk/books?id=A45rCQAAQBAJ&dq=petri+net+read+arc&hl=sk">More info</a>
*/
public class ReadArc extends PTArc {
public abstract class ReadArc extends PTArc {

public ReadArc() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* </ul>
* <a href="https://books.google.sk/books?id=A45rCQAAQBAJ&dq=petri+net+read+arc&hl=sk">More info</a>
*/
public class ResetArc extends PTArc {
public abstract class ResetArc extends PTArc {

public ResetArc() {
super();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs;

import com.netgrif.application.engine.objects.petrinet.domain.Node;
import org.springframework.data.annotation.Transient;

public class Arc extends com.netgrif.application.engine.objects.petrinet.domain.arcs.Arc {

public Arc() {
super();
}

public Arc(Arc arc) {
super(arc);
}
Comment on lines +12 to +14
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Copy constructor is too narrowly typed.

At Line 12, Arc(Arc arc) only accepts the adapter type, which prevents copying when the source is referenced as the core/base arc type. Use the core arc type in the constructor signature.

Proposed fix
-    public Arc(Arc arc) {
+    public Arc(com.netgrif.application.engine.objects.petrinet.domain.arcs.Arc arc) {
         super(arc);
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/Arc.java`
around lines 12 - 14, The copy constructor public Arc(Arc arc) is too narrowly
typed; change its parameter to the core/base arc type (the base Arc
interface/class used by the superclass) so it can accept core arcs, e.g. public
Arc(BaseArcType arc) { super(arc); }, and update the import for that core/base
Arc type; keep the body calling super(arc) unchanged to delegate copying to the
superclass.


public Arc(Node source, Node destination, int multiplicity) {
super(source, destination, multiplicity);
}

@Override
@Transient
public Node getDestination() {
return super.getDestination();
}

@Override
@Transient
public Node getSource() {
return super.getSource();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs;

import com.netgrif.application.engine.objects.petrinet.domain.Node;
import org.springframework.data.annotation.Transient;

public class InhibitorArc extends com.netgrif.application.engine.objects.petrinet.domain.arcs.InhibitorArc {

public InhibitorArc() {
super();
}

public InhibitorArc(InhibitorArc arc) {
super(arc);
}

@Override
@Transient
public Node getDestination() {
return super.getDestination();
}

@Override
@Transient
public Node getSource() {
return super.getSource();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs;

import com.netgrif.application.engine.objects.petrinet.domain.Node;
import org.springframework.data.annotation.Transient;

public class ReadArc extends com.netgrif.application.engine.objects.petrinet.domain.arcs.ReadArc {

public ReadArc() {
super();
}

public ReadArc(ReadArc readArc) {
super(readArc);
}

@Override
@Transient
public Node getDestination() {
return super.getDestination();
}

@Override
@Transient
public Node getSource() {
return super.getSource();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.netgrif.application.engine.adapter.spring.petrinet.domain.arcs;

import com.netgrif.application.engine.objects.petrinet.domain.Node;
import org.springframework.data.annotation.Transient;

public class ResetArc extends com.netgrif.application.engine.objects.petrinet.domain.arcs.ResetArc {

public ResetArc() {
super();
}

public ResetArc(ResetArc arc) {
super(arc);
}

@Override
@Transient
public Node getDestination() {
return super.getDestination();
}

@Override
@Transient
public Node getSource() {
return super.getSource();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.netgrif.application.engine.adapter.spring.workflow.domain;

import com.netgrif.application.engine.objects.workflow.domain.DataFieldsCollection;
import org.springframework.data.annotation.Transient;

import java.beans.Transient;

public class DataGroup extends com.netgrif.application.engine.objects.petrinet.domain.DataGroup {

Expand Down
Loading