Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a sample program to:
- // 1. get the latest version of an AAF file from Interplay
- // 2. check in an AAF into Interplay
- // 3. print out the contents of a folder in Interplay
- package com.avid.interplay.ws.client;
- import com.avid.interplay.ws.assets.*;
- import com.avid.interplay.ws.assets.types.*;
- import javax.activation.FileDataSource;
- import javax.activation.DataHandler;
- import java.io.*;
- public class InterplayWSClient {
- public static void main(String[] args) {
- getLatest();
- checkInAAF();
- getChildren();
- }
- public static void getLatest() {
- // setup the credentials
- UserCredentialsType creds = new UserCredentialsType();
- creds.setUsername("uuu");
- creds.setPassword("ppp");
- // setup the service
- Assets service = new Assets();
- AssetsPortType port = service.getAssetsPort();
- // set the Interplay URI
- GetLatestType body = new GetLatestType();
- body.setInterplayURI("interplay://WGC?mobid=060a2b340101010101010f0013-000000-5649977d2af0818d-060e2b347f7f-2a80");
- try {
- // make the call
- GetLatestResponseType result;
- result = port.getLatest(body, creds);
- // print out the results
- if (result.getErrors() != null && result.getErrors().getError().size()>0)
- {
- for (ErrorType error : result.getErrors().getError()) {
- System.out.println("Checkin error: " + error.getDetails());
- }
- }
- else {
- // save out the file
- DataHandler dataHandler = result.getFile();
- FileOutputStream os = new FileOutputStream("c:\\folder\\theFile.aaf");
- dataHandler.writeTo(os);
- os.close();
- System.out.println("GetLatest Success!");
- }
- } catch (AssetsFault e) {
- e.printStackTrace();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public static void checkInAAF() {
- // setup the credentials
- UserCredentialsType creds = new UserCredentialsType();
- creds.setUsername("uuu");
- creds.setPassword("ppp");
- // setup the service
- Assets service = new Assets();
- AssetsPortType port = service.getAssetsPort();
- // set the parameters
- CheckInAAFType body = new CheckInAAFType();
- body.setInterplayURI("interplay://WGC/Catalogs/MyClips/CheckCallg/");
- // setup the data handler
- FileDataSource fileDataSource = new FileDataSource(new File("c:\\folder\\theFile.aaf"));
- DataHandler dataHandler = new DataHandler(fileDataSource);
- body.setAAF(dataHandler);
- try {
- // make the call
- CheckInAAFResponseType result;
- result = port.checkInAAF(body, creds);
- // print out the results
- if (result.getErrors() != null && result.getErrors().getError().size()>0)
- {
- for (ErrorType error : result.getErrors().getError()) {
- System.out.println("Checkin error: " + error.getDetails());
- }
- }
- else {
- System.out.println("Success! Checked in: " + result.getInterplayURI());
- }
- } catch (AssetsFault e) {
- e.printStackTrace();
- }
- }
- public static void getChildren() {
- // setup the credentials
- UserCredentialsType creds = new UserCredentialsType();
- creds.setUsername("uuu");
- creds.setPassword("ppp");
- // setup the service
- Assets service = new Assets();
- AssetsPortType port = service.getAssetsPort();
- // set the parameters
- GetChildrenType body = new GetChildrenType();
- body.setInterplayURI("interplay://WGC/Catalogs/MyClips/CheckCallg/");
- body.setIncludeFiles(false);
- body.setIncludeFolders(false);
- body.setIncludeMOBs(true);
- try {
- // make the call
- GetChildrenResponseType result;
- result = port.getChildren(body, creds);
- // print out the results
- for (AssetDescriptionType asset : result.getResults().getAssetDescription()) {
- System.out.println(asset.getInterplayURI());
- for (AttributeType att : asset.getAttributes().getAttribute()) {
- System.out.println(att.getGroup() + "." + att.getName() + " = " + att.getValue());
- }
- System.out.println();
- }
- } catch (AssetsFault e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement