You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2023/01/09 13:17:13 UTC

[GitHub] [sling-org-apache-sling-repoinit-parser] kwin commented on a diff in pull request #27: SLING-11736 Add "ensure nodes" as replacement of "create path" with

kwin commented on code in PR #27:
URL: https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/27#discussion_r1064629244


##########
src/main/java/org/apache/sling/repoinit/parser/operations/EnsureNodes.java:
##########
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sling.repoinit.parser.operations;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Formatter;
+import java.util.List;
+
+import org.jetbrains.annotations.NotNull;
+import org.osgi.annotation.versioning.ProviderType;
+
+@ProviderType
+public class EnsureNodes extends Operation {
+    private List<PathSegmentDefinition> pathDef;
+    private final String defaultPrimaryType;
+    private List<PropertyLine> lines = Collections.emptyList();
+
+    public EnsureNodes(String defaultPrimaryType) {
+        this.pathDef = new ArrayList<>();
+        this.defaultPrimaryType = defaultPrimaryType;
+    }
+    
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + " " + pathDef;
+    }
+    
+    @Override
+    protected String getParametersDescription() {
+        return pathDef.toString();
+    }
+
+    @NotNull
+    @Override
+    public String asRepoInitString() {

Review Comment:
   I don't think it is worth it, as I don't expect any changes to be done on the deprecated classes.
   I would rather keep the code as is and remove with the next major version.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org