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

Last change on this file since 8243 was 8243, checked in by mdewsnip, 20 years ago

Removed all occurrences of classes explicitly importing other classes in the same package.

  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 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/** 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. */
41final public class MSMAction {
42 private boolean hfile = false;
43 /** The type of action required in subsequent actions involving the specified set and source element. */
44 private int action = Declarations.NO_ACTION;
45 private String set = null;
46 private String source = null;
47 /** 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. */
48 private String target = null;
49 /** 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.
50 * @param action An <i>int</i> representing what action needs to be taken in subsequent access of the given set and source element.
51 * @param target A <strong>String</strong> representing the fully qualified name of the target element.
52 */
53 public MSMAction(int action, String target) {
54 this.target = target;
55 switch(action) {
56 case Declarations.DELETE:
57 this.action = action;
58 break;
59 case Declarations.FORCE_MERGE:
60 this.action = Declarations.RENAME;
61 break;
62 case Declarations.RENAME:
63 this.action = action;
64 break;
65 case Declarations.SKIP:
66 this.action = action;
67 this.target = null;
68 break;
69 default:
70 this.action = Declarations.NO_ACTION;
71 }
72 }
73 /** 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.
74 * @param action An <i>int</i> representing what action needs to be taken in subsequent access of the given set and source element.
75 * @param target A <strong>String</strong> representing the fully qualified name of the target element.
76 * @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.
77 */
78 public MSMAction(int action, String target, boolean hfile) {
79 this.hfile = hfile;
80 this.target = target;
81 switch(action) {
82 case Declarations.FORCE_MERGE:
83 this.action = Declarations.RENAME;
84 break;
85 case Declarations.RENAME:
86 this.action = action;
87 break;
88 case Declarations.SKIP:
89 this.action = action;
90 this.target = null;
91 break;
92 default:
93 this.action = Declarations.NO_ACTION;
94 }
95 }
96
97 public MSMAction(String set, String source, int action, String target) {
98 this(action, target);
99 this.set = set;
100 this.source = source;
101 }
102
103 /** Method for retrieving the appropriate action from this class.
104 * @return An <i>int</i> specifying a particular action.
105 */
106 public int getAction() {
107 return action;
108 }
109 public String getSet() {
110 return set;
111 }
112 public String getSource() {
113 return source;
114 }
115 /** Method for retrieving the target element of this action.
116 * @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.
117 */
118 /* private String getTarget() {
119 return target;
120 } */
121 /* private boolean isHFile() {
122 return hfile;
123 } */
124}
Note: See TracBrowser for help on using the repository browser.