2 * jSite - a tool for uploading websites into Freenet
3 * Copyright (C) 2006 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package de.todesbaum.jsite.application;
22 public class FileOption {
24 private static final boolean DEFAULT_INSERT = true;
25 private static final String DEFAULT_CUSTOM_KEY = "CHK@";
26 private static final String DEFAULT_CONTAINER = "";
27 private static final int DEFAULT_EDITION_RANGE = 3;
28 private static final boolean DEFAULT_REPLACE_EDITION = false;
30 private boolean insert;
31 private String customKey;
32 private final String defaultMimeType;
33 private String mimeType;
34 private String container;
35 private int editionRange;
36 private boolean replaceEdition;
38 public FileOption(String defaultMimeType) {
39 insert = DEFAULT_INSERT;
40 customKey = DEFAULT_CUSTOM_KEY;
41 this.defaultMimeType = defaultMimeType;
42 mimeType = defaultMimeType;
43 container = DEFAULT_CONTAINER;
44 editionRange = DEFAULT_EDITION_RANGE;
45 replaceEdition = DEFAULT_REPLACE_EDITION;
49 * @return Returns the customKey.
51 public String getCustomKey() {
57 * The customKey to set.
59 public void setCustomKey(String customKey) {
60 if (customKey == null) {
63 this.customKey = customKey;
67 * @return Returns the insert.
69 public boolean isInsert() {
77 public void setInsert(boolean insert) {
81 public void setMimeType(String mimeType) {
82 if (mimeType == null) {
83 mimeType = defaultMimeType;
85 this.mimeType = mimeType;
88 public String getMimeType() {
93 * @return Returns the container.
95 public String getContainer() {
101 * The container to set.
103 public void setContainer(String container) {
104 if (container == null) {
105 container = DEFAULT_CONTAINER;
107 this.container = container;
110 public void setReplaceEdition(boolean replaceEdition) {
111 this.replaceEdition = replaceEdition;
114 public boolean getReplaceEdition() {
115 return replaceEdition;
118 public void setEditionRange(int editionRange) {
119 this.editionRange = editionRange;
122 public int getEditionRange() {
126 public boolean isCustom() {
127 if (insert != DEFAULT_INSERT) {
130 if (!customKey.equals(DEFAULT_CUSTOM_KEY)) {
133 if (!defaultMimeType.equals(mimeType)) {
136 if (!DEFAULT_CONTAINER.equals(container)) {
139 if (replaceEdition != DEFAULT_REPLACE_EDITION) {
142 if (editionRange != DEFAULT_EDITION_RANGE) {