Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8c8481b1f8ee9afe7bbcaadae0a8192713814f11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*******************************************************************************
 * Copyright (c) 2006 Oracle Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:  Oracle
 *******************************************************************************/
package org.eclipse.jst.jsf.core.internal.jsflibraryconfig;

import org.eclipse.emf.common.util.EList;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;

/**
 * Attach additonal attributes such as selection and deployment 
 * to a JSF library when it is referenced by a project.  
 * 
 * @author Justin Chen - Oracle
 * @deprecated
 */
public class JSFLibraryInternalReference {
	final private JSFLibrary jsfLib;
	private boolean check4Deploy;			// Initialized from default in workspace
	private boolean selected; 				// selected for project
	
	/**
	 * Constructor
	 * @param jsfLib JSFLibrary  instance embedded inside.
	 * @param selected boolean  true if selected, otherwise, not selected.
	 * @param deploy boolean  true if needs to be deployed, otherwise, won't be deployed.
	 */
	public JSFLibraryInternalReference(JSFLibrary jsfLib, boolean selected, boolean deploy) {
		this.jsfLib = jsfLib;
		this.selected = selected;
		this.check4Deploy = deploy;		
	}
	
	/**
	 * Return the embedded JSFLibrary instance.
	 *  
	 * @return jsfLib JSFLibrary
	 */	 
	public JSFLibrary getLibrary() {
		return jsfLib;
	}

	/**
	 * Set the to be deployed flag.
	 * 
	 * @param deploy boolean
	 */
	public void setToBeDeployed(final boolean deploy) {
		check4Deploy = deploy;
	}	
	
	/**
	 * Return true if the JSF library needs to be deployed.
	 * Otheriwse, return false.
	 * 
	 * @return boolean
	 */
	public boolean isCheckedToBeDeployed() {
		return check4Deploy;
	}

	/**
	 * Set the selected attribute to a JSFLibraryLibraryReference object.
	 * 
	 * @param selected boolean
	 */
	public void setSelected(final boolean selected) {
		this.selected = selected;
	}
	
	/**
	 * Return true if the JSF library is referenced by a project.  
	 * Otherwise, return false.
	 * 
	 * @return selected boolean
	 */
	public boolean isSelected() {
		return selected;
	}	
	
	/**
	 * To generate a string that represents the JSFLibraryLibraryReference 
	 * object for persistence. 
	 * 
	 * @return String
	 */
	protected String generatePersistString() {
		return (getID() + JSFLibraryConfigDialogSettingData.SPTR_TUPLE + 
				String.valueOf(isSelected()) + JSFLibraryConfigDialogSettingData.SPTR_TUPLE + 
				String.valueOf(isCheckedToBeDeployed())); 
	}

	/**
	 * Helper method to return the library ID from the embedded 
	 * JSFLibrary instance. 
	 * 
	 * @return id String
	 */
	public String getID() {
		return jsfLib.getID();
	}

	/**
	 * Helper method to return the library name from the embedded 
	 * JSFLibrary instance. 
	 * 
	 * @return name String
	 */
	public String getName() {
		return jsfLib.getName();
	}

	/**
	 * Helper method to return the label for the library from the embedded 
	 * JSFLibrary instance. 
	 * 
	 * @return name String
	 */
	public String getLabel() {
		return jsfLib.getLabel();
	}
	
	/**
	 * Return true if the embedded JSF library instance i implementation. 
	 * Otherwise, return false.
	 * 
	 * @return boolean
	 */
	public boolean isImplementation() {
		return jsfLib.isImplementation();
	}

	/**
	 *  Help method to return a list of Archive files from 
	 *  the embedded JSFLibrary instance.
	 * 
	 * @return boolean
	 */	
	public EList getArchiveFiles() {
		return jsfLib.getArchiveFiles();
	}
	
}

Back to the top