use of com.servoy.j2db.persistence.ScriptNameValidator in project servoy-client by Servoy.
the class JSCalculation method setCode.
@JSSetter
public void setCode(String code) {
checkModification();
String name = JSMethod.parseName(code);
if (!name.equals(scriptCalculation.getName())) {
try {
scriptCalculation.updateName(new ScriptNameValidator(application.getFlattenedSolution()), name);
} catch (RepositoryException e) {
// $NON-NLS-1$ //$NON-NLS-2$
throw new RuntimeException("Error updating the name from " + scriptCalculation.getName() + " to " + name, e);
}
}
scriptCalculation.setDeclaration(code);
try {
TableScope tableScope = (TableScope) application.getScriptEngine().getTableScope(scriptCalculation.getTable());
if (tableScope != null) {
tableScope.put(scriptCalculation, scriptCalculation);
String dataSource = scriptCalculation.getTable().getDataSource();
FoundSetManager fsm = (FoundSetManager) application.getFoundSetManager();
fsm.flushSQLSheet(dataSource);
fsm.getRowManager(dataSource).clearCalcs(null, Arrays.asList(scriptCalculation.getName()));
}
} catch (ServoyException e) {
Debug.error(e);
}
}
use of com.servoy.j2db.persistence.ScriptNameValidator in project servoy-client by Servoy.
the class JSVariable method setName.
@JSSetter
public void setName(String name) {
checkModification();
if (!name.equals(variable.getName())) {
try {
variable.updateName(new ScriptNameValidator(application.getFlattenedSolution()), name);
refreshVariableInScope();
} catch (RepositoryException e) {
// $NON-NLS-1$ //$NON-NLS-2$
throw new RuntimeException("Error updating the name from " + variable.getName() + " to " + name, e);
}
}
}
Aggregations