// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/connector/beans/FolderBean.java
// public class FolderBean implements VmwareManagedEntity, Comparable<FolderBean> {
//   private final String myPath;
//   private final String[] myChildType;
//   private final String myName;
//   private final ManagedObjectReference myMOR;
//   private final ManagedObjectReference myParentRef;
//   private final String myDatacenterId;
// 
//   @Used("Tests")
//   public FolderBean(final Folder folder){
//     this(folder.getMOR(), folder.getName(), null, folder.getChildType(), folder.getParent().getMOR(), "dc");
//   }
// 
//   public FolderBean(@NotNull final ManagedObjectReference mor,
//                     @NotNull final String name,
//                     @NotNull final String path,
//                     @NotNull final String[] childType,
//                     @Nullable final ManagedObjectReference parentRef,
//                     @Nullable final String datacenterId) {
//     myPath = path;
//     myChildType = childType;
//     myName = name;
//     myMOR = mor;
//     myParentRef = parentRef;
//     myDatacenterId = datacenterId;
//   }
// 
//   public String[] getChildType() {
//     return myChildType;
//   }
// 
//   @NotNull
//   @Override
//   public String getId() {
//     return myMOR.getVal();
//   }
// 
//   public String getName() {
//     return myName;
//   }
// 
//   @NotNull
//   @Override
//   public String getPath() {
//     return myPath == null ? myName : myPath;
//   }
// 
//   @Nullable
//   @Override
//   public String getDatacenterId() {
//     return myDatacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public ManagedObjectReference getMOR() {
//     return myMOR;
//   }
// 
//   public ManagedObjectReference getParentMOR() {
//     return myParentRef;
//   }
// 
//   @Override
//   public int compareTo(@NotNull final FolderBean o) {
//     if (myPath == null && o.myPath == null) {
//       return StringUtil.compare(StringUtil.toLowerCase(myName), StringUtil.toLowerCase(o.myName));
//     }
//     return StringUtil.compare(StringUtil.toLowerCase(myPath), StringUtil.toLowerCase(o.myPath));
//   }
// }
// 
// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/connector/beans/ResourcePoolBean.java
// public class ResourcePoolBean implements VmwareManagedEntity, Comparable<ResourcePoolBean> {
//   private final String myName;
//   private final ManagedObjectReference myMOR;
//   private final String myPath;
//   private final ManagedObjectReference myParentRef;
//   private final String myDatacenterId;
// 
// 
//   @Used("Tests")
//   public ResourcePoolBean(final ResourcePool rp){
//     this(rp.getMOR(), rp.getName(), null, rp.getParent().getMOR(), "dc");
//   }
// 
//   public ResourcePoolBean(@NotNull final ManagedObjectReference mor,
//                           @NotNull final String name,
//                           @NotNull final String path,
//                           @Nullable final ManagedObjectReference parentRef,
//                           @Nullable final String datacenterId) {
//     myName = name;
//     myMOR = mor;
//     myPath = path;
//     myParentRef = parentRef;
//     myDatacenterId = datacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public String getId() {
//     return myMOR.getVal();
//   }
// 
//   @NotNull
//   public String getName() {
//     return myName;
//   }
// 
//   @NotNull
//   @Override
//   public String getPath() {
//     return myPath;
//   }
// 
//   @Nullable
//   @Override
//   public String getDatacenterId() {
//     return myDatacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public ManagedObjectReference getMOR() {
//     return myMOR;
//   }
// 
//   @Nullable
//   @Override
//   public ManagedObjectReference getParentMOR() {
//     return myParentRef;
//   }
// 
//   @Override
//   public int compareTo(@NotNull final ResourcePoolBean o) {
//     if (myPath == null && o.myPath == null){
//       return StringUtil.compare(StringUtil.toLowerCase(myName), StringUtil.toLowerCase(o.myName));
//     }
//     return StringUtil.compare(StringUtil.toLowerCase(myPath), StringUtil.toLowerCase(o.myPath));
//   }
// }


import com.vmware.vim25.mo.Datacenter;
import com.vmware.vim25.mo.Folder;
import com.vmware.vim25.mo.ManagedEntity;
import com.vmware.vim25.mo.ResourcePool;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import jetbrains.buildServer.clouds.vmware.connector.beans.FolderBean;
import jetbrains.buildServer.clouds.vmware.connector.beans.ResourcePoolBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/*
 * 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.clouds.vmware.connector;


/**
 * @author Sergey.Pak
 *         Date: 2/6/2015
 *         Time: 5:37 PM
 */
public class VmwareUtils {
  private static final String FOLDER_TYPE = Folder.class.getSimpleName();
  private static final String RESPOOL_TYPE = ResourcePool.class.getSimpleName();
  private static final String SPEC_FOLDER = "vm";
  private static final String SPEC_RESPOOL = "Resources";

// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/connector/beans/FolderBean.java
// public class FolderBean implements VmwareManagedEntity, Comparable<FolderBean> {
//   private final String myPath;
//   private final String[] myChildType;
//   private final String myName;
//   private final ManagedObjectReference myMOR;
//   private final ManagedObjectReference myParentRef;
//   private final String myDatacenterId;
// 
//   @Used("Tests")
//   public FolderBean(final Folder folder){
//     this(folder.getMOR(), folder.getName(), null, folder.getChildType(), folder.getParent().getMOR(), "dc");
//   }
// 
//   public FolderBean(@NotNull final ManagedObjectReference mor,
//                     @NotNull final String name,
//                     @NotNull final String path,
//                     @NotNull final String[] childType,
//                     @Nullable final ManagedObjectReference parentRef,
//                     @Nullable final String datacenterId) {
//     myPath = path;
//     myChildType = childType;
//     myName = name;
//     myMOR = mor;
//     myParentRef = parentRef;
//     myDatacenterId = datacenterId;
//   }
// 
//   public String[] getChildType() {
//     return myChildType;
//   }
// 
//   @NotNull
//   @Override
//   public String getId() {
//     return myMOR.getVal();
//   }
// 
//   public String getName() {
//     return myName;
//   }
// 
//   @NotNull
//   @Override
//   public String getPath() {
//     return myPath == null ? myName : myPath;
//   }
// 
//   @Nullable
//   @Override
//   public String getDatacenterId() {
//     return myDatacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public ManagedObjectReference getMOR() {
//     return myMOR;
//   }
// 
//   public ManagedObjectReference getParentMOR() {
//     return myParentRef;
//   }
// 
//   @Override
//   public int compareTo(@NotNull final FolderBean o) {
//     if (myPath == null && o.myPath == null) {
//       return StringUtil.compare(StringUtil.toLowerCase(myName), StringUtil.toLowerCase(o.myName));
//     }
//     return StringUtil.compare(StringUtil.toLowerCase(myPath), StringUtil.toLowerCase(o.myPath));
//   }
// }
// 
// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/connector/beans/ResourcePoolBean.java
// public class ResourcePoolBean implements VmwareManagedEntity, Comparable<ResourcePoolBean> {
//   private final String myName;
//   private final ManagedObjectReference myMOR;
//   private final String myPath;
//   private final ManagedObjectReference myParentRef;
//   private final String myDatacenterId;
// 
// 
//   @Used("Tests")
//   public ResourcePoolBean(final ResourcePool rp){
//     this(rp.getMOR(), rp.getName(), null, rp.getParent().getMOR(), "dc");
//   }
// 
//   public ResourcePoolBean(@NotNull final ManagedObjectReference mor,
//                           @NotNull final String name,
//                           @NotNull final String path,
//                           @Nullable final ManagedObjectReference parentRef,
//                           @Nullable final String datacenterId) {
//     myName = name;
//     myMOR = mor;
//     myPath = path;
//     myParentRef = parentRef;
//     myDatacenterId = datacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public String getId() {
//     return myMOR.getVal();
//   }
// 
//   @NotNull
//   public String getName() {
//     return myName;
//   }
// 
//   @NotNull
//   @Override
//   public String getPath() {
//     return myPath;
//   }
// 
//   @Nullable
//   @Override
//   public String getDatacenterId() {
//     return myDatacenterId;
//   }
// 
//   @NotNull
//   @Override
//   public ManagedObjectReference getMOR() {
//     return myMOR;
//   }
// 
//   @Nullable
//   @Override
//   public ManagedObjectReference getParentMOR() {
//     return myParentRef;
//   }
// 
//   @Override
//   public int compareTo(@NotNull final ResourcePoolBean o) {
//     if (myPath == null && o.myPath == null){
//       return StringUtil.compare(StringUtil.toLowerCase(myName), StringUtil.toLowerCase(o.myName));
//     }
//     return StringUtil.compare(StringUtil.toLowerCase(myPath), StringUtil.toLowerCase(o.myPath));
//   }
// }


// Path: cloud-vmware-server/src/main/java/jetbrains/buildServer/clouds/vmware/connector/VmwareUtils.java
import com.vmware.vim25.mo.Datacenter;
import com.vmware.vim25.mo.Folder;
import com.vmware.vim25.mo.ManagedEntity;
import com.vmware.vim25.mo.ResourcePool;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import jetbrains.buildServer.clouds.vmware.connector.beans.FolderBean;
import jetbrains.buildServer.clouds.vmware.connector.beans.ResourcePoolBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*
 * 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.clouds.vmware.connector;


/**
 * @author Sergey.Pak
 *         Date: 2/6/2015
 *         Time: 5:37 PM
 */
public class VmwareUtils {
  private static final String FOLDER_TYPE = Folder.class.getSimpleName();
  private static final String RESPOOL_TYPE = ResourcePool.class.getSimpleName();
  private static final String SPEC_FOLDER = "vm";
  private static final String SPEC_RESPOOL = "Resources";

  static boolean isSpecial(@NotNull final ResourcePoolBean pool){