List of usage examples for org.dom4j Element add
void add(Namespace namespace);
Namespace
to this element. From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.ActivitySourceXmlSerializer.java
License:BSD License
@Override protected Element createElement(Source source, boolean inCollection) { Element sourceElement = rootElement().create(); XsdAttribute.ACTIVITY_SOURCE_NAME.addTo(sourceElement, source.getName()); for (Activity a : source.getActivities()) { sourceElement.add(activitySerializer.createElement(a)); }// ww w . j a v a2s . co m return sourceElement; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.ActivitySourceXmlSerializer.java
License:BSD License
public Element createElement(Collection<Source> rs) { Element element = createCollectionRootElement(); for (Source r : rs) { element.add(createElement(r, true)); }/*w ww.j av a 2s . com*/ return element; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.ActivityXmlSerializer.java
License:BSD License
@Override public Element createElement(Activity a) { Element aElt = XsdElement.ACTIVITY.create(); XsdAttribute.ACTIVITY_NAME.addTo(aElt, a.getName()); XsdAttribute.ACTIVITY_CODE.addTo(aElt, a.getCode()); XsdAttribute.ACTIVITY_DESC.addTo(aElt, a.getDescription()); XsdAttribute.ACTIVITY_TYPE.addTo(aElt, a.getType().getName()); if (!embeddedInSource && a.getSource() != null) { XsdAttribute.ACTIVITY_SOURCE.addTo(aElt, a.getSource().getNaturalKey()); }//from w ww .j av a 2 s . co m if (embeddedInSource) { for (ActivityProperty ap : a.getProperties()) { aElt.add(activityPropertyXmlSerializer.createElement(ap)); } } return aElt; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.AddXmlSerializer.java
License:BSD License
protected void addAdditionalAttributes(final Change change, Element element) { Add add = (Add) change;/* w ww.j a v a2s . c om*/ if (add.getIndex() != null) { element.addAttribute(INDEX, add.getIndex().toString()); } Child child = add.getChild(); if (child != null) { Changeable added = child; StudyCalendarXmlSerializer serializer = getChangeableXmlSerializerFactory().createXmlSerializer(added); Element ePlanTreeNode = serializer.createElement(added); element.add(ePlanTreeNode); } }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.AmendmentXmlSerializer.java
License:BSD License
@SuppressWarnings({ "RawUseOfParameterizedType" }) private void addDeltas(final Amendment amendment, Element element) { for (Delta delta : amendment.getDeltas()) { DeltaXmlSerializer serializer = getDeltaXmlSerializerFactory().createXmlSerializer(delta); Element eDelta = serializer.createElement(delta); element.add(eDelta); }//from w ww . ja va 2 s .c om }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.DefaultDeltaXmlSerializer.java
License:BSD License
@Override public Element createElement(Delta delta) { Element eDelta = element(elementName()); eDelta.addAttribute(ID, delta.getGridId()); eDelta.addAttribute(NODE_ID, delta.getNode().getGridId()); List<Change> changes = delta.getChanges(); for (Change change : changes) { ChangeXmlSerializer changeSerializer = getChangeXmlSerializerFactory().createXmlSerializer(change); Element eChange = changeSerializer.createElement(change); if (eChange != null) { eDelta.add(eChange); }/* ww w . ja v a2s. c o m*/ } return eDelta; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.EpochXmlSerializer.java
License:BSD License
protected void addChildrenElements(PlanTreeInnerNode<?, PlanTreeNode<?>, ?> node, Element eStudySegment) { if (getChildXmlSerializer() != null) { for (PlanTreeNode<?> oChildNode : node.getChildren()) { Element childElement = getChildXmlSerializer().createElement(oChildNode); eStudySegment.add(childElement); }/*from w ww. j a v a 2 s .c o m*/ } }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.PlannedActivityXmlSerializer.java
License:BSD License
protected void addAdditionalElementAttributes(final PlanTreeNode<?> node, Element element) { element.addAttribute(DETAILS, ((PlannedActivity) node).getDetails()); element.addAttribute(DAY, ((PlannedActivity) node).getDay().toString()); element.addAttribute(CONDITION, ((PlannedActivity) node).getCondition()); if (((PlannedActivity) node).getWeight() != null) { element.addAttribute(WEIGHT, ((PlannedActivity) node).getWeight().toString()); }/*from www .j av a2s.c o m*/ if (!(((PlannedActivity) node).getPlannedActivityLabels().isEmpty())) { for (PlannedActivityLabel label : ((PlannedActivity) node).getPlannedActivityLabels()) { Element eLabel = plannedActivityLabelXmlSerializer.createElement(label); element.add(eLabel); } } Population population = ((PlannedActivity) node).getPopulation(); if (population != null) { element.addAttribute(POPULATION, ((PlannedActivity) node).getPopulation().getAbbreviation()); } Element eActivity = activityReferenceXmlSerializer.createElement(((PlannedActivity) node).getActivity()); element.add(eActivity); }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.PlannedCalendarXmlSerializer.java
License:BSD License
public Element createElement(PlannedCalendar cal) { Element element = element(PLANNED_CALENDAR); element.addAttribute(ID, cal.getGridId()); if (serializeEpoch) { EpochXmlSerializer serializer = getEpochSerializer(); for (Epoch epoch : cal.getEpochs()) { element.add(serializer.createElement(epoch)); }/*from w w w . j a v a2s .c o m*/ } return element; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.ScheduledActivityXmlSerializer.java
License:BSD License
@Override public Element createElement(ScheduledActivity scheduledActivity, boolean inCollection) { if (scheduledActivity == null) { throw new StudyCalendarSystemException("scheduled activity must not be null"); }/* w w w. j a v a 2 s. c om*/ Element rootElement = rootElement().create(); SCHEDULED_ACTIVITY_ID.addTo(rootElement, scheduledActivity.getGridId()); SCHEDULED_ACTIVITY_IDEAL_DATE.addTo(rootElement, scheduledActivity.getIdealDate()); SCHEDULED_ACTIVITY_NOTES.addTo(rootElement, scheduledActivity.getNotes()); SCHEDULED_ACTIVITY_DETAILS.addTo(rootElement, scheduledActivity.getDetails()); SCHEDULED_ACTIVITY_REPETITION_NUMBER.addTo(rootElement, scheduledActivity.getRepetitionNumber()); if (scheduledActivity.getPlannedActivity() != null) { SCHEDULED_ACTIVITY_PLANNED_ACITIVITY_ID.addTo(rootElement, scheduledActivity.getPlannedActivity().getGridId()); } rootElement.add(currentScheduledActivityStateSerializer.createElement(scheduledActivity.getCurrentState())); for (ScheduledActivityState state : scheduledActivity.getPreviousStates()) { rootElement.add(previousScheduledActivityStateSerializer.createElement(state)); } return rootElement; }