public static FacetValue getEnterpriseFacetValue(final XSDSimpleTypeDefinition startingType) {
    FacetValue fv = new FacetValue();

    final XSDSimpleTypeDefinition definingEnterpriseType = getDefiningEnterpriseType(startingType);
    fv.type = startingType;
    EnterpriseDatatypeInfo edi =
        ModelerCore.getWorkspaceDatatypeManager().getEnterpriseDatatypeInfo(definingEnterpriseType);
    fv.value = edi.getRuntimeType();

    if (startingType == definingEnterpriseType) {
      // this "facet" set in the specified type, so it is not default.
      // check parent for real default:
      final XSDSimpleTypeDefinition dftDefiner =
          getDefiningEnterpriseType(definingEnterpriseType.getBaseTypeDefinition());
      EnterpriseDatatypeInfo ediDft =
          ModelerCore.getWorkspaceDatatypeManager().getEnterpriseDatatypeInfo(dftDefiner);
      fv.defaultValue = ediDft.getRuntimeType();
      // set a fake facet to allow inherited checks to work:
      fv.facet =
          new XSDConstrainingFacetImpl() {
            @Override
            public String getFacetName() {
              return "This is not a real facet!"; //$NON-NLS-1$
            }

            @Override
            public XSDConcreteComponent getContainer() {
              return dftDefiner;
            }
          }; // endanon
    } else {
      // facet set by a parent, so it is default:
      fv.defaultValue = fv.value;
      // set a fake facet to allow inherited checks to work:
      fv.facet =
          new XSDConstrainingFacetImpl() {
            @Override
            public String getFacetName() {
              return "This is not a real facet!"; //$NON-NLS-1$
            }

            @Override
            public XSDConcreteComponent getContainer() {
              return definingEnterpriseType;
            }
          }; // endanon
    } // endif

    Boolean rtFixed = edi.getRuntimeTypeFixed();
    if (rtFixed != null) {
      fv.isFixedLocal = rtFixed.booleanValue();
    } // endif -- fixed null

    return fv;
  }
 public static void setEnterpriseFacetValue(XSDSimpleTypeDefinition type, FacetValue newValue) {
   if (newValue.value != null) {
     // set new enterprise info:
     EnterpriseDatatypeInfo edi =
         ModelerCore.getWorkspaceDatatypeManager().getEnterpriseDatatypeInfo(type);
     if (edi == null) {
       edi = new EnterpriseDatatypeInfo();
     } // endif
     edi.setRuntimeTypeFixed(new Boolean(newValue.isFixedLocal));
     edi.setRuntimeType((String) newValue.value);
     ModelEditorImpl.fillWithDefaultValues(edi, type);
     ModelerCore.getModelEditor().setEnterpriseDatatypePropertyValue(type, edi);
   } else {
     // need to unset:
     ModelerCore.getModelEditor().unsetEnterpriseDatatypePropertyValue(type);
   } // endif
 }