1 /* 2 * Copyright 2001,2004 The Apache Software Foundation. 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, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.apache.commons.scaffold.util; 18 19 20 import java.util.Map; 21 22 23 /** 24 * Simple interface to describe public methods on a 25 * data access object. 26 * 27 * @author Ted Husted 28 * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $ 29 */ 30 public interface Storable { 31 32 33 /** 34 * Commit record to storage. 35 */ 36 public void store() throws Exception; 37 38 39 /** 40 * Retrieve record from storage. 41 */ 42 public void retrieve() throws Exception; 43 44 45 /** 46 * Permenantly delete record. 47 */ 48 public void delete() throws Exception; 49 50 51 /** 52 * Mark entry for deletion. 53 */ 54 public void recycle() throws Exception; 55 56 57 /** 58 * Unmark entry for deletion. 59 */ 60 public void restore() throws Exception; 61 62 63 64 /** 65 * Return this object's primary key. 66 */ 67 public Object getStorageKey(); 68 69 70 /** 71 * Set this object's primary key. 72 */ 73 public void setStorageKey(Object key); 74 75 76 /** 77 * Obtain a new primary key for this object. 78 */ 79 public void allocateKey() throws Exception; 80 81 82 83 /** 84 * Cache the result object of an operation. 85 */ 86 public void setResult(Object result); 87 88 89 /** 90 * Return the result object of an operation. 91 */ 92 public Object getResult(); 93 94 95 /** 96 * Set a result code for an operation. 97 */ 98 public void setResultCode(int resultCode); 99 100 101 /** 102 * Return the result code from an operation. 103 */ 104 public int getResultCode(); 105 106 107 108 /** 109 * Populate this object from a Map. 110 */ 111 public void populate(Map parameters) throws Exception; 112 113 }