Subversion Repositories SmartDukaan

Rev

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