07-12-2007 08:52 PM
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.sample;
import java.util.List;
import net.sf.jooreports.openoffice.connection.OpenOfficeConnection;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sun.star.uno.UnoRuntime;
/**
* Logger action executer.
*
* This action will log a message to the application log file at the level specified.
*
* @author Roy Wetherall
*/
public class AdddocToOrigianlActionExecuter extends ActionExecuterAbstractBase
{
/** The name of the action */
public static final String NAME = "AdddocToOrigial-action";
/** The parameter names */
private NodeService nodeService;
private OpenOfficeConnection openOfficeConnection;
/**
* Set the node service
*
* @param nodeService set the node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
public void setOpenOfficeConnection(OpenOfficeConnection openOfficeConnection)
{
this.openOfficeConnection = openOfficeConnection;
}
/**
* This action will take the log message and log it at the provided log level.
*
* If the log level is not provided the default will be INFO.
*
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
ContentData contentData = (ContentData)this.nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_CONTENT);
if(contentData !=null){
String contentUrl =contentData.getContentUrl();
System.out.println(contentUrl);
//openoffice
contentUrl = contentUrl.substring(7);
//com.sun.star.frame.XDesktop oDesktop =getDesktop();
String strFileUrl ="file:///D:/m.doc";
com.sun.star.frame.XComponentLoader xComponentLoader = null;
com.sun.star.lang.XComponent xComponent = null;
xComponentLoader= openOfficeConnection.getDesktop();
System.out.println("xComponentLoaderisOK");
com.sun.star.beans.PropertyValue[] propertyValue =
new com.sun.star.beans.PropertyValue[1];
propertyValue[0] = new com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Hidden";
propertyValue[0].Value = new Boolean(true);
try{
xComponent =xComponentLoader.loadComponentFromURL(
strFileUrl, "_blank", 0, propertyValue);
}
catch(Exception e){
System.out.println("xComponentisFalse");
}
// com.sun.star.lang.XComponent aComponent= GetNewDocument(oDesktop,strFileUrl);
com.sun.star.text.XTextDocument xTextDocument = null;
xTextDocument =GetTextdocument(xComponent);
System.out.println("xTextDocumentIsOK");
com.sun.star.text.XText xText = (com.sun.star.text.XText)xTextDocument.getText();
String strtextFileURL = "file:///G:/alfresco-community-tomcat-2.1.0R1/alf_data/contentstore"+contentUrl;
System.out.println(strtextFileURL);
String strModelTopFileURL = "file:///D:/top.doc";
InsertFile(xText,strtextFileURL,strModelTopFileURL);
//替æ
07-31-2007 11:21 AM
07-31-2007 10:05 PM
08-01-2007 07:44 AM
08-02-2007 05:47 AM
08-02-2007 08:48 PM
08-02-2007 09:09 PM
08-02-2007 10:01 PM
08-02-2007 10:06 PM
08-02-2007 10:11 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.