Allow for export of all Repository content including version store. Required:

- supporting content in ANY properties (for Content Service and Exporter)
- moving Content related permission to sys:base as type can support a property of datatype CONTENT

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2505 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2006-02-28 17:11:17 +00:00
parent 2c88c5f17a
commit 32990f3d62
17 changed files with 408 additions and 146 deletions

View File

@@ -37,3 +37,7 @@ patch.guestPersonPermission.result=Updated Guest Person permission from 'Consume
patch.spacesRootPermission.description=Change Spaces store root permission from 'Consumer' to 'Read' patch.spacesRootPermission.description=Change Spaces store root permission from 'Consumer' to 'Read'
patch.spacesRootPermission.result=Updated Spaces store root permission from 'Consumer' to 'Read' patch.spacesRootPermission.result=Updated Spaces store root permission from 'Consumer' to 'Read'
patch.contentPermission.description=Update permission entries from 'cm:content' to 'sys:base'.
patch.contentPermission.result=Created the following permission reference names: {0}. \nUpdated {1} permission entries.

View File

@@ -66,6 +66,7 @@
<permissionGroup name="Write" expose="true" allowFullControl="false" /> <permissionGroup name="Write" expose="true" allowFullControl="false" />
<permissionGroup name="Delete" expose="true" allowFullControl="false" /> <permissionGroup name="Delete" expose="true" allowFullControl="false" />
<permissionGroup name="AddChildren" expose="true" allowFullControl="false" /> <permissionGroup name="AddChildren" expose="true" allowFullControl="false" />
<permissionGroup name="Execute" allowFullControl="false" expose="false"/>
<!-- =========== --> <!-- =========== -->
<!-- Permissions --> <!-- Permissions -->
@@ -121,6 +122,33 @@
<!-- permission just to show the delete icon. --> <!-- permission just to show the delete icon. -->
<!-- --> <!-- -->
<!-- The permission to read content. -->
<permission name="ReadContent" expose="false">
<grantedToGroup permissionGroup="Read"/>
<!-- Commented out parent permission check ...
<requiredPermission on="parent" name="ReadChildren" implies="false"/>
-->
</permission>
<!-- The permission to write content. -->
<permission name="WriteContent" expose="false">
<grantedToGroup permissionGroup="Write" />
<!-- Commented out parent permission check ...
<requiredPermission on="parent" name="ReadChildren" implies="false"/>
-->
</permission>
<!-- Execute permission on content. -->
<permission name="ExecuteContent" expose="false">
<grantedToGroup permissionGroup="Execute" />
<!-- Commented out parent permission check ...
<requiredPermission on="parent" name="ReadChildren" implies="false"/>
-->
</permission>
<permission name="DeleteNode" expose="true" > <permission name="DeleteNode" expose="true" >
<grantedToGroup permissionGroup="Delete" /> <grantedToGroup permissionGroup="Delete" />
<!-- Commented out parent permission check ... <!-- Commented out parent permission check ...
@@ -264,41 +292,7 @@
<permissionSet type="cm:content" expose="selected"> <permissionSet type="cm:content" expose="selected">
<!-- Extend some base permission groups to include permissoins related to content. --> <!-- Content specific roles. -->
<permissionGroup name="Read" extends="true" expose="false"/>
<permissionGroup name="Write" extends="true" expose="false"/>
<!-- Add an execute permission group. -->
<permissionGroup name="Execute" allowFullControl="false" expose="false"/>
<!-- Content specific low-level permissions. -->
<!-- The permission to read content. -->
<permission name="ReadContent" expose="false">
<grantedToGroup permissionGroup="Read"/>
<!-- Commented out parent permission check ...
<requiredPermission on="parent" name="ReadChildren" implies="false"/>
-->
</permission>
<!-- The permission to write content. -->
<permission name="WriteContent" expose="false">
<grantedToGroup permissionGroup="Write" />
<!-- Commented out parent permission check ...
<requiredPermission on="parent" name="ReadChildren" implies="false"/>
-->
</permission>
<!-- Execute permission on content. -->
<permission name="ExecuteContent" expose="false">
<grantedToGroup permissionGroup="Execute" />
<!-- Commented out parent permission check ...
<requiredPermission on="parent" name="ReadChildren" implies="false"/>
-->
</permission>
<permissionGroup name="Coordinator" extends="true" expose="true"/> <permissionGroup name="Coordinator" extends="true" expose="true"/>
<permissionGroup name="Collaborator" extends="true" expose="true"/> <permissionGroup name="Collaborator" extends="true" expose="true"/>

View File

@@ -265,5 +265,20 @@
<ref bean="spacesBootstrap" /> <ref bean="spacesBootstrap" />
</property> </property>
</bean> </bean>
<bean id="patch.contentPermission" class="org.alfresco.repo.admin.patch.impl.ContentPermissionPatch" parent="basePatch" >
<property name="id"><value>patch.contentPermission</value></property>
<property name="description"><value>patch.contentPermission.description</value></property>
<property name="fixesFromSchema"><value>0</value></property>
<property name="fixesToSchema"><value>6</value></property>
<property name="targetSchema"><value>7</value></property>
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
<property name="dependsOn">
<list>
<ref bean="patch.updateGuestPermission" />
</list>
</property>
</bean>
</beans> </beans>

View File

@@ -378,8 +378,8 @@
<property name="afterInvocationManager"><ref local="afterInvocationManager"/></property> <property name="afterInvocationManager"><ref local="afterInvocationManager"/></property>
<property name="objectDefinitionSource"> <property name="objectDefinitionSource">
<value> <value>
org.alfresco.service.cmr.repository.ContentService.getReader=ACL_NODE.0.cm:content.ReadContent org.alfresco.service.cmr.repository.ContentService.getReader=ACL_NODE.0.sys:base.ReadContent
org.alfresco.service.cmr.repository.ContentService.getWriter=ACL_NODE.0.cm:content.WriteContent org.alfresco.service.cmr.repository.ContentService.getWriter=ACL_NODE.0.sys:base.WriteContent
org.alfresco.service.cmr.repository.ContentService.isTransformable=ACL_ALLOW org.alfresco.service.cmr.repository.ContentService.isTransformable=ACL_ALLOW
org.alfresco.service.cmr.repository.ContentService.transform=ACL_ALLOW org.alfresco.service.cmr.repository.ContentService.transform=ACL_ALLOW
org.alfresco.service.cmr.repository.ContentService.getTempWriter=ACL_ALLOW org.alfresco.service.cmr.repository.ContentService.getTempWriter=ACL_ALLOW

View File

@@ -15,4 +15,4 @@ version.edition=Community Network
# Schema number # Schema number
version.schema=6 version.schema=7

View File

@@ -0,0 +1,127 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.repo.admin.patch.impl;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.repo.admin.patch.AbstractPatch;
import org.alfresco.repo.security.permissions.impl.hibernate.PermissionReference;
import org.alfresco.repo.security.permissions.impl.hibernate.PermissionReferenceImpl;
import org.alfresco.service.namespace.QName;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* Roles defined in permissionsDefinition.xml moved from <b>cm:content</b> to <b>sys:base</b>.
* This effects the data stored in the <b>node_perm_entry</b> table.
*
* @author Derek Hulley
*/
public class ContentPermissionPatch extends AbstractPatch
{
private static final String MSG_SUCCESS = "patch.contentPermission.result";
private HibernateHelper helper;
public ContentPermissionPatch()
{
helper = new HibernateHelper();
}
public void setSessionFactory(SessionFactory sessionFactory)
{
this.helper.setSessionFactory(sessionFactory);
}
@Override
protected String applyInternal() throws Exception
{
List<String> createdNames = helper.createPermissionReferences();
int updatedEntries = helper.updatePermissionEntries();
// build the result message
String msg = I18NUtil.getMessage(MSG_SUCCESS, createdNames, updatedEntries);
// done
return msg;
}
private static class HibernateHelper extends HibernateDaoSupport
{
private static final String TYPE_URI_OLD = "http://www.alfresco.org/model/content/1.0";
private static final String TYPE_NAME_OLD = "content";
private static final String TYPE_URI_NEW = "http://www.alfresco.org/model/system/1.0";
private static final String TYPE_NAME_NEW = "base";
private static final String[] NAMES = new String[] {"Execute", "ReadContent", "WriteContent", "ExecuteContent"};
private static final String QUERY_UPDATE_PERM_ENTRY_TYPE = "permission.patch.UpdatePermissionEntryType";
public List<String> createPermissionReferences()
{
List<String> createdNames = new ArrayList<String>(4);
for (String name : NAMES)
{
// create permission references as required, double checking for their existence first
PermissionReference ref = new PermissionReferenceImpl();
ref.setTypeUri(TYPE_URI_NEW);
ref.setTypeName(TYPE_NAME_NEW);
ref.setName(name);
// it acts as its own key
PermissionReference found = (PermissionReference) getHibernateTemplate().get(
PermissionReferenceImpl.class,
ref);
if (found == null)
{
// it was not found, so create it
getHibernateTemplate().save(ref);
createdNames.add(QName.createQName(TYPE_URI_NEW, TYPE_NAME_NEW).toString() + "/" + name);
}
}
return createdNames;
}
public int updatePermissionEntries()
{
HibernateCallback callback = new HibernateCallback()
{
public Object doInHibernate(Session session)
{
// flush any outstanding entities
session.flush();
Query query = session.getNamedQuery(HibernateHelper.QUERY_UPDATE_PERM_ENTRY_TYPE);
query.setString("typeNameNew", TYPE_NAME_NEW)
.setString("typeNameOld", TYPE_NAME_OLD)
.setString("typeUriNew", TYPE_URI_NEW)
.setString("typeUriOld", TYPE_URI_OLD)
.setParameterList("names", NAMES);
int updateCount = query.executeUpdate();
return new Integer(updateCount);
}
};
Integer updateCount = (Integer) getHibernateTemplate().execute(callback);
// done
return updateCount.intValue();
}
}
}

View File

@@ -236,22 +236,31 @@ public class RoutingContentService implements ContentService
{ {
return getReader(nodeRef, propertyQName, true); return getReader(nodeRef, propertyQName, true);
} }
private ContentReader getReader(NodeRef nodeRef, QName propertyQName, boolean fireContentReadPolicy) private ContentReader getReader(NodeRef nodeRef, QName propertyQName, boolean fireContentReadPolicy)
{ {
// ensure that the node property is of type content // get the property value
PropertyDefinition contentPropDef = dictionaryService.getProperty(propertyQName); ContentData contentData = null;
if (contentPropDef == null || !contentPropDef.getDataType().getName().equals(DataTypeDefinition.CONTENT)) Serializable propValue = nodeService.getProperty(nodeRef, propertyQName);
if (propValue instanceof ContentData)
{ {
throw new InvalidTypeException("The node property must be of type content: \n" + contentData = (ContentData)propValue;
" node: " + nodeRef + "\n" + }
" property name: " + propertyQName + "\n" +
" property type: " + ((contentPropDef == null) ? "unknown" : contentPropDef.getDataType()), // ensure that the node property is of type content
propertyQName); if (contentData == null)
{
PropertyDefinition contentPropDef = dictionaryService.getProperty(propertyQName);
if (contentPropDef == null || !(contentPropDef.getDataType().getName().equals(DataTypeDefinition.CONTENT)))
{
throw new InvalidTypeException("The node property must be of type content: \n" +
" node: " + nodeRef + "\n" +
" property name: " + propertyQName + "\n" +
" property type: " + ((contentPropDef == null) ? "unknown" : contentPropDef.getDataType()),
propertyQName);
}
} }
// get the content property
ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, propertyQName);
// check that the URL is available // check that the URL is available
if (contentData == null || contentData.getContentUrl() == null) if (contentData == null || contentData.getContentUrl() == null)
{ {

View File

@@ -142,6 +142,12 @@ public class ACPExportPackageHandler
*/ */
public ContentData exportContent(InputStream content, ContentData contentData) public ContentData exportContent(InputStream content, ContentData contentData)
{ {
// if the content stream to output is empty, then just return content descriptor as is
if (content == null)
{
return contentData;
}
// create zip entry for stream to export // create zip entry for stream to export
String contentDirPath = contentDir.getPath(); String contentDirPath = contentDir.getPath();
if (contentDirPath.indexOf(".") != -1) if (contentDirPath.indexOf(".") != -1)

View File

@@ -18,7 +18,6 @@ package org.alfresco.repo.exporter;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.ContentData;
@@ -234,6 +233,28 @@ import org.alfresco.service.namespace.QName;
} }
} }
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#startValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
public void startValueCollection(NodeRef nodeRef, QName property)
{
for (Exporter exporter : exporters)
{
exporter.startValueCollection(nodeRef, property);
}
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#endValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
public void endValueCollection(NodeRef nodeRef, QName property)
{
for (Exporter exporter : exporters)
{
exporter.endValueCollection(nodeRef, property);
}
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable) * @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable)
*/ */
@@ -245,17 +266,6 @@ import org.alfresco.service.namespace.QName;
} }
} }
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Collection)
*/
public void value(NodeRef nodeRef, QName property, Collection values)
{
for (Exporter exporter : exporters)
{
exporter.value(nodeRef, property, values);
}
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#content(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.InputStream) * @see org.alfresco.service.cmr.view.Exporter#content(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.InputStream)
*/ */

View File

@@ -33,6 +33,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -396,66 +397,16 @@ public class ExporterComponent
// start export of property // start export of property
exporter.startProperty(nodeRef, property); exporter.startProperty(nodeRef, property);
// get the property type if (value instanceof Collection)
PropertyDefinition propertyDef = dictionaryService.getProperty(property);
boolean isContentProperty = (propertyDef == null) ? false : propertyDef.getDataType().getName().equals(DataTypeDefinition.CONTENT);
if (isContentProperty)
{ {
// export property of datatype CONTENT for (Object valueInCollection : (Collection)value)
ContentReader reader = contentService.getReader(nodeRef, property);
if (reader == null || reader.exists() == false)
{ {
exporter.warning("Failed to read content for property " + property + " on node " + nodeRef); walkProperty(nodeRef, property, valueInCollection, parameters, exporter);
}
else
{
// filter out content if not required
if (parameters.isCrawlContent())
{
InputStream inputStream = reader.getContentInputStream();
try
{
exporter.content(nodeRef, property, inputStream, reader.getContentData());
}
finally
{
try
{
inputStream.close();
}
catch(IOException e)
{
throw new ExporterException("Failed to export node content for node " + nodeRef, e);
}
}
}
else
{
// skip content values
exporter.content(nodeRef, property, null, null);
}
} }
} }
else else
{ {
// Export all other datatypes walkProperty(nodeRef, property, value, parameters, exporter);
try
{
if (value instanceof Collection)
{
exporter.value(nodeRef, property, (Collection)value);
}
else
{
exporter.value(nodeRef, property, value);
}
}
catch(TypeConversionException e)
{
exporter.warning("Value of property " + property + " could not be converted to xml string");
exporter.value(nodeRef, property, properties.get(property).toString());
}
} }
// end export of property // end export of property
@@ -511,6 +462,81 @@ public class ExporterComponent
exporter.endNode(nodeRef); exporter.endNode(nodeRef);
} }
/**
* Export Property
*
* @param nodeRef
* @param property
* @param value
* @param parameters
* @param exporter
*/
private void walkProperty(NodeRef nodeRef, QName property, Object value, ExporterCrawlerParameters parameters, Exporter exporter)
{
// determine data type of value
PropertyDefinition propDef = dictionaryService.getProperty(property);
DataTypeDefinition dataTypeDef = (propDef == null) ? null : propDef.getDataType();
QName valueDataType = null;
if (dataTypeDef == null || dataTypeDef.getName().equals(DataTypeDefinition.ANY))
{
dataTypeDef = (value == null) ? null : dictionaryService.getDataType(value.getClass());
if (dataTypeDef != null)
{
valueDataType = dataTypeDef.getName();
}
}
else
{
valueDataType = dataTypeDef.getName();
}
if (valueDataType == null || !valueDataType.equals(DataTypeDefinition.CONTENT))
{
// Export non content data types
try
{
exporter.value(nodeRef, property, value);
}
catch(TypeConversionException e)
{
exporter.warning("Value of property " + property + " could not be converted to xml string");
exporter.value(nodeRef, property, value.toString());
}
}
else
{
// export property of datatype CONTENT
ContentReader reader = contentService.getReader(nodeRef, property);
if (!parameters.isCrawlContent() || reader == null || reader.exists() == false)
{
// export an empty url for the content
ContentData contentData = (ContentData)value;
ContentData noContentURL = new ContentData("", contentData.getMimetype(), contentData.getSize(), contentData.getEncoding());
exporter.content(nodeRef, property, null, noContentURL);
exporter.warning("Skipped content for property " + property + " on node " + nodeRef);
}
else
{
InputStream inputStream = reader.getContentInputStream();
try
{
exporter.content(nodeRef, property, inputStream, reader.getContentData());
}
finally
{
try
{
inputStream.close();
}
catch(IOException e)
{
throw new ExporterException("Failed to export node content for node " + nodeRef, e);
}
}
}
}
}
/** /**
* Export Secondary Links * Export Secondary Links
* *

View File

@@ -20,7 +20,6 @@ import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Collection;
import org.alfresco.repo.security.authentication.AuthenticationComponent; import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
@@ -151,16 +150,21 @@ public class ExporterComponentTest extends BaseSpringTest
// System.out.println("TestProgress: end property " + property); // System.out.println("TestProgress: end property " + property);
} }
public void startValueCollection(NodeRef nodeRef, QName property)
{
// System.out.println("TestProgress: start value collection: node " + nodeRef + " , property " + property);
}
public void endValueCollection(NodeRef nodeRef, QName property)
{
// System.out.println("TestProgress: end value collection: node " + nodeRef + " , property " + property);
}
public void value(NodeRef nodeRef, QName property, Object value) public void value(NodeRef nodeRef, QName property, Object value)
{ {
// System.out.println("TestProgress: single value " + value); // System.out.println("TestProgress: single value " + value);
} }
public void value(NodeRef nodeRef, QName property, Collection values)
{
// System.out.println("TestProgress: multi value " + value);
}
public void content(NodeRef nodeRef, QName property, InputStream content, ContentData contentData) public void content(NodeRef nodeRef, QName property, InputStream content, ContentData contentData)
{ {
// System.out.println("TestProgress: content stream "); // System.out.println("TestProgress: content stream ");

View File

@@ -113,6 +113,12 @@ public class FileExportPackageHandler
*/ */
public ContentData exportContent(InputStream content, ContentData contentData) public ContentData exportContent(InputStream content, ContentData contentData)
{ {
// if the content stream to output is empty, then just return content descriptor as is
if (content == null)
{
return contentData;
}
// Lazily create package directory // Lazily create package directory
try try
{ {

View File

@@ -17,7 +17,6 @@
package org.alfresco.repo.exporter; package org.alfresco.repo.exporter;
import java.io.InputStream; import java.io.InputStream;
import java.util.Collection;
import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -186,6 +185,22 @@ import org.alfresco.util.ParameterCheck;
exporter.endProperty(nodeRef, property); exporter.endProperty(nodeRef, property);
} }
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#startValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
public void startValueCollection(NodeRef nodeRef, QName property)
{
exporter.startValueCollection(nodeRef, property);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#endValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
public void endValueCollection(NodeRef nodeRef, QName property)
{
exporter.endValueCollection(nodeRef, property);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable) * @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable)
*/ */
@@ -194,14 +209,6 @@ import org.alfresco.util.ParameterCheck;
exporter.value(nodeRef, property, value); exporter.value(nodeRef, property, value);
} }
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Collection)
*/
public void value(NodeRef nodeRef, QName property, Collection values)
{
exporter.value(nodeRef, property, values);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#content(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.InputStream) * @see org.alfresco.service.cmr.view.Exporter#content(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.InputStream)
*/ */
@@ -209,7 +216,7 @@ import org.alfresco.util.ParameterCheck;
{ {
// Handle the stream by converting it to a URL and export the URL // Handle the stream by converting it to a URL and export the URL
ContentData exportedContentData = streamHandler.exportContent(content, contentData); ContentData exportedContentData = streamHandler.exportContent(content, contentData);
value(nodeRef, property, exportedContentData.toString()); value(nodeRef, property, exportedContentData);
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@@ -457,6 +457,38 @@ import org.xml.sax.helpers.AttributesImpl;
} }
} }
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#startValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
public void startValueCollection(NodeRef nodeRef, QName property)
{
try
{
// start collection
contentHandler.startElement(NamespaceService.REPOSITORY_VIEW_PREFIX, VALUES_LOCALNAME, toPrefixString(VALUES_QNAME), EMPTY_ATTRIBUTES);
}
catch (SAXException e)
{
throw new ExporterException("Failed to process start collection event - nodeRef " + nodeRef + "; property " + toPrefixString(property), e);
}
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#endValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
public void endValueCollection(NodeRef nodeRef, QName property)
{
try
{
// end collection
contentHandler.endElement(NamespaceService.REPOSITORY_VIEW_PREFIX, VALUES_LOCALNAME, toPrefixString(VALUES_QNAME));
}
catch (SAXException e)
{
throw new ExporterException("Failed to process end collection event - nodeRef " + nodeRef + "; property " + toPrefixString(property), e);
}
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable) * @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable)
*/ */

View File

@@ -149,7 +149,19 @@
typeName = :typeNameOld and typeName = :typeNameOld and
name in ('Coordinator', 'Contributor', 'Editor', 'Guest') name in ('Coordinator', 'Contributor', 'Editor', 'Guest')
</query> </query>
<query name="permission.patch.UpdatePermissionEntryType" >
update
org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntryImpl as entry
set
typeUri = :typeUriNew,
typeName = :typeNameNew
where
typeUri = :typeUriOld and
typeName = :typeNameOld and
name in ( :names )
</query>
<query name="permission.patch.UpdatePermissionName" > <query name="permission.patch.UpdatePermissionName" >
update update
org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntryImpl as entry org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntryImpl as entry

View File

@@ -17,7 +17,6 @@
package org.alfresco.service.cmr.view; package org.alfresco.service.cmr.view;
import java.io.InputStream; import java.io.InputStream;
import java.util.Collection;
import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -163,6 +162,14 @@ public interface Exporter
*/ */
public void endProperties(NodeRef nodeRef); public void endProperties(NodeRef nodeRef);
/**
* Export start of value collection
*
* @param nodeRef the node reference
* @param property the property name
*/
public void startValueCollection(NodeRef nodeRef, QName property);
/** /**
* Export single valued property * Export single valued property
* *
@@ -173,16 +180,15 @@ public interface Exporter
public void value(NodeRef nodeRef, QName property, Object value); public void value(NodeRef nodeRef, QName property, Object value);
/** /**
* Export multi valued property * Export end of value collection
* *
* @param nodeRef the node reference * @param nodeRef the node reference
* @param property the property name * @param property the property name
* @param value the value
*/ */
public void value(NodeRef nodeRef, QName property, Collection values); public void endValueCollection(NodeRef nodeRef, QName property);
/** /**
* Export content stream * Export content stream property
* *
* @param nodeRef the node reference * @param nodeRef the node reference
* @param property the property name * @param property the property name

View File

@@ -18,10 +18,9 @@ package org.alfresco.tools;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.util.Collection;
import org.alfresco.repo.exporter.FileExportPackageHandler;
import org.alfresco.repo.exporter.ACPExportPackageHandler; import org.alfresco.repo.exporter.ACPExportPackageHandler;
import org.alfresco.repo.exporter.FileExportPackageHandler;
import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -239,6 +238,7 @@ public final class Export extends Tool
} }
catch(ExporterException e) catch(ExporterException e)
{ {
e.printStackTrace();
throw new ToolException("Failed to export", e); throw new ToolException("Failed to export", e);
} }
} }
@@ -552,16 +552,23 @@ public final class Export extends Tool
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable) * @see org.alfresco.service.cmr.view.Exporter#startValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/ */
public void value(NodeRef nodeRef, QName property, Object value) public void startValueCollection(NodeRef nodeRef, QName property)
{ {
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Collection) * @see org.alfresco.service.cmr.view.Exporter#endValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/ */
public void value(NodeRef nodeRef, QName property, Collection values) public void endValueCollection(NodeRef nodeRef, QName property)
{
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable)
*/
public void value(NodeRef nodeRef, QName property, Object value)
{ {
} }
@@ -627,10 +634,7 @@ public final class Export extends Tool
*/ */
public void endReference(NodeRef nodeRef) public void endReference(NodeRef nodeRef)
{ {
// TODO Auto-generated method stub
} }
} }
} }