public QueryResult<VariableSet> addFieldToVariableSet(String studyStr, String variableSetStr, Variable variable, String sessionId)
throws CatalogException {
if (StringUtils.isEmpty(variable.getId())) {
if (StringUtils.isEmpty(variable.getName())) {
throw new CatalogException("Missing variable id");
}
variable.setId(variable.getName());
}
MyResourceId resource = getVariableSetId(variableSetStr, studyStr, sessionId);
String userId = resource.getUser();
authorizationManager.checkCanCreateUpdateDeleteVariableSets(resource.getStudyId(), userId);
QueryResult<VariableSet> queryResult = studyDBAdaptor.addFieldToVariableSet(resource.getResourceId(), variable, userId);
auditManager.recordDeletion(AuditRecord.Resource.variableSet, resource.getResourceId(), userId, queryResult.first(), null, null);
return queryResult;
}