private String getSymptomClass(GraphEntity symptom) { String result = "Symptom"; try { GraphAttribute typeGA = symptom.getAttributeByName("PDSymptomTypeField"); String symptType = typeGA.getSimpleValue(); if (!symptType.equals("")) { if (symptType.equals("Tremor")) { result = "TremorSymptom"; } } } catch (NotFound ex) { logger.log(Level.SEVERE, null, ex); } return result; }
public static String getValue(GraphAttribute attribute) { if (attribute.isCollectionValue()) { try { return replaceBadChars(attribute.getCollectionValue().getElementAt(0).getID()); } catch (NullEntity ex) { Logger.getLogger(TaskGenerator.class.getName()).log(Level.SEVERE, null, ex); } } if(attribute.isEntityValue()) { return replaceBadChars(attribute.getSimpleValue()); } return attribute.getSimpleValue(); }
GraphAttribute attr2=attributes2[l]; found=found || attr1.getName().equals(attr2.getName()); if (found){ found = found || (attr1.getSimpleValue()!=null && attr2.getSimpleValue()!=null && attr1.getSimpleValue().equals(attr2.getSimpleValue())); if (!found){ try { attr1.getEntityValue(); try { attr2.getEntityValue(); found = found || attr1.getEntityValue().getID().equals(attr2.getEntityValue().getID()); } catch (NullEntity e1) { attr2.getEntityValue();
public static String getAttributeByName(GraphEntity ge, String attributeName, String defaultValue) { for (GraphAttribute ga : ge.getAllAttrs()) { if (ga.getName().equals(attributeName)) { return (ga.getSimpleValue().equals("")) ? defaultValue : ga.getSimpleValue(); } } return defaultValue; }
boolean found=false; GraphAttribute gaE1=attsEnt1[k]; if (!gaE1.getName().equalsIgnoreCase("prefs")){ for (int j=0;j<attsEnt2.length && !found;j++) { GraphAttribute gaE2=attsEnt2[j]; if (gaE1.getName().equals(gaE2.getName())){ if (gaE1.isSimpleValue() && gaE2.isSimpleValue()){ evaluateSimpleValueField(ent1, differences, gaE1, gaE2); } else if (gaE1.isCollectionValue() && gaE2.isCollectionValue()){ evaluateCollectionValueField(ent1, alreadyVerified, differences, found, gaE1, gaE2); } else { if (gaE1.isEntityValue() && gaE2.isEntityValue()) evaluateEntityValueField(ent1, alreadyVerified, differences, gaE1, gaE2); else { differences.add("entity "+ent1.getID()+":"+ent1.getType()+" has an attribute named "+gaE1.getName()+" with different type in the second spec");
GraphAttribute gaE1, GraphAttribute gaE2) { boolean found; if (gaE1.isEntityValue() && gaE2.isEntityValue()){ entValue1=gaE1.getEntityValue(); } catch (NullEntity ne){}; try { entValue2=gaE2.getEntityValue(); } catch (NullEntity ne){}; if (entValue1==null && entValue2==null) if (entValue1!=null && entValue2==null){ differences.add("entity " +ent1.getID()+":"+ent1.getType()+" has not the same values for attribute "+ gaE1.getName()+":"+entValue1+" instead the second spec has null"); } else if (entValue1==null && entValue2!=null){ differences.add("entity " +ent1.getID()+":"+ent1.getType()+" has not the same values for attribute "+ gaE1.getName()+":null instead the second spec has \""+entValue2+"\""); } else if (entValue1!=null && entValue2!=null){
private void generateDeviceAgentsInitialization(Graph simDiag, Repeat simInitRep) throws NullEntity, NotFound { for (GraphEntity progPool : Utils.getEntities(simDiag, INIT_PROGRAM_POOL)) { for (GraphEntity deviceEntity : Utils.getTargetsEntity(progPool, "device")) { Repeat importADLRep = new Repeat("importDevices"); simInitRep.add(importADLRep); String deviceId = deviceEntity.getID(); Repeat agentRep = new Repeat("deviceAgentRep"); simInitRep.add(agentRep); simInitRep.add(new Var("daID", deviceId)); GraphCollection gc = progPool.getAttributeByName("ProgramPoolField").getCollectionValue(); for (int i = 0; i < gc.size(); i++) { String progId = gc.getElementAt(i).getAttributeByName("modelID").getSimpleValue(); Repeat progRep = new Repeat("progsRep"); progRep.add(new Var("progId", progId)); agentRep.add(progRep); } } } }
if (!gaHours.getSimpleValue().equals("")) { hours = Integer.parseInt(gaHours.getSimpleValue()); } else { logger.log(Level.WARNING, if (!gaMins.getSimpleValue().equals("")) { mins = Integer.parseInt(gaMins.getSimpleValue()); } else { logger.log(Level.WARNING, if (!gaSecs.getSimpleValue().equals("")) { secs = Integer.parseInt(gaSecs.getSimpleValue()); } else { logger.log(Level.WARNING, if (!gaHours.getSimpleValue().equals("")) { hours = Integer.parseInt(gaHours.getSimpleValue()); } else { logger.log(Level.WARNING, if (!gaMins.getSimpleValue().equals("")) { mins = Integer.parseInt(gaMins.getSimpleValue()); } else { logger.log(Level.WARNING, if (!gaSecs.getSimpleValue().equals("")) { secs = Integer.parseInt(gaSecs.getSimpleValue()); } else { logger.log(Level.WARNING,
GraphCollection colValue2=null; try { colValue1=gaE1.getCollectionValue(); } catch (ingenias.exception.NullEntity ne){}; try { colValue2=gaE2.getCollectionValue(); } catch (ingenias.exception.NullEntity ne){}; if (colValue1==null && colValue2==null){ if (colValue1==null && colValue2!=null){ differences.add("entity " +ent1.getID()+":"+ent1.getType()+" has a null value for attribute "+ gaE1.getName()+" instead the second spec has "+colValue2); } else if (colValue1!=null && colValue2==null){ differences.add("entity " +ent1.getID()+":"+ent1.getType()+" has not the same values for attribute "+ gaE1.getName()+":"+colValue1+" instead the second spec has null"); } else if (colValue1!=null && colValue2!=null && } else { differences.add("entity " +ent1.getID()+":"+ent1.getType()+" has not the same number of values for attribute "+ gaE1.getName()+" with "+colValue1.size()+" instead the second spec has "+colValue2.size()+" elements");
public void setAttribute(GraphAttribute ga) throws InvalidAttribute{ try { GraphAttribute oldga=this.getAttributeByName(ga.getName()); ((GraphAttributeImp)oldga).setValue(((GraphAttributeImp)ga).getValue()); Object nvalue=((GraphAttributeImp)ga).getValue(); Class nvalueclass=((TypedVector)nvalue).getType(); Class entclass=this.ent.getClass(); Method m=entclass.getMethod("add"+ga.getName(), new Class[]{nvalueclass}); TypedVector tv=(TypedVector)nvalue; Method m=entclass.getMethod("set"+ga.getName(), new Class[]{nvalue.getClass()});
public static String getAttributeByName(GraphEntity ge, String attributeName) { for (GraphAttribute ga : ge.getAllAttrs()) { if (ga.getName().equals(attributeName)) { return ga.getSimpleValue(); } } return ""; }
GraphEntity stageGE = stages.get(0); GraphAttribute stageGA = stageGE.getAttributeByName("NamePDStageField"); rep.add(new Var("stageName", stageGA.getSimpleValue())); for (GraphEntity symptom : Utils.getTargetsEntity(stageGE, SYMPTOMS)) { System.out.println("\tSymptom = " + symptom.getID()); if (level != null) { GraphAttribute filters = filter.getAttributeByName(TASK_ALLOWED); GraphCollection filterCollection = filters.getCollectionValue(); for (int i = 0; i < filterCollection.size(); i++) { GraphEntity ge = filterCollection.getElementAt(i); GraphAttribute filterRef = ge.getAttributeByName("modelID"); String filterDiagName = filterRef.getSimpleValue(); Graph filtersGraph = Utils.getGraphByName(filterDiagName, browser); if (filtersGraph != null) {
public static String getADLName(String humanId, Browser browser) throws NotFound { GraphEntity ge = getADL(humanId, browser); if (ge != null) { GraphAttribute ga = ge.getAttributeByName("ADLSpecField"); if(ga != null && !ga.getSimpleValue().equals("")) { return Utils.replaceBadChars(ga.getSimpleValue()); } } return null; }
private static void evaluateSimpleValueField(GraphEntity ent1, Vector<String> differences, GraphAttribute gaE1, GraphAttribute gaE2) { boolean found; String simpleValue1=null; String simpleValue2=null; simpleValue1=gaE1.getSimpleValue(); simpleValue2=gaE2.getSimpleValue(); if (simpleValue1==null && simpleValue1==null){ found=true; } else if (simpleValue1==null && simpleValue2!=null){ differences.add("entity " +ent1.getID()+":"+ent1.getType()+" has a null value for attribute "+ gaE1.getName()+" instead the second spec has "+simpleValue2); } else if (simpleValue1!=null && simpleValue2==null){ differences.add("entity " +ent1.getID()+":"+ent1.getType()+" has not the same values for attribute "+ gaE1.getName()+":"+simpleValue1+" instead the second spec has null"); } else if (simpleValue1!=null && simpleValue2!=null && !simpleValue1.equals(simpleValue2)){ differences.add("entity " +ent1.getID()+":"+ent1.getType()+" has a value \""+simpleValue1+"\" for attribute "+ gaE1.getName()+" instead the second spec has \""+simpleValue2+"\""); } }
private static String isCanBeInterrupted(GraphEntity task) { try { GraphAttribute ga = task .getAttributeByName("CanBeInterruptedField"); String value = ga.getSimpleValue(); if (value.equals("No")) { return "false"; } } catch (NotFound e) { // TODO Auto-generated catch block e.printStackTrace(); } return "true"; }
try { ga = ge.getAttributeByName("InteractionSpecDiagField"); if (ga != null && !ga.getSimpleValue().equals("")) { System.out.println("\t-" + ga.getSimpleValue()); 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"); if (!"".equals(message.getSimpleValue())) { List<String> words = new ArrayList<>(); words.addAll(Arrays.asList(message.getSimpleValue().split("[\\s,?!]"))); result.add(words);
public static String getFieldValue(GraphEntity task, String fieldName, String def, boolean mandatory) { GraphAttribute at = null; try { at = task.getAttributeByName(fieldName); } catch (NotFound ex) { } if (at == null || at.getSimpleValue().equals("")) { if (mandatory) { logger.log(Level.SEVERE, "Attribute {0} of {1} is empty!", new Object[]{fieldName, task.getID()}); System.exit(0); } else { logger.log(Level.WARNING, "Attribute {0} of {1} is empty!", new Object[]{fieldName, task.getID()}); return def; } } return Utils.getValue(at); }
private Vector<Graph> getPDDiagramsForActor(GraphEntity actor) { Vector<Graph> patientGraphs = new Vector<Graph>(); Vector<GraphRelationship> rels = actor.getAllRelationships("ProfileOf"); for (GraphRelationship rel : rels) { GraphEntity target; try { target = Utils.getSourceEntity(actor, rel); if (target.getType().equals("ParkinsonsProfile")) { GraphAttribute diagNameAtt = target.getAttributeByName("ParkinsonSpecDiag"); if (diagNameAtt != null && diagNameAtt.getSimpleValue() != null && browser.getGraph(diagNameAtt.getSimpleValue()) != null) { patientGraphs.add(browser.getGraph(diagNameAtt.getSimpleValue())); } } } catch (NotFound e) { // TODO Auto-generated catch block e.printStackTrace(); } } return patientGraphs; }
GraphAttribute sd = sp .getAttributeByName("SocialSpecDiagField"); if (sd.getSimpleValue() != null) { System.out.println("Diagram name = " + sd.getSimpleValue()); Graph socialProfile = Utils.getGraphByName( sd.getSimpleValue(), browser); GraphEntity pi = getEntity(socialProfile, "PersonalInfo"); .getAttributeByName("AgeField"); if (ageAt != null && !ageAt.getSimpleValue().equals("")) { int age = Integer.parseInt(ageAt .getSimpleValue()); if (age > 60) { return "ElderLP";
public static void linkPDManager(String humanId, Repeat repFather, Browser browser) { GraphEntity dmGraph = Utils.getProfileTypeOf(humanId, PARKINSON_PROFILE, browser); if (dmGraph != null) { try { GraphAttribute pdSpec = dmGraph.getAttributeByName("ParkinsonSpecDiag"); Repeat rep = new Repeat("filterManager"); repFather.add(rep); rep.add(new Var("fmName", Utils.replaceBadChars(pdSpec.getSimpleValue()))); } catch (NotFound ex) { Logger.getLogger(PDGenerator.class.getName()).log(Level.SEVERE, null, ex); } } } }