private void writeContentType(String filePath, Alfresco.RepositoryWebService.Reference rwsRef, String property, String mimetype) { Alfresco.ContentWebService.Reference newContentNode = new Alfresco.ContentWebService.Reference(); newContentNode.path = rwsRef.path; newContentNode.uuid = rwsRef.uuid; Alfresco.ContentWebService.Store cwsStore = new Alfresco.ContentWebService.Store(); cwsStore.address = "SpacesStore"; spacesStore.scheme = Alfresco.RepositoryWebService.StoreEnum.workspace; newContentNode.store = cwsStore; // Open the file and convert to byte array FileStream inputStream = new FileStream(filePath, FileMode.Open); int bufferSize = (int)inputStream.Length; byte[] bytes = new byte[bufferSize]; inputStream.Read(bytes, 0, bufferSize); inputStream.Close(); ContentFormat contentFormat = new ContentFormat(); contentFormat.mimetype = mimetype; WebServiceFactory.getContentService().write(newContentNode, property, bytes, contentFormat); }
private void BrowseDataDictionary_Load(object sender, EventArgs e) { AuthenticationUtils.startSession("admin", "sametsis"); try { ClassDefinition[] classDefinitions = WebServiceFactory.getDictionaryService().getClasses(null, null); foreach (ClassDefinition classDefinition in classDefinitions) { string displayLabel = classDefinition.title; if (displayLabel != null && displayLabel.Trim().Length != 0) { ListViewItem item = new ListViewItem(classDefinition.title); item.Tag = classDefinition; listBoxClasses.Items.Add(item); listBoxClasses.DisplayMember = "Text"; listBoxClasses.ValueMember = "Tag"; } } } finally { AuthenticationUtils.endSession(); } }
//********************************************************** // 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); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.SignIn); webService = WebServiceFactory.Create(); editTextUsername = FindViewById <EditText> (Resource.Id.editTextUsername); editTextPassword = FindViewById <EditText> (Resource.Id.editTextPassword); buttonSignIn = FindViewById <Button> (Resource.Id.buttonSignIn); buttonRegister = FindViewById <Button> (Resource.Id.buttonRegister); buttonSignIn.Click += async delegate { var r = await webService.SignInAsync(new SignInRequest { Username = editTextUsername.Text }); if (!r.Succeeded) { Toast.MakeText(this, "SignIn Failed: " + r.Exception, ToastLength.Short).Show(); return; } App.Settings.SignedInUsername = editTextUsername.Text; StartActivity(typeof(CommitmentsActivity)); }; buttonRegister.Click += delegate { StartActivity(typeof(RegisterActivity)); }; }
public JsonResult IsTenantAvailable(TenantModel tenant) { try { var svc = WebServiceFactory.ApplicationTenant(); var result = svc.ReadMultiple(new [] { new ApplicationTenant_Filter { Field = ApplicationTenant_Fields.Name, Criteria = "@" + tenant.TenantName }, new ApplicationTenant_Filter { Field = ApplicationTenant_Fields.Application_Service_Name_Web_Service_Filter_Field, Criteria = Configuration.ApplicationServiceName } }, null, 1); return(Json(result.Length == 0, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(e.Message, JsonRequestBehavior.AllowGet)); } }
public ResultSetRow FindNodeByPath(ref string nodePath) { ResultSetRow lResult = null; nodePath = PathUtils.NormalicePath(nodePath); string queryString = PathUtils.ConvertToRepositoryPath(System.IO.Path.GetDirectoryName(nodePath) + "/" + ISO9075.Encode(System.IO.Path.GetFileName(nodePath))); var query = new RepositoryWebService.Query(); query.language = Constants.QUERY_LANG_LUCENE; //TODO: Consultas que sí funcionan: //query.statement = "PATH:\"//app:company_home//cm:Pruebas//cm:Test_Folder/*\""; //query.statement = "PATH:\"//cm:Pruebas//cm:Test_Folder/*\""; Todos los archivos de un folder //query.statement = "PATH:\"//cm:Pruebas//cm:Test_Folder\""; Devuelve un folder query.statement = "PATH:\"" + queryString + "\""; QueryResult result = WebServiceFactory.getRepositoryService().query(spacesStore, query, false); if (result.resultSet.rows != null) { lResult = result.resultSet.rows[0]; } return(lResult); }
public static NodeBase GetNodeById(string documentId) { NodeBase lNode = null; Alfresco.RepositoryWebService.Store spacesStore = new Alfresco.RepositoryWebService.Store(); spacesStore.scheme = Alfresco.RepositoryWebService.StoreEnum.workspace; spacesStore.address = Constants.SPACES_STORE; // Create a query object Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Constants.QUERY_LANG_LUCENE; query.statement = string.Format("@sys\\:node-uuid:\"{0}\"", documentId); QueryResult result = WebServiceFactory.getRepositoryService().query(spacesStore, query, true); if (result.resultSet.rows != null) { ResultSetRow row = result.resultSet.rows[0]; lNode = new NodeBase(); lNode.properties = new NamedValue[row.columns.Length]; row.columns.CopyTo(lNode.properties, 0); lNode.id = documentId; } return(lNode); }
protected UpdateResult[] CreateNode(string parentId, string parentPath, string nodeType) { UpdateResult[] result = null; var parent = new RepositoryWebService.ParentReference( spacesStore, parentId, parentPath, Constants.ASSOC_CONTAINS, Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, name) ); //build properties BuildCustomProperties(); //create operation CMLCreate create = new CMLCreate(); create.id = "1"; create.parent = parent; create.type = nodeType; // Constants.TYPE_CONTENT; create.property = properties; //build the CML object CML cml = new CML(); cml.create = new CMLCreate[] { create }; //perform a CML update to create the node result = WebServiceFactory.getRepositoryService().update(cml); return(result); }
private string A6GetSuit(string urls) { try { if (urls.Trim().Length <= 0) { return(MessageManager.GetMessageInfo(DingYiZhiFuChuan.ServerEmpty)); } string str = urls + "/pzWebService.ws"; object obj2 = new object(); string str2 = "getAccount"; string[] strArray = new string[0]; string[] strArray2 = (string[])WebServiceFactory.InvokeWebService(str, str2, strArray); if (strArray2.Length <= 0) { return(DingYiZhiFuChuan.strErrLinkFailTip); } this._A6SuitList = strArray2; } catch (BaseException exception) { this.loger.Error(exception.Message + MessageManager.GetMessageInfo(DingYiZhiFuChuan.strErrLinkFailTip)); return(DingYiZhiFuChuan.strErrLinkFailTip); } catch (Exception exception2) { this.loger.Error(exception2.Message + MessageManager.GetMessageInfo(DingYiZhiFuChuan.strErrLinkFailTip)); return(DingYiZhiFuChuan.strErrLinkFailTip); } return(string.Empty); }
//[DebuggerStepThrough()] public static Content GetContentByPath(string documentPath) { Content lResult = null; try { var spacesStore = new ContentWebService.Store(); spacesStore.scheme = ContentWebService.StoreEnum.workspace; spacesStore.address = Constants.SPACES_STORE; var reference = new ContentWebService.Reference(); reference.store = spacesStore; reference.path = PathUtils.ConvertToRepositoryPath(documentPath); var predicate = new ContentWebService.Predicate(); predicate.Items = new Object[] { reference }; Content[] contents = WebServiceFactory.getContentService().read(predicate, "{http://www.alfresco.org/model/content/1.0}content"); if (contents.Length != 0) { lResult = contents[0]; } } catch (SoapException ex) { if (ex.Detail.InnerText.Contains("Node does not exist")) { throw new NotFoundDocumentException(ErrorMessages.NoData, documentPath, ErrorMessages.DocumentNotFound); } //else // throw ex; } return(lResult); }
private static void ReturnCoin() { var availableChoices = new[] {1, 2}; Console.WriteLine("How would you like to determine your coin?"); Console.WriteLine("1. Random weighed towards low Market Cap"); Console.WriteLine("2. Completely random"); var choice = GetInput(availableChoices); var webService = WebServiceFactory.BuildWebService(WebServiceFactory.WebServiceType.CryptoCompare); var coinList = webService.GetAllCoins(); webService.HydrateCoinsWithPrices(coinList, TimeFrame.Minute, 1); switch (choice) { case 1: AssignWeights(coinList); ProcessWeightedRandomChoice(coinList); break; case 2: break; default: break; } Console.ReadLine(); }
// GET: Users public ActionResult Index() { InitializeState(); var svc = WebServiceFactory.ApplicationTenantUser(); var users = svc.ReadMultiple( new [] { new ApplicationTenantUser.ApplicationTenantUser_Filter { Field = ApplicationTenantUser.ApplicationTenantUser_Fields.Application_Tenant_ID, Criteria = State.Get <TenantModel>().Id } }, null, 0); return(View(new UserListModel { Users = users.Select(u => new UserModel { UserName = u.User_Name, FullName = u.Full_Name, ContactEmail = u.Contact_Email, Administrator = u.Administrator }).ToArray(), Tenant = State.Get <TenantModel>() })); }
public void CanDeleteNodes() { AuthenticationUtils.startSession("admin", "admin"); Store spacesStore = new Store(StoreEnum.workspace, "SpacesStore"); String name = "AWS Book " + DateTime.Now.Ticks; String description = "This is a content created with a sample of the book"; //custom value object CreateSampleVO createSampleVo = Builder.BuildCreateSampleVO(name, name, description); try { ParentReference parent = new ParentReference( spacesStore, null, "/app:company_home", Constants.ASSOC_CONTAINS, "{" + Constants.NAMESPACE_CONTENT_MODEL + "}" + name ); //build properties NamedValue[] properties = Builder.BuildCustomProperties(createSampleVo); //create operation CMLCreate create = new CMLCreate(); create.id = "1"; create.parent = parent; create.type = Constants.TYPE_CONTENT; create.property = properties; //build the CML object CML cmlAdd = new CML(); cmlAdd.create = new CMLCreate[] { create }; //perform a CML update to create the node UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cmlAdd); String expectedPath = "/app:company_home/cm:AWS_x0020_Book_x0020_"; Assert.IsTrue(result[0].destination.path.StartsWith(expectedPath)); //create a predicate Reference reference = result[0].destination; Predicate predicate = new Predicate(new Reference[] { reference }, spacesStore, null); //delete content CMLDelete delete = new CMLDelete(); delete.where = predicate; CML cmlRemove = new CML(); cmlRemove.delete = new CMLDelete[] { delete }; //perform a CML update to remove the node WebServiceFactory.getRepositoryService().update(cmlRemove); expectedPath = "/app:company_home/cm:AWS_x0020_Book_x0020_"; Assert.IsTrue(reference.path.StartsWith(expectedPath)); } finally { AuthenticationUtils.endSession(); } }
///// <summary> ///// Copia un archivo de una localización a otroa ///// </summary> ///// <param name="uuidNodeToCopy"></param> ///// <param name="DestinationNodePath"></param> ///// <returns>En DestinationNodePath se devuelve la ruta final del archivo</returns> //public string CopyFile(string uuidNodeToCopy, ref string DestinationNodePath) //{ // if (string.IsNullOrEmpty(uuidNodeToCopy) || string.IsNullOrEmpty(DestinationNodePath)) // return null; // string documentId = null; // RepositoryWebService.Store cwsStore = new RepositoryWebService.Store(); // cwsStore.address = Constants.SPACES_STORE; // try // { // //Obtenemos la ruta donde se copiara el documento, o la creamos si no existe // FolderNode nod = new FolderNode(); // string destNodeId = nod.CreatePathRecursive(DestinationNodePath); // this.Name = GetNodeById(uuidNodeToCopy).Name; // UpdateResult[] rsrDest = CreateNode(destNodeId, null, Constants.TYPE_CONTENT); // ResultSetRow rsrOrigin = FindNodeById(uuidNodeToCopy); // RepositoryWebService.Reference refOrigin = GetReferenceFromResultSetRow(rsrOrigin); // RepositoryWebService.Predicate sourcePredicate = new RepositoryWebService.Predicate( // new Alfresco.RepositoryWebService.Reference[] { refOrigin }, cwsStore, null); // //reference for the target space // RepositoryWebService.ParentReference targetSpace = new RepositoryWebService.ParentReference(); // targetSpace.store = spacesStore; // targetSpace.path = DestinationNodePath; // targetSpace.associationType = Constants.ASSOC_CONTAINS; // targetSpace.childName = Name; // //copy content // CMLCopy copy = new CMLCopy(); // copy.where = sourcePredicate; // copy.to = targetSpace; // CML cmlCopy = new CML(); // cmlCopy.copy = new CMLCopy[] { copy }; // //perform a CML update to move the node // UpdateResult[] updateResult = WebServiceFactory.getRepositoryService().update(cmlCopy); // DestinationNodePath = ISO9075.Decode(PathUtils.ConvertFromRepositoryPath(updateResult[0].destination.path)); // documentId = updateResult[0].destination.uuid; // } // catch (SoapException ex) // { // if (ex.Detail.InnerText.Contains("DuplicateChildNodeNameException")) // { // var node = new NodeBase(); // var nodePath = String.Format("{0}/{1}", DestinationNodePath, this.Name); // var id = node.GetIdByPath(nodePath); // throw new DuplicateDocumentException(id, nodePath); // } // else // throw ex; // } // catch (Exception ex) // { // throw ex; // } // return documentId; //} //public string CopyFile(string uuidNodeToCopy, ref string DestinationNodePath) //{ // if (string.IsNullOrEmpty(uuidNodeToCopy) || string.IsNullOrEmpty(DestinationNodePath)) // return null; // string documentId = null; // try // { // this.Name = GetNodeById(uuidNodeToCopy).Name; // //Obtenemos la ruta donde se copiara el documento, o la creamos si no existe // FolderNode nod = new FolderNode(); // string destNodeId = nod.CreatePathRecursive(DestinationNodePath); // UpdateResult[] updateNode = CreateNode(destNodeId, null, Constants.TYPE_CONTENT); // //reference for the target space // RepositoryWebService.ParentReference targetSpace = new RepositoryWebService.ParentReference(); // targetSpace.store = spacesStore; // targetSpace.path = updateNode[0].destination.path; // targetSpace.associationType = Constants.ASSOC_CONTAINS; // targetSpace.childName = Name; // RepositoryWebService.Predicate Source = new RepositoryWebService.Predicate( // new Alfresco.RepositoryWebService.Reference[] { GetReferenceFromResultSetRow(FindNodeById(uuidNodeToCopy)) }, spacesStore, null); // //copy content // CMLCopy copy = new CMLCopy(); // copy.where = Source; // copy.to = targetSpace; // CML cmlCopy = new CML(); // cmlCopy.copy = new CMLCopy[] { copy }; // //perform a CML update to move the node // RepositoryWebService.UpdateResult[] updateResult = WebServiceFactory.getRepositoryService().update(cmlCopy); // DestinationNodePath = ISO9075.Decode(PathUtils.ConvertFromRepositoryPath(updateResult[0].destination.path)); // documentId = updateResult[0].destination.uuid; // } // catch (SoapException ex) // { // if (ex.Detail.InnerText.Contains("DuplicateChildNodeNameException")) // { // var node = new NodeBase(); // var nodePath = String.Format("{0}/{1}", DestinationNodePath, this.Name); // var id = node.GetIdByPath(nodePath); // throw new DuplicateDocumentException(id, nodePath); // } // else // throw ex; // } // catch (Exception ex) // { // throw ex; // } // return documentId; //} public string CopyFile(string uuidNodeToCopy, ref string DestinationNodePath) { if (string.IsNullOrEmpty(uuidNodeToCopy) || string.IsNullOrEmpty(DestinationNodePath)) { return(null); } string documentId = null; try { this.Name = GetNodeById(uuidNodeToCopy).Name; //Obtenemos la ruta donde se copiara el documento, o la creamos si no existe FolderNode nod = new FolderNode(); string destNodeId = nod.CreatePathRecursive(DestinationNodePath); RepositoryWebService.Predicate Source = new RepositoryWebService.Predicate( new Alfresco.RepositoryWebService.Reference[] { GetReferenceFromResultSetRow(FindNodeById(uuidNodeToCopy)) }, spacesStore, null); //copy content CMLCopy copy = new CMLCopy(); copy.where = Source; copy.to = createParentReference(destNodeId, Constants.ASSOC_CONTAINS, Name); CML cmlCopy = new CML(); cmlCopy.copy = new CMLCopy[] { copy }; //perform a CML update to move the node RepositoryWebService.UpdateResult[] updateResult = WebServiceFactory.getRepositoryService().update(cmlCopy); DestinationNodePath = ISO9075.Decode(PathUtils.ConvertFromRepositoryPath(updateResult[0].destination.path)); documentId = updateResult[0].destination.uuid; } catch (SoapException ex) { if (ex.Detail.InnerText.Contains("DuplicateChildNodeNameException")) { var node = new NodeBase(); var nodePath = String.Format("{0}/{1}", DestinationNodePath, this.Name); var id = node.GetIdByPath(nodePath); throw new DuplicateDocumentException(id, nodePath); } else { throw ex; } } catch (Exception ex) { throw ex; } return(documentId); }
public static bool IsA6Version() { try { if (_FistFindIsA6Version) { _FistFindIsA6Version = false; DingYiZhiFuChuan.GetLinkUserSuit(); if (string.IsNullOrEmpty(DingYiZhiFuChuan.A6ServerLink)) { _IsA6Version = false; return(_IsA6Version); } string str = DingYiZhiFuChuan.A6ServerLink + "/pzWebService.ws"; writeLogfile("A6Link:" + str, _Loger); if (string.IsNullOrEmpty(DingYiZhiFuChuan.A6SuitGuid) || string.IsNullOrEmpty(DingYiZhiFuChuan.A6UserGuid)) { _IsA6Version = false; return(_IsA6Version); } string str2 = DingYiZhiFuChuan.A6SuitGuid; string str3 = DingYiZhiFuChuan.A6UserGuid; str2 = str2.Substring(0, str2.IndexOf("=")); str3 = str3.Substring(0, str3.IndexOf("=")); object obj2 = new object(); string str4 = "getAcctGUID"; string[] strArray2 = new string[2]; strArray2[0] = str2; string[] strArray = strArray2; string str5 = (string)WebServiceFactory.InvokeWebService(str, str4, strArray); if (str5.Length <= 0) { _IsA6Version = false; return(_IsA6Version); } if (str5.Equals("1")) { _IsA6Version = true; return(_IsA6Version); } _IsA6Version = false; } return(_IsA6Version); } catch (BaseException exception) { _Loger.Error(exception.Message + " 不是A6平台"); _IsA6Version = false; return(_IsA6Version); } catch (Exception exception2) { _Loger.Error(exception2.Message + " 不是A6平台"); _IsA6Version = false; return(_IsA6Version); } }
public ImageUploadExample() { InitializeComponent(); AuthenticationUtils.startSession("admin", "sametsis"); // Create the repo service and set the authentication credentials this.repoService = WebServiceFactory.getRepositoryService(); }
public UploadExample() { InitializeComponent(); AuthenticationUtils.startSession("admin", "sametsis"); // Get the repository service this.repoService = WebServiceFactory.getRepositoryService(); }
/// <summary> /// Update the status of each event to be "Rejected" WorkOrderEventStatus.Rejected /// </summary> /// <param name="eventIds"></param> public void ResolveEvents(long[] eventIds, DateTime localTime, bool vandalism = false) { if (eventIds == null) { return; } //for each event, set the status to closed., as they are closing out individual events on a work order if (eventIds.Any()) { var webServiceFactory = new WebServiceFactory(); foreach (var eventId in eventIds) { var fmworkOrderEvent = MaintenanceEntities.FMWorkOrderEvents.FirstOrDefault(x => x.WorkOrderEventId == eventId); if (fmworkOrderEvent != null) { fmworkOrderEvent.Vandalism = vandalism; //now that we have closed them on our side, we need to close them on Duncans side, so for each event, send the request off to duncan to close this alarm as well. //create the event via the web service factory. //create the close Alarm Request object to pass to the web services var closeAlarmRequest = new CloseAlarmRequest { AreaId = fmworkOrderEvent.WorkOrder.AreaId, AssetId = fmworkOrderEvent.WorkOrder.MeterId, CustomerId = fmworkOrderEvent.WorkOrder.CustomerId, EventCode = fmworkOrderEvent.EventCode, EventUID = fmworkOrderEvent.EventId, LocalTime = localTime, }; var closeAlarmResponse = webServiceFactory.CloseAlarm(closeAlarmRequest); //set the status and if there were errors, report them //first, check to see if it is valid. if it is, then if (closeAlarmResponse.Closed) { fmworkOrderEvent.Status = (int)WorkOrderEventStatus.Closed; } else { fmworkOrderEvent.Status = (int)WorkOrderEventStatus.Open; var eventResource = (new ResourceFactory()).GetLocalizedTitle(ResourceTypes.Glossary, "Event(s) not closed:"); if (string.IsNullOrEmpty(ErrorMessage)) { ErrorMessage = string.Format(eventResource + " {0}", fmworkOrderEvent.WorkOrderEventId); } else { ErrorMessage += string.Format(", {0}", fmworkOrderEvent.WorkOrderEventId); } } } } MaintenanceEntities.SaveChanges(); } }
protected override void RequestTasks() { var service = WebServiceFactory.ApplicationTenantUser(); RegisterTask( new AsyncWorkflowTask("Creating the administrative user account", (state, action) => { state.Get <UserModel>().TenantId = state.Get <TenantModel>().Id; service.CreateCompleted += (sender, args) => { action.CompleteAsyncOperation(args, () => state.Set(args.ApplicationTenantUser)); }; service.CreateAsync(state.Get <UserModel>().ToApplicationTenantUser()); }) .Then( new AsyncWorkflowTask("Enabling the user account to access the tenant", (state, action) => { service.NewCompleted += (sender, args) => { action.CompleteAsyncOperation(args, () => { state.Get <UserModel>().Password = args.Result; state["UserCreated"] = true; }); }; service.NewAsync(state.Get <ApplicationTenantUser.ApplicationTenantUser>().Key, true); }).Then( new AsyncWorkflowTask("Activating security system for the tenant", (state, action) => { Task.Factory.StartNew(() => { while (!state["CompanyRenamed"]) { Thread.Sleep(1000); } var svcUser = WebServiceFactory.Tenant.User(state); var user = svcUser.ReadMultiple(null, null, 1)?[0]; if (user != null) { user.Permissions = new[] { new User_Line { Permission_Set = "SUPER" } }; svcUser.UpdateCompleted += (sender, args) => { action.CompleteAsyncOperation(args, null); }; svcUser.UpdateAsync(user); } }); })))); }
/// <summary> /// /// </summary> /// <param name="service"></param> /// <param name="webServiceURL"></param> /// <param name="behavior"></param> /// <param name="binding"></param> /// <param name="wsType"></param> private void AddWebService(WebServiceFactory service, string webServiceURL, SessionIdBehavior behavior, BasicHttpBinding binding, Type wsType) { // get the specific web service Url Uri wsUri = new Uri(PolarionUri, webServiceURL); // create a new web service object dynamic ws = Activator.CreateInstance(wsType, new Object[] { binding, new EndpointAddress(wsUri.ToString()) }); // adding a specific client behavior programmatically ws.Endpoint.Behaviors.Add(behavior); WebServices.Add(service, ws); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.CommitmentDetails); webService = WebServiceFactory.Create(); //Deserialize the commitment that was passed in commitment = JsonSerializer.Deserialize <Commitment> (this.Intent.GetStringExtra("COMMITMENT")); textViewName = FindViewById <TextView> (Resource.Id.textViewName); textViewDescription = FindViewById <TextView> (Resource.Id.textViewDescription); textViewStartDate = FindViewById <TextView> (Resource.Id.textViewStartDate); textViewEndDate = FindViewById <TextView> (Resource.Id.textViewEndDate); textViewCluster = FindViewById <TextView> (Resource.Id.textViewCluster); buttonCheckIn = FindViewById <Button> (Resource.Id.buttonCheckIn); //TODO: Need to add meaningful name/descriptions textViewName.Text = "TODO: Put in Name"; textViewDescription.Text = "TODO: Put in Desc"; textViewStartDate.Text = commitment.StartDate.ToString("ddd MMM d, yyyy"); textViewEndDate.Text = commitment.EndDate.ToString("ddd MMM d, yyyy"); textViewCluster.Text = "TODO: Put in Cluster"; buttonCheckIn.Click += async delegate { //TODO: Create confirmation dialog (Are you sure: Yes/No) var confirm = true; if (confirm) { var checkedIn = commitment.IsActive; if (checkedIn) { var r = await webService.CheckOutAsync(new CheckOutRequest { Username = App.Settings.SignedInUsername }); checkedIn = !(r.Succeeded && r.Result); } else { var r = await webService.CheckInAsync(new CheckInRequest { Username = App.Settings.SignedInUsername }); checkedIn = r.Succeeded && r.Result; } buttonCheckIn.Text = checkedIn ? "Check Out" : "Check In"; commitment.IsActive = checkedIn; } }; }
public void CanPerformSearches() { AuthenticationUtils.startSession("admin", "admin"); try { RepositoryService repositoryService = WebServiceFactory.getRepositoryService(); Store spacesStore = new Store(StoreEnum.workspace, "SpacesStore"); String luceneQuery = "PATH:\"/app:company_home\""; Query query = new Query(Constants.QUERY_LANG_LUCENE, luceneQuery); QueryResult queryResult = repositoryService.query(spacesStore, query, false); ResultSet resultSet = queryResult.resultSet; ResultSetRow[] results = resultSet.rows; //your custom list IList <CustomResultVO> customResultList = new List <CustomResultVO>(); //retrieve results from the resultSet foreach (ResultSetRow resultRow in results) { ResultSetRowNode nodeResult = resultRow.node; //create your custom value object CustomResultVO customResultVo = new CustomResultVO(); customResultVo.Id = nodeResult.id; customResultVo.Type = nodeResult.type; //retrieve properties from the current node foreach (NamedValue namedValue in resultRow.columns) { if (Constants.PROP_NAME.Equals(namedValue.name)) { customResultVo.Name = namedValue.value; } else if (Constants.PROP_DESCRIPTION.Equals(namedValue.name)) { customResultVo.Description = namedValue.value; } } //add the current result to your custom list customResultList.Add(customResultVo); } Assert.AreEqual(1, customResultList.Count); CustomResultVO firstResult = customResultList[0]; Assert.IsNotNull(firstResult.Id); Assert.AreEqual("{http://www.alfresco.org/model/content/1.0}folder", firstResult.Type); } finally { AuthenticationUtils.endSession(); } }
/// <summary> /// Guarda un fichero en el nodo especificado /// </summary> /// <param name="parentId">uuid del nodo donde queremos guardar el documento</param> /// <param name="documentPath">Ruta local de la que se debe sacar el fichero, aquí se devuelve la ruta del repositorio donde se ha guardado el documento</param> /// <param name="document">raw document, si este valor es null se intentará leer el documento del documentPath</param> /// <returns>uuid del documento que se ha salvado</returns> public string CreateFileByParentId(string parentId, ref string documentName, byte[] document) { if (document == null) { return(null); } string documentId = null; var mimeType = new MimetypeMap(); try { UpdateResult[] updateResult = CreateNode(parentId, null, Constants.TYPE_CONTENT); // work around to cast Alfresco.RepositoryWebService.Reference to Alfresco.ContentWebService.Reference RepositoryWebService.Reference rwsRef = updateResult[0].destination; ContentWebService.Reference newContentNode = new Alfresco.ContentWebService.Reference(); newContentNode.path = rwsRef.path; newContentNode.uuid = rwsRef.uuid; ContentWebService.Store cwsStore = new Alfresco.ContentWebService.Store(); cwsStore.address = Constants.SPACES_STORE; newContentNode.store = cwsStore; var contentFormat = new Alfresco.ContentWebService.ContentFormat(); contentFormat.mimetype = mimeType.GuessMimetype(Name); Content lContent = WebServiceFactory.getContentService().write(newContentNode, Constants.PROP_CONTENT, document, contentFormat); documentName = ISO9075.Decode(PathUtils.ConvertFromRepositoryPath(lContent.node.path)); documentId = lContent.node.uuid; } catch (SoapException ex) { if (ex.Detail.InnerText.Contains("DuplicateChildNodeNameException")) { var node = new NodeBase(); var nodePath = String.Format("{0}/{1}", node.GetPathById(parentId), System.IO.Path.GetFileName(documentName)); var id = node.GetIdByPath(nodePath); throw new DuplicateDocumentException(id, nodePath); } else { throw ex; } } catch (Exception ex) { throw ex; } return(documentId); }
void BindData() { try { var zone = AdminMgr.GetSelectZoneId(HttpContext.Current, ddlZone); var cacheType = AdminMgr.GetSelectInt(ddlCacheType); var s = WebServiceFactory.GetWebService(zone).ResetCache(cacheType); ShowMessage(s); } catch (Exception ex) { LogHelper.Insert(ex); ShowMessage("local exception:" + ex.Message); } }
public CommitmentsViewController() : base(MonoTouch.UIKit.UITableViewStyle.Grouped, new RootElement("Commitments"), true) { webService = WebServiceFactory.Create(); Root = new RootElement("Commitments") { new Section("Active Commitments") { }, new Section("Inactive / Past Commitments") { } }; }
/// <summary> /// The form load event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Browse_Load(object sender, EventArgs e) { // Ensure the user has been authenticated if (AuthenticationUtils.IsSessionValid == false) { AuthenticationUtils.startSession("admin", "sametsis"); } // Get a repository and content service from the web service factory this.repoService = WebServiceFactory.getRepositoryService(); this.contentService = WebServiceFactory.getContentService(); this.authoringService = WebServiceFactory.getAuthoringService(); // Populate the list box populateListBox(); }
private ISearchAvailableObjectWebService GetSearchAvailableObjectService() { if (IsDesignMode) { return(null); } if (string.IsNullOrEmpty(SearchServicePath)) { throw new InvalidOperationException(string.Format("BocAutoCompleteReferenceValue '{0}' does not have a SearchServicePath set.", ID)); } var virtualServicePath = VirtualPathUtility.GetVirtualPath(this, SearchServicePath); return(WebServiceFactory.CreateJsonService <ISearchAvailableObjectWebService> (virtualServicePath)); }
private void DeleteNodes(Alfresco.RepositoryWebService.Reference[] references) { var predicate = new RepositoryWebService.Predicate(references, spacesStore, null); //delete content CMLDelete delete = new CMLDelete(); delete.where = predicate; CML cmlRemove = new CML(); cmlRemove.delete = new CMLDelete[] { delete }; //perform a CML update to remove the node WebServiceFactory.getRepositoryService().update(cmlRemove); }
protected override void RequestTasks() { var service = WebServiceFactory.ApplicationTenantUser(); RegisterTask( new AsyncWorkflowTask("Creating the user account", (state, action) => { state.Get <NewUserModel>().User.TenantId = state.Get <TenantModel>().Id; service.CreateCompleted += (sender, args) => { action.CompleteAsyncOperation(args, () => state.Set(args.ApplicationTenantUser)); }; service.CreateAsync(state.Get <NewUserModel>().User.ToApplicationTenantUser()); }) .Then( new AsyncWorkflowTask("Enabling the user account to access the tenant", (state, action) => { service.NewCompleted += (sender, args) => { action.CompleteAsyncOperation(args, null); }; service.NewAsync(state.Get <ApplicationTenantUser.ApplicationTenantUser>().Key, true); }).Then( new AsyncWorkflowTask("Setting user permission sets", (state, action) => { var userSvc = WebServiceFactory.Tenant.User(state); var newUser = state.Get <NewUserModel>(); var user = userSvc.ReadMultiple( new[] { new User_Filter { Field = User_Fields.User_Name, Criteria = state.Get <NewUserModel>().User.UserName } }, null, 1)[0]; user.Permissions = JsonConvert.DeserializeObject <string[]>( newUser.SelectedPermissionSets).Select(p => new User_Line { Company = newUser.User.Company, Permission_Set = p }).ToArray(); userSvc.Update(ref user); action.Complete(); })))); }
//public void asignarPermisos(string espacioID, NewUserDetails user) //{ // Alfresco.AccessControlWebService.Reference Ref = new Alfresco.AccessControlWebService.Reference(); // Alfresco.AccessControlWebService.Store spacesS = new Alfresco.AccessControlWebService.Store(); // spacesS.scheme = Alfresco.AccessControlWebService.StoreEnum.workspace; // spacesS.address = "SpacesStore;" // Ref.store = spacesS; // Ref.uuid = espacioID; // Ref.path = null; // Alfresco.AccessControlWebService.Predicate pred = new Alfresco.AccessControlWebService.Predicate(); // pred.Items = new Object[] { Ref, spacesS, null }; // Alfresco.AccessControlWebService.ACE[] aceRemove = new Alfresco.AccessControlWebService.ACE[1]; // aceRemove[0] = new Alfresco.AccessControlWebService.ACE(); // aceRemove[0].authority = user.userName; // aceRemove[0].permission = Constants.ALL_PERMISSIONS;//Constants.COORDINATOR; // aceRemove[0].accessStatus = Alfresco.AccessControlWebService.AccessStatus.declined; // WebServiceFactory.getAccessControlService().removeACEs(pred, aceRemove); // Alfresco.AccessControlWebService.ACE[] aceWrite = new Alfresco.AccessControlWebService.ACE[1]; // aceWrite[0] = new Alfresco.AccessControlWebService.ACE(); // aceWrite[0].authority = user.userName; // aceWrite[0].permission = "Consumer";//Consumer Permissions // aceWrite[0].accessStatus = Alfresco.AccessControlWebService.AccessStatus.acepted; // WebServiceFactory.getAccessControlService().addACEs(pred, aceWrite); //} public string getHomeFolder(string usuario) { Alfresco.AdministrationWebService.AdministrationService administrationService = new Alfresco.AdministrationWebService.AdministrationService(); administrationService = WebServiceFactory.getAdministrationService(); Alfresco.AdministrationWebService.UserDetails detallesUser = new Alfresco.AdministrationWebService.UserDetails(); detallesUser = administrationService.getUser(usuario); string homeFolder = string.Empty; for (int i = 0; i < detallesUser.properties.Length; i++) { if (detallesUser.properties[i].name.ToString() == "{http://www.alfresco.org/model/content/1.0}homeFolder") { homeFolder = detallesUser.properties[i].value.ToString(); i = detallesUser.properties.Length; } } return(homeFolder); }
public DispatcherModule(List<SimpleWebServiceDescriptor> classList) { frontendModule = new acadGraph.Libs.RpcWebLib.FileModule("/RpcTest", Path.Combine(BASE_DIR, "RpcTest")); frontendModule.AddDefaultMimeTypes(); var serviceFactory = new WebServiceFactory(); var webServices = new List<IWebServiceDescriptor>() { //new SimpleWebServiceDescriptor("qooxdoo.test", new HelloWorld()), new SimpleWebServiceDescriptor("EventService", new EventService()), new SimpleWebServiceDescriptor("Publisher", new PublisherService()), new SimpleWebServiceDescriptor("EMWebService", new Services.EMWebService()) }; webServices.AddRange(classList); serviceFactory.InitWebServices(webServices); rpcModule = new RpcModule("/rpc", serviceFactory); }