Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
479 rajveer 1
/**
2
 * 
3
 */
4
package in.shop2020.metamodel.core;
5
 
6
import in.shop2020.metamodel.util.MetaModelComponent;
7
 
8
import java.io.UnsupportedEncodingException;
9
import java.net.URLEncoder;
500 rajveer 10
import java.util.StringTokenizer;
479 rajveer 11
 
12
/**
13
 * @author naveen
14
 *
15
 */
16
public class Media extends MetaModelComponent {
17
	/**
18
	 * 
19
	 */
20
	private static final long serialVersionUID = 1L;
21
	private String label;
22
	private String title;
23
	private String videoType;
24
	private String type;
25
	private String fileName;
26
	private String contentType;
27
	private String location;
28
 
29
	/**
30
	 * 
31
	 * @param label
32
	 * @param type
33
	 * @param location
34
	 */
35
	public Media(String label, String type, String location) {
36
		this.label = label;
37
		this.type = type;
38
		this.location = location;
39
	}
40
 
41
	/**
42
	 * @param label the label to set
43
	 */
44
	public void setLabel(String label) {
45
		this.label = label;
46
	}
47
	/**
48
	 * @return the label
49
	 */
50
	public String getLabel() {
51
		return label;
52
	}
53
	public void setTitle(String title) {
54
		this.title = title;
55
	}
56
 
57
	public String getTitle() {
58
		return title;
59
	}
60
 
61
	public void setVideoType(String videoType) {
62
		this.videoType = videoType;
63
	}
64
 
65
	public String getVideoType() {
66
		return videoType;
67
	}
68
 
69
	/**
70
	 * @return the label
71
	 */
72
	public String getEncodedLabel() {
73
		try {
74
			return URLEncoder.encode(label, "UTF-8");
75
		} catch (UnsupportedEncodingException e) {
76
			//CreationUtils.getStackTrace(e);
77
			e.printStackTrace();
78
			return "";
79
		}
80
	}
81
	/**
82
	 * @param type the type to set
83
	 */
84
	public void setType(String type) {
85
		this.type = type;
86
	}
87
	/**
88
	 * @return the type
89
	 */
90
	public String getType() {
91
		return type;
92
	}
93
	/**
94
	 * @param location the location to set
95
	 */
96
	public void setLocation(String location) {
97
		this.location = location;
98
	}
99
	/**
100
	 * @return the location
101
	 */
102
	public String getLocation() {
103
		return location;
104
	}
105
 
500 rajveer 106
	public String getYoutubeId(){
107
		StringTokenizer token = new StringTokenizer(location,"?v=");
108
		if(token.countTokens() == 2){
109
			token.nextToken();
110
			return token.nextToken();
111
		}
112
		return "";
113
	}
114
 
479 rajveer 115
	/**
116
	 * @param fileName the fileName to set
117
	 */
118
	public void setFileName(String fileName) {
119
		this.fileName = fileName;
120
	}
121
 
122
	/**
123
	 * @return the fileName
124
	 */
125
	public String getFileName() {
126
		return fileName;
127
	}
128
 
129
	/**
130
	 * @param contentType the contentType to set
131
	 */
132
	public void setContentType(String contentType) {
133
		this.contentType = contentType;
134
	}
135
 
136
	/**
137
	 * @return the contentType
138
	 */
139
	public String getContentType() {
140
		return contentType;
141
	}
142
 
143
	/* (non-Javadoc)
144
	 * @see java.lang.Object#toString()
145
	 */
146
	@Override
147
	public String toString() {
148
		return "Media [label=" + label + ", location=" + location + ", type="
149
				+ type + "]";
150
	}
151
}