Java Code Examples for org.alfresco.service.cmr.repository.ContentData

The following examples show how to use org.alfresco.service.cmr.repository.ContentData. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
private NodeRef createCorruptedContent(NodeRef parentFolder) throws IOException
{
    // The below pdf file has been truncated such that it is identifiable as a PDF but otherwise corrupt.
    File corruptPdfFile = AbstractContentTransformerTest.loadNamedQuickTestFile("quickCorrupt.pdf");
    assertNotNull("Failed to load required test file.", corruptPdfFile);

    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NAME, "corrupt.pdf");
    NodeRef node = this.secureNodeService.createNode(parentFolder, ContentModel.ASSOC_CONTAINS,
            QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "quickCorrupt.pdf"),
            ContentModel.TYPE_CONTENT, props).getChildRef();

    secureNodeService.setProperty(node, ContentModel.PROP_CONTENT, new ContentData(null,
                MimetypeMap.MIMETYPE_PDF, 0L, null));
    ContentWriter writer = contentService.getWriter(node, ContentModel.PROP_CONTENT, true);
    writer.setMimetype(MimetypeMap.MIMETYPE_PDF);
    writer.setEncoding("UTF-8");
    writer.putContent(corruptPdfFile);
    
    return node;
}
 
Example 2
protected NodeRef getRenditionByName(NodeRef nodeRef, String renditionId, Parameters parameters)
{
    if (nodeRef != null)
    {
        if (StringUtils.isEmpty(renditionId))
        {
            throw new InvalidArgumentException("renditionId can't be null or empty.");
        }

        ChildAssociationRef nodeRefRendition = renditionService2.getRenditionByName(nodeRef, renditionId);
        if (nodeRefRendition != null)
        {
            ContentData contentData = getContentData(nodeRefRendition.getChildRef(), false);
            if (contentData != null)
            {
                return tenantService.getName(nodeRef, nodeRefRendition.getChildRef());
            }
        }
    }

    return null;
}
 
Example 3
/**
 * Test when the aspect is not set when check-in is performed
 */
@Test
public void testVersionAspectNotSetOnCheckIn()
{
    // Create a bag of props
    Map<QName, Serializable> bagOfProps = createTypePropertyBag();
    bagOfProps.put(ContentModel.PROP_CONTENT, new ContentData(null, MimetypeMap.MIMETYPE_TEXT_PLAIN, 0L, "UTF-8"));

    // Create a new node 
    ChildAssociationRef childAssocRef = nodeService.createNode(
            rootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QName.createQName("test"),
            ContentModel.TYPE_CONTENT,
            bagOfProps);
    NodeRef noVersionNodeRef = childAssocRef.getChildRef();
    
    // Check out and check in
    NodeRef workingCopy = cociService.checkout(noVersionNodeRef);
    cociService.checkin(workingCopy, new HashMap<String, Serializable>());
    
    // Check that the origional node has no version history dispite sending verion props
    assertNull(this.versionService.getVersionHistory(noVersionNodeRef));        
}
 
Example 4
/**
 * Ensure that upper and lowercase URLs don't clash
 * @throws Exception
 */
public void testEnsureCaseSensitiveStorage() throws Exception
{
    ContentData contentData = getContentData();
    String contentUrlUpper = contentData.getContentUrl().toUpperCase();
    ContentData contentDataUpper = new ContentData(
            contentUrlUpper, MimetypeMap.MIMETYPE_TEXT_PLAIN, 0L, "UTF-8", new Locale("FR"));
    String contentUrlLower = contentData.getContentUrl().toLowerCase();
    ContentData contentDataLower = new ContentData(
            contentUrlLower, MimetypeMap.MIMETYPE_TEXT_PLAIN, 0L, "utf-8", new Locale("fr"));
    
    Pair<Long, ContentData> resultPairUpper = create(contentDataUpper);
    getAndCheck(resultPairUpper.getFirst(), contentDataUpper);
    
    Pair<Long, ContentData> resultPairLower = create(contentDataLower);
    getAndCheck(resultPairLower.getFirst(), contentDataLower);
}
 
Example 5
/**
 * 
 */
public void addContent(ContentData data) throws TransferException
{
    logger.debug("add content size:" + data.getSize());
    buffer.add(data);
    
    /**
     * work out whether the buffer has filled up and needs to be flushed
     */
    Iterator<ContentData> iter = buffer.iterator();      
    long totalContentSize = 0;
    
    while (iter.hasNext())
    {
        ContentData x = (ContentData)iter.next();
        totalContentSize += x.getSize();
    }
    if(logger.isDebugEnabled())
    {
        logger.debug("elements " + buffer.size() + ", totalContentSize:" + totalContentSize);
    }
    if(totalContentSize >= chunkSize)
    {
        flush();
    }
}
 
Example 6
/**
 * Return the Alfresco property value for the specified WebDAV property
 * 
 * @param davPropName String
 * @return Object
 */
public static Object getDAVPropertyValue( Map<QName, Serializable> props, String davPropName)
{
    // Convert the WebDAV property name to the corresponding Alfresco property
    
    QName propName = _propertyNameMap.get( davPropName);
    if ( propName == null)
        throw new AlfrescoRuntimeException("No mapping for WebDAV property " + davPropName);
    
    //  Return the property value
    Object value = props.get(propName);
    if (value instanceof ContentData)
    {
        ContentData contentData = (ContentData) value;
        if (davPropName.equals(WebDAV.XML_GET_CONTENT_TYPE))
        {
            value = contentData.getMimetype();
        }
        else if (davPropName.equals(WebDAV.XML_GET_CONTENT_LENGTH))
        {
            value = new Long(contentData.getSize());
        }
    }
    return value;
}
 
Example 7
public void testDelete() throws Exception
{
    ContentData contentData = getContentData();
    
    Pair<Long, ContentData> resultPair = create(contentData);
    getAndCheck(resultPair.getFirst(), contentData);
    delete(resultPair.getFirst());
    try
    {
        getAndCheck(resultPair.getFirst(), contentData);
        fail("Entity still exists");
    }
    catch (Throwable e)
    {
        // Expected
    }
}
 
Example 8
public void sendContent(final Transfer transfer, final Set<ContentData> data)
{
    transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            String transferId = transfer.getTransferId();
    
            for(ContentData content : data)
            {
                String contentUrl = content.getContentUrl();
                String fileName = TransferCommons.URLToPartName(contentUrl);

                InputStream contentStream = getContentService().getRawReader(contentUrl).getContentInputStream();
                receiver.saveContent(transferId, fileName, contentStream);
            }
            return null;
        }
    }, false, true);
}
 
Example 9
public void testAuditModel() throws Exception
{
    final File file = AbstractContentTransformerTest.loadQuickTestFile("pdf");
    assertNotNull(file);
    final URL url = new URL("file:" + file.getAbsolutePath());
    RetryingTransactionCallback<Pair<Long, ContentData>> callback = new RetryingTransactionCallback<Pair<Long, ContentData>>()
    {
        public Pair<Long, ContentData> execute() throws Throwable
        {
            Pair<Long, ContentData> auditModelPair = auditDAO.getOrCreateAuditModel(url);
            return auditModelPair;
        }
    };
    Pair<Long, ContentData> configPair = txnHelper.doInTransaction(callback);
    assertNotNull(configPair);
    // Now repeat.  The results should be exactly the same.
    Pair<Long, ContentData> configPairCheck = txnHelper.doInTransaction(callback);
    assertNotNull(configPairCheck);
    assertEquals(configPair, configPairCheck);
}
 
Example 10
protected Rendition toApiRendition(NodeRef renditionNodeRef)
{
    Rendition apiRendition = new Rendition();

    String renditionName = (String) nodeService.getProperty(renditionNodeRef, ContentModel.PROP_NAME);
    apiRendition.setId(renditionName);

    ContentData contentData = getContentData(renditionNodeRef, false);
    ContentInfo contentInfo = null;
    if (contentData != null)
    {
        contentInfo = new ContentInfo(contentData.getMimetype(),
                getMimeTypeDisplayName(contentData.getMimetype()),
                contentData.getSize(),
                contentData.getEncoding());
    }
    apiRendition.setContent(contentInfo);
    apiRendition.setStatus(RenditionStatus.CREATED);

    return apiRendition;
}
 
Example 11
/**
 * ALF-17483: It's possible that even for a single-valued contentdata property, its definition may have been changed
 * and the previous persisted value is multi-valued, so let's be careful about converting to ContentData.
 * 
 * @param object
 *            property value to convert
 * @return a ContentData if one can be extracted
 */
private static ContentData toContentData(Object object)
{
    if (object == null)
    {
        return null;
    }
    if (object instanceof ContentData)
    {
        return (ContentData) object;
    }
    if (object instanceof Collection<?> && !((Collection<?>) object).isEmpty())
    {
        return toContentData(((Collection<?>) object).iterator().next());
    }
    return null;
}
 
Example 12
public void testEquals()
{
    ContentData contentData1 = new ContentData("abc://xxx", MimetypeMap.MIMETYPE_BINARY, 600L, "UTF-8", Locale.ENGLISH);
    ContentData contentData2 = new ContentData("abc://xxx", MimetypeMap.MIMETYPE_BINARY, 600L, "UTF-8", Locale.ENGLISH);
    ContentData contentData3 = new ContentData("abc://XXX", MimetypeMap.MIMETYPE_BINARY, 600L, "UTF-8", Locale.ENGLISH);
    ContentData contentData4 = new ContentData("abc://xxx", MimetypeMap.MIMETYPE_TEXT_PLAIN, 600L, "UTF-8", Locale.ENGLISH);
    ContentData contentData5 = new ContentData("abc://xxx", MimetypeMap.MIMETYPE_BINARY, 500L, "UTF-8", Locale.ENGLISH);
    ContentData contentData6 = new ContentData("abc://xxx", MimetypeMap.MIMETYPE_BINARY, 600L, "UTF-16", Locale.ENGLISH);
    ContentData contentData7 = new ContentData("abc://xxx", MimetypeMap.MIMETYPE_BINARY, 600L, "UTF-8", Locale.CHINESE);
    assertEquals(contentData1, contentData2);
    assertNotSame(contentData1, contentData3);
    assertNotSame(contentData1, contentData4);
    assertNotSame(contentData1, contentData5);
    assertNotSame(contentData1, contentData6);
    assertNotSame(contentData1, contentData7);
}
 
Example 13
@Test
public void changedSourceToNonNull()
{
    NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg");
    render(ADMIN, sourceNodeRef, DOC_LIB);
    NodeRef rendition1 = waitForRendition(ADMIN, sourceNodeRef, DOC_LIB, true);
    ContentData contentData1 = DefaultTypeConverter.INSTANCE.convert(ContentData.class, nodeService.getProperty(rendition1, PROP_CONTENT));

    updateContent(ADMIN, sourceNodeRef, "quick.png");
    render(ADMIN, sourceNodeRef, DOC_LIB);
    NodeRef rendition2 = waitForRendition(ADMIN, sourceNodeRef, DOC_LIB, true);
    ContentData contentData2 = DefaultTypeConverter.INSTANCE.convert(ContentData.class, nodeService.getProperty(rendition2, PROP_CONTENT));

    assertEquals("The rendition node should not change", rendition1, rendition2);
    assertNotEquals("The content should have change", contentData1.toString(), contentData2.toString());
}
 
Example 14
@Category(PerformanceTests.class)
public void testCreateSpeedSingleTxn()
{
    RetryingTransactionCallback<List<Pair<Long, ContentData>>> writeCallback = new RetryingTransactionCallback<List<Pair<Long, ContentData>>>()
    {
        public List<Pair<Long, ContentData>> execute() throws Throwable
        {
            return speedTestWrite(getName(), 10000);
        }
    };
    final List<Pair<Long, ContentData>> pairs = txnHelper.doInTransaction(writeCallback, false, false);
    RetryingTransactionCallback<Void> readCallback = new RetryingTransactionCallback<Void>()
    {
        public Void execute() throws Throwable
        {
            speedTestRead(getName(), pairs);
            return null;
        }
    };
    txnHelper.doInTransaction(readCallback, false, false);
}
 
Example 15
protected ContentData getContentData(CMISNodeInfo nodeInfo)
{
    if (!nodeInfo.isDocument())
    {
        return null;
    }

    if (nodeInfo.containsPropertyValue(CONTENT_PROPERTY))
    {
        return (ContentData) nodeInfo.getPropertyValue(CONTENT_PROPERTY);
    } else
    {
        ContentData contentData = null;

        Serializable value = nodeInfo.getNodeProps().get(ContentModel.PROP_CONTENT);

        if (value != null)
        {
            contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, value);
        }

        nodeInfo.putPropertyValue(CONTENT_PROPERTY, contentData);
        return contentData;
    }
}
 
Example 16
@Before
public void before() throws Exception
{
    super.before();

    this.transactionHelper = (RetryingTransactionHelper)this.applicationContext.getBean("retryingTransactionHelper");

    // Create the node used for tests
    this.nodeRef = this.nodeService.createNode(
            this.rootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QName.createQName("{test}testnode"),
            ContentModel.TYPE_CONTENT).getChildRef();
    this.nodeService.setProperty(
            this.nodeRef,
            ContentModel.PROP_CONTENT,
            new ContentData(null, MimetypeMap.MIMETYPE_TEXT_PLAIN, 0L, null));
    this.folder = this.nodeService.createNode(
            this.rootNodeRef,
            ContentModel.ASSOC_CHILDREN,
            QName.createQName("{test}testFolder"),
            ContentModel.TYPE_FOLDER).getChildRef();
    
    // Register the test executor, if needed
    SleepActionExecuter.registerIfNeeded(applicationContext);
}
 
Example 17
/**
 * Returns the hash code of the source node's content url. As transformations may be returned in a different
 * sequences to which they were requested, this is used work out if a rendition should be replaced.
 */
private int getSourceContentHashCode(NodeRef sourceNodeRef)
{
    int hashCode = SOURCE_HAS_NO_CONTENT;
    ContentData contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, nodeService.getProperty(sourceNodeRef, PROP_CONTENT));
    if (contentData != null)
    {
        // Originally we used the contentData URL, but that is not enough if the mimetype changes.
        String contentString = contentData.getContentUrl()+contentData.getMimetype();
        if (contentString != null)
        {
            hashCode = contentString.hashCode();
        }
    }
    return hashCode;
}
 
Example 18
/**
 *
 * {@inheritDoc}
 */
@Override
protected ContentStore selectStoreForContentDataMove(final NodeRef nodeRef, final QName propertyQName, final ContentData contentData,
        final Serializable selectorValue)
{
    ContentStore targetStore;
    if (this.storeBySelectorPropertyValue.containsKey(selectorValue))
    {
        LOGGER.debug("Selecting store for value {} to move {}", selectorValue, contentData);
        targetStore = this.storeBySelectorPropertyValue.get(selectorValue);
    }
    else
    {
        LOGGER.debug("No store registered for value {} - delegating to super.selectStoreForContentDataMove to move {}", selectorValue,
                contentData);
        targetStore = super.selectStoreForContentDataMove(nodeRef, propertyQName, contentData, selectorValue);
    }
    return targetStore;
}
 
Example 19
/**
 * {@inheritDoc}
 */
@Override
public void initialize(final ContentContext context)
{
    final Object contentDataAttribute = ContentStoreContext.getContextAttribute(ContentStoreContext.DEFAULT_ATTRIBUTE_CONTENT_DATA);
    if (contentDataAttribute == null && context instanceof NodeContentContext)
    {
        final NodeRef nodeRef = ((NodeContentContext) context).getNodeRef();
        final QName propertyQName = ((NodeContentContext) context).getPropertyQName();

        final Serializable currentValue = AuthenticationUtil.runAsSystem(() -> this.nodeService.getProperty(nodeRef, propertyQName));

        if (currentValue instanceof ContentData)
        {
            ContentStoreContext.setContextAttribute(ContentStoreContext.DEFAULT_ATTRIBUTE_CONTENT_DATA, currentValue);
        }
    }
}
 
Example 20
@Override
public void updateContentData(Long id, ContentData contentData)
{
    if (id == null)
    {
        throw new IllegalArgumentException("Cannot look up ContentData by null ID.");
    }
    if (contentData == null)
    {
        throw new IllegalArgumentException("Cannot update ContentData with a null.");
    }
    contentData = sanitizeMimetype(contentData);
    int updated = contentDataCache.updateValue(id, contentData);
    if (updated < 1)
    {
        throw new ConcurrencyFailureException("ContentData with ID " + id + " not updated");
    }
}
 
Example 21
public ContentInfo getContentInfo(Map<QName, Serializable> props)
{
    final Serializable content = props.get(ContentModel.PROP_CONTENT);
    ContentInfo contentInfo = null;
    if ((content instanceof ContentData))
    {
        ContentData cd = (ContentData) content;
        contentInfo = new ContentInfo(cd.getMimetype(), cd.getSize(), cd.getEncoding());
    }
    return contentInfo;
}
 
Example 22
/**
 * Tests that tag scopes are properly updated. Cache on the first layer MUST NOT be empty. All other tag scopes MUST BE null
 * 
 * @throws Exception
 */
@Test
public void testSimpleTagScopesUpsdate() throws Exception
{
    Action tagScopeUpdateAction = actionService.createAction(UpdateTagScopesActionExecuter.NAME);
    tagScopeUpdateAction.setParameterValue(UpdateTagScopesActionExecuter.PARAM_TAG_SCOPES, (Serializable) expectedTagScopes);
    actionExecuter.execute(tagScopeUpdateAction, null);

    Iterator<NodeRef> iterator = expectedTagScopes.iterator();
    assertTrue(iterator.hasNext());

    NodeRef taggedTagScope = iterator.next();
    assertNotNull(taggedTagScope);

    ContentData contentData = getTagScopeCacheContentDataProperty(taggedTagScope);
    assertNotNull(contentData);
    assertTrue(contentData.getSize() > 0L);

    assertTrue(iterator.hasNext());

    for (NodeRef tagScopeFolder = iterator.next(); iterator.hasNext(); tagScopeFolder = iterator.next())
    {
        assertNotNull(tagScopeFolder);
        contentData = getTagScopeCacheContentDataProperty(tagScopeFolder);
        assertNull(contentData);
    }
}
 
Example 23
/**
 * Determine whether the thumbnail meta-data matches the given mimetype and options
 * 
 * If mimetype and transformation options are null then match is guarenteed
 * 
 * @param  thumbnail     thumbnail node reference
 * @param  mimetype      mimetype
 * @param  options       transformation options
 * @return boolean       true if the mimetype and options match the thumbnail metadata, false otherwise
 */
private boolean matchMimetypeOptions(NodeRef thumbnail, String mimetype, TransformationOptions options)
{
    boolean result = true;
    
    if (mimetype != null)
    {
        // Check the mimetype
        String thumbnailMimetype = ((ContentData) this.nodeService.getProperty(thumbnail, ContentModel.PROP_CONTENT)).getMimetype();

        if (mimetype.endsWith(SUBTYPES_POSTFIX))
        {
            String baseMimetype = mimetype.substring(0, mimetype.length() - SUBTYPES_POSTFIX.length());
            if (thumbnailMimetype == null || thumbnailMimetype.startsWith(baseMimetype) == false)
            {
                result = false;
            }
        }
        else
        {
            if (mimetype.equals(thumbnailMimetype) == false)
            {
                result = false;
            }
        }
    }
    
    if (result != false && options != null)
    {
        // TODO .. check for matching options here ...
    }
    
    return result;
}
 
Example 24
private void setImageContentOnNode(NodeRef nodeWithImage, String mimetypeImage, File imageFile)
{
    assertTrue(imageFile.exists());
    nodeService.setProperty(nodeWithImage, ContentModel.PROP_CONTENT, new ContentData(null,
                mimetypeImage, 0L, null));
    ContentWriter writer = contentService.getWriter(nodeWithImage, ContentModel.PROP_CONTENT, true);
    writer.setMimetype(mimetypeImage);
    writer.setEncoding("UTF-8");
    writer.putContent(imageFile);
}
 
Example 25
/**
 * Gets the content properties for a node
 * @param node the node to process
 */
public static Set<ContentData> getContentData(TransferManifestNormalNode node)
{
    Set<ContentData> content = new HashSet<ContentData>();
    
    for(Serializable value : node.getProperties().values())
    {
        if(value instanceof ContentData)
        {
            content.add((ContentData)value);
        }
    }
    
    return content;
}
 
Example 26
private Pair<Long, ContentData> update(final Long id, final ContentData contentData)
{
    RetryingTransactionCallback<Pair<Long, ContentData>> callback = new RetryingTransactionCallback<Pair<Long, ContentData>>()
    {
        public Pair<Long, ContentData> execute() throws Throwable
        {
            contentDataDAO.updateContentData(id, contentData);
            return new Pair<Long, ContentData>(id, contentData);
        }
    };
    return txnHelper.doInTransaction(callback, false, false);
}
 
Example 27
/**
 * @param nodeToUpdate NodeRef
 * @param contentProps Map<QName, Serializable>
 * @return true if any content property has been updated for the needToUpdate node
 */
private boolean writeContent(NodeRef nodeToUpdate, Map<QName, Serializable> contentProps)
{
    boolean contentUpdated = false;
    File stagingDir = getStagingFolder();
    for (Map.Entry<QName, Serializable> contentEntry : contentProps.entrySet())
    {
        ContentData contentData = (ContentData) contentEntry.getValue();
        String contentUrl = contentData.getContentUrl();
        if(contentUrl == null || contentUrl.isEmpty())
        {
            log.debug("content data is null or empty:" + nodeToUpdate);
            ContentData cd = new ContentData(null, null, 0, null);
            nodeService.setProperty(nodeToUpdate, contentEntry.getKey(), cd);
            contentUpdated = true;
        }
        else
        {
            String fileName = TransferCommons.URLToPartName(contentUrl);
            File stagedFile = new File(stagingDir, fileName);
            if (!stagedFile.exists())
            {
                error(MSG_REFERENCED_CONTENT_FILE_MISSING);
            }
            ContentWriter writer = contentService.getWriter(nodeToUpdate, contentEntry.getKey(), true);
            writer.setEncoding(contentData.getEncoding());
            writer.setMimetype(contentData.getMimetype());
            writer.setLocale(contentData.getLocale());
            writer.putContent(stagedFile);
            contentUpdated = true;
        }
    }
    return contentUpdated;
}
 
Example 28
/**
 * inject transferred
 */
private void injectTransferred(Map<QName, Serializable> props)
{       
    if(!props.containsKey(TransferModel.PROP_REPOSITORY_ID))
    {
        log.debug("injecting repositoryId property");
        props.put(TransferModel.PROP_REPOSITORY_ID, header.getRepositoryId());
    }
    props.put(TransferModel.PROP_FROM_REPOSITORY_ID, header.getRepositoryId());
    
    /**
     * For each property
     */
    List<String> contentProps = new ArrayList<String>();
    for (Serializable value : props.values())
    {
        if ((value != null) && ContentData.class.isAssignableFrom(value.getClass()))
        {
            ContentData srcContent = (ContentData)value;

            if(srcContent.getContentUrl() != null && !srcContent.getContentUrl().isEmpty())
            {
                log.debug("adding part name to from content field");
                contentProps.add(TransferCommons.URLToPartName(srcContent.getContentUrl()));
            }  
        }
    }
    
    props.put(TransferModel.PROP_FROM_CONTENT, (Serializable)contentProps);
}
 
Example 29
public void onCreateNode(ChildAssociationRef childAssocRef)
{
    NodeRef nodeRef = childAssocRef.getChildRef();
    if (stores.contains(tenantService.getBaseName(nodeRef.getStoreRef()).toString()) && (! alreadyCreated(nodeRef)))
    {
        // TODO use data dictionary to get content property
        ContentData contentData = (ContentData)nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT);
        
        if (contentData != null)
        {
            long contentSize = contentData.getSize();
            
            // Get owner/creator
            String owner = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_OWNER);
            if ((owner == null) || (owner.equals(OwnableService.NO_OWNER)))
            {
                owner = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_CREATOR);
            }
            
            if (contentSize != 0 && owner != null)
            {
               // increment usage if node is being created
               if (logger.isDebugEnabled()) logger.debug("onCreateNode: nodeRef="+nodeRef+", owner="+owner+", contentSize="+contentSize);
               incrementUserUsage(owner, contentSize, nodeRef);
               recordCreate(nodeRef);
            }
        }
    }
}
 
Example 30
private String getMimeType(ContentData contentProperty)
{
    String mimetype = null;

    if(contentProperty != null)
    {
        mimetype = contentProperty.getMimetype();
    }

    return mimetype;
}