示例#1
0
        //**********************************************************
        // Function:	OpenScript()
        // Scope:		internal
        // Overview:	Script initialization point.  Perform any
        //				necessary initialization such as logging
        //				in to a remote data source, allocated any
        //				necessary resources, etc.
        // Params:		none
        // Returns:		One of the following:
        //				KFX_REL_SUCCESS, KFX_REL_ERROR
        // Called By:	The Batch Release Manager.  Called once
        //				when the script object is loaded.
        //**********************************************************
        public AscentRelease.KfxReturnValue OpenScript()
        {
            // Start the Alfresco session
            try
            {
                string repository = ReleaseUtils.getCustomProperty(this.releaseData.CustomProperties, ReleaseConstants.CUSTOM_REPOSITORY);
                WebServiceFactory.setEndpointAddress(repository);

                string userName = ReleaseUtils.getCustomProperty(this.releaseData.CustomProperties, ReleaseConstants.CUSTOM_USERNAME);
                string password = ReleaseUtils.getCustomProperty(this.releaseData.CustomProperties, ReleaseConstants.CUSTOM_PASSWORD);
                AuthenticationUtils.startSession(userName, password);
                this.repoService = WebServiceFactory.getRepositoryService();

                // the uuid of the location to be saved
                this.locationUuid = ReleaseUtils.getCustomProperty(this.releaseData.CustomProperties, ReleaseConstants.CUSTOM_LOCATION_UUID);

                this.contentType = ReleaseUtils.getCustomProperty(this.releaseData.CustomProperties, ReleaseConstants.CUSTOM_CONTENT_TYPE);

                this.imageContentProp = ReleaseUtils.getCustomProperty(this.releaseData.CustomProperties, ReleaseConstants.CUSTOM_IMAGE);
                this.ocrContentProp   = ReleaseUtils.getCustomProperty(this.releaseData.CustomProperties, ReleaseConstants.CUSTOM_OCR);
                this.pdfContentProp   = ReleaseUtils.getCustomProperty(this.releaseData.CustomProperties, ReleaseConstants.CUSTOM_PDF);

                // Initialise the reference to the spaces store
                this.spacesStore    = new Alfresco.RepositoryWebService.Store();
                spacesStore.scheme  = Alfresco.RepositoryWebService.StoreEnum.workspace;
                spacesStore.address = "SpacesStore";

                return(AscentRelease.KfxReturnValue.KFX_REL_SUCCESS);
            }
            catch (Exception)
            {
                return(AscentRelease.KfxReturnValue.KFX_REL_ERROR);
            }
        }