source: trunk/gli/src/org/greenstone/gatherer/msm/MSMAction.java@ 7159

Last change on this file since 7159 was 6770, checked in by kjdon, 20 years ago

fixed all the javadoc errors. (hope I didn't commit anything I wasn't supposed to)

  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37package org.greenstone.gatherer.msm;
38
39/**
40 * Title: The Gatherer<br>
41 * Description: The Gatherer: a tool for gathering and enriching digital collections.<br>
42 * Copyright: Copyright (c) 2001<br>
43 * Company: The University of Waikato<br>
44 * Written: /04/02<br>
45 * @author John Thompson, Greenstone Digital Libraries
46 * @version 2.1
47 */
48import org.greenstone.gatherer.msm.Declarations;
49import org.greenstone.gatherer.msm.MetadataSetManager;
50/** This class provides all the information required to correctly perform metadata actions, with regard to the users previously indicated preferences in terms of importing and renaming. */
51final public class MSMAction {
52 private boolean hfile = false;
53 /** The type of action required in subsequent actions involving the specified set and source element. */
54 private int action = Declarations.NO_ACTION;
55 private String set = null;
56 private String source = null;
57 /** The fully qualified name of the target element (which must be currently in the loaded metadata sets, otherwise the set it belongs to cannot be determined. */
58 private String target = null;
59 /** Constructor. Note that the standard action FORCE_MERGE is only named so for clarity and is translated into its actual action RENAME when this profile is created.
60 * @param action An <i>int</i> representing what action needs to be taken in subsequent access of the given set and source element.
61 * @param target A <strong>String</strong> representing the fully qualified name of the target element.
62 */
63 public MSMAction(int action, String target) {
64 this.target = target;
65 switch(action) {
66 case Declarations.DELETE:
67 this.action = action;
68 break;
69 case Declarations.FORCE_MERGE:
70 this.action = Declarations.RENAME;
71 break;
72 case Declarations.RENAME:
73 this.action = action;
74 break;
75 case Declarations.SKIP:
76 this.action = action;
77 this.target = null;
78 break;
79 default:
80 this.action = Declarations.NO_ACTION;
81 }
82 }
83 /** Constructor. Note that the standard action FORCE_MERGE is only named so for clarity and is translated into its actual action RENAME when this profile is created.
84 * @param action An <i>int</i> representing what action needs to be taken in subsequent access of the given set and source element.
85 * @param target A <strong>String</strong> representing the fully qualified name of the target element.
86 * @param hfile If this action was created from the hfile parsing stage, does the element require a replacement to change its alias value into a real one. Note that this profile item may be created for fully namespaced elements as well, to ensure aliases are always remapped.
87 */
88 public MSMAction(int action, String target, boolean hfile) {
89 this.hfile = hfile;
90 this.target = target;
91 switch(action) {
92 case Declarations.FORCE_MERGE:
93 this.action = Declarations.RENAME;
94 break;
95 case Declarations.RENAME:
96 this.action = action;
97 break;
98 case Declarations.SKIP:
99 this.action = action;
100 this.target = null;
101 break;
102 default:
103 this.action = Declarations.NO_ACTION;
104 }
105 }
106
107 public MSMAction(String set, String source, int action, String target) {
108 this(action, target);
109 this.set = set;
110 this.source = source;
111 }
112
113 /** Method for retrieving the appropriate action from this class.
114 * @return An <i>int</i> specifying a particular action.
115 */
116 public int getAction() {
117 return action;
118 }
119 public String getSet() {
120 return set;
121 }
122 public String getSource() {
123 return source;
124 }
125 /** Method for retrieving the target element of this action.
126 * @return A <strong>String</strong> stating the fully qualified name of the target element, within the namespace of one of the currently loaded metadata sets.
127 */
128 /* private String getTarget() {
129 return target;
130 } */
131 /* private boolean isHFile() {
132 return hfile;
133 } */
134}
Note: See TracBrowser for help on using the repository browser.