Example #1
0
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hash = (Key != null) ? Key.GetHashCode() : 0;
         // Suitable nullity checks etc, of course :)
         hash = (DefinitionKey != null) ? hash * 17 + DefinitionKey.GetHashCode() : hash;
         hash = (Id != null) ? hash * 17 + Id.GetHashCode() : hash;
         hash = (Name != null) ? hash * 17 + Name.GetHashCode() : hash;
         hash = hash * 17 + IsExecutable.GetHashCode();
         hash = hash * 17 + IsClosed.GetHashCode();
         return(hash);
     }
 }
Example #2
0
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hash = (Key != null) ? Key.GetHashCode() : 0;
         // Suitable nullity checks etc, of course :)
         hash = (DeploymentId != null) ? hash * 17 + DeploymentId.GetHashCode() : hash;
         hash = (Name != null) ? hash * 17 + Name.GetHashCode() : hash;
         hash = (DefinitionKey != null) ? hash * 17 + DefinitionKey.GetHashCode() : hash;
         hash = (ProcessDefinitionDescription != null) ? hash * 17 + ProcessDefinitionDescription.GetHashCode() : hash;
         hash = (ProcessDefinitionResource != null) ? hash * 17 + ProcessDefinitionResource.GetHashCode() : hash;
         hash = (ProcessDefinitionDiagramResourceName != null) ? hash * 17 + ProcessDefinitionDiagramResourceName.GetHashCode() : hash;
         hash = hash * 17 + ProcessDefinitionHasStartFormKey.GetHashCode();
         hash = hash * 17 + ProcessDefinitionHasGraphicalNotation.GetHashCode();
         hash = hash * 17 + IsSuspended.GetHashCode();
         hash = (TenantId != null) ? hash * 17 + TenantId.GetHashCode() : hash;
         return(hash);
     }
 }
        /// <summary>
        /// Retrieve a specific definition from the reference data
        /// </summary>
        /// <param name="definitionTypeName">The name of the definition type</param>
        /// <param name="moniker">The moniker of the definition, refers to the Sitecore GUID of the item</param>
        /// <param name="definitionName">The name of the definition (to be used in culture data)</param>
        /// <param name="referenceDataHost">The host URL of the reference data service</param>
        /// <param name="thumbprint">The thumbprint for the endpoint certificate</param>
        /// <returns></returns>
        public virtual async Task <Definition <string, string> > CreateDefinition(string definitionTypeName, string moniker, string definitionName, string referenceDataHost, string thumbprint)
        {
            using (var client = BuildClient(referenceDataHost, thumbprint))
            {
                try
                {
                    //Get the definition type that the definition will be associated to
                    var definitionType = await client.EnsureDefinitionTypeAsync(definitionTypeName);

                    //Define the data about the definition
                    var definitionKey = new DefinitionKey(moniker, definitionType, 1);
                    var definition    = new Definition <string, string>(definitionKey)
                    {
                        IsActive    = true,
                        CommonData  = "Some common data",
                        CultureData =
                        {
                            { new CultureInfo("en"), definitionName }
                        }
                    };

                    //Culture invariant data - has culture, but culture is unknown
                    definition.CultureData[CultureInfo.InvariantCulture] = definitionName;

                    //Create the definition
                    var result = await client.SaveAsync(definition);

                    Logger.WriteSaveResult(result);

                    return(definition);
                }
                catch (Exception ex)
                {
                    Logger.WriteError("Error creating definition", ex);
                }
            }

            return(null);
        }
Example #4
0
        public bool Equals(BpmnDefinition other)
        {
            // Check for null
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            // Check for same reference
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            // Not Check DeploymentId, because generated Guid

            // Check for same value
            return(((DeploymentId == null && other.DeploymentId == null) || (DeploymentId != null && other.DeploymentId != null && DeploymentId.Equals(other.DeploymentId))) &&
                   ((Name == null && other.Name == null) || (Name != null && other.Name != null && Name.Equals(other.Name))) &&
                   ((DefinitionKey == null && other.DefinitionKey == null) || (DefinitionKey != null && other.DefinitionKey != null && DefinitionKey.Equals(other.DefinitionKey))) &&
                   ((ProcessDefinitionDescription == null && other.ProcessDefinitionDescription == null) || (ProcessDefinitionDescription != null && other.ProcessDefinitionDescription != null && ProcessDefinitionDescription.Equals(other.ProcessDefinitionDescription))) &&
                   ((ProcessDefinitionDiagramResourceName == null && other.ProcessDefinitionDiagramResourceName == null) || (ProcessDefinitionDiagramResourceName != null && other.ProcessDefinitionDiagramResourceName != null && ProcessDefinitionDiagramResourceName.Equals(other.ProcessDefinitionDiagramResourceName))) &&
                   (ProcessDefinitionHasStartFormKey.Equals(other.ProcessDefinitionHasStartFormKey)) &&
                   (ProcessDefinitionHasGraphicalNotation.Equals(other.ProcessDefinitionHasGraphicalNotation)) &&
                   (IsSuspended.Equals(other.IsSuspended)) &&
                   ((TenantId == null && other.TenantId == null) || (TenantId != null && other.TenantId != null && TenantId.Equals(other.TenantId))));
        }
Example #5
0
        public bool Equals(BpmnProcess other)
        {
            // Check for null
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            // Check for same reference
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            // Not Check Key, because generated Guid

            // Check for same value
            return(((DefinitionKey == null && other.DefinitionKey == null) || (DefinitionKey != null && other.DefinitionKey != null && DefinitionKey.Equals(other.DefinitionKey))) &&
                   ((Id == null && other.Id == null) || (Id != null && other.Id != null && Id.Equals(other.Id))) &&
                   ((Name == null && other.Name == null) || (Name != null && other.Name != null && Name.Equals(other.Name))) &&
                   (IsExecutable.Equals(other.IsExecutable)) &&
                   (IsClosed.Equals(other.IsClosed)));
        }