@Override
  public String doDefault() throws Exception {
    if (isFieldLocked()) {
      return "locked";
    }

    // Set up the context so the view can see it nicely.
    final FieldConfigScheme configScheme = getConfig();
    setGlobal(isGlobalAvailable());
    if (configScheme != null) {
      setName(configScheme.getName());
      setDescription(configScheme.getDescription());

      // Check if this is still editable in "basic" mode
      if (configScheme.isBasicMode()) {
        setBasicMode(true);
        setGlobal(configScheme.isAllProjects());

        final Set issueTypesList = configScheme.getAssociatedIssueTypes();
        setIssuetypes(GenericValueUtils.transformToStrings(issueTypesList, "id"));

        final List projectCategoriesList = configScheme.getAssociatedProjectCategories();
        setProjectCategories(GenericValueUtils.transformToLongIds(projectCategoriesList));

        final List projectsList = configScheme.getAssociatedProjects();
        setProjects(GenericValueUtils.transformToLongIds(projectsList));

        // Set the config
        final MultiMap configMap = configScheme.getConfigsByConfig();
        if (configMap == null) {
          fieldConfigIds = new Long[0];
        } else {
          final Set entries = configScheme.getConfigsByConfig().keySet();
          fieldConfigIds = new Long[entries.size()];
          int i = 0;
          for (final Object entry : entries) {
            final FieldConfig config = (FieldConfig) entry;
            fieldConfigIds[i] = config.getId();
            i++;
          }
        }

      } else {
        // Complex mode
        setBasicMode(false);
        // @TODO
      }
    }

    return super.doDefault();
  }
 public Builder(final FieldConfigScheme scheme) {
   if (scheme != null) {
     id = scheme.getId();
     name = scheme.getName();
     description = scheme.getDescription();
     configs = scheme.getConfigs();
     if (scheme instanceof FieldConfigSchemeImpl) {
       final FieldConfigSchemeImpl fieldConfigSchemeImpl = (FieldConfigSchemeImpl) scheme;
       configContextPersister = fieldConfigSchemeImpl.getFieldConfigContextPersister();
       fieldId = fieldConfigSchemeImpl.getFieldId();
     } else {
       final ConfigurableField field = scheme.getField();
       fieldId = (field != null) ? field.getId() : null;
     }
   }
 }