@Override public OAlterClusterStatement copy() { OAlterClusterStatement result = new OAlterClusterStatement(-1); result.name = name == null ? null : name.copy(); result.attributeName = attributeName == null ? null : attributeName.copy(); result.starred = starred; result.attributeValue = attributeValue == null ? null : attributeValue.copy(); return result; }
final public OAlterClusterStatement AlterClusterStatement() throws ParseException { OAlterClusterStatement jjtn000 = new OAlterClusterStatement(JJTALTERCLUSTERSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(ALTER); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0));
@Override public OResultSet executeDDL(OCommandContext ctx) { OInternalResultSet result = new OInternalResultSet(); List<com.orientechnologies.orient.core.storage.OCluster> clustersToUpdate = getClusters(ctx); Object finalValue = attributeValue.execute((OIdentifiable) null, ctx); com.orientechnologies.orient.core.storage.OCluster.ATTRIBUTES attribute; try { attribute = OCluster.ATTRIBUTES.valueOf(attributeName.getStringValue()); } catch (IllegalArgumentException e) { throw OException.wrapException(new OCommandExecutionException( "Unknown class attribute '" + attributeName + "'. Supported attributes are: " + Arrays .toString(OCluster.ATTRIBUTES.values())), e); } for (com.orientechnologies.orient.core.storage.OCluster cluster : clustersToUpdate) { if (attributeName.getStringValue().equalsIgnoreCase("status") || attributeName.getStringValue().equalsIgnoreCase("name")) // REMOVE CACHE OF COMMAND RESULTS IF ACTIVE getDatabase().getMetadata().getCommandCache().invalidateResultsOfCluster(cluster.getName()); try { cluster.set(attribute, finalValue); } catch (IOException e) { OException.wrapException(new OCommandExecutionException("Cannot execute alter cluster"), e); } OResultInternal resultItem = new OResultInternal(); resultItem.setProperty("cluster", cluster.getName()); result.add(resultItem); } return result; }