// Path: sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/manager/projectfeatures/SQSInfoImpl.java
// public class SQSInfoImpl extends BaseSQSInfo {
//     public SQSInfoImpl(@Nullable final Map<String, String> properties) {
//         super(properties);
//     }
// 
//     public SQSInfoImpl(@NotNull final SProjectFeatureDescriptor fd) {
//         super(projectFeatureToMap(fd));
//     }
// 
//     public SQSInfoImpl(@NotNull String id,
//                        @Nullable String name,
//                        @Nullable String url,
//                        @NotNull String useToken,
//                        @Nullable String token,
//                        @Nullable String login,
//                        @Nullable String password,
//                        @Nullable String jdbcUrl,
//                        @Nullable String jdbcUsername,
//                        @Nullable String jdbcPassword) {
//         super(id, name, url, useToken, token, login, password, jdbcUrl, jdbcUsername, jdbcPassword);
//     }
// 
//     public SQSInfoImpl(@NotNull String id) {
//         super(id);
//     }
// 
//     private static Map<String, String> projectFeatureToMap(@NotNull final SProjectFeatureDescriptor projectFeatureDescriptor) {
//         final Map<String, String> res = new HashMap<>(projectFeatureDescriptor.getParameters());
//         for (String f : ENCRYPTED_FIELDS) {
//             final String val = res.get(f);
//             if (!StringUtil.isEmpty(val)) {
//                 res.put(f, EncryptUtil.unscramble(val));
//             }
//         }
//         return res;
//     }
// }


import jetbrains.buildserver.sonarplugin.manager.projectfeatures.SQSInfoImpl;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
/*
 * Copyright 2000-2022 JetBrains s.r.o.
 *
 * Licensed 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 jetbrains.buildserver.sonarplugin.manager;



/**
 * Created by linfar on 04.10.16.
 */
public class SQSInfoFactory {
    public SQSInfo create(@Nullable final String id,
                          @Nullable final String name,
                          @Nullable final String useTokenString,
                          @Nullable final String token,
                          @Nullable final String url,
                          @Nullable final String login,
                          @Nullable final String password,
                          @Nullable final String jdbcUrl,
                          @Nullable final String jdbcUsername,
                          @Nullable final String jdbcPassword) {
        boolean useToken = useTokenString != null ? Boolean.parseBoolean(useTokenString) : token != null;
// Path: sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/manager/projectfeatures/SQSInfoImpl.java
// public class SQSInfoImpl extends BaseSQSInfo {
//     public SQSInfoImpl(@Nullable final Map<String, String> properties) {
//         super(properties);
//     }
// 
//     public SQSInfoImpl(@NotNull final SProjectFeatureDescriptor fd) {
//         super(projectFeatureToMap(fd));
//     }
// 
//     public SQSInfoImpl(@NotNull String id,
//                        @Nullable String name,
//                        @Nullable String url,
//                        @NotNull String useToken,
//                        @Nullable String token,
//                        @Nullable String login,
//                        @Nullable String password,
//                        @Nullable String jdbcUrl,
//                        @Nullable String jdbcUsername,
//                        @Nullable String jdbcPassword) {
//         super(id, name, url, useToken, token, login, password, jdbcUrl, jdbcUsername, jdbcPassword);
//     }
// 
//     public SQSInfoImpl(@NotNull String id) {
//         super(id);
//     }
// 
//     private static Map<String, String> projectFeatureToMap(@NotNull final SProjectFeatureDescriptor projectFeatureDescriptor) {
//         final Map<String, String> res = new HashMap<>(projectFeatureDescriptor.getParameters());
//         for (String f : ENCRYPTED_FIELDS) {
//             final String val = res.get(f);
//             if (!StringUtil.isEmpty(val)) {
//                 res.put(f, EncryptUtil.unscramble(val));
//             }
//         }
//         return res;
//     }
// }


// Path: sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/manager/SQSInfoFactory.java
import jetbrains.buildserver.sonarplugin.manager.projectfeatures.SQSInfoImpl;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;

/*
 * Copyright 2000-2022 JetBrains s.r.o.
 *
 * Licensed 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 jetbrains.buildserver.sonarplugin.manager;



/**
 * Created by linfar on 04.10.16.
 */
public class SQSInfoFactory {
    public SQSInfo create(@Nullable final String id,
                          @Nullable final String name,
                          @Nullable final String useTokenString,
                          @Nullable final String token,
                          @Nullable final String url,
                          @Nullable final String login,
                          @Nullable final String password,
                          @Nullable final String jdbcUrl,
                          @Nullable final String jdbcUsername,
                          @Nullable final String jdbcPassword) {
        boolean useToken = useTokenString != null ? Boolean.parseBoolean(useTokenString) : token != null;
        return new SQSInfoImpl(id == null ? UUID.randomUUID().toString() : id, name, url, Boolean.toString(useToken), token, login, password, jdbcUrl, jdbcUsername, jdbcPassword);