use of com.google.api.ads.admanager.axis.v202202.Content in project pom-manipulation-ext by release-engineering.
the class PomIO method write.
private void write(final Project project, final File pom, final Model model) throws ManipulationException {
try {
final String manifestInformation = project.isInheritanceRoot() ? ManifestUtils.getManifestInformation() : null;
MavenJDOMWriter mjw = new MavenJDOMWriter(model);
// We possibly could store the EOL type in the Project when we first read
// the file but we would then have to do a dual read, then write as opposed
// to a read, then read + write now.
LineSeparator ls = determineEOL(pom);
mjw.setLineSeparator(ls);
mjw.write(model, pom, new DocumentModifier() {
@Override
public void postProcess(final Document doc) {
// Only add the modified by to the top level pom.
if (project.isExecutionRoot()) {
final Iterator<Content> it = doc.getContent(new ContentFilter(ContentFilter.COMMENT)).iterator();
while (it.hasNext()) {
final Comment c = (Comment) it.next();
if (c.toString().contains(MODIFIED_BY)) {
it.remove();
}
}
doc.addContent(Collections.<Content>singletonList(new Comment("\nModified by POM Manipulation Extension for Maven " + manifestInformation + "\n")));
}
}
});
} catch (final IOException e) {
throw new ManipulationException("Failed to read POM for rewrite: %s. Reason: %s", e, pom, e.getMessage());
} catch (final JDOMException e) {
throw new ManipulationException("Failed to parse POM for rewrite: %s. Reason: %s", e, pom, e.getMessage());
}
}
use of com.google.api.ads.admanager.axis.v202202.Content in project mycore by MyCoRe-Org.
the class MCRMetaXML method createXML.
/**
* This method create a XML stream for all data in this class, defined by
* the MyCoRe XML MCRMetaLangText definition for the given subtag.
*
* @exception MCRException
* if the content of this class is not valid
* @return a JDOM Element with the XML MCRMetaLangText part
*/
@Override
public org.jdom2.Element createXML() throws MCRException {
Element elm = super.createXML();
List<Content> addedContent = new ArrayList<>(content.size());
cloneListContent(addedContent, content);
elm.addContent(addedContent);
return elm;
}
use of com.google.api.ads.admanager.axis.v202202.Content in project mycore by MyCoRe-Org.
the class MCRSwapElements method swap.
public static MCRChangeData swap(Element parent, int posA, int posB) {
Content a = parent.getContent().get(posA);
Content b = parent.getContent().get(posB);
return swap(parent, posA, a, posB, b);
}
use of com.google.api.ads.admanager.axis.v202202.Content in project jspwiki by apache.
the class CreoleRenderer method renderElement.
/**
* Renders an element into the StringBuilder given
* @param ce element to render
* @param sb stringbuilder holding the element render
*/
private void renderElement(final Element ce, final StringBuilder sb) {
String endEl = EMPTY_STRING;
for (int i = 0; i < ELEMENTS.length; i += 3) {
if (ELEMENTS[i].equals(ce.getName())) {
sb.append(ELEMENTS[i + 1]);
endEl = ELEMENTS[i + 2];
}
}
if (UL.equals(ce.getName())) {
m_listCount++;
m_listChar = '*';
} else if (OL.equals(ce.getName())) {
m_listCount++;
m_listChar = '#';
} else if (LI.equals(ce.getName())) {
for (int i = 0; i < m_listCount; i++) sb.append(m_listChar);
sb.append(ONE_SPACE);
} else if (A.equals(ce.getName())) {
final String href = ce.getAttributeValue(HREF_ATTRIBUTE);
final String text = ce.getText();
if (href.equals(text)) {
sb.append(HREF_START).append(href).append(HREF_END);
} else {
sb.append(HREF_START).append(href).append(HREF_DELIMITER).append(text).append(HREF_END);
}
// Do not render anything else
return;
} else if (PRE.equals(ce.getName())) {
sb.append(PRE_START);
sb.append(ce.getText());
sb.append(PRE_END);
return;
}
// Go through the children
for (final Content c : ce.getContent()) {
if (c instanceof PluginContent) {
final PluginContent pc = (PluginContent) c;
if (pc.getPluginName().equals(PLUGIN_IMAGE)) {
sb.append(IMG_START).append(pc.getParameter(PARAM_SRC)).append(IMG_END);
} else {
m_plugins.add(pc);
sb.append(PLUGIN_START).append(pc.getPluginName()).append(ONE_SPACE).append(m_plugins.size()).append(PLUGIN_END);
}
} else if (c instanceof Text) {
sb.append(((Text) c).getText());
} else if (c instanceof Element) {
renderElement((Element) c, sb);
}
}
if (UL.equals(ce.getName()) || OL.equals(ce.getName())) {
m_listCount--;
} else if (P.equals(ce.getName())) {
sb.append(LINEBREAK);
}
sb.append(endEl);
}
use of com.google.api.ads.admanager.axis.v202202.Content in project jspwiki by apache.
the class MarkdownTheadDecorator method decorate.
/**
* {@inheritDoc}
*/
@Override
public void decorate(final Element element) throws JDOMException {
super.decorate(element);
final Content cNestedTr = element.getContent().get(0);
if (cNestedTr instanceof Element) {
final Element nestedTr = (Element) cNestedTr;
final int ths = nestedTr.getContent().size();
if (ths > 0) {
for (int i = 0; i < ths; i++) {
out.print("|---");
}
}
out.println();
}
}
Aggregations