add virtual flag in entry
[jSite2.git] / src / net / pterodactylus / jsite / project / AbstractEntry.java
index 74e9076..4f6e6ed 100644 (file)
@@ -25,23 +25,49 @@ import net.pterodactylus.util.beans.AbstractBean;
  * Abstract base implementation of a {@link Entry}.
  * 
  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- * @version $Id$
  */
 public abstract class AbstractEntry extends AbstractBean implements Entry {
 
        /** The name of the “name” property. */
        public static final String PROPERTY_NAME = "name";
 
+       /** The name of the “insert” property. */
+       public static final String PROPERTY_INSERT = "insert";
+
        /** The name of the “content type” property. */
        public static final String PROPERTY_CONTENT_TYPE = "contentType";
 
+       /** Whether this entry is virtual. */
+       private final boolean virtual;
+
        /** The name of the file. */
        private String name;
 
+       /** Whether to insert the file. */
+       private boolean insert;
+
        /** The content type of the file. */
        private String contentType;
 
        /**
+        * Creates a new entry.
+        * 
+        * @param virtual
+        *            <code>true</code> if this entry is virtual,
+        *            <code>false</code> otherwise
+        */
+       protected AbstractEntry(boolean virtual) {
+               this.virtual = virtual;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       public boolean isVirtual() {
+               return virtual;
+       }
+
+       /**
         * {@inheritDoc}
         */
        public String getName() {
@@ -60,6 +86,22 @@ public abstract class AbstractEntry extends AbstractBean implements Entry {
        /**
         * {@inheritDoc}
         */
+       public boolean isInsert() {
+               return insert;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       public void setInsert(boolean insert) {
+               boolean oldInsert = this.insert;
+               this.insert = insert;
+               fireIfPropertyChanged(PROPERTY_INSERT, oldInsert, insert);
+       }
+
+       /**
+        * {@inheritDoc}
+        */
        public String getContentType() {
                return contentType;
        }