Examples of JcrProperty


Examples of com.cognifide.slice.mapper.annotation.JcrProperty

   *
   * @param field field to get associated property name for
   * @return property name associated with given field, never null.
   */
  private String getPropertyName(Field field) {
    final JcrProperty annotation = field.getAnnotation(JcrProperty.class);
    if ((annotation != null) && StringUtils.isNotBlank(annotation.value())) {
      return annotation.value();
    }
    return field.getName();
  }
View Full Code Here

Examples of com.cognifide.slice.mapper.annotation.JcrProperty

   *
   * @param field field to get associated property name for
   * @return property name associated with given field, never null.
   */
  private String getPropertyName(Field field) {
    final JcrProperty annotation = field.getAnnotation(JcrProperty.class);
    if ((annotation != null) && StringUtils.isNotBlank(annotation.value())) {
      return annotation.value();
    }
    return field.getName();
  }
View Full Code Here

Examples of org.apache.sling.ide.eclipse.ui.nav.model.JcrProperty

                jcrNode.changePropertyType(String.valueOf(me.getKey()), propertyType);
                break;
            }
            case VALUE: {
                try{
                    final JcrProperty property = getNode().getProperty(getPropertyName());
                    final int propertyType = property.getType();
                    String encodedValue;
                    if (property.isMultiple()) {
                        Object[] values = (Object[])value;
                        encodedValue = "";
                        for (int i = 0; i < values.length; i++) {
                            Object aValue = values[i];
                            String aValueAsString = PropertyTypeSupport.encodeValueAsString(aValue, propertyType);
                            if (i==0) {
                                encodedValue = aValueAsString;
                            } else {
                                encodedValue = encodedValue+","+aValueAsString;
                            }
                        }
                        encodedValue = "["+encodedValue+"]";
                    } else {
                        encodedValue = PropertyTypeSupport.encodeValueAsString(value, propertyType);
                    }
                    if (propertyType!=PropertyType.STRING && propertyType!=PropertyType.NAME) {
                        encodedValue = "{"+PropertyType.nameFromValue(propertyType)+"}"+encodedValue;
                    }
                    jcrNode.setPropertyValue(me.getKey(), encodedValue);
                } catch(Exception e) {
                    // emergency fallback
                    jcrNode.setPropertyValue(me.getKey(), String.valueOf(value));
                }
                break;
            }
            case MULTIPLE: {
                if (!(value instanceof Integer)) {
                    // value must be an integer
                    return;
                }
                final Integer newIsMultipleValue = (Integer) value;
                final boolean newIsMultiple = newIsMultipleValue==1;
                final JcrProperty property = getNode().getProperty(getPropertyName());
                final boolean oldIsMultiple = property.isMultiple();
                if (newIsMultiple==oldIsMultiple) {
                    // then nothing is to be done
                    return;
                }
                final String oldPropertyValue = getNode().getProperties().getValue(getPropertyName());
View Full Code Here

Examples of org.apache.sling.ide.eclipse.ui.nav.model.JcrProperty

                final String propertyName = String.valueOf(me.getKey());
                int propertyType = jcrNode.getPropertyType(propertyName);
                if (propertyType<=-1 || propertyType==PropertyType.UNDEFINED) {
                    cell.setText("");
                } else {
                    final JcrProperty property = jcrNode.getProperty(propertyName);
                    String type = PropertyType.nameFromValue(propertyType);
                    if (property!=null && property.isMultiple()) {
                        type = type + "[]";
                    }
                    cell.setText(type);
                }
            } else {
View Full Code Here

Examples of org.apache.sling.ide.eclipse.ui.nav.model.JcrProperty

        this.propertyName = propertyName;
    }
   
    @Override
    protected Object openDialogBox(Control cellEditorWindow) {
        final JcrProperty property = node.getProperty(propertyName);
        final MVPEditor mvpEditor = new MVPEditor(cellEditorWindow.getShell(), property);
        if (mvpEditor.open() == IStatus.OK) {
            return mvpEditor.getLines();
        } else {
            return null;
View Full Code Here

Examples of org.apache.sling.ide.eclipse.ui.nav.model.JcrProperty

        this.propertyName = propertyName;
    }
   
    @Override
    protected Object openDialogBox(Control cellEditorWindow) {
        final JcrProperty property = node.getProperty(propertyName);
        final DateTimeEditor dtEditor = new DateTimeEditor(cellEditorWindow.getShell(), property);
        if (dtEditor.open() == IStatus.OK) {
            return dtEditor.getDate();
        } else {
            return null;
View Full Code Here

Examples of org.brixcms.jcr.api.JcrProperty

                } else if (n.hasNode("jcr:content")) {
                    JcrNode content = n.getNode("jcr:content");
                    if (content.isModified() || content.isNew()) {
                        touch(n);
                    } else if (content.hasProperty("jcr:data")) {
                        JcrProperty data = content.getProperty("jcr:data");
                        if (data.isNew() || data.isModified()) {
                            touch(n);
                        }
                    }
                }
            }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrProperty

            JcrNode targetNode = current.targetNode;

            JcrValueFactory vf = targetNode.getSession().getValueFactory();
            JcrPropertyIterator propertyIterator = originalNode.getProperties();
            while (propertyIterator.hasNext()) {
                JcrProperty property = propertyIterator.nextProperty();
                String name = property.getName();
                if (!property.getDefinition().isProtected()) {
                    if (!property.getDefinition().isMultiple()) {
                        JcrValue value = property.getValue();
                        targetNode.setProperty(name, remapReference(value, uuidMap, vf));
                    } else {
                        JcrValue values[] = property.getValues();
                        for (int i = 0; i < values.length; ++i) {
                            values[i] = remapReference(values[i], uuidMap, vf);
                        }
                        targetNode.setProperty(name, values);
                    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrProperty

    private static void checkDependencies(JcrNode node, List<String> paths, JcrWorkspace targetWorkspace,
                                          Map<JcrNode, List<JcrNode>> result) {
        // go through all properties
        JcrPropertyIterator iterator = node.getProperties();
        while (iterator.hasNext()) {
            JcrProperty property = iterator.nextProperty();

            // if it is a reference property
            if (property.getType() == PropertyType.REFERENCE) {
                // if the property has multiple values
                if (property.getDefinition().isMultiple()) {
                    JcrValue values[] = property.getValues();
                    for (JcrValue value : values) {
                        checkReferenceValue(value, node, paths, targetWorkspace, result);
                    }
                } else {
                    JcrValue value = property.getValue();
                    checkReferenceValue(value, node, paths, targetWorkspace, result);
                }
            }
        }
View Full Code Here

Examples of org.modeshape.web.shared.JcrProperty

            names.addAll(Arrays.asList(defs));
        }

        ArrayList<JcrProperty> list = new ArrayList<>();
        for (PropertyDefinition def :  names) {
            JcrProperty prop = null;
           
            String name = def.getName();
            String type = PropertyType.nameFromValue(def.getRequiredType());
            String value = null;
            String display = null;
           
            Property p = null;
            try {
                p = node.getProperty(def.getName());
            } catch (PathNotFoundException e) {
            }
           
            display = values(def, p)
           
            switch (def.getRequiredType()) {
                case PropertyType.BINARY:
                    HttpServletRequest request = this.getThreadLocalRequest();
                    String context = request.getContextPath();
                    value = String.format("%s/binary/node?repository=%s&workspace=%s&path=%s&property=%s",
                            context, repository, workspace, path, def.getName());
                    break;
                default:
                    value = p == null ? "N/A" : p.getValue() != null ? p.getValue().getString() : "N/A";
                    break;
            }
           
            list.add(new JcrProperty(name, type, value, display));
        }
        return list;
    }   
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.