function GroupCloudController(e){function t(e,t,r){var i={group:e,successFunc:t,failureFunc:r};funcObj.margeComm.sendMsg("delete","group/"+e.groupID,null,n,null,null,i)}function n(t,n,r){var i=r.group,s=r.successFunc,o=r.failureFunc;if(n.status===200){var u=e.removeGroup({groupID:i.groupID,originType:"cloud"});u.length>0?s&&s():o&&o()}else o&&o()}function r(t){var n=[];fastEach($(t).find("group"),function(t){var r=$(t),i={groupID:r.attr("id"),groupName:r.children("name").text(),groupMaster:r.children("masterDeviceId").text(),roles:{}};n.push(i.groupID),fastEach(r.find("groupRole"),function(e){var t=$(e),n=t.children("role").text(),r=t.children("deviceId").text();i.roles[n]=r}),e.updateGroup({groupID:i.groupID,groupName:i.groupName,groupMaster:i.groupMaster,roles:i.roles,originType:"cloud"})});var r=e.getGroups();for(var i in r)n.indexOf(r[i].groupID)<0&&e.removeGroup({groupID:r[i].groupID,originType:"cloud"})}function i(e,t){var n=null;t||(n={"If-None-Match":e}),funcObj.margeComm.sendMsg("get","groups",null,r,null,n)}this.fetchCloudGroups=i,this.removeCloudGroup=t};