/* 
 * 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.
 *
 * Contributions from 2013-2017 where performed either by US government 
 * employees, or under US Veterans Health Administration contracts. 
 *
 * US Veterans Health Administration contributions by government employees
 * are work of the U.S. Government and are not subject to copyright
 * protection in the United States. Portions contributed by government 
 * employees are USGovWork (17USC §105). Not subject to copyright. 
 * 
 * Contribution by contractors to the US Veterans Health Administration
 * during this period are contractually contributed under the
 * Apache License, Version 2.0.
 *
 * See: https://www.usa.gov/government-works
 * 
 * Contributions prior to 2013:
 *
 * Copyright (C) International Health Terminology Standards Development Organisation.
 * Licensed under the Apache License, Version 2.0.
 *
 */
package sh.komet.gui.control;

//~--- non-JDK imports --------------------------------------------------------
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import sh.isaac.api.Get;
import sh.isaac.api.component.concept.ConceptSpecification;

import sh.komet.gui.manifold.Manifold;

//~--- classes ----------------------------------------------------------------
/**
 *
 * @author kec
 */
public class ConceptForControlWrapper
        implements ConceptSpecification {

   private final Manifold manifold;
   private final int conceptSequence;

   public ConceptForControlWrapper(Manifold manifold, int conceptSequence) {
      this.manifold = manifold;
      this.conceptSequence = conceptSequence;
   }

   @Override
   public String getFullySpecifiedConceptDescriptionText() {
      return this.manifold.getFullySpecifiedDescriptionText(this.conceptSequence);
   }

   @Override
   public Optional<String> getPreferedConceptDescriptionText() {
      return Optional.of(manifold.getPreferredDescriptionText(this.conceptSequence));
   }

   @Override
   public List<UUID> getUuidList() {
      return Get.concept(conceptSequence).getUuidList();
   }

   @Override
   public String toString() {
      if (this.conceptSequence <= 0) {
         Optional<String> description = getPreferedConceptDescriptionText();
         if (description.isPresent()) {
            return description.get();
         }
      }
      return "No description for: " + conceptSequence;
   }
}

@@ -1394,16 +1394,19 @@
 %0A *%0A */%0A
+%0A%0A%0A
 package 
@@ -1428,16 +1428,171 @@
 ntrol;%0A%0A
+//~--- JDK imports ------------------------------------------------------------%0A%0Aimport java.util.List;%0Aimport java.util.Optional;%0Aimport java.util.UUID;%0A%0A
 //~--- n
@@ -1667,80 +1667,8 @@
 ---%0A
-import java.util.List;%0Aimport java.util.Optional;%0Aimport java.util.UUID;
 %0Aimp
@@ -1870,16 +1870,17 @@
 -------%0A
+%0A
 /**%0A *%0A 
@@ -1943,16 +1943,17 @@
         
+ 
 implemen
@@ -1978,17 +1978,16 @@
 ation %7B%0A
-%0A
    priva
@@ -2031,24 +2031,29 @@
 e final int 
+     
 conceptSeque
@@ -2058,16 +2058,97 @@
 uence;%0A%0A
+   //~--- constructors --------------------------------------------------------%0A%0A
    publi
@@ -2236,16 +2236,23 @@
 anifold 
+       
 = manifo
@@ -2299,32 +2299,599 @@
 Sequence;%0A   %7D%0A%0A
+   //~--- methods -------------------------------------------------------------%0A%0A   @Override%0A   public String toString() %7B%0A      if (this.conceptSequence %3C= 0) %7B%0A         Optional%3CString%3E description = getPreferedConceptDescriptionText();%0A%0A         if (description.isPresent()) %7B%0A            return description.get();%0A         %7D%0A      %7D%0A%0A      return %22No description for: %22 + conceptSequence;%0A   %7D%0A%0A   //~--- get methods ---------------------------------------------------------%0A%0A   @Override%0A   public int getConceptSequence() %7B%0A      return conceptSequence;%0A   %7D%0A%0A
    @Override%0A   
@@ -3302,339 +3302,39 @@
 nce)
-.getUuidList();%0A   %7D%0A%0A   @Override%0A   public String toString() %7B%0A      if (this.conceptSequence %3C= 0) %7B%0A         Optional%3CString%3E description = getPreferedConceptDescriptionText();%0A         if (description.isPresent()) %7B%0A            return description.get();%0A         %7D%0A      %7D%0A      return %22No description for: %22 + conceptSequence
+%0A                .getUuidList()
 ;%0A  
@@ -3338,8 +3338,9 @@
 %0A   %7D%0A%7D%0A
+%0A

Fix for not overriding default concept spec getConceptSequence method. .