org.opendope.conditions.Conditionref Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docx4j-core Show documentation
Show all versions of docx4j-core Show documentation
docx4j is a library which helps you to work with the Office Open
XML file format as used in docx
documents, pptx presentations, and xlsx spreadsheets.
package org.opendope.conditions;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.CustomXmlPart;
import org.docx4j.openpackaging.parts.opendope.ConditionsPart;
/**
* Java class for anonymous complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "conditionref")
public class Conditionref implements Evaluable {
@XmlAttribute(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "NCName")
protected String id;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
public boolean evaluate(WordprocessingMLPackage pkg,
Map customXmlDataStorageParts,
Map conditionsMap,
Map xpathsMap) {
//Condition particle = ConditionsPart.getConditionById(conditions, id);
Condition particle = conditionsMap.get(id);
return particle.evaluate(pkg, customXmlDataStorageParts, conditionsMap, xpathsMap);
}
public void listXPaths( List theList,
Map conditionsMap,
Map xpathsMap) {
//Condition particle = ConditionsPart.getConditionById(conditions, id);
Condition particle = conditionsMap.get(id);
particle.listXPaths(theList, conditionsMap, xpathsMap);
}
/**
* Map the IDs used in this condition to new values; useful for merging ConditionParts.
*
* @param xpathIdMap
* @param conditionIdMap
* @since 3.0.0
*/
public void mapIds(Map xpathIdMap, Map conditionIdMap) {
if (conditionIdMap==null) return;
String newId = conditionIdMap.get(getId());
if (newId!=null) {
setId(newId);
}
}
public String toString(Map conditionsMap,
Map xpathsMap) {
//Condition particle = ConditionsPart.getConditionById(conditions, id);
Condition particle = conditionsMap.get(id);
return particle.toString(conditionsMap, xpathsMap);
}
public Condition repeat(String xpathBase,
int index,
Map conditionsMap,
Map xpathsMap) {
// Condition particle = ConditionsPart.getConditionById(conditions, id);
Condition particle = conditionsMap.get(id);
Condition newCondition = particle.repeat(xpathBase, index, conditionsMap, xpathsMap);
this.id = newCondition.getId();
return null;
}
}