gerlowskija commented on code in PR #1080: URL: https://github.com/apache/solr/pull/1080#discussion_r1017074323
########## solr/core/src/java/org/apache/solr/handler/admin/api/RenameCollectionAPI.java: ########## @@ -0,0 +1,82 @@ +/* + * 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.solr.handler.admin.api; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.solr.api.EndPoint; +import org.apache.solr.client.solrj.request.beans.RenameCollectionPayload; +import org.apache.solr.common.params.CollectionAdminParams; +import org.apache.solr.common.params.CollectionParams; +import org.apache.solr.common.util.ContentStream; +import org.apache.solr.handler.admin.CollectionsHandler; +import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.response.SolrQueryResponse; +import org.apache.solr.util.SolrJacksonAnnotationInspector; + +import java.util.Locale; + +import static org.apache.solr.client.solrj.SolrRequest.METHOD.POST; +import static org.apache.solr.common.params.CollectionAdminParams.FOLLOW_ALIASES; +import static org.apache.solr.common.params.CollectionAdminParams.TARGET; +import static org.apache.solr.common.params.CommonAdminParams.ASYNC; +import static org.apache.solr.common.params.CommonParams.ACTION; +import static org.apache.solr.common.params.CommonParams.NAME; +import static org.apache.solr.handler.ClusterAPI.wrapParams; +import static org.apache.solr.security.PermissionNameProvider.Name.COLL_EDIT_PERM; + + +public class RenameCollectionAPI { + + + + private final CollectionsHandler collectionsHandler; + public RenameCollectionAPI(CollectionsHandler collectionsHandler) { + this.collectionsHandler = collectionsHandler; + } + + + private static final ObjectMapper mapper = SolrJacksonAnnotationInspector.createObjectMapper() + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .disable(MapperFeature.AUTO_DETECT_FIELDS); + + @EndPoint( + path = {"/collections/{collection}/commands/rename"}, Review Comment: [0] There was some [discussion on a different v2 API PR](https://github.com/apache/solr/pull/1115#issuecomment-1303995329) about the `/commands` path segment in this path, and the consensus was that we should drop that path segment. I'll update the code here accordingly. ########## build.gradle: ########## @@ -207,5 +207,5 @@ apply from: file('gradle/ant-compat/solr.post-jar.gradle') apply from: file('gradle/node.gradle') -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +//sourceCompatibility = JavaVersion.VERSION_16_PREVIEW Review Comment: [Q] Ooh, interesting. Did you intend to edit these lines @AAnakhe ? A few months back I inadvertently committed changes to these two lines, but to this day I have no memory of editing them. I suspected it came from importing into my IDE or some similar operation but I never was able to figure out what did it. Anyway, just curious if you intended these changes here. And if you didn't, if you had any guesses what might've edited them on your behalf? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
