/** * Persists the given field data as the encoding property * * @param nodeRef The NodeRef to update the encoding for * @param fieldData The data representing the new encoding value * @param propsToPersist Map of properties to be persisted */ protected void processEncodingPropertyPersist(NodeRef nodeRef, FieldData fieldData, Map<QName, Serializable> propsToPersist) { ContentData contentData = (ContentData) propsToPersist.get(ContentModel.PROP_CONTENT); if (contentData == null) { // content data has not been persisted yet so get it from the node contentData = (ContentData) this.nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); } if (contentData != null) { // update content data if we found the property contentData = ContentData.setEncoding(contentData, (String) fieldData.getValue()); propsToPersist.put(ContentModel.PROP_CONTENT, contentData); } }
/** * Persists the given field data as the encoding property * * @param nodeRef The NodeRef to update the encoding for * @param fieldData The data representing the new encoding value * @param propsToPersist Map of properties to be persisted */ protected void processEncodingPropertyPersist(NodeRef nodeRef, FieldData fieldData, Map<QName, Serializable> propsToPersist) { ContentData contentData = (ContentData) propsToPersist.get(ContentModel.PROP_CONTENT); if (contentData == null) { // content data has not been persisted yet so get it from the node contentData = (ContentData) this.nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); } if (contentData != null) { // update content data if we found the property contentData = ContentData.setEncoding(contentData, (String) fieldData.getValue()); propsToPersist.put(ContentModel.PROP_CONTENT, contentData); } }
public void setEncoding(String encoding) { this.contentData = ContentData.setEncoding(this.contentData, encoding); services.getNodeService().setProperty(nodeRef, this.property, this.contentData); updateContentData(false); }
public void setEncoding(String encoding) { this.contentData = ContentData.setEncoding(this.contentData, encoding); services.getNodeService().setProperty(nodeRef, this.property, this.contentData); updateContentData(false); }
contentData = ContentData.setEncoding(contentData, mimetypeEncoding.getEncoding());
contentData = ContentData.setEncoding(contentData, mimetypeEncoding.getEncoding());
contentData = ContentData.setMimetype(contentData, mimetypeEncoding.getMimetype()); contentData = ContentData.setEncoding(contentData, mimetypeEncoding.getEncoding());
public void testUpdate() throws Exception { ContentData contentData = getContentData(); Pair<Long, ContentData> resultPair = create(contentData); Long id = resultPair.getFirst(); // Update contentData = ContentData.setMimetype(contentData, "TEXT/HTML"); // Note the upper case mimetype contentData = ContentData.setEncoding(contentData, "UTF-16"); // Don't update the content itself update(id, contentData); // Check Pair<Long, ContentData> result = getAndCheck(id, contentData); // Check the mimetype has been lowercased assertEquals("text/html", result.getSecond().getMimetype()); }