/** * Map the diagram to the logical model (both in memory). This method should be called only after * the diagram is initialized. We call it in "OpenDiagram" after the diagram is opened by an * editor. */ public void mapModels() { // 1. from diagram get the logical model OLCBProcImpl opi = (OLCBProcImpl) ((View) olcbep.getModel()).getElement(); // 2. from apdl file get the real model OLCBProc op = olcbProc; OLCBProcAssistant oa = new OLCBProcAssistant(op); // 3. do the model mapping by id objectMap.clear(); if (!opi.getId().equals(op.getId())) { System.err.println("Wrong Mapping in MC.mapModels()"); return; } addMap(opi.hashCode(), op); for (CLCBProc cpi : opi.getCLCBProc()) { org.ow2.aspirerfid.commons.apdl.model.CLCBProc cp; if ((cp = oa.getCLCB(cpi.getId())) != null) { addMap(cpi.hashCode(), cp); for (EBProc ebi : cpi.getEBProc()) { org.ow2.aspirerfid.commons.apdl.model.EBProc ep; if ((ep = oa.getEBProc(cp, ebi.getId())) != null) { addMap(ebi.hashCode(), ep); } else { System.err.println("Wrong Mapping in MC.mapModels()"); return; } } } else { System.err.println("Wrong Mapping"); return; } } }
/** * Get the parent for the given ebproc An overall search is involved * * @param ebProc * @return */ public org.ow2.aspirerfid.commons.apdl.model.CLCBProc getParent( org.ow2.aspirerfid.commons.apdl.model.EBProc ebProc) { for (org.ow2.aspirerfid.commons.apdl.model.CLCBProc clcb : olcbProc.getCLCBProc()) { if (clcb.getEBProc().contains(ebProc)) { return clcb; } } return null; }
public boolean removeCLCBProc(org.ow2.aspirerfid.commons.apdl.model.CLCBProc clcb) { boolean result = olcbProc.getCLCBProc().remove(clcb); saveObject(); return result; }
public org.ow2.aspirerfid.commons.apdl.model.CLCBProc createCLCBProc() { org.ow2.aspirerfid.commons.apdl.model.CLCBProc clcbProc = objectFactory.createCLCBProc(); olcbProc.getCLCBProc().add(clcbProc); saveObject(); return clcbProc; }