@Override public Void visit(CreateFeedPolicyStatement cfps, Integer step) throws CompilationException { out.print(skip(step) + CREATE + "ingestion policy "); out.print(cfps.getPolicyName()); out.print(generateIfNotExists(cfps.getIfNotExists())); out.print(" from "); String srcPolicyName = revertStringToQuoted(cfps.getSourcePolicyName()); if (srcPolicyName != null) { out.print(" policy "); out.print(srcPolicyName + " "); printConfiguration(cfps.getProperties()); } else { out.print(" path "); out.print(cfps.getSourcePolicyFile() + " "); printConfiguration(cfps.getProperties()); } String desc = cfps.getDescription(); if (cfps.getDescription() != null) { out.print(" definition "); out.print(revertStringToQuoted(desc)); } out.println(SEMICOLON); out.println(); return null; }
boolean extendingExisting = cfps.getSourcePolicyName() != null; String description = cfps.getDescription() == null ? "" : cfps.getDescription(); if (extendingExisting) { FeedPolicyEntity sourceFeedPolicy = MetadataManager.INSTANCE .getFeedPolicy(metadataProvider.getMetadataTxnContext(), dataverse, cfps.getSourcePolicyName()); if (sourceFeedPolicy == null) { sourceFeedPolicy = MetadataManager.INSTANCE.getFeedPolicy(metadataProvider.getMetadataTxnContext(), MetadataConstants.METADATA_DATAVERSE_NAME, cfps.getSourcePolicyName()); if (sourceFeedPolicy == null) { throw new CompilationException(ErrorCode.COMPILATION_ERROR, sourceLoc, "Unknown policy " + cfps.getSourcePolicyName());