Package org.exoplatform.services.jcr.impl.core

Examples of org.exoplatform.services.jcr.impl.core.PropertyImpl


            {
               String propertyName = resolver.createJCRName(properties[i]).getAsString();
               node = (NodeImpl)getNode();
               if (node.hasProperty(propertyName))
               {
                  PropertyImpl prop = (PropertyImpl)node.getProperty(propertyName);
                  if (!prop.getDefinition().isMultiple())
                  {
                     if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED)
                     {
                        tmp[i] = valueFactory.createValue(prop.getString());
                     }
                     else
                     {
                        tmp[i] = prop.getValue();
                     }
                  }
                  else
                  {
                     // mvp values cannot be returned
View Full Code Here


   private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ext.AddMetadataAction");

   public boolean execute(Context ctx) throws Exception
   {
      PropertyImpl property = (PropertyImpl)ctx.get("currentItem");
      NodeImpl parent = property.getParent();
      if (!parent.isNodeType("nt:resource"))
      {
         throw new Exception("incoming node is not nt:resource type");
      }

      InputStream data = null;
      String mimeType;

      try
      {
         if (property.getInternalName().equals(Constants.JCR_DATA))
         {
            data = ((PropertyData)property.getData()).getValues().get(0).getAsStream();
            try
            {
               mimeType = parent.getProperty("jcr:mimeType").getString();
            }
            catch (PathNotFoundException e)
            {
               return false;
            }
         }
         else if (property.getInternalName().equals(Constants.JCR_MIMETYPE))
         {
            int evt = (Integer)ctx.get(InvocationContext.EVENT);
            if (evt != ExtendedEvent.PROPERTY_ADDED)
            {
               // In case the mime type is modified we assume that the property jcr:data is modified too so to
               // prevent issue like JCR-1873 we do the data extraction only on jcr:data change
               return false;
            }

            mimeType = property.getString();
            try
            {
               PropertyImpl propertyImpl = (PropertyImpl)parent.getProperty("jcr:data");
               data = ((PropertyData)propertyImpl.getData()).getValues().get(0).getAsStream();
            }
            catch (PathNotFoundException e)
            {
               return false;
            }
View Full Code Here

   private static Log log = ExoLogger.getLogger("exo.jcr.component.ext.AddMetadataAction");

   public boolean execute(Context ctx) throws Exception
   {

      PropertyImpl property = (PropertyImpl)ctx.get("currentItem");
      NodeImpl parent = property.getParent();
      if (!parent.isNodeType("nt:resource"))
      {
         throw new Exception("incoming node is not nt:resource type");
      }

      InputStream data = null;
      String mimeType;

      try
      {
         if (property.getInternalName().equals(Constants.JCR_DATA))
         {
            data = ((PropertyData)property.getData()).getValues().get(0).getAsStream();
            try
            {
               mimeType = parent.getProperty("jcr:mimeType").getString();
            }
            catch (PathNotFoundException e)
            {
               return false;
            }
         }
         else if (property.getInternalName().equals(Constants.JCR_MIMETYPE))
         {
            mimeType = property.getString();
            try
            {
               PropertyImpl propertyImpl = (PropertyImpl)parent.getProperty("jcr:data");
               data = ((PropertyData)propertyImpl.getData()).getValues().get(0).getAsStream();
            }
            catch (PathNotFoundException e)
            {
               return false;
            }
View Full Code Here

            {
               String propertyName = resolver.createJCRName(properties[i]).getAsString();
               node = (NodeImpl)getNode();
               if (node.hasProperty(propertyName))
               {
                  PropertyImpl prop = (PropertyImpl)node.getProperty(propertyName);
                  if (!prop.getDefinition().isMultiple())
                  {
                     if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED)
                     {
                        tmp[i] = valueFactory.createValue(prop.getString());
                     }
                     else
                     {
                        tmp[i] = prop.getValue();
                     }
                  }
                  else
                  {
                     // mvp values cannot be returned
View Full Code Here

   private static Log log = ExoLogger.getLogger("exo.jcr.component.ext.AddMetadataAction");

   public boolean execute(Context ctx) throws Exception
   {

      PropertyImpl property = (PropertyImpl)ctx.get("currentItem");
      NodeImpl parent = (NodeImpl)property.getParent();
      if (!parent.isNodeType("nt:resource"))
      {
         throw new Exception("incoming node is not nt:resource type");
      }

      InputStream data = null;
      String mimeType;

      try
      {
         if (property.getInternalName().equals(Constants.JCR_DATA))
         {
            data = ((PropertyData)property.getData()).getValues().get(0).getAsStream();
            try
            {
               mimeType = parent.getProperty("jcr:mimeType").getString();
            }
            catch (PathNotFoundException e)
            {
               return false;
            }
         }
         else if (property.getInternalName().equals(Constants.JCR_MIMETYPE))
         {
            mimeType = property.getString();
            try
            {
               PropertyImpl propertyImpl = (PropertyImpl)parent.getProperty("jcr:data");
               data = ((PropertyData)propertyImpl.getData()).getValues().get(0).getAsStream();
            }
            catch (PathNotFoundException e)
            {
               return false;
            }
View Full Code Here

   private static Log log = ExoLogger.getLogger("exo.jcr.component.ext.AddMetadataAction");

   public boolean execute(Context ctx) throws Exception
   {

      PropertyImpl property = (PropertyImpl)ctx.get("currentItem");
      NodeImpl parent = (NodeImpl)property.getParent();
      if (!parent.isNodeType("nt:resource"))
      {
         throw new Exception("incoming node is not nt:resource type");
      }

      InputStream data = null;
      String mimeType;

      try
      {
         if (property.getInternalName().equals(Constants.JCR_DATA))
         {
            data = ((PropertyData)property.getData()).getValues().get(0).getAsStream();
            try
            {
               mimeType = parent.getProperty("jcr:mimeType").getString();
            }
            catch (PathNotFoundException e)
            {
               return false;
            }
         }
         else if (property.getInternalName().equals(Constants.JCR_MIMETYPE))
         {
            mimeType = property.getString();
            try
            {
               PropertyImpl propertyImpl = (PropertyImpl)parent.getProperty("jcr:data");
               data = ((PropertyData)propertyImpl.getData()).getValues().get(0).getAsStream();
            }
            catch (PathNotFoundException e)
            {
               return false;
            }
View Full Code Here

      assertTrue(session.getRootNode().hasNode(TextUtil.relativizePath(path)));
      Node node = session.getRootNode().getNode(TextUtil.relativizePath(path));
      assertTrue(node.hasNode("jcr:content"));
      Node node2 = node.getNode("jcr:content");
      assertTrue(node2.hasProperty("jcr:mimeType"));
      PropertyImpl property = (PropertyImpl)node2.getProperty("jcr:mimeType");
      assertEquals(headers.getFirst(HttpHeaders.CONTENT_TYPE), property.getString());
   }
View Full Code Here

      Node node = session.getRootNode().getNode(TextUtil.relativizePath(filename));
      assertTrue(node.hasNode("jcr:content"));
      Node node2 = node.getNode("jcr:content");
      assertTrue(node2.hasProperty("jcr:mimeType"));
      PropertyImpl property = (PropertyImpl)node2.getProperty("jcr:mimeType");
      assertEquals(MediaType.TEXT_HTML, property.getString());

      containerResponse = service(WebDAVMethods.GET, getPathWS() + "/" + filename, "", null, null);
      assertEquals(MediaType.TEXT_HTML, containerResponse.getHttpHeaders().getFirst(HttpHeaders.CONTENT_TYPE));
   }
View Full Code Here

            for (int i = 0; i < properties.length; i++)
            {
               String propertyName = resolver.createJCRName(properties[i]).getAsString();
               if (node.hasProperty(propertyName))
               {
                  PropertyImpl prop = (PropertyImpl) node.getProperty(propertyName);
                  if (!prop.getDefinition().isMultiple())
                  {
                     if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED)
                     {
                        tmp[i] = vfactory.createValue(prop.getString());
                     }
                     else
                     {
                        tmp[i] = prop.getValue();
                     }
                  }
                  else
                  {
                     // mvp values cannot be returned
View Full Code Here

      catalog.clear();

      // test by path

      Node testNode = root.addNode("testNode");
      PropertyImpl prop = (PropertyImpl)testNode.setProperty("test", "test");
      root.save();

      SessionEventMatcher matcher =
         new SessionEventMatcher(ExtendedEvent.READ, new QPath[]{prop.getData().getQPath()}, true, null,
            new InternalQName[]{Constants.NT_UNSTRUCTURED}, ntHolder);
      DummyAction dAction = new DummyAction();

      catalog.addAction(matcher, dAction);
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.core.PropertyImpl

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.