Subversion Repositories SmartDukaan

Rev

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

Rev 199 Rev 211
Line 2... Line 2...
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.metamodel.core;
4
package in.shop2020.metamodel.core;
5
 
5
 
6
import java.util.ArrayList;
6
import java.util.ArrayList;
-
 
7
import java.util.HashMap;
7
import java.util.List;
8
import java.util.List;
-
 
9
import java.util.Map;
8
 
10
 
9
import in.shop2020.metamodel.util.MetaModelComponent;
11
import in.shop2020.metamodel.util.MetaModelComponent;
10
 
12
 
11
/**
13
/**
12
 * Represents un-structured data about Slide, Feature and Bullet. It is used
14
 * Represents un-structured data about Slide, Feature and Bullet. It is used
Line 24... Line 26...
24
	private static final long serialVersionUID = 1L;
26
	private static final long serialVersionUID = 1L;
25
	
27
	
26
	// Un-structured text only
28
	// Un-structured text only
27
	private List<String> freeformTexts;
29
	private List<String> freeformTexts;
28
 
30
 
29
	private List<String> imageURLs;
31
	private Map<String, List<String>> mediaRefs;
30
 
32
	
31
	private List<String> youtubeURLs;
-
 
32
 
-
 
33
    /**
33
    /**
34
     * 
34
     * 
35
     */
35
     */
36
    public FreeformContent() {
36
    public FreeformContent() {
37
    }
37
    }
Line 81... Line 81...
81
			return this.freeformTexts.get(0);
81
			return this.freeformTexts.get(0);
82
		}
82
		}
83
		
83
		
84
		return null;
84
		return null;
85
	}
85
	}
86
	
86
 
87
	/**
87
	/**
88
	 * @param imageURLs the imageURLs to set
88
	 * Convenience method to add new image Refs
-
 
89
	 * 
-
 
90
	 * @param imgURL
89
	 */
91
	 */
90
	public void setImageURLs(List<String> imageURLs) {
92
	public void addMedia(String type, String mediaRef) {
91
		this.imageURLs = imageURLs;
93
		if(this.mediaRefs == null) {
-
 
94
			this.mediaRefs = new HashMap<String, List<String>>();
-
 
95
		}
-
 
96
		
-
 
97
		List<String> typeRefs = this.mediaRefs.get(type);
-
 
98
		if(typeRefs == null) {
-
 
99
			typeRefs = new ArrayList<String>();
-
 
100
			this.mediaRefs.put(type, typeRefs);
-
 
101
		}
-
 
102
		
-
 
103
		typeRefs.add(mediaRef);
92
	}
104
	}
93
 
105
 
-
 
106
 
94
	/**
107
	/**
95
	 * Convenience method to add new image URL
108
	 * Convenience method to add new image Refs
96
	 * 
109
	 * 
97
	 * @param imgURL
110
	 * @param imgURL
98
	 */
111
	 */
99
	public void addImageURL(String imgURL) {
112
	public void setMedia(String type, List<String> mediaRefs) {
100
		if(this.imageURLs == null) {
113
		if(this.mediaRefs == null) {
101
			this.imageURLs = new ArrayList<String>();
114
			this.mediaRefs = new HashMap<String, List<String>>();
102
		}
115
		}
103
		
116
		
104
		this.imageURLs.add(imgURL);
117
		this.mediaRefs.put(type, mediaRefs);
105
	}
118
	}
106
	
119
	
107
	/**
120
	/**
108
	 * @return the imageURLs
121
	 * @return the imageRefs
109
	 */
-
 
110
	public List<String> getImageURLs() {
-
 
111
		return imageURLs;
-
 
112
	}
-
 
113
 
-
 
114
	/**
-
 
115
	 * @param youtubeURLs the youtubeURLs to set
-
 
116
	 */
122
	 */
117
	public void setYoutubeURLs(List<String> youtubeURLs) {
123
	public List<String> getImageRefs() {
118
		this.youtubeURLs = youtubeURLs;
-
 
119
	}
-
 
120
 
-
 
121
	public void addYoutubeURL(String ytURL) {
-
 
122
		if(this.youtubeURLs == null) {
124
		if(this.mediaRefs != null) {
123
			this.youtubeURLs = new ArrayList<String>();
125
			return this.mediaRefs.get("image");
124
		}
126
		}
125
		
127
		
126
		this.youtubeURLs.add(ytURL);
128
		return null;
127
	}
129
	}
128
	
130
	
129
	/**
131
	/**
130
	 * @return the youtubeURLs
132
	 * @return the youtubeURLs
131
	 */
133
	 */
132
	public List<String> getYoutubeURLs() {
134
	public List<String> getYoutubeRefs() {
-
 
135
		if(this.mediaRefs != null) {
-
 
136
			return this.mediaRefs.get("youtube");
-
 
137
		}
-
 
138
		
133
		return youtubeURLs;
139
		return null;
134
	}
140
	}
135
 
141
 
136
	/* (non-Javadoc)
142
	/* (non-Javadoc)
137
	 * @see java.lang.Object#toString()
143
	 * @see java.lang.Object#toString()
138
	 */
144
	 */
139
	@Override
145
	@Override
140
	public String toString() {
146
	public String toString() {
141
		return "FreeformContent [freeformTexts=" + freeformTexts
147
		return "FreeformContent [freeformTexts=" + freeformTexts
142
				+ ", imageURLs=" + imageURLs + ", youtubeURLs=" + youtubeURLs
148
				+ ", mediaRefs=" + mediaRefs + "]";
143
				+ "]";
-
 
144
	}
149
	}
145
 
150
 
146
}
151
}