Package org.jboss.seam.wiki.preferences.metamodel

Examples of org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity$Property


      if ( level01.getDataItems()[i] instanceof ElementaryDataItem ) {
        ElementaryDataItem edi = (ElementaryDataItem)level01.getDataItems()[i];
        String attrName = edi.getDataName();
        DataField dataField = (DataField)edi.interpret();
        if (dataField != null) {
          Property attr = (Property)attrs.get(attrName);
          Type type = dataField.getType() == Integer.class ? integerType : stringType;
          if (attr == null) {
            String timestampFormat = "";
            String dateFormat = "";
            String length = "" + dataField.getLength();
            String fraction = "" + dataField.getFraction();
            System.out.println("INFO [jIvalo]  - Adding new attribute: " + attrName);
            Property newAttr = addAttribute(c, attrName, type, timestampFormat, dateFormat, length, fraction);
          }
          else {
            System.out.println("INFO [jIvalo]  - Updating new attribute: " + attrName);
            attr.setType(type);
            setTagValue(attr, "length", "" + dataField.getLength());
            setTagValue(attr, "fraction", "" + dataField.getFraction());
            attrs.remove(attrName);
          }
        }
      }
      else if ( level01.getDataItems()[i] instanceof GroupDataItem ) {
        GroupDataItem gdi = (GroupDataItem)level01.getDataItems()[i];
        String className = c.getName() + "_" + gdi.getDataName();
        Class cl = getClass(p, className);
        if (cl == null) {
          addClass(p, className);
          System.out.println("INFO [jIvalo] Added class: " + className);
          cl = getClass(p, className);
        }
        else {
          System.out.println("INFO [jIvalo] Updating existing class: " + className);
        }
       
        if (cl != null) {
          addAttributes(gdi, p, cl, model);
   
          Property newAttr = null;
          if ( level01.getDataItems()[i] instanceof GroupDataItemOccurs ) {
            GroupDataItemOccurs gdio = (GroupDataItemOccurs)level01.getDataItems()[i];
            newAttr = c.createOwnedAttribute(className,p.getOwnedType(cl.getName()),gdio.getOccurs(),gdio.getOccurs());
          }
          else {
            newAttr = c.createOwnedAttribute(className,p.getOwnedType(cl.getName()),1,1);
          }
          if (newAttr != null) {
            newAttr.setVisibility(VisibilityKind.PUBLIC_LITERAL);
            addStereotype(newAttr, jIvaloAttributeStereotype);
            setTagValue(newAttr, "timestampFormat", "");
            setTagValue(newAttr, "dateFormat", "");
            setTagValue(newAttr, "length", "0");
            setTagValue(newAttr, "fraction", "0");
View Full Code Here


    cobolResourceDir = Namespaces.instance().getNamespace(namespace).getProperty("cobolResourceDir").getValue();
    targetPackage = Namespaces.instance().getNamespace(namespace).getProperty("targetPackage").getValue();
   
    jIvaloPackage = getPackage(jIvaloPackageName, model);
    jIvaloClass = getClass(jIvaloPackage, jIvaloClassName);
    Property attribute1 = getAttribute(jIvaloClass, "string");
    stringType = attribute1.getType();
    Property attribute2 = getAttribute(jIvaloClass, "integer");
    integerType = attribute2.getType();

    jIvaloClassStereotype = getStereotype(jIvaloClass, jIvaloClassSteroetypeName);
    jIvaloAttributeStereotype = getStereotype(attribute1, jIvaloAttrSteroetypeName);

  }
View Full Code Here

    Repositories.instance().getImplementation(encoding).writeModel(element,
        outputLocation, xmiVersion);
  }

  private Property addAttribute(Class c, String name, Type type, String timestampFormat, String dateFormat, String length, String fraction) {
    Property p = c.createOwnedAttribute(name, type, 1, 1);
    p.setVisibility(VisibilityKind.PUBLIC_LITERAL);
    setTagValue(p, "timestampFormat", timestampFormat);
    setTagValue(p, "dateFormat", dateFormat);
    setTagValue(p, "length", length);
    setTagValue(p, "fraction", fraction);
    return p;
View Full Code Here

            }

            protected void invokeApplication() throws Exception {

                PreferenceRegistry registry = (PreferenceRegistry)getInstance(PreferenceRegistry.class);
                PreferenceEntity docEditorEntity = registry.getPreferenceEntitiesByName().get("DocEditor");

                invokeMethod("#{userHome.initPreferencesEditor}");

                PreferenceEditor prefEditor = (PreferenceEditor)getInstance(PreferenceEditor.class);
                prefEditor.selectPreferenceEntity(docEditorEntity);
View Full Code Here

            }

            protected void invokeApplication() throws Exception {

                PreferenceRegistry registry = (PreferenceRegistry)getInstance(PreferenceRegistry.class);
                PreferenceEntity wikiEntity = registry.getPreferenceEntitiesByName().get("Wiki");

                invokeMethod("#{adminHome.initPreferencesEditor}");

                PreferenceEditor prefEditor = (PreferenceEditor)getInstance(PreferenceEditor.class);
                prefEditor.selectPreferenceEntity(wikiEntity);
View Full Code Here

        log.debug("assembling preference values for '"
                    + preferenceEntityName
                    + "' and user '" + user
                    + "' and wiki macro ' " + instance + "'");

        PreferenceEntity entity = preferenceRegistry.getPreferenceEntitiesByName().get(preferenceEntityName);
        SortedSet<PreferenceValue> valueHolders = new TreeSet<PreferenceValue>();

        Set<PreferenceValue> systemValueHolders = null;
        if (visibilities.contains(PreferenceVisibility.SYSTEM)) {
            log.trace("retrieving SYSTEM preference values from database");

            systemValueHolders = loadSystemValues(preferenceEntityName);

            // Check if all SYSTEM-level properties were present in the database
            for (PreferenceEntity.Property systemVisibleProperty : entity.getPropertiesSystemVisible()) {
                WikiPreferenceValue newValueHolder = new WikiPreferenceValue(systemVisibleProperty);
                // If not, queue a new value holder (with a null "value") for that property and return it
                if (!systemValueHolders.contains(newValueHolder)) {
                    systemValueHolders.add(newValueHolder);
                    newValueHolders.add(newValueHolder);
                }
            }
            valueHolders.addAll(systemValueHolders);
        }

        Set<PreferenceValue> userValueHolders;
        if (visibilities.contains(PreferenceVisibility.USER)) {
            if (user == null)
                throw new IllegalArgumentException("can't load preferences for null user");
            log.trace("retrieving USER preference values from database");

            userValueHolders = loadUserValues(preferenceEntityName, user);

            // We need them when we iterate through missing properties next
            if (systemValueHolders == null) systemValueHolders = loadSystemValues(preferenceEntityName);

            // Check if all USER-level properties were present in the database
            for (PreferenceEntity.Property userVisibleProperty : entity.getPropertiesUserVisible()) {
                WikiPreferenceValue newValueHolder = new WikiPreferenceValue(userVisibleProperty);

                // If not, queue a new value for that property and return it
                if (!userValueHolders.contains(newValueHolder)) {
                    log.trace("creating new preference value for user, missing in database " + userVisibleProperty);
View Full Code Here

        return new HashSet(values);
    }

    private Set<PreferenceValue> loadInstanceValues(String entityName, WikiPluginMacro instance) {
        Set<PreferenceValue> valueHolders = new HashSet<PreferenceValue>();
        PreferenceEntity preferenceEntity = preferenceRegistry.getPreferenceEntitiesByName().get(entityName);
        for (Map.Entry<String, String> entry : instance.getParams().entrySet()) {
            log.trace("converting WikiMacro parameter into WikiPreferenceValue: " + entry.getKey());

            // TODO: Maybe we should log the following as DEBUG level, these occur when the user edits macro parameters

            PreferenceEntity.Property property = preferenceEntity.getPropertiesByName().get(entry.getKey());
            if (property == null) {
                log.info("can't convert unknown property as WikiMacro parameter: " + entry.getKey());
                continue;
            }
            if (!property.getVisibility().contains(PreferenceVisibility.INSTANCE)) {
View Full Code Here

            }
        }
    }

    private boolean setPropertyReference(WikiPreferenceValue value, String entityName, PreferenceVisibility visibility) {
        PreferenceEntity entity = preferenceRegistry.getPreferenceEntitiesByName().get(entityName);
        if (entity == null) {
            log.warn("orphaned preference value found in database, please clean up: " + value);
            return false;
        }
        PreferenceEntity.Property property = entity.getPropertiesByName().get(value.getPropertyName());
        if (property == null) {
            log.warn("orphaned preference value found in database, please clean up: " + value);
            return false;
        }
        if (!property.getVisibility().contains(visibility)) {
View Full Code Here

            }

            protected void invokeApplication() throws Exception {

                PreferenceRegistry registry = (PreferenceRegistry)getInstance(PreferenceRegistry.class);
                PreferenceEntity wikiEntity = registry.getPreferenceEntitiesByName().get("Wiki");

                invokeMethod("#{adminHome.initPreferencesEditor}");

                PreferenceEditor prefEditor = (PreferenceEditor)getInstance(PreferenceEditor.class);
                prefEditor.selectPreferenceEntity(wikiEntity);
View Full Code Here

   {
      public Property apply(V1Property from)
      {
         if (from != null)
         {
            Property result = WSRPTypeFactory.createProperty(from.getName(), from.getLang(), from.getStringValue());
            result.setType(WSRPConstants.XSD_STRING); // todo: not sure what to do here... :(

            List<Object> any = from.getAny();
            if (ParameterValidation.existsAndIsNotEmpty(any))
            {
               result.getAny().addAll(any);
            }
            return result;
         }
         else
         {
View Full Code Here

TOP

Related Classes of org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity$Property

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.