public boolean hasVisibility(String codeVisibility) { boolean hasVisibility = false; for (Iterator<?> i = this.topics.iterator(); i.hasNext(); ) { Topic a = Topic.class.cast(i.next()); if (a.getCodeVisibility().equals(codeVisibility)) { hasVisibility = true; break; } } return hasVisibility; }
private String recurseGetParentName(String qualifiedName) { Topic parent = this.getParentTopic(); if (parent != null) { if (parent.getName() != null) { qualifiedName = parent.getName() + "/" + qualifiedName; qualifiedName = parent.recurseGetParentName(qualifiedName); } } return qualifiedName; }
/* * An analysis, experiment, or data track can be part of many topics. This convenience method * allows the caller to send in the list of parent topics and it will generate XML nodes showing the * topic with its contents. This methods is used the GetAnalysis, GetRequest, and GetDataTrack to * fill in the XML structure for "related" topics. */ public static void appendParentTopicsXML( SecurityAdvisor secAdvisor, Element parentNode, Set topics) throws UnknownPermissionException { for (Topic topic : (Set<Topic>) topics) { Element topicNode = new Element("Topic"); topicNode.setAttribute("idTopic", topic.getIdTopic().toString()); topicNode.setAttribute( "label", (secAdvisor.canRead(topic) ? (topic.getName() != null ? topic.getName() : "") : "(Not authorized)")); topicNode.setAttribute("codeVisibility", topic.getCodeVisibility()); parentNode.addContent(topicNode); for (Request r : (Set<Request>) topic.getRequests()) { Element rNode = new Element("Request"); r.appendBasicXML(secAdvisor, topicNode); } for (Analysis a : (Set<Analysis>) topic.getAnalyses()) { Element aNode = new Element("Analysis"); a.appendBasicXML(secAdvisor, topicNode); } for (DataTrack dt : (Set<DataTrack>) topic.getDataTracks()) { Element dtNode = new Element("DataTrack"); dt.appendBasicXML(secAdvisor, topicNode); } } }
private String recurseGetParentNameExcludingRoot(String typeName) { Topic parent = this.getParentTopic(); if (parent != null) { if (parent.getName() != null) { // Stop before the root dataTrack grouping if (parent.getIdParentTopic() != null) { typeName = parent.getName() + "/" + typeName; typeName = parent.recurseGetParentNameExcludingRoot(typeName); } } } return typeName; }
public void recurseGetChildren(List<Object> descendents) { for (Iterator<?> i = this.getTopics().iterator(); i.hasNext(); ) { Topic ag = Topic.class.cast(i.next()); descendents.add(ag); ag.recurseGetChildren(descendents); } for (Iterator<?> i = this.getRequests().iterator(); i.hasNext(); ) { Request r = Request.class.cast(i.next()); descendents.add(r); } for (Iterator<?> i = this.getAnalyses().iterator(); i.hasNext(); ) { Analysis a = Analysis.class.cast(i.next()); descendents.add(a); } for (Iterator<?> i = this.getDataTracks().iterator(); i.hasNext(); ) { DataTrack dt = DataTrack.class.cast(i.next()); descendents.add(dt); } }