ResourceUtil.java
1.48 KB
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
package com.topdraw.sohu.utils;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.afflatus.utility.DruidUtil;
public class ResourceUtil {
public static void CreateResourceRecycle(String strFileUrl) {
Connection writeConnection = null;
try {
writeConnection = DruidUtil.getRandomWriteConnection();
Map<String, Object> map = new HashMap<String, Object>();
map.put("path", strFileUrl);
map.put("id", UUID.randomUUID().toString());
DruidUtil.beginTransaction(writeConnection);
DruidUtil.save(writeConnection, map, "cm_resource_recycle");
DruidUtil.commitTransaction(writeConnection);
} catch(Exception ex) {
ex.printStackTrace();
} finally {
DruidUtil.close(writeConnection);
writeConnection = null;
}
}
public static String getImageKeyByType(int iType) {
String strType = "normal";
switch (iType) {
case 0:
strType = "thumbnail";
break;
case 1:
strType = "poster";
break;
case 2:
strType = "stills";
break;
case 3:
strType = "icon";
break;
case 4:
strType = "title";
break;
case 5:
strType = "ad";
break;
case 6:
strType = "sketch";
break;
case 7:
strType = "background";
break;
case 9:
strType = "channel";
break;
case 10:
strType = "channel_bw";
break;
case 11:
strType = "channel_logo";
break;
case 12:
strType = "channel_name";
break;
case 99:
strType = "other";
break;
}
return strType;
}
}