Search in sources :

Example 1 with IMicroComment

use of com.helger.xml.microdom.IMicroComment in project ph-commons by phax.

the class AbstractSimpleDAO method modifyWriteData.

/**
 * Modify the created document by e.g. adding some comment or digital
 * signature or whatsoever.
 *
 * @param aDoc
 *        The created non-<code>null</code> document.
 */
@OverrideOnDemand
@MustBeLocked(ELockType.WRITE)
protected void modifyWriteData(@Nonnull final IMicroDocument aDoc) {
    final IMicroComment aComment = new MicroComment("This file was generated automatically - do NOT modify!\n" + "Written at " + PDTToString.getAsString(ZonedDateTime.now(Clock.systemUTC()), Locale.US));
    final IMicroElement eRoot = aDoc.getDocumentElement();
    // Add a small comment
    if (eRoot != null)
        aDoc.insertBefore(aComment, eRoot);
    else
        aDoc.appendChild(aComment);
}
Also used : MicroComment(com.helger.xml.microdom.MicroComment) IMicroComment(com.helger.xml.microdom.IMicroComment) IMicroElement(com.helger.xml.microdom.IMicroElement) IMicroComment(com.helger.xml.microdom.IMicroComment) MustBeLocked(com.helger.commons.annotation.MustBeLocked) OverrideOnDemand(com.helger.commons.annotation.OverrideOnDemand)

Example 2 with IMicroComment

use of com.helger.xml.microdom.IMicroComment in project ph-commons by phax.

the class AbstractWALDAO method modifyWriteData.

/**
 * Modify the created document by e.g. adding some comment or digital
 * signature or whatsoever.
 *
 * @param aDoc
 *        The created non-<code>null</code> document.
 */
@OverrideOnDemand
@MustBeLocked(ELockType.WRITE)
protected void modifyWriteData(@Nonnull final IMicroDocument aDoc) {
    final IMicroComment aComment = new MicroComment("This file was generated automatically - do NOT modify!\n" + "Written at " + PDTToString.getAsString(ZonedDateTime.now(Clock.systemUTC()), Locale.US));
    final IMicroElement eRoot = aDoc.getDocumentElement();
    // Add a small comment
    if (eRoot != null)
        aDoc.insertBefore(aComment, eRoot);
    else
        aDoc.appendChild(aComment);
}
Also used : IMicroComment(com.helger.xml.microdom.IMicroComment) MicroComment(com.helger.xml.microdom.MicroComment) IMicroElement(com.helger.xml.microdom.IMicroElement) IMicroComment(com.helger.xml.microdom.IMicroComment) MustBeLocked(com.helger.commons.annotation.MustBeLocked) OverrideOnDemand(com.helger.commons.annotation.OverrideOnDemand)

Aggregations

MustBeLocked (com.helger.commons.annotation.MustBeLocked)2 OverrideOnDemand (com.helger.commons.annotation.OverrideOnDemand)2 IMicroComment (com.helger.xml.microdom.IMicroComment)2 IMicroElement (com.helger.xml.microdom.IMicroElement)2 MicroComment (com.helger.xml.microdom.MicroComment)2