<commit_before>package placebooks.model;

import java.net.URL;
import java.net.MalformedURLException;
import java.util.*;

import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.Inheritance;
import javax.jdo.annotations.InheritanceStrategy;
import javax.jdo.annotations.Discriminator;
import javax.jdo.annotations.DiscriminatorStrategy;

import org.apache.log4j.*;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import com.vividsolutions.jts.geom.Geometry;

/**
 * A PlacebookItem represents an item that appears in a Placebook, e.g. photo, map, bit 
 * of text or web url.  This is an Abstract class that defines the general funcitonality
 *  of PlacebookItems.  Decendant classes will be created that implement the specific 
 *  functionality for each content type (image, map, url, etc).
 *  
 * PlacebookItems consist of the 'PlacebookItemID' field (a unique ID) and a number of 
 * ItemParameters that are used to store the individual bits of data for an item (for 
 * example, if it's a text item, the text; if it's an external web page, it's URL).  
 * These will be accessed by the GetParameter and SetParameter methods, etc.
 * Every PlacebookItem _must_ have the two parameters "Name" and "Type".  
 *
 * Name is the user specified title of the Item in their Placebook (e.g. 'A photo of
 *  the sea') which will be plain text (n.b. should be parsed for HTML/bad things 
 *  by database and view methods).
 *  For packaging purposes the method 'GetData' is defined that will return the 
 *  PlacebookItem and it's associated ItemParameters in the format suitable for 
 *  packaging. 
 *  @TODO with MarkD; define/document this format)
 * 
 *  The methods 'RenderBodyHTML' and 'CreateCache' are both abstract methods, to be 
 *  implemented by the 'real' PlacebookItem classes. 
 *  
 *  'CreateCache' will generate a stream containing the data required for the 
 *  cached version of this page suitable for inclusion in a downloadable package 
 *  version of the Placebook. (@TODO with MarkD; define/document this format)
 */
@PersistenceCapable
@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME)
@Extension(vendorName="datanucleus", key="mysql-engine-type", value="MyISAM")
public abstract class PlaceBookItem 
{
	private static final Logger log = 
		Logger.getLogger(PlaceBookItem.class.getName());

	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.UUIDHEX)
	private String key;

	@Persistent
	private String pbKey; // PlaceBook this PlaceBookItem belongs to

	@Persistent
	private int owner;
	
	@Persistent
	private Date timestamp;

	@Persistent
	private Geometry geom;

	@Persistent
	private URL sourceURL; // The original internet resource string if it exists

	// The PlaceBookItem's parameters:
	// 		Layout on GUI
	// 		State data, etc.
	@Persistent<commit_msg>Fixed private logger to protected.<commit_after>package placebooks.model;

import java.net.URL;
import java.net.MalformedURLException;
import java.util.*;

import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.Inheritance;
import javax.jdo.annotations.InheritanceStrategy;
import javax.jdo.annotations.Discriminator;
import javax.jdo.annotations.DiscriminatorStrategy;

import org.apache.log4j.*;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import com.vividsolutions.jts.geom.Geometry;

/**
 * A PlacebookItem represents an item that appears in a Placebook, e.g. photo, map, bit 
 * of text or web url.  This is an Abstract class that defines the general funcitonality
 *  of PlacebookItems.  Decendant classes will be created that implement the specific 
 *  functionality for each content type (image, map, url, etc).
 *  
 * PlacebookItems consist of the 'PlacebookItemID' field (a unique ID) and a number of 
 * ItemParameters that are used to store the individual bits of data for an item (for 
 * example, if it's a text item, the text; if it's an external web page, it's URL).  
 * These will be accessed by the GetParameter and SetParameter methods, etc.
 * Every PlacebookItem _must_ have the two parameters "Name" and "Type".  
 *
 * Name is the user specified title of the Item in their Placebook (e.g. 'A photo of
 *  the sea') which will be plain text (n.b. should be parsed for HTML/bad things 
 *  by database and view methods).
 *  For packaging purposes the method 'GetData' is defined that will return the 
 *  PlacebookItem and it's associated ItemParameters in the format suitable for 
 *  packaging. 
 *  @TODO with MarkD; define/document this format)
 * 
 *  The methods 'RenderBodyHTML' and 'CreateCache' are both abstract methods, to be 
 *  implemented by the 'real' PlacebookItem classes. 
 *  
 *  'CreateCache' will generate a stream containing the data required for the 
 *  cached version of this page suitable for inclusion in a downloadable package 
 *  version of the Placebook. (@TODO with MarkD; define/document this format)
 */
@PersistenceCapable
@Inheritance(strategy=InheritanceStrategy.NEW_TABLE)
@Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME)
@Extension(vendorName="datanucleus", key="mysql-engine-type", value="MyISAM")
public abstract class PlaceBookItem 
{
	protected static final Logger log = 
		Logger.getLogger(PlaceBookItem.class.getName());

	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.UUIDHEX)
	private String key;

	@Persistent
	private String pbKey; // PlaceBook this PlaceBookItem belongs to

	@Persistent
	private int owner;
	
	@Persistent
	private Date timestamp;

	@Persistent
	private Geometry geom;

	@Persistent
	private URL sourceURL; // The original internet resource string if it exists

	// The PlaceBookItem's parameters:
	// 		Layout on GUI
	// 		State data, etc.
	@Persistent
{'fraction_non_alphanumeric': 0.07762408462164361, 'fraction_numerical': 0.0009764035801464605, 'mean_word_length': 4.526978417266187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3432658', 'n_tokens_mistral': 1795, 'n_tokens_neox': 1730, 'n_words': 657}