Examples of PropertyDescription


Examples of org.apache.sling.jcr.contentloader.internal.PropertyDescription

        assertEquals(properties, node.getProperties());
    }

    public void testPropertiesSingleValue() throws IOException, JSONException {
        List<PropertyDescription> properties = new ArrayList<PropertyDescription>();
        PropertyDescription prop = new PropertyDescription();
        prop.setName("p1");
        prop.setValue("v1");
        properties.add(prop);
       
        String json = this.toJsonObject(properties).toString();
       
        NodeDescription node = this.parse(json);
View Full Code Here

Examples of org.apache.sling.jcr.contentloader.internal.PropertyDescription

        assertEquals(new HashSet<PropertyDescription>(properties), new HashSet<PropertyDescription>(node.getProperties()));
    }
   
    public void testPropertiesTwoSingleValue() throws IOException, JSONException {
        List<PropertyDescription> properties = new ArrayList<PropertyDescription>();
        PropertyDescription prop = new PropertyDescription();
        prop.setName("p1");
        prop.setValue("v1");
        properties.add(prop);
        prop = new PropertyDescription();
        prop.setName("p2");
        prop.setValue("v2");
        properties.add(prop);

        String json = this.toJsonObject(properties).toString();

        NodeDescription node = this.parse(json);
View Full Code Here

Examples of org.apache.sling.jcr.contentloader.internal.PropertyDescription

        assertEquals(new HashSet<PropertyDescription>(properties), new HashSet<PropertyDescription>(node.getProperties()));
    }

    public void testPropertiesMultiValue() throws IOException, JSONException {
        List<PropertyDescription> properties = new ArrayList<PropertyDescription>();
        PropertyDescription prop = new PropertyDescription();
        prop.setName("p1");
        prop.addValue("v1");
        properties.add(prop);

        String json = this.toJsonObject(properties).toString();

        NodeDescription node = this.parse(json);
View Full Code Here

Examples of org.apache.sling.jcr.contentloader.internal.PropertyDescription

        assertEquals(new HashSet<PropertyDescription>(properties), new HashSet<PropertyDescription>(node.getProperties()));
    }

    public void testPropertiesMultiValueEmpty() throws IOException, JSONException {
        List<PropertyDescription> properties = new ArrayList<PropertyDescription>();
        PropertyDescription prop = new PropertyDescription();
        prop.setName("p1");
        prop.addValue(null); // empty multivalue property
        properties.add(prop);

        String json = this.toJsonObject(properties).toString();

        NodeDescription node = this.parse(json);
View Full Code Here

Examples of org.apache.sling.jcr.contentloader.internal.PropertyDescription

    public void testChildWithProperty() throws IOException, JSONException {
        List<NodeDescription> nodes = new ArrayList<NodeDescription>();
        NodeDescription child = new NodeDescription();
        child.setName("c1");
        PropertyDescription prop = new PropertyDescription();
        prop.setName("c1p1");
        prop.setValue("c1v1");
        child.addProperty(prop);
        nodes.add(child);

        String json = this.toJsonObject(nodes).toString();
View Full Code Here

Examples of org.eclipse.orion.server.core.resources.annotations.PropertyDescription

    JSONObject result = new JSONObject();
    try {
      for (Property property : resourceShape.getProperties()) {
        Method getter = ReflectionHelper.findGetterForPropertyName(resource.getClass(), property.getName());
        Object value = ReflectionHelper.callGetter(resource, getter);
        PropertyDescription propertyDescriptionAnnotation = ReflectionHelper.getAnnotation(getter, PropertyDescription.class);
        if (propertyDescriptionAnnotation.expandable()) {
          ResourceShape nestedResourceShape = property.getResourceShape();
          Assert.isNotNull(nestedResourceShape, "Could not find resource shape definition for: " + property.getName()); //$NON-NLS-1$
          result.put(property.getName(), serialize(value, nestedResourceShape));
        } else {
          result.put(property.getName(), value);
View Full Code Here

Examples of org.eclipse.orion.server.core.resources.annotations.PropertyDescription

      for (Method method : currentResourceClass.getDeclaredMethods()) {
        if (method.getParameterTypes().length == 0) {
          String methodName = method.getName();
          int methodNameLength = methodName.length();
          if (((methodName.startsWith(METHOD_NAME_GET)) && (methodNameLength > METHOD_NAME_GET.length())) || ((methodName.startsWith(METHOD_NAME_IS)) && (methodNameLength > METHOD_NAME_IS.length()))) {
            PropertyDescription propertyDescriptionAnnotation = ReflectionHelper.getAnnotation(method, PropertyDescription.class);
            if (propertyDescriptionAnnotation != null) {
              String propertyDescriptionName = propertyDescriptionAnnotation.name();
              if (propertyName.equals(propertyDescriptionName)) {
                return method;
              }
            }
          }
View Full Code Here

Examples of org.oasis.wsrp.v2.PropertyDescription

    * @since 2.6
    */
   public static PropertyDescription convertToPropertyDescription(RegistrationPropertyDescription propertyDescription)
   {
      ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "RegistrationPropertyDescription");
      PropertyDescription propDesc = WSRPTypeFactory.createPropertyDescription(propertyDescription.getName().toString(),
         propertyDescription.getType());

      // todo: deal with languages properly!!
      LocalizedString hint = propertyDescription.getHint();
      if (hint != null)
      {
         propDesc.setHint(convertToWSRPLocalizedString(hint));
      }
      LocalizedString label = propertyDescription.getLabel();
      if (label != null)
      {
         propDesc.setLabel(convertToWSRPLocalizedString(label));
      }
      return propDesc;
   }
View Full Code Here

Examples of org.oasis.wsrp.v2.PropertyDescription

               {
                  //todo: check what we should use key
                  //todo: right now we only support String properties
                  List<String> desiredLocales = getPortletPropertyDescription.getDesiredLocales();
                  desiredLocales = WSRPUtils.replaceByEmptyListIfNeeded(desiredLocales);
                  PropertyDescription desc = WSRPTypeFactory.createPropertyDescription(prefInfo.getKey(), WSRPConstants.XSD_STRING);
                  desc.setLabel(Utils.convertToWSRPLocalizedString(prefInfo.getDisplayName(), desiredLocales));
                  desc.setHint(Utils.convertToWSRPLocalizedString(prefInfo.getDescription(), desiredLocales));
                  descs.add(desc);
               }
            }
         }
View Full Code Here

Examples of org.oasis.wsrp.v2.PropertyDescription

   {
      public PropertyDescription apply(V1PropertyDescription from)
      {
         if (from != null)
         {
            PropertyDescription result = WSRPTypeFactory.createPropertyDescription(from.getName(), from.getType());
            result.setHint(toV2LocalizedString(from.getHint()));
            result.setLabel(toV2LocalizedString(from.getLabel()));
            List<Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
            if (extensions != null)
            {
               result.getExtensions().addAll(extensions);
            }

            return result;
         }
         else
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.