public static Graph getGraphByName(String name, Browser browser) { for (Graph g : browser.getGraphs()) { if (g.getName().equals(name)) { return g; } } return null; }
public static Vector<Hashtable<String,String>> getPossibleRoleAssignment(String relationshipType, String[] connectedEntities, Graph graph, Browser browser) throws NotFound{ Vector<GraphCell> entities=new Vector<GraphCell>(); for (String entityID:connectedEntities) { DefaultGraphCell entity = findEntity(entityID,graph); if (entity==null) throw new ingenias.exception.NotFound("Entity "+entityID+" that you tried to connect did not exist in the graph "+graph.getName()); entities.add(entity); } GraphCell[] selected=new GraphCell[entities.size()]; selected=entities.toArray(selected); NAryEdge nEdge=(NAryEdge) RelationshipFactory.getNRelationshipInstance(relationshipType, selected,browser); Vector<Hashtable<String, String>> result = convertToVectorHashtable(connectedEntities, selected, nEdge); return result; }
public static Vector< String> getPossibleRelationships( String[] connectedEntities, Graph graph) throws NotFound{ Vector<GraphCell> entities=new Vector<GraphCell>(); for (String entityID:connectedEntities) { DefaultGraphCell entity = findEntity(entityID,graph); if (entity==null) throw new ingenias.exception.NotFound("Entity "+entityID+" that you tried to connect did not exist in the graph "+graph.getName()); entities.add(findEntity(entityID,graph)); } GraphCell[] selected=new GraphCell[entities.size()]; selected=entities.toArray(selected); Object[] relObjArray = graph.getGraph().getPossibleRelationships(selected); Vector<String> result = new Vector<String>(); for (Object rel:relObjArray){ result.add(rel.toString()); } return result; }
/** * Description of the Method * *@param args Description of Parameter *@exception Exception Description of Exception */ public static void main(String args[]) throws Exception { String file = args[0]; Browser b = new BrowserImp(file); Graph[] gs = b.getGraphs(); for (int k = 0; k < gs.length; k++) { System.err.println(gs[k].getType() + ":" + gs[k].getName()); } }
public void actionPerformed(ActionEvent e) { if (dmtn.getUserObject()instanceof Entity){ Entity ent=(Entity)dmtn.getUserObject(); StringBuffer result=new StringBuffer(); result.append("Diagrams found:<ul>"); Graph[] graphs=browser.getGraphs(); for (int k=0;k<graphs.length;k++){ GraphEntity[] ges; try { ges = graphs[k].getEntities(); boolean found=false; for (int j=0;j<ges.length &&!found;j++){ found=ges[j].getID().equals(ent.getId()); } if (found){ result.append("<li><a href=\"http://app/"+graphs[k].getName()+"/"+ent.getId()+"\">"+graphs[k].getName()+"</a>"); } } catch (NullEntity e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } result.append("</ul>"); resources.getSearchDiagramPanel().setText(result.toString()); resources.focusSearchPane(); } } });
public void actionPerformed(ActionEvent e) { StringBuffer result=new StringBuffer(); result.append("Diagrams found:<ul>"); Graph[] graphs=bimp.getGraphs(); for (int k=0;k<graphs.length;k++){ GraphEntity[] ges; try { ges = graphs[k].getEntities(); boolean found=false; for (int j=0;j<ges.length &&!found;j++){ found=ges[j].getID().equals(ent.getId()); } if (found){ result.append("<li><a href=\"http://app/"+graphs[k].getName()+"/"+ent.getId()+"\">"+graphs[k].getName()+"</a>"); } } catch (NullEntity e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } result.append("</ul>"); resources.getSearchDiagramPanel().setText(result.toString()); resources.focusSearchPane(); } });
Graph interactionGraph = Utils.getGraphByName(ga.getSimpleValue(), browser); if (interactionGraph != null) { System.out.println("\t-" + interactionGraph.getName()); for (GraphEntity mle : Utils.getEntities(interactionGraph, "MessageListenedEvent")) { GraphAttribute message = mle.getAttributeByName("Message");
Graph g = gs[k]; rp2 = new Repeat("graph"); rp2.add(new Var("name", ingenias.generator.util.Conversor.replaceInvalidCharsForID(g.getName()))); rp2.add(new Var("fname", this.toSafeName(g.getName()))); rp2.add(new Var("tipo", g.getType())); rp2.add(new Var("image", toSafeName(g.getName()) + ".png")); g.generateImage( ( (ProjectProperty)this.getProperty("htmldoc:output")). value + "/" + toSafeName(g.getName()) + ".png"); rp1.add(rp2);
( (ProjectProperty)this.getProperty("htmldoc:output")). value)); r.add(new Var("name", gs[k].getName())); r.add(new Var("fname", this.toSafeName(gs[k].getName()))); r.add(new Var("image", toSafeName(gs[k].getName()) + ".png")); r.add(new Var("tipo", gs[k].getType())); for (int l=0;l<dges.length;l++){ found=dges[l].getID().equals(ge.getID()); if (found && !mentioned.contains(gs[m].getName())){ Repeat diagram=new Repeat("relateddiagrams"); diagram.add(new Var("diagramname",toSafeName(gs[m].getName()))); diagram.add(new Var("diagramtype",gs[m].getType())); ens.add(diagram); mentioned.add(gs[k].getName());