Created
November 13, 2014 18:08
-
-
Save yupadhyay/cbae58c8b066e7c0b02f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.day.crx.statistics.Entry; | |
import com.day.crx.statistics.PathBuilder; | |
/** | |
* Custom Impression Path Builder | |
* @author Yogesh Upadhyay | |
* | |
*/ | |
public class ImpressionsPathBuilder extends PathBuilder { | |
/** The name of the node that contains the statistical data about a page */ | |
public static final String STATS_NAME = ".stats"; | |
/** The path of the page. */ | |
private final String path; | |
/** Default constructor */ | |
public ImpressionsPathBuilder(String path) { | |
super("yyyy/MM/dd"); | |
this.path = path; | |
} | |
/** | |
* Formats the path for a {@link ImpressionsEntry} instance. | |
* | |
* @param entry | |
* a {@link ImpressionsEntry} instance | |
* @param buffer | |
* where to write the path to | |
*/ | |
public void formatPath(Entry entry, StringBuffer buffer) { | |
MicrositesImpressionEntry pv = (MicrositesImpressionEntry) entry; | |
buffer.append(pv.getPathPrefix()); | |
buffer.append(path); | |
buffer.append("/").append(STATS_NAME).append("/"); | |
// add date nodes as specified in constructor pattern | |
super.formatPath(pv, buffer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment