Esempio n. 1
0
        internal static PrintResult PrintArtifact(ArtifactToPrint printArtifact)
        {
            var id    = printArtifact.Id;
            var draft = printArtifact.Draft;

            switch (printArtifact.Type)
            {
            case ArtifactType.Base:
                var b = ModelManager.GetBaseArtifact(new ArtifactSymbol
                {
                    Id = id
                });

                if (b != null)
                {
                    PrintBase(b, draft);
                }

                break;

            case ArtifactType.Behavior:
                var behavior = ModelManager.GetBehaviorArtifact(new ArtifactSymbol
                {
                    Id = id
                });

                if (behavior != null)
                {
                    PrintBehavior(behavior, draft);
                }

                break;

            case ArtifactType.BehaviorGroup:
                var behaviorGroup = ModelManager.GetBehaviorGroupArtifact(new ArtifactSymbol
                {
                    Id = id
                });

                if (behaviorGroup != null)
                {
                    PrintBehaviorGroup(behaviorGroup, draft);
                }

                break;

            case ArtifactType.PropertySet:
                var propertySet = ModelManager.GetPropertySetArtifact(new ArtifactSymbol
                {
                    Id = id
                });

                if (propertySet != null)
                {
                    PrintPropertySet(propertySet, draft);
                }

                break;

            case ArtifactType.TemplateFormula:
                var formula = ModelManager.GetTemplateFormulaArtifact(new ArtifactSymbol
                {
                    Id = id
                });

                if (formula != null)
                {
                    PrintFormula(formula, draft);
                }

                break;

            case ArtifactType.TemplateDefinition:
                var definition = ModelManager.GetTemplateDefinitionArtifact(new ArtifactSymbol
                {
                    Id = id
                });

                if (definition != null)
                {
                    PrintDefinition(definition, draft);
                }

                break;

            case ArtifactType.TokenTemplate:
                var spec = Printer.TaxonomyClient.GetTokenSpecification(new TokenTemplateId
                {
                    DefinitionId = id
                });

                if (spec != null)
                {
                    if (spec.Artifact.Name == null || spec.Artifact.Name.Contains("Error:"))
                    {
                        _log.Error(spec.Artifact.Name);
                        break;
                    }

                    PrintSpec(spec, draft);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(GetPrintResult());
        }
Esempio n. 2
0
 public override Task <PrintResult> PrintTTFArtifact(ArtifactToPrint printArtifact, ServerCallContext ctx)
 {
     _log.Info("gRpc request to PrintTTFArtifact: " + printArtifact.Type + " id: " + printArtifact.Id);
     return(Task.FromResult(PrintController.PrintArtifact(printArtifact)));
 }