Skip to content

Commit

Permalink
Cleanup. Consolidate version references. Remove dead code. Remove dea…
Browse files Browse the repository at this point in the history
…d todos.
  • Loading branch information
adamburkegh committed Nov 21, 2023
1 parent 3b43e08 commit 53d0583
Show file tree
Hide file tree
Showing 27 changed files with 149 additions and 184 deletions.
17 changes: 1 addition & 16 deletions WoPeD-BPELExport/src/main/java/org/woped/bpel/BPEL.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.woped.core.utilities.Utils;
import org.woped.gui.translations.Messages;

// TODO class description
/** Operations with BPEL files. */
public class BPEL {

private static BPEL bpelMainClass;
Expand All @@ -34,39 +34,33 @@ public class BPEL {
private FileFilter _filter;
private String _fileextension = "bpel";

// TODO method description
public BPEL() {
if (BPEL.bpelMainClass != null) return;
this.initFilefilter();
bpelMainClass = this;
}

// TODO method description
private final void initFilefilter() {
this._extensions = new Vector<String>();
this._extensions.add(this._fileextension);
this._filter = new FileFilterImpl(FileFilterImpl.BPELFilter, "BPEL (*.bpel)", this._extensions);
}

// TODO method description
public static final BPEL getBPELMainClass() {
if (bpelMainClass == null) {
new BPEL();
}
return bpelMainClass;
}

// TODO method description
public FileFilter getFilefilter() {
return this._filter;
}

// TODO method description
public boolean checkFileExtension(JFileChooser jfc) {
return ((FileFilterImpl) jfc.getFileFilter()).getFilterType() == FileFilterImpl.BPELFilter;
}

// TODO method description
public String getSavePath(String basicPath, JFileChooser jfc) {
return basicPath
+ Utils.getQualifiedFileName(jfc.getSelectedFile().getName(), this._extensions);
Expand All @@ -81,24 +75,18 @@ public boolean saveFile(String Path, IEditor editor) {
m.createModel(pnp.getElementContainer());
ProcessDocument doc = ProcessDocument.Factory.newInstance();
TProcess process = doc.addNewProcess();
// BPEL.genBpelProcess();
// BPEL.Process.set(m.generate_bpel());
// setGlobals(BPEL.Process, pnp);
process.set(m.generate_bpel());
setGlobals(process, pnp);
// File Output
XmlOptions opt = new XmlOptions();

// opt.setSavePrettyPrintIndent(2);
// opt.setUseDefaultNamespace();
Map<String, String> map = new HashMap<String, String>();
map.put("http://docs.oasis-open.org/wsbpel/2.0/process/executable", "bpel");
map.put("http://www.w3.org/2001/XMLSchema", "xs");
opt = opt.setSaveSuggestedPrefixes(map);
opt.setSavePrettyPrint();
try {
doc.save(new File(Path), opt);
// bpelDoc.save(new File(Path), opt);
return true;
} catch (IOException e) {
return false;
Expand Down Expand Up @@ -128,8 +116,6 @@ public String genPreview(IEditor editor) {
return "" + Messages.getString("BPEL.genPreview.Error");
}
XmlOptions opt = new XmlOptions();
// opt.setSavePrettyPrintIndent(2);
// opt.setUseDefaultNamespace();
Map<String, String> map = new HashMap<String, String>();
map.put("http://docs.oasis-open.org/wsbpel/2.0/process/executable", "bpel");
map.put("http://www.w3.org/2001/XMLSchema", "xs");
Expand All @@ -139,7 +125,6 @@ public String genPreview(IEditor editor) {
}

public static TProcess genBpelProcess() {
// if(BPEL.Process != null)return BPEL.Process;
XmlOptions opt = new XmlOptions();
opt.setUseDefaultNamespace();
opt.setSavePrettyPrint();
Expand Down
6 changes: 0 additions & 6 deletions WoPeD-Core/src/main/java/org/woped/core/Constants.java

This file was deleted.

11 changes: 11 additions & 0 deletions WoPeD-Core/src/main/java/org/woped/core/WoPeDConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.woped.core;

public class WoPeDConstants {

public static final String CORE_LOGGER = "CORE_LOGGER";

// Keep in synch with mvn pom file.
// Could read directly from pom like this:
// https://stackoverflow.com/questions/3697449/retrieve-version-from-maven-pom-xml-in-code
public static final String WOPED_VERSION = "3.9.1";
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.List;
import java.util.Map;
import javax.swing.UIManager;
import org.woped.core.Constants;
import org.woped.core.WoPeDConstants;
import org.woped.core.config.ConfigurationManager;
import org.woped.core.config.IGeneralConfiguration;
import org.woped.core.gui.IEditorAware;
Expand All @@ -55,7 +55,7 @@ public AbstractApplicationMediator(IUserInterface ui, IGeneralConfiguration conf
viewControllerMap = new HashMap<String, IViewController>();
boolean confOK = true;

LoggerManager.info(Constants.CORE_LOGGER, "START INIT Application");
LoggerManager.info(WoPeDConstants.CORE_LOGGER, "START INIT Application");
setUi(ui);
setConf(conf);

Expand All @@ -64,8 +64,8 @@ public AbstractApplicationMediator(IUserInterface ui, IGeneralConfiguration conf
confOK = conf.initConfig();
if (!confOK) {
// This should NEVER happen!
LoggerManager.fatal(Constants.CORE_LOGGER, "Could really not load any configuration.");
LoggerManager.info(Constants.CORE_LOGGER, "EXIT WoPeD - LOGGING DEACTIVATED");
LoggerManager.fatal(WoPeDConstants.CORE_LOGGER, "Could really not load any configuration.");
LoggerManager.info(WoPeDConstants.CORE_LOGGER, "EXIT WoPeD - LOGGING DEACTIVATED");
System.exit(0);
}
}
Expand All @@ -79,9 +79,9 @@ public AbstractApplicationMediator(IUserInterface ui, IGeneralConfiguration conf

UIManager.setLookAndFeel(ConfigurationManager.getConfiguration().getLookAndFeel());
LoggerManager.info(
Constants.CORE_LOGGER, "Look-And-Feel set to " + Platform.getSystemLookAndFeel());
WoPeDConstants.CORE_LOGGER, "Look-And-Feel set to " + Platform.getSystemLookAndFeel());
} catch (Exception e) {
LoggerManager.debug(Constants.CORE_LOGGER, "Look-And-Feel could not be set");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Look-And-Feel could not be set");
}
}

Expand Down Expand Up @@ -118,7 +118,7 @@ public static IViewController createViewController(String className, String id)
return vc;
} catch (Exception e1) {
LoggerManager.error(
Constants.CORE_LOGGER,
WoPeDConstants.CORE_LOGGER,
"Could not create the ViewController (ID:" + id + ")" + e1.getMessage());
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.jgraph.graph.GraphModel;
import org.jgraph.graph.GraphUndoManager;
import org.jgraph.graph.Port;
import org.woped.core.Constants;
import org.woped.core.WoPeDConstants;
import org.woped.core.config.ConfigurationManager;
import org.woped.core.model.PetriNetModelProcessor;
import org.woped.core.model.petrinet.AbstractPetriNetElementModel;
Expand Down Expand Up @@ -204,7 +204,7 @@ public void connect(DefaultEdge edge, boolean insertIntoCache) {
}
//
} else {
LoggerManager.warn(Constants.CORE_LOGGER, "Not a valid connection, did nothing!");
LoggerManager.warn(WoPeDConstants.CORE_LOGGER, "Not a valid connection, did nothing!");
}
}

Expand Down Expand Up @@ -241,7 +241,7 @@ public GroupModel group(
if (mainElement != null && name != null) {
// Create Group Cell
GroupModel group = new GroupModel(mainElement, name, additional, ungroupable);
LoggerManager.debug(Constants.CORE_LOGGER, "Grouping of Elements created.");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Grouping of Elements created.");
return group;
} else {
GroupModel group = new GroupModel(mainElement, name, additional, ungroupable);
Expand Down Expand Up @@ -283,7 +283,7 @@ public void ungroup(Object[] cells) {
graphModel.remove(groups.toArray());
// Select Children
setSelectionCells(children.toArray());
LoggerManager.debug(Constants.CORE_LOGGER, "Grouping of Elements deleted. ");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Grouping of Elements deleted. ");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.jgraph.graph.CellView;
import org.jgraph.graph.GraphLayoutCache;
import org.jgraph.graph.GraphModel;
import org.woped.core.Constants;
import org.woped.core.WoPeDConstants;
import org.woped.core.utilities.LoggerManager;

/**
Expand Down Expand Up @@ -89,14 +89,14 @@ public void valueForCellChanged(Object cell, Object newValue) {
if (cell instanceof DefaultMutableTreeNode) {
if (((DefaultMutableTreeNode) cell).getUserObject() == null) {
if (newValue == null) {
LoggerManager.debug(Constants.CORE_LOGGER, "Edit not added: No change.");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Edit not added: No change.");
} else {
super.valueForCellChanged(cell, newValue);
}
} else if (!((DefaultMutableTreeNode) cell).getUserObject().equals(newValue)) {
super.valueForCellChanged(cell, newValue);
} else {
LoggerManager.debug(Constants.CORE_LOGGER, "Edit not added: No change.");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Edit not added: No change.");
}
} else {
super.valueForCellChanged(cell, newValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import org.woped.core.Constants;
import org.woped.core.WoPeDConstants;
import org.woped.core.utilities.LoggerManager;

/**
Expand Down Expand Up @@ -52,7 +52,7 @@ public void unregister(int viewEventType, AbstractEventProcessor vep) {

if (processors == null || !processors.contains(vep)) {
LoggerManager.warn(
Constants.CORE_LOGGER,
WoPeDConstants.CORE_LOGGER,
"Tried to unregister a AbstractViewEventProcessor which has not"
+ " registered for this type.");
return;
Expand Down
6 changes: 3 additions & 3 deletions WoPeD-Core/src/main/java/org/woped/core/model/ArcModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.jgraph.graph.DefaultPort;
import org.jgraph.graph.GraphConstants;
import org.jgraph.graph.PortView;
import org.woped.core.Constants;
import org.woped.core.WoPeDConstants;
import org.woped.core.config.ConfigurationManager;
import org.woped.core.config.DefaultStaticConfiguration;
import org.woped.core.model.petrinet.AbstractPetriNetElementModel;
Expand Down Expand Up @@ -287,7 +287,7 @@ public void addPoint(Point2D c, int index) {
HashMap<Object, Object> map = new HashMap<Object, Object>();
GraphConstants.setPoints(map, points);
getAttributes().applyMap(map);
LoggerManager.debug(Constants.CORE_LOGGER, "Point added " + c.toString());
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Point added " + c.toString());
}

/**
Expand Down Expand Up @@ -369,7 +369,7 @@ public void removePoint(Point2D l) {
points.remove(pos);
GraphConstants.setPoints(map, points);
getAttributes().applyMap(map);
LoggerManager.debug(Constants.CORE_LOGGER, "Point removed");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Point removed");
}

public boolean hasPoint(Point2D p, int tolerance) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.List;
import java.util.Vector;
import javax.swing.ImageIcon;
import org.woped.core.Constants;
import org.woped.core.WoPeDConstants;
import org.woped.core.config.ConfigurationManager;
import org.woped.core.model.petrinet.AbstractPetriNetElementModel;
import org.woped.core.utilities.LoggerManager;
Expand Down Expand Up @@ -387,7 +387,8 @@ public void setArcPoints(List<?> points) {
newPoints.add(new Point2D.Double(p.getX1(), p.getX2()));
} else {
LoggerManager.error(
Constants.CORE_LOGGER, "Could not convert " + o.toString() + "to Point2D. Skipped");
WoPeDConstants.CORE_LOGGER,
"Could not convert " + o.toString() + "to Point2D. Skipped");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.oasisOpen.docs.wsbpel.x20.process.executable.TPartnerLinks;
import org.oasisOpen.docs.wsbpel.x20.process.executable.TVariable;
import org.oasisOpen.docs.wsbpel.x20.process.executable.TVariables;
import org.woped.core.Constants;
import org.woped.core.WoPeDConstants;
import org.woped.core.model.bpel.BpelVariable;
import org.woped.core.model.bpel.BpelVariableList;
import org.woped.core.model.bpel.PartnerlinkList;
Expand Down Expand Up @@ -140,11 +140,11 @@ public AbstractPetriNetElementModel addElement(AbstractPetriNetElementModel elem
element.addOwningContainer(this);

LoggerManager.debug(
Constants.CORE_LOGGER, String.format("Element: %s added", element.getId()));
WoPeDConstants.CORE_LOGGER, String.format("Element: %s added", element.getId()));
} else {

// an element with the id of the new element already exists
LoggerManager.debug(Constants.CORE_LOGGER, "The Element already exists, did nothing!");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "The Element already exists, did nothing!");
}

return element;
Expand All @@ -163,28 +163,29 @@ public void addReference(ArcModel arc) {
// validate source
if (getElementById(arc.getSourceId()) == null) {
LoggerManager.warn(
Constants.CORE_LOGGER, String.format("Source (ID: %s) doesn't exist", arc.getSourceId()));
WoPeDConstants.CORE_LOGGER,
String.format("Source (ID: %s) doesn't exist", arc.getSourceId()));
return;
}

// validate target
if (getElementById(arc.getTargetId()) == null) {
LoggerManager.warn(
Constants.CORE_LOGGER, "Target (ID:" + arc.getTargetId() + ") does not exist");
WoPeDConstants.CORE_LOGGER, "Target (ID:" + arc.getTargetId() + ") does not exist");
return;
}

// Check if reference already exists
if (hasReference(arc.getSourceId(), arc.getTargetId())) {
LoggerManager.debug(Constants.CORE_LOGGER, "Arc already exists!");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Arc already exists!");
return;
}

// Add reference
getIdMap().get(arc.getSourceId()).put(arc.getId(), arc);
arcs.put(arc.getId(), arc);
LoggerManager.debug(
Constants.CORE_LOGGER,
WoPeDConstants.CORE_LOGGER,
"Reference: "
+ arc.getId()
+ " ("
Expand Down Expand Up @@ -233,7 +234,7 @@ public void removeOnlyElement(Object id) {
// The element is no longer owned by anybody
if (element != null) element.removeOwningContainer(this);
getIdMap().remove(id);
LoggerManager.debug(Constants.CORE_LOGGER, "Element (ID:" + id + ") removed.");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Element (ID:" + id + ") removed.");
}

/**
Expand All @@ -246,7 +247,8 @@ public void removeArcsFromElement(Object id) {
removeIncomingArcsFromElement(id);
removeOutgoingArcsFromElement(id);

LoggerManager.debug(Constants.CORE_LOGGER, "All References from/to (ID:" + id + ") deleted");
LoggerManager.debug(
WoPeDConstants.CORE_LOGGER, "All References from/to (ID:" + id + ") deleted");
}

/**
Expand Down Expand Up @@ -283,7 +285,7 @@ public void removeArc(Object id) {
ArcModel arc = getArcById(id);

if (arc == null) {
LoggerManager.warn(Constants.CORE_LOGGER, "Arc with ID: " + id + " does not exists");
LoggerManager.warn(WoPeDConstants.CORE_LOGGER, "Arc with ID: " + id + " does not exists");
}

removeArc(arc);
Expand All @@ -296,7 +298,7 @@ public void removeArc(Object id) {
*/
public void removeArc(ArcModel arc) {
if (arc != null) {
LoggerManager.debug(Constants.CORE_LOGGER, "Reference (ID:" + arc.getId() + ") deleted");
LoggerManager.debug(WoPeDConstants.CORE_LOGGER, "Reference (ID:" + arc.getId() + ") deleted");
// remove in arc Map
arcs.remove(arc.getId());
// remove Target Entry, (in Source Element's reference Map)
Expand Down Expand Up @@ -450,7 +452,7 @@ public AbstractPetriNetElementModel getElementById(Object id) {

} else {
LoggerManager.debug(
Constants.CORE_LOGGER, "Requested Element (ID:" + id + ") does not exists");
WoPeDConstants.CORE_LOGGER, "Requested Element (ID:" + id + ") does not exists");
return null;
}
}
Expand All @@ -477,7 +479,8 @@ public ArcModel getArcById(Object id) {
if (arcs.get(id) != null) {
return arcs.get(id);
} else {
LoggerManager.debug(Constants.CORE_LOGGER, " Requested Arc (ID:" + id + ") does not exists");
LoggerManager.debug(
WoPeDConstants.CORE_LOGGER, " Requested Arc (ID:" + id + ") does not exists");
return null;
}
}
Expand Down
Loading

0 comments on commit 53d0583

Please sign in to comment.