public OStatement copy() { OAlterClassStatement result = new OAlterClassStatement(-1); result.name = name == null ? null : name.copy(); result.property = property; result.identifierValue = identifierValue == null ? null : identifierValue.copy(); result.identifierListValue = identifierListValue == null ? null : identifierListValue.stream().map(x -> x.copy()).collect(Collectors.toList()); result.add = add; result.remove = remove; result.numberValue = numberValue == null ? null : numberValue.copy(); result.booleanValue = booleanValue; result.customKey = customKey == null ? null : customKey.copy(); result.customValue = customValue == null ? null : customValue.copy(); result.customString = customString; result.defaultClusterId = defaultClusterId == null ? null : defaultClusterId.copy(); result.defaultClusterName = defaultClusterName == null ? null : defaultClusterName.copy(); result.unsafe = unsafe; return result; }
private void doSetSuperclass(OCommandContext ctx, OClass oClass, OIdentifier superclassName) { if (superclassName == null) { throw new OCommandExecutionException("Invalid superclass name: " + toString()); } OClass superclass = ctx.getDatabase().getMetadata().getSchema().getClass(superclassName.getStringValue()); if (superclass == null) { throw new OCommandExecutionException("superclass not found: " + toString()); } if (Boolean.TRUE.equals(add)) { oClass.addSuperClass(superclass); } else if (Boolean.TRUE.equals(remove)) { oClass.removeSuperClass(superclass); } else { oClass.setSuperClasses(Collections.singletonList(superclass)); } }
case NAME: if (!unsafe) { checkNotEdge(oClass); checkNotIndexed(oClass); OException x = OException.wrapException(new OCommandExecutionException("Invalid class name: " + toString()), e); throw x; oClass.setShortName(identifierValue.getStringValue()); } catch (Exception e) { OException x = OException.wrapException(new OCommandExecutionException("Invalid class name: " + toString()), e); throw x; throw new OCommandExecutionException("Invalid class name: " + toString()); oClass.addClusterId(numberValue.getValue().intValue()); } else { throw new OCommandExecutionException("Invalid cluster value: " + toString()); clusterId = ctx.getDatabase().getClusterIdByName(identifierValue.getStringValue()); if (clusterId < 0) { throw new OCommandExecutionException("Cluster not found: " + toString()); throw new OCommandExecutionException("Invalid cluster value: " + toString()); oClass.setDescription(identifierValue.getStringValue()); } else { throw new OCommandExecutionException("Invalid class name: " + toString());
final public OAlterClassStatement AlterClassStatement() throws ParseException { OAlterClassStatement jjtn000 = new OAlterClassStatement(JJTALTERCLASSSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));OIdentifier lastIdentifier; OInteger lastInteger; Token lastToken; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0));
private void doSetSuperclasses(OCommandContext ctx, OClass oClass, List<OIdentifier> superclassNames) { if (superclassNames == null) { throw new OCommandExecutionException("Invalid superclass name: " + toString()); } List<OClass> superclasses = new ArrayList<>(); for (OIdentifier superclassName : superclassNames) { OClass superclass = ctx.getDatabase().getMetadata().getSchema().getClass(superclassName.getStringValue()); if (superclass == null) { throw new OCommandExecutionException("superclass not found: " + toString()); } superclasses.add(superclass); } if (Boolean.TRUE.equals(add)) { for (OClass superclass : superclasses) { oClass.addSuperClass(superclass); } } else if (Boolean.TRUE.equals(remove)) { for (OClass superclass : superclasses) { oClass.removeSuperClass(superclass); } } else { oClass.setSuperClasses(superclasses); } } }