Source:
<code>public String saveFieldVariable(String id, String fieldId, String name, String key, String value) throws DotRuntimeException, PortalException, SystemException, DotDataException, DotSecurityException { WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI(); User user = userWebAPI.getLoggedInUser(req); boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(req); key = key.trim(); value = value.trim(); name = name.trim(); name = UtilMethods.escapeDoubleQuotes(name); value = UtilMethods.escapeDoubleQuotes(value); if (key.equals("")) { return LanguageUtil.get(user, "message.fieldvariables.key.required"); } if (RegEX.contains(key, "[^A-Za-z0-9]")) { return LanguageUtil.get(user, "message.fieldvariables.exist.error.regex"); } FieldAPI fieldAPI = APILocator.getFieldAPI(); List<FieldVariable> variables = fieldAPI.getFieldVariablesForField(fieldId, user, false); FieldVariable fieldVariable = new FieldVariable(); fieldVariable.setId(id); fieldVariable.setFieldId(fieldId); fieldVariable.setName(name); fieldVariable.setKey(key); fieldVariable.setValue(value); fieldVariable.setLastModifierId(user.getUserId()); fieldVariable.setLastModDate(new Date()); try { fieldAPI.saveFieldVariable(fieldVariable, user, respectFrontendRoles); Field field = APILocator.getContentTypeFieldAPI().find(fieldVariable.getFieldId()); <START> ContentTypeAPI tapi = APILocator.getContentTypeAPI(user); <END> ContentType type = tapi.find(field.contentTypeId()); tapi.updateModDate(type); } catch (DotSecurityException e) { return LanguageUtil.get(user, "message.fieldvariables.permission.error.save"); } return null; }</code><technical_language>tapi is a good name, contentTypeAPI a choice</technical_language>

Target:
public String saveFieldVariable(String id, String fieldId, String name, String key, String value) throws DotRuntimeException, PortalException, SystemException, DotDataException, DotSecurityException { WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI(); User user = userWebAPI.getLoggedInUser(req); boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(req); key = key.trim(); value = value.trim(); name = name.trim(); name = UtilMethods.escapeDoubleQuotes(name); value = UtilMethods.escapeDoubleQuotes(value); if (key.equals("")) { return LanguageUtil.get(user, "message.fieldvariables.key.required"); } if (RegEX.contains(key, "[^A-Za-z0-9]")) { return LanguageUtil.get(user, "message.fieldvariables.exist.error.regex"); } FieldAPI fieldAPI = APILocator.getFieldAPI(); List<FieldVariable> variables = fieldAPI.getFieldVariablesForField(fieldId, user, false); FieldVariable fieldVariable = new FieldVariable(); fieldVariable.setId(id); fieldVariable.setFieldId(fieldId); fieldVariable.setName(name); fieldVariable.setKey(key); fieldVariable.setValue(value); fieldVariable.setLastModifierId(user.getUserId()); fieldVariable.setLastModDate(new Date()); try { fieldAPI.saveFieldVariable(fieldVariable, user, respectFrontendRoles); Field field = APILocator.getContentTypeFieldAPI().find(fieldVariable.getFieldId()); ContentTypeAPI contentTypeAPI = APILocator.getContentTypeAPI(user); ContentType type = contentTypeAPI.find(field.contentTypeId()); contentTypeAPI.updateModDate(type); } catch (DotSecurityException e) { return LanguageUtil.get(user, "message.fieldvariables.permission.error.save"); } return null; }