@SuppressWarnings("unchecked")
Class<T> resourceSubclass = (Class<T>) Class.forName(
getPage().getPageParameters().get(PARAM_RESOURCE_TYPE).toString());
StringValue sContractId = getPage().getPageParameters().get(PARAM_CONTRACT_ID);
T editingResource = resourcesFactory.createResource(resourceSubclass,
authorizedUserService.getCurrentUserId(), sContractId.toInteger());
resourceModel.setObject(editingResource);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Cannot create new resource instance", e);
}
}