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

Last change on this file since 6158 was 5785, checked in by mdewsnip, 21 years ago

Commented out about 60 unused functions.

  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 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 * @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.
63 */
64 public MSMAction(int action, String target) {
65 this.target = target;
66 switch(action) {
67 case Declarations.DELETE:
68 this.action = action;
69 break;
70 case Declarations.FORCE_MERGE:
71 this.action = Declarations.RENAME;
72 break;
73 case Declarations.RENAME:
74 this.action = action;
75 break;
76 case Declarations.SKIP:
77 this.action = action;
78 this.target = null;
79 break;
80 default:
81 this.action = Declarations.NO_ACTION;
82 }
83 }
84 /** 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.
85 * @param action An <i>int</i> representing what action needs to be taken in subsequent access of the given set and source element.
86 * @param target A <strong>String</strong> representing the fully qualified name of the target element.
87 * @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.
88 */
89 public MSMAction(int action, String target, boolean hfile) {
90 this.hfile = hfile;
91 this.target = target;
92 switch(action) {
93 case Declarations.FORCE_MERGE:
94 this.action = Declarations.RENAME;
95 break;
96 case Declarations.RENAME:
97 this.action = action;
98 break;
99 case Declarations.SKIP:
100 this.action = action;
101 this.target = null;
102 break;
103 default:
104 this.action = Declarations.NO_ACTION;
105 }
106 }
107
108 public MSMAction(String set, String source, int action, String target) {
109 this(action, target);
110 this.set = set;
111 this.source = source;
112 }
113
114 /** Method for retrieving the appropriate action from this class.
115 * @return An <i>int</i> specifying a particular action.
116 */
117 public int getAction() {
118 return action;
119 }
120 public String getSet() {
121 return set;
122 }
123 public String getSource() {
124 return source;
125 }
126 /** Method for retrieving the target element of this action.
127 * @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.
128 */
129 /* private String getTarget() {
130 return target;
131 } */
132 /* private boolean isHFile() {
133 return hfile;
134 } */
135}
Note: See TracBrowser for help on using the repository browser.