Subversion Repositories SmartDukaan

Rev

Rev 323 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 323 Rev 451
Line 5... Line 5...
5
 
5
 
6
import java.util.ArrayList;
6
import java.util.ArrayList;
7
import java.util.HashMap;
7
import java.util.HashMap;
8
import java.util.List;
8
import java.util.List;
9
import java.util.Map;
9
import java.util.Map;
-
 
10
import java.util.StringTokenizer;
10
 
11
 
11
import in.shop2020.metamodel.util.MetaModelComponent;
12
import in.shop2020.metamodel.util.MetaModelComponent;
12
 
13
 
13
/**
14
/**
14
 * Represents un-structured data about Slide, Feature and Bullet. It is used
15
 * Represents un-structured data about Slide, Feature and Bullet. It is used
Line 101... Line 102...
101
		}
102
		}
102
		
103
		
103
		typeRefs.add(mediaRef);
104
		typeRefs.add(mediaRef);
104
	}
105
	}
105
 
106
 
-
 
107
	
-
 
108
	/**
-
 
109
	 * Convenience method to add new image Refs
-
 
110
	 * 
-
 
111
	 * @param imgURL
-
 
112
	 */
-
 
113
	public void removeMedia(String type, String label) {
-
 
114
		if(this.mediaRefs == null) {
-
 
115
			return;
-
 
116
		}
-
 
117
		
-
 
118
		List<String> typeRefs = this.mediaRefs.get(type);
-
 
119
		if(typeRefs == null) {
-
 
120
			return;
-
 
121
		}
-
 
122
		typeRefs.remove(label);
-
 
123
	}
-
 
124
 
106
 
125
 
107
	/**
126
	/**
108
	 * Convenience method to add new image Refs
127
	 * Convenience method to add new image Refs
109
	 * 
128
	 * 
110
	 * @param imgURL
129
	 * @param imgURL
Line 137... Line 156...
137
		}
156
		}
138
		
157
		
139
		return null;
158
		return null;
140
	}
159
	}
141
 
160
 
-
 
161
	/**
-
 
162
	 * @return the imageRefs
-
 
163
	 */
-
 
164
	public List<Map<String, String>> getImageDetails() {
-
 
165
		if(this.mediaRefs != null) {
-
 
166
			List<String> imageDetails = this.mediaRefs.get("image");
-
 
167
			List<Map<String, String>> imageDetailsList = new ArrayList<Map<String,String>>();
-
 
168
			if(imageDetails == null)
-
 
169
				return null;
-
 
170
			
-
 
171
			for(String imageDetail: imageDetails){
-
 
172
				StringTokenizer tokenizer = new StringTokenizer(imageDetail,"~!~");
-
 
173
				String label = tokenizer.nextToken();
-
 
174
				String name = tokenizer.nextToken();
-
 
175
				HashMap<String, String> imageInfoMap = new HashMap<String, String>();
-
 
176
				imageInfoMap.put("label", label);
-
 
177
				imageInfoMap.put("name", name);
-
 
178
				imageDetailsList.add(imageInfoMap);
-
 
179
			}
-
 
180
			return imageDetailsList;
-
 
181
		}
-
 
182
		
-
 
183
		return null;
-
 
184
	}
-
 
185
	
-
 
186
	/**
-
 
187
	 * @return the youtubeURLs
-
 
188
	 */
-
 
189
	public List<Map<String,String>> getVideoDetails() {
-
 
190
		if(this.mediaRefs != null) {
-
 
191
			List<String> videoDetails = this.mediaRefs.get("youtube");
-
 
192
			if(videoDetails == null)
-
 
193
				return null;
-
 
194
			List<Map<String, String>> videoDetailsList = new ArrayList<Map<String,String>>();
-
 
195
			
-
 
196
			for(String videoDetail: videoDetails){
-
 
197
				StringTokenizer tokenizer = new StringTokenizer(videoDetail,"~!~");
-
 
198
				String label = tokenizer.nextToken();
-
 
199
				String url = tokenizer.nextToken();
-
 
200
				StringTokenizer urlTokenizer = new StringTokenizer(url,"=");
-
 
201
				urlTokenizer.nextToken();
-
 
202
				String videoId = urlTokenizer.nextToken();
-
 
203
				HashMap<String, String> videoInfoMap = new HashMap<String, String>();
-
 
204
				videoInfoMap.put("label", label);
-
 
205
				videoInfoMap.put("videoid", videoId);
-
 
206
				videoDetailsList.add(videoInfoMap);
-
 
207
			}
-
 
208
			return videoDetailsList;
-
 
209
	
-
 
210
		}
-
 
211
		
-
 
212
		return null;
-
 
213
	}
-
 
214
 
142
	/* (non-Javadoc)
215
	/* (non-Javadoc)
143
	 * @see java.lang.Object#toString()
216
	 * @see java.lang.Object#toString()
144
	 */
217
	 */
145
	@Override
218
	@Override
146
	public String toString() {
219
	public String toString() {