cancel
Showing results for 
Search instead for 
Did you mean: 

[Resolved] : how to checkin a checkedout file

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi All

I am using webservice examples project.
For uploading a file, i am doing checkout/checkin if file already exist on alfresco server.
I am not able to upload a file on alfresco if file is already checked out.

Can anyone pls tell me how to check if a file is already checkedout or checkedin.

Regards
Nishant
7 REPLIES 7

lotharm
Champ on-the-rise
Champ on-the-rise
Hi,

I checked the NodeBrowser view, and from there:
The original document has the special aspect {http://www.alfresco.org/model/content/1.0}lockable set with the property {http://www.alfresco.org/model/content/1.0}lockType set to READ_ONLY_LOCK

The working copy has the special aspect {http://www.alfresco.org/model/content/1.0}workingcopy set.

Regards

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi LotharM

Thanks for the response.
I am not able to understand. Can you please explain in more detail.

Let me repeat my question again. Suppose I have Policy.pdf file uploaded in alfresco server.
Now I upload same file Policy.pdf (i.e. 2nd time upload) in which case I checkout the existing file and checkin the new Policy.pdf file. During this time assume network fails after checkout operation, alfresco creates a working copy of checked Policy.pdf (original) as the upload operation is incomplete. When the network is up and I again try to upload Policy.pdf, the system is not accepting because file is already checkedout. So here no need to ckeckout & checkin I just have to checkin.

In this scenario I need to know file status whether it is checkedout or checkedin during every file upload.

And also can you tell me how we can get reference to working copy when the file is already checked out.


Regards
Nishant

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi All

Can anyone please tell me the following things–

1) how can we know that file is already checkedout or checkin. Is there any method like boolean isCheckedout(Reference fileRef) in webservices API.Acording to my application, i want to checkin a checkedout file but before that i need to know about file status (checkedout or checkedin).
Pls see this URL http://forums.alfresco.com/en/viewtopic.php?f=14&t=1448&p=6559 
isCheckedout() is available in jacrabit API (javax.jcr.Node).
I saw this method in webservices API also. But not able to find the class of this method.pls see this URL http://wiki.alfresco.com/wiki/Version_Aspect

2) how can we get reference to working copy when the file is already checked out.

Please help me in resolving these problems.

Thanks in Advance
Nishant

lotharm
Champ on-the-rise
Champ on-the-rise
1. I don't know of such a method isWorkingCopy(). Instead you have to do little more work by using the Repository.describe method, see http://wiki.alfresco.com/wiki/Repository_Web_Service#describe to get the assigned aspects. Alfresco assigns special aspects to mark a checked out document, as well as the working copy

2. The original document, from which the working copy is created, does not maintain a reference to the working copy. It is the other way round, the working copy tracks which document is the original document.

Try the Node Browser from the Administrative Console page to see what happens to the documents on checkout and checkin.

Regards,
  lothar

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi LotharM

Using webservices, When we add versioning asspect to a file which is already checkedout that time i am getting below exception at this line respositoryService.update(cml) —-

2009-01-27 10:34:13,896 ERROR [STDERR] AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
   {http://www.alfresco.org/ws/service/repository/1.0}RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>org.alfresco.service.cmr.lock.NodeLockedException: Can not perform operation since the node (id:91fec287-e3b9-11dd-bbcd-d302f1baf9e5) is locked.</ns1:message>
   {http://xml.apache.org/axis/}exceptionNameSmiley Surprisedrg.alfresco.repo.webservice.repository.RepositoryFault
   {http://xml.apache.org/axis/}stackTrace:
   at org.alfresco.repo.webservice.repository.RepositoryWebService.update(RepositoryWebService.java:518)
   at sun.reflect.GeneratedMethodAccessor801.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
   at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
   at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
   at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
   at java.lang.Thread.run(Thread.java:595)

   {http://xml.apache.org/axis/}hostnameSmiley FrustratedJP1-184217
2009-01-27 10:34:14,021 ERROR [STDERR]    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2009-01-27 10:34:14,021 ERROR [STDERR]    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
2009-01-27 10:34:14,037 ERROR [STDERR]    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
2009-01-27 10:34:14,037 ERROR [STDERR]    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
2009-01-27 10:34:14,037 ERROR [STDERR]    at java.lang.Class.newInstance0(Class.java:350)
2009-01-27 10:34:14,037 ERROR [STDERR]    at java.lang.Class.newInstance(Class.java:303)
2009-01-27 10:34:14,037 ERROR [STDERR]    at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:104)
2009-01-27 10:34:14,037 ERROR [STDERR]    at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:90)
2009-01-27 10:34:14,053 ERROR [STDERR]    at org.alfresco.webservice.repository.RepositoryFault.getDeserializer(RepositoryFault.java:146)
2009-01-27 10:34:14,053 ERROR [STDERR]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2009-01-27 10:34:14,053 ERROR [STDERR]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
2009-01-27 10:34:14,053 ERROR [STDERR]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2009-01-27 10:34:14,053 ERROR [STDERR]    at java.lang.reflect.Method.invoke(Method.java:585)
2009-01-27 10:34:14,053 ERROR [STDERR]    at org.apache.axis.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:154)
2009-01-27 10:34:14,068 ERROR [STDERR]    at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:84)
2009-01-27 10:34:14,068 ERROR [STDERR]    at org.apache.axis.encoding.DeserializationContext.getDeserializer(DeserializationContext.java:464)
2009-01-27 10:34:14,068 ERROR [STDERR]    at org.apache.axis.encoding.DeserializationContext.getDeserializerForType(DeserializationContext.java:547)
2009-01-27 10:34:14,068 ERROR [STDERR]    at org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:157)
2009-01-27 10:34:14,068 ERROR [STDERR]    at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
2009-01-27 10:34:14,068 ERROR [STDERR]    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
2009-01-27 10:34:14,084 ERROR [STDERR]    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
2009-01-27 10:34:14,084 ERROR [STDERR]    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
2009-01-27 10:34:14,084 ERROR [STDERR]    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
2009-01-27 10:34:14,084 ERROR [STDERR]    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
2009-01-27 10:34:14,084 ERROR [STDERR]    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
2009-01-27 10:34:14,084 ERROR [STDERR]    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
2009-01-27 10:34:14,099 ERROR [STDERR]    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
2009-01-27 10:34:14,099 ERROR [STDERR]    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
2009-01-27 10:34:14,099 ERROR [STDERR]    at javax.xml.parsers.SAXParser.parse(Unknown Source)
2009-01-27 10:34:14,099 ERROR [STDERR]    at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
2009-01-27 10:34:14,099 ERROR [STDERR]    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
2009-01-27 10:34:14,099 ERROR [STDERR]    at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
2009-01-27 10:34:14,115 ERROR [STDERR]    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
2009-01-27 10:34:14,115 ERROR [STDERR]    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
2009-01-27 10:34:14,115 ERROR [STDERR]    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
2009-01-27 10:34:14,115 ERROR [STDERR]    at org.apache.axis.client.Call.invoke(Call.java:2767)
2009-01-27 10:34:14,115 ERROR [STDERR]    at org.apache.axis.client.Call.invoke(Call.java:2443)
2009-01-27 10:34:14,115 ERROR [STDERR]    at org.apache.axis.client.Call.invoke(Call.java:2366)
2009-01-27 10:34:14,115 ERROR [STDERR]    at org.apache.axis.client.Call.invoke(Call.java:1812)
2009-01-27 10:34:14,115 ERROR [STDERR]    at org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub.update(RepositoryServiceSoapBindingStub.java:986)
2009-01-27 10:34:14,131 ERROR [STDERR]    at org.alfresco.sample.webservice.NEBUpload.makeVersionable(Unknown Source)
2009-01-27 10:34:14,131 ERROR [STDERR]    at org.alfresco.sample.webservice.NEBUpload.upload(Unknown Source)
2009-01-27 10:34:14,131 ERROR [STDERR]    at org.apache.struts.webapp.upload.UploadAction.execute(UploadAction.java:266)
2009-01-27 10:34:14,131 ERROR [STDERR]    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
2009-01-27 10:34:14,131 ERROR [STDERR]    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
2009-01-27 10:34:14,146 ERROR [STDERR]    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
2009-01-27 10:34:14,146 ERROR [STDERR]    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
2009-01-27 10:34:14,146 ERROR [STDERR]    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
2009-01-27 10:34:14,146 ERROR [STDERR]    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
2009-01-27 10:34:14,146 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
2009-01-27 10:34:14,146 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2009-01-27 10:34:14,162 ERROR [STDERR]    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2009-01-27 10:34:14,162 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
2009-01-27 10:34:14,162 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2009-01-27 10:34:14,162 ERROR [STDERR]    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
2009-01-27 10:34:14,162 ERROR [STDERR]    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
2009-01-27 10:34:14,162 ERROR [STDERR]    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
2009-01-27 10:34:14,177 ERROR [STDERR]    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
2009-01-27 10:34:14,177 ERROR [STDERR]    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
2009-01-27 10:34:14,177 ERROR [STDERR]    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
2009-01-27 10:34:14,177 ERROR [STDERR]    at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
2009-01-27 10:34:14,177 ERROR [STDERR]    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
2009-01-27 10:34:14,177 ERROR [STDERR]    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
2009-01-27 10:34:14,193 ERROR [STDERR]    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
2009-01-27 10:34:14,193 ERROR [STDERR]    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
2009-01-27 10:34:14,193 ERROR [STDERR]    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
2009-01-27 10:34:14,193 ERROR [STDERR]    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
2009-01-27 10:34:14,193 ERROR [STDERR]    at java.lang.Thread.run(Thread.java:595)



As per my understanding, We can't add versioning aspect if a file is already checkedout.
Now if i use respositoryService.update(cml) in try block then i will catch exception in catch block.
Now at this point i know that file is already checkedout. Now i have to know how to get reference to a working copy.

Regards
Nishant

lotharm
Champ on-the-rise
Champ on-the-rise
Nishant,
Now at this point i know that file is already checkedout. Now i have to know how to get reference to a working copy.

There is no reference to the working copy stored with the original document. The options are
* Lookup up working copy by name: OrginialDocument (Working Copy).doc for example.
* Loop through all the files in the folder and check the property {http://www.alfresco.org/model/content/1.0}source

Regards,
  lothar

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi LotharM

* When I search OrginialDocument (Working Copy).doc in a folder then i am getting error.
Error in Xpath Execution.
I encoded the path .then also i am getting some others error. For your information, I am not using lucene search.
If i search files whose name start with number and whose name having spaces (like company policy.pdf) it gives error Error in Xpath Execution. Can you please guide me how can i use lucene search. Actualy for searching file & node, I am using my own approach for searching. If possible can you share your lucene search code.

* I am using this approach. I wrote one method where i am getting all the files name with uuid.
Here i am creating Working Copy Reference object based on Store and Uuid.
Now i am able to checkin a checkedout file.

Thanks For Your Continuous Help. Please keep in touch. I will wait for your help in my next post.

Regards
Nishant