getPermission3();
savePermission();
}
private void savePermission() throws Exception {
IPermissionInstanceService permissionService = getPermissionInstanceService();
assertNotNull(permissionService);
IPermissionService permService = getPermissionService();
IPermissionMetaInfo perm2 = permService.findPermission("com.jresearchsoft.flexess.examples.orders", "ManageCustomerOrder"); //$NON-NLS-1$ //$NON-NLS-2$
assertNotNull(perm2);
IPermissionInstanceMetaInfo pm = permissionService.getPermissionInstanceImpl();
pm.setPermissionId("regional_permission"); //$NON-NLS-1$
IPermissionParameter param = permissionService.getPermissionParameterImpl();
param.setPermissionInstance(pm);
IAttributeMetaInfo am = perm2.getAttribute("region"); //$NON-NLS-1$
assertNotNull(perm2);
param.setAttributeName(am.getId());
param.setValue("Europe"); //$NON-NLS-1$
pm.addPermissionParameter(param);
List<IRoleInstanceMetaInfo> roleInstances = roleInstanceService.getRoleInstances();
assertFalse(roleInstances.isEmpty());
pm.setRoleInstance(roleInstances.get(0));
pm = permissionService.savePermissionInstance(pm);
id1 = pm.getId();
id2 = ((PermissionParameter) pm.getPermissionParameters().iterator().next()).getId();
assertNotNull(id1);
}