View Javadoc

1   /*
2    * Copyright 2004-2006 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.tuigwaa.system;
17  
18  import java.text.ParseException;
19  import java.util.Date;
20  
21  public class BackupDto {
22  
23  	public static final String BACKUPTYPE_FULL = "full";
24  	public static final String BACKUPTYPE_PAGE = "page";
25  	public static final String BACKUPTYPE_DATABASE = "database";
26  	public static final String BACKUPTYPE_NONE = "none";	
27  	
28  	private String type;
29  	private String[] tablenames;
30  	private String backupDate;
31  	
32  	public BackupDto(){		
33  	}
34  	
35  	public String[] getTablenames() {
36  		return tablenames;
37  	}
38  	
39  	public void setTablenames(String[] tablenames) {
40  		this.tablenames = tablenames;
41  	}
42  	
43  	public String getType() {
44  		return type;
45  	}
46  	
47  	public void setType(String type) {
48  		this.type = type;
49  	}
50  
51  	public String getBackupDate() {
52  		return backupDate;
53  	}
54  
55  	public void setBackupDate(String backupDate) {
56  		this.backupDate = backupDate;
57  	}	
58  	
59  	public Date getBackupDateAsDate(){		
60  		Date date = null;
61  		if(backupDate != null){
62  			try {
63  				date = Constants.SIMPLE_DATEFORMAT.parse(backupDate);				
64  			} catch (ParseException pe) {
65  				// do nothing
66  			}
67  		}		
68  		return date;
69  	}
70  	
71  	public boolean isIncludeContents(){
72  		return BACKUPTYPE_PAGE.equals(this.type) || BACKUPTYPE_FULL.equals(this.type);
73  	}
74  	
75  	public boolean isIncludeDatabase(){
76  		return BACKUPTYPE_DATABASE.equals(this.type) || BACKUPTYPE_FULL.equals(this.type);
77  	}	
78  	
79  	public boolean isNone(){
80  		return BACKUPTYPE_NONE.equals(this.type);
81  	}
82  	
83  	
84  }