1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package fulmine.context;
17
18 import fulmine.Domain;
19 import fulmine.Type;
20 import fulmine.event.EventFrameExecution;
21 import fulmine.model.container.IContainer;
22 import fulmine.model.field.IField;
23
24
25
26
27
28
29
30 public class RemoteUpdateHandler implements IRemoteUpdateHandler
31 {
32
33 IFulmineContext context;
34
35
36
37
38 public RemoteUpdateHandler()
39 {
40 super();
41 }
42
43 public String handle(String identity, int type, int domain,
44 String fieldName, String valueAsString, int permissionApp,
45 int permissionCode, String originatingRemoteContextIdentity)
46 {
47 if (domain == Domain.FRAMEWORK.value())
48 {
49 return "Cannot update a framework container: " + identity;
50 }
51 final IContainer container =
52 this.context.getLocalContainer(identity, Type.get(type),
53 Domain.get(domain));
54 final IField field = container.get(fieldName);
55 if (field != null
56 && this.context.getPermissionProfile().matches(
57 (byte) permissionApp, (short) permissionCode,
58 field.getApplication(), field.getPermission()))
59 {
60 container.beginFrame(new EventFrameExecution());
61 try
62 {
63 field.setValueFromString(valueAsString);
64 }
65 finally
66 {
67 container.endFrame();
68 }
69 return "Success";
70 }
71 return "Operation not permissioned for application=" + permissionApp
72 + ", permission=" + permissionCode;
73 }
74
75 public void setContext(IFulmineContext context)
76 {
77 this.context = context;
78 }
79
80 }