perm = service.getPermissions(res); } } else { name = "..."; perm = new Permission("", ""); } ResourcePropertyDialog dialog = new ResourcePropertyDialog(this, service, name, perm, created, modified, mimeType); dialog.setVisible(true); if (dialog.getResult() == ResourcePropertyDialog.APPLY_OPTION) { int rows[] = fileman.getSelectedRows(); for (int i = 0; i < rows.length; i++) { Object obj = (Object) resources.getValueAt(rows[i], 3); if (obj instanceof InteractiveClient.CollectionName) { Collection coll = collection.getChildCollection(obj .toString()); service.setPermissions(coll, dialog.permissions); } else { Resource res = collection.getResource((String) obj); service.setPermissions(res, dialog.permissions); } } client.reloadCollection(); } } catch (XMLDBException e) { showErrorMessage("XMLDB Exception: " + e.getMessage(), e); e.printStackTrace(); } }
perm = service.getPermissions(res); } } else { name = "..."; perm = new Permission("", ""); } ResourcePropertyDialog dialog = new ResourcePropertyDialog(this, service, name, perm, created, modified, mimeType); dialog.setVisible(true); if (dialog.getResult() == ResourcePropertyDialog.APPLY_OPTION) { int rows[] = fileman.getSelectedRows(); for (int i = 0; i < rows.length; i++) { ResourceDescriptor desc = resources.getRow(rows[i]); if (desc.isCollection()) { Collection coll = collection.getChildCollection(desc .getName()); service.setPermissions(coll, dialog.permissions); } else { Resource res = collection.getResource(desc.getName()); service.setPermissions(res, dialog.permissions); } } client.reloadCollection(); } } catch (XMLDBException e) { showErrorMessage("XMLDB Exception: " + e.getMessage(), e); e.printStackTrace(); } }
	private void setPermAction(ActionEvent ev) {		if (fileman.getSelectedRowCount() == 0)			return;		try {			Collection collection = client.getCollection();			UserManagementService service = (UserManagementService) collection					.getService("UserManagementService", "1.0");			Permission perm = null;			String name;			Date created = new Date();			Date modified = null;            String mimeType = null;			if (fileman.getSelectedRowCount() == 1) {				int row = fileman.getSelectedRow();				Object obj = (Object) resources.getValueAt(row, 3);				if (obj instanceof InteractiveClient.CollectionName) {					name = obj.toString();					Collection coll = collection.getChildCollection(name);					created = ((CollectionImpl) coll).getCreationTime();					perm = service.getPermissions(coll);				} else {					name = (String) obj;					Resource res = collection.getResource(name);					created = ((EXistResource) res).getCreationTime();					modified = ((EXistResource) res).getLastModificationTime();                    mimeType = ((EXistResource) res).getMimeType();					perm = service.getPermissions(res);				}			} else {				name = "...";				perm = new Permission("", "");			}			ResourcePropertyDialog dialog = new ResourcePropertyDialog(this,					service, name, perm, created, modified, mimeType);			dialog.setVisible(true);			if (dialog.getResult() == ResourcePropertyDialog.APPLY_OPTION) {				int rows[] = fileman.getSelectedRows();				for (int i = 0; i < rows.length; i++) {					Object obj = (Object) resources.getValueAt(rows[i], 3);					if (obj instanceof InteractiveClient.CollectionName) {						Collection coll = collection.getChildCollection(obj								.toString());						service.setPermissions(coll, dialog.permissions);					} else {						Resource res = collection.getResource((String) obj);						service.setPermissions(res, dialog.permissions);					}				}				client.reloadCollection();			}		} catch (XMLDBException e) {			showErrorMessage("XMLDB Exception: " + e.getMessage(), e);			e.printStackTrace();		}	}