// ignore
}
public Resource checkMessage(WonderlandClientID clientID, Message message) {
CellResourceManager crm = AppContext.getManager(CellResourceManager.class);
Resource out = null;
// for each cell being modified, check that the caller has
// permissions to modify the children of the parent cell
CellEditMessage editMessage = (CellEditMessage) message;
switch (editMessage.getEditType()) {
case CREATE_CELL:
CellCreateMessage ccm = (CellCreateMessage) editMessage;
if (ccm.getParentCellID() != null) {
out = crm.getCellResource(ccm.getParentCellID());
}
break;
case DELETE_CELL:
{
// delete requires permission from both the cell being
// deleted and the parent cell
CellDeleteMessage cdm = (CellDeleteMessage) editMessage;
CellMO deleteMO = CellManagerMO.getCell(cdm.getCellID());
if (deleteMO == null ||
deleteMO.getCellID().equals(CellID.getEnvironmentCellID()))
{
break;
}
Resource child = crm.getCellResource(cdm.getCellID());
Resource parent = null;
// get the cell's parent, if any
CellMO parentMO = deleteMO.getParent();
if (parentMO != null) {
parent = crm.getCellResource(parentMO.getCellID());
}
// now create a delete resource with child & parent
if (child != null || parent != null) {
out = new DeleteCellResource(cdm.getCellID().toString(),
child, parent);
}
}
break;
case DUPLICATE_CELL:
CellDuplicateMessage cnm = (CellDuplicateMessage) editMessage;
CellMO dupMO = CellManagerMO.getCell(cnm.getCellID());
if (dupMO != null && dupMO.getParent() != null) {
out = crm.getCellResource(dupMO.getParent().getCellID());
}
break;
case REPARENT_CELL:
{
CellReparentMessage msg = (CellReparentMessage) editMessage;
CellMO childMO = CellManagerMO.getCell(msg.getCellID());
if (childMO==null)
break;
Resource child = crm.getCellResource(msg.getCellID());
Resource oldParent = null;
Resource newParent = null;
CellMO oldParentMO = childMO.getParent();
if (oldParentMO!=null)
oldParent = crm.getCellResource(oldParentMO.getCellID());