Hi Guys,
How can I get access to publish date of an edition via java. I need to locate edition via publish date. Any help is greatly appreciated, thanks?
com/interwoven/cssdk/filesys/CSEdition will provide the publish date, check you CSSDK docs.
Thanks Andy, I'll check it out.
Hi Andy, I see CSEdition in cssdk docs, but I don't find it on TeamSite server, I only see CSArea in for eg \customer_src\src\com\interwoven\workflow\utils\WorkflowUtil.java from import within file below:
import com.interwoven.cssdk.filesys.CSArea;
Any other suggestions, thanks?
You need to load the CSSDK client. You may need to download it as it may be a separate install.
Thanks Andy, my code keep failing at "client = ..."
package com;
import com.interwoven.cssdk.common.CSClient; import com.interwoven.cssdk.common.CSException; import com.interwoven.cssdk.common.CSRemoteException; import com.interwoven.cssdk.factory.CSFactory; import com.interwoven.cssdk.filesys.CSBranch; import com.interwoven.cssdk.filesys.CSVPath; import java.util.Locale; import java.util.Properties;
public class TeamsiteConnect { public void testMethod() throws CSRemoteException, CSException { CSClient client; Properties properties = new Properties(); String host = "TeamsiteTest"; properties.setProperty("username", "testuser"); properties.setProperty("password", "testpassword"); properties.setProperty("com.interwoven.cssdk.factory.CSFactory", "com.interwoven.cssdk.factory.CSJavaFactory"); properties.setProperty("defaultTSServer",host); properties.setProperty("ts.server.os","win"); CSFactory factory = CSFactory.getFactory(properties); client = factory.getClient(properties.getProperty("username"), "", properties.getProperty("password"), Locale.getDefault(), "AuditUtility", properties.getProperty("defaultTSServer")); System.out.println("connected"); CSVPath csvPath = new CSVPath(properties.getProperty("csvPath")); CSBranch parent = client.getBranch(csvPath, true); } }
Any ideas why, thanks?
A stack trace would certainly help, load the CSSDK sample and see if you can get it running
Thanks Andy, I got it connected a few days back, some jar files were missing.
Hi Andy or anyone else how can I get a list of all editions. I thought my code below was the right way to achieve it but it's not working:
CSBranch branch = client.getBranch(csvPath, true); CSEdition[] editions = branch.getEditions(true, true, 0); for (int i = 0; i < editions.length; i++) { System.out.println("editions[i]: " + editions[i]); }
I searched here but didn't find anything useful. Your help is greatly appreciated, thanks.
I forgot to mention that I have csvPath set as below:
properties.setProperty("csvPath","////TESTSERVER//default//main//MainBranch//Branch//Subbranch");
Any ideas, thanks?
I got the (editions list) values from
CSEdition[] editions = branch.getEditions(true, true, -1);
Hi Andy or anyone else I'm trying to see if I can get the modified date of these files below, but since I'm getting them from the edition I can't get content modification date until I can reproduce these files as CsFile. here is my code below:
CSVPath csvPath = new CSVPath(properties.getProperty("csvPath")); CSBranch branch = client.getBranch(csvPath, true); CSEdition[] editions = branch.getEditions(true, true, -1);
for (int i = 0; i < editions.length; i++) { log.write("editions publishdate: " + editions[i].getPublishDate()); log.write("\n"); log.write("editions Vpath: " + editions[i].getVPath()); log.write("\n"); log.write("editions filename: " + editions[i].getVPath().concat(filename)); log.write("\n"); }
I tried a bunch of stuff nothing works yet. Any ideas, thanks?
You can cast that to a File object, correct ? Can't you use File.lastModified() ?
Note: I have not tried this, though it should work.
There is also a CLT call iwrlog, which will dump out all sorts of information on a specific file, I do not know if/what the CSSDK equivalent is, but you could exec that for more details.
What exactly are you trying to do? All your code sample above will do is get you information about the Edition itself. What files (when you refer to a CSFile) are you trying to get information for? You need to be clearer about what you're trying to accomplish.
Thanks Andy and David for your response, I'm now able to access the files using the following code below:
for (int j = 0; j < editions.length; j++) { CSFile csFile = client.getFile(editions[j].getVPath().concat(filename));
if (csFile == null || (csFile instanceof CSHole)) { log.write("file not found: " + csFile); log.write("\n"); } else { log.write("file vpath: " + csFile.getVPath()); log.write("\n"); }
}
Guys, by the way is there a special class I can use to copy an entire edition to a workarea using cssdk? I have been searching but haven't found anything useful yet.
Thanks for your help.
CSWorkarea.update()
As Smitty mentioned, update will work, however check the parameters, you will likely have issues with locks and with conflicts that you will have to resolve or ignore.
He just asked for the class, not a tutorial
That's the joy of using the CSSDK - beating your head against the wall trying to make things work. Don't take that away from the boy.
@David Smith said: He just asked for the class, not a tutorial
like you have any class.......
Guys, I'm havig an issue getting wa (workarea) value, I'm getting null when I check wa.update line below in netbeans IDE in debug mode. What's strange is that in line above with cswPath I'm seeing the workarea value there in debug mode. Any ideas why code failing at wa.update line below?
CSAreaRelativePath[] csAreaRelPath = new CSAreaRelativePath[1]; csAreaRelPath[0] = new CSAreaRelativePath("shared/_audit/test"); CSVPath cswPath = new CSVPath("default/main/Test/testing"); CSVPath vPath = new CSVPath(editions[j].getVPath()); CSWorkarea wa = client.getWorkarea(cswPath, true); CSArea area = client.getEdition(vPath, true); CSUpdateResult res = wa.update(csAreaRelPath, area, 3); CSFileCmpResult[] fcr = res.getResultOfUpdate(); log.write("fcr" +fcr);
As always your help is greatly appreciated, thanks.
You need to debug this on your own at this point. You've got a bunch of convoluted code with no context whatsoever. Do some basic debugging. Print stuff out or use a debugger so you can see what values your variables hold. You have enough information to do this on your own at this point. Or hire Andy.
I have updated my code as below but still getting workarea null. I'm getting vPath which has the workarea as seen in code, so why am I still getting wa null?
CSAreaRelativePath csAreaRelPath = new CSAreaRelativePath("shared/_audit/test"); System.out.println("csAreaRelPath: " + csAreaRelPath); CSVPath vPath = new CSVPath(editions[j].getVPath()); System.out.println("vPath: " + "//TESTSERVER/default/main/Test/testing/EDITION/Edition_test"); CSWorkarea wa = client.getWorkarea(vPath, true); System.out.println("wa: " + wa);
You really need to do some basic debugging much earlier in your code.
Thanks David, you were right I needed to define full path ("//TESTSERVER/default/main/Test/testing/WORKAREA/shared) in properties file, with the shared folder then I was able to get workarea. The code below I have now but can't execute wa.update because it says CSAreaRelativePath cannot be converted to CSAreaRelativePath[]. Any ideas on how to get past this, I'm still researching, thanks?
CSAreaRelativePath csAreaRelPath = new CSAreaRelativePath("shared/_audit/test"); CSVPath vPath = new CSVPath(editions[j].getVPath()); CSArea area = client.getEdition(vPath, true); CSUpdateResult res = wa.update(csAreaRelPath, area, 0);
Unfortunately Smitty is correct. The only way for one of us to help is to load the complete class on our system and start debugging.
Unfortunately Smitty is correct. I would be offended but this is one of the milder things you've said about me.
Basil - you need to look at the javadocs for the CSSDK and understand what a relative path is. Among other things. I'm done responding to your basic debugging issues. You need to work harder and figure this out for yourself.
Okay, but I got workarea to work here is code with workarea, I just need to get CSAreaRelativePath as an array of files as per the last line complaint in IDE, "CSAreaRelativePath cannot be converted to CSAreaRelativePath[]"
CSWorkarea wa = client.getWorkarea(cswPath, true); CSAreaRelativePath csAreaRelPath = new CSAreaRelativePath("shared/_audit/test"); CSVPath vPath = new CSVPath(editions[j].getVPath()); CSArea area = client.getEdition(vPath, true); CSUpdateResult res = wa.update(csAreaRelPath, area, 0);
Thanks for your help, I probably will figure it out, but time is of essence so any help is appreciated. I'm sure I don't need much more to get copy to work.
CSAreaRelativePath[] is an arrary of files to be updated.
CSAreaRelativePath[] csAreaRelPath = new CSAreaRelativePath[1]; csAreaRelPath[0] = new CSAreaRelativePath("file1.txt"); CSUpdateResult res = wa.update(csAreaRelPath, branch.getStaging(), OVERWRITE_ALL);
You should be able to use a wildcard, like . or *
David, I have been working at it diligently to get to this point and the manuals are not always very informative, I'm sure you didn't get all your answers from the manuals when you faced issues.
Thanks Andy, it got me past that point but I just got an exception below:
Exception in thread "main" com.interwoven.cssdk.access.CSAuthorizationException: //TESTSERVER/default/main/Test/testing/WORKAREA/shared(Operation not permitted)
with the following code:
CSAreaRelativePath[] csAreaRelPath = new CSAreaRelativePath[1]; csAreaRelPath[0] = new CSAreaRelativePath("shared/_audit/test"); CSWorkarea wa = client.getWorkarea(cswPath, true); CSAreaRelativePath csAreaRelPath = new CSAreaRelativePath("shared/_audit/test"); CSVPath vPath = new CSVPath(editions[j].getVPath()); CSArea area = client.getEdition(vPath, true); CSUpdateResult res = wa.update(csAreaRelPath, area, 0);
I'm looking into why this exception...
What user are you connecting with ? What role does that user have in the specific workarea ?