I would like to create a WF receive activity but customized to use a fixed contract and fixed parameters. I have thought in extending the Receive activity and set some of it properties, but it is a sealed class.
Which is the best aproach to do that?
Your designer can use an IActivityTemplateFactory to pre-configure the existing Send/Receive with the contract you want. You can also add variables that may be required. That way developers won't have to type in each of the parameters.
You create a XAML activity and drop the Receive activity in there. If you add a service reference to a workflow project that is exactly what the tooling does when it generates the prepackaged activities for you.
Related
I 'm working on an Android App that I take entries from user and add them to Firebase to retrieve in the future but I confused about that do I need a viewModel for this operation.
So, I know we need viewModels for business logic e.g grabbing data from an API or database but I have no idea about that Is it necessary when adding data to Firebase. If it does, I can't access the views where users enter data from a viewModel.
Can you explain do I need viewModel and if I do, how to access these views from viewModel ?
I know we need view models for business logic.
Yes, that is correct. It's recommended to put your business logic in the ViewModel, as it should serve as the connector between our UI and the rest of your app. Besides that, bear in mind that the ViewModel it's a class that is designed to store and manage UI-related data that are lifecycle aware. It allows the data to survive configuration changes such as screen rotations.
but I have no idea about that Is it necessary when adding data to Firebase.
Yes, the read and the write operation should be managed through the ViewModel.
If it does, I can't access the views where users enter data from a ViewModel.
The views should never exist in the ViewModel class. You should only have objects that can be observed from the activity or fragment.
how to access these views from ViewModel?
It's exactly the opposite. You access (observe) the data in the ViewModel class from the activity or fragment classes. I have also written two articles that can help you understand the concept:
How to create an Android app using multiple Firebase products in Kotlin?
How to make a clean architecture Android app, using MVVM, Firestore, and Jetpack Compose?
While having a view model is custom and improves the readability of your code, it is not required. Instead of a view model, you can also handle all interaction with the database through Map objects and primitive data types.
If you're using Firestore, that is actually what most of the documentation does, such as in the documentation on adding all types of data. For Firebase's Realtime Database the same logic applies, although the documentation only shows examples with view model objects.
We have a requirement of custom traits and the data for the custom trait should be fetched from our rest API.
Examples for traits we are looking into are like : Balance, Currency, Birthday etc.(Should be dynamic).
Business wants the ability to add a new custom trait from the configuration, with the data available from the rest api.
In case if we add new data items in the rest api we should be able to configure and use that custom trait corresponding to that data.
For this requirement,
I had gone through the Silver pop & Sugar CRM modules,
It seems like complexity involved to understand the login and external forms.
I have added some generic class implementation. But still I am not able to populate the traits in the Magnolia with data from rest.
I need few more clarifications regarding this.
1.How Magnolia recognizes the trait. Through Configuration/ something else(XML)?
2.If I try to generate the configuration with the static values in the version handler and called register methods by passing the tasks as parameters in the constructor. But still I am unable to see the trait configuration in the admin central.(config.modules.rest-traits-module.traits.balance.xml, config.modules.rest-traits-module.traits.currency.xml). Can we generate this kind of configuration as dynamic in Java code?
3.How can we set labels for the Traits instead of adding in Properties file? because we need them as dynamic.
4.Can we generate dynamic yaml files through java?(For traits configuration) If yes, does it support for Magnolia 5.3.9?
In the silver pop module they given some external form and its actions.. In my requirement i am not using any external forms? How can I proceed?
Does login is mandatory for this requirement?
Could you please suggest.
Thanks for your support,
--Vijay Kodali.
1.How Magnolia recognizes the trait.
You register the trait in the traits folder under your module. See documentation on creating custom traits for more info.
Can we generate this kind of configuration as dynamic in Java code?
Yes you can. Perhaps you made mistake somewhere in your version handler? Or it was not called because your module is already installed? Hard to say without seeing the code.
3.How can we set labels for the Traits instead of adding in Properties file? because we need them as dynamic.
not really "trait specific", but general Magnolia/Vaadin UI question. If you want to set labels dynamically, you would need to write your own FormPresenter (or View) implementation.
4.Can we generate dynamic yaml files through java?(For traits configuration) If yes, does it support for Magnolia 5.3.9?
Yes, you can generate yaml files through java. It doesn't matter what/whom puts them in filesystem as long as they are on observed file path.
And no, you can't register traits via yaml (yet) no matter which version of Magnolia you use. And in general yaml support is since 5.4 only, so it would not work on 5.3.9 anyway.
In my requirement i am not using any external forms? How can I proceed?
Traits have no direct connection to external forms. Those two are independent feature. In silverpop/marketing-cloud module they were used together since Magnolia was both producing data for Silverpop and consuming data from it, but you can have custom traits even without external forms. For more details see the above mentioned documentation on creation of custom traits.
Does login is mandatory for this requirement?
No login is not mandatory.
HTH,
Jan
I want to provide my own implementation of TimerExtention in place of DurableTimerExtention provided by Delay activity, so that I can test workflows that use delays.
How can I accomplish that?
I have WorkflowService instance and its root Activity. The workflow service is hosted in WorkflowServiceHost, (though I can not figure out how to get WorkflowInstance instance)
One way to test your workflows is to use the Microsoft.Activities.UnitTesting on CodePlex. It has the capability to mock activities using XAML Injection. See here for more details.
In the case of a Delay activity you can do things a lot simpler though. Instead of hard coding the Duration to a fixed value I normally create a config object with the duration in there. In the Delay activity I just enter an expression like Settings.WaitForPaymentDuration. In production the Settings.WaitForPaymentDuration will be set to something like 30 days but in a test I can set it to 1 second instead without changing the workflow at all.
I have had a similar interest in mocking the TimerExtension, I wrote a blog post about it. In that post I inject my own implementation of the TimerExtension using WorkflowApplication.Extensions.Add<T>(Func<T>). WorkflowServiceHost also has this collection. You could replace the concrete class I have in my example with a mock. I wrote it targeting 4.5, but it should work with anything that uses the Extension collection. Its in 4, not sure earlier versions.
[Link]
I'm currently looking at developing a WCF Service for the first time, but am a bit confused.
Say I've got a windows application that is going to call into this web service, that service is then going to call our data methods to retrieve and save the data.
Now, say for example we have 2 classes in our solution, Customer and Product. Do all methods within the service have to go into the same class file (e.g. MyService.svc), or can they be split into several classes replicating the main data layer, i.e. Customer.cs and Product.cs. If they can be split, how do these get called from within the windows forms application? Would each class be a different end point?
At the moment I can access the methods within the main class (e.g. MyService.svc), but I can't see any of the methods in the other classes, even though I have attributed them with "ServiceContract" and "OperationContract".
I have a feeling I'm missing something simple somewhere, just not sure what.
I would be grateful if some nice person could point me in the direction of a tutorial on doing this, as every tutorial I've found only includes the single class :)
Thanks in advance.
What you need to define is Data Contracts for your service
Theoretically, these data contracts could be your business entities (since 3.5 SP1 and its WCF poco support)
It's better though to create separate entities for your service and then to create conversion classes that can convert your business entities into service entities and the other way around
Actually, after loads of searching, I finally seemed to find what I was looking for just after posting my question (typical).
I've found the following page - http://www.scribd.com/doc/13136057/ChapterImplementing-a-WCF-Service-in-the-Real-World
Although I've not gone through it yet, it does look like it will cover what I'm after.
Apologies for wasting anyones time :) Hopefully this will be useful to someone else looking for the same thing.
It sounds like you only need one service. However, if you need to create multiple services. Consider this as an example.
[ServiceContract(Name = "Utility", Namespace = Constants.COMMON_SERVICE_NAMESPACE)]
public interface IService
[ServiceContract(Name="Documents", Namespace = Constants.DOCUMENTS_SERVICE_NAMESPACE)]
public interface IDocumentService
[ServiceContract(Name = "Lists", Namespace = Constants.LISTS_SERVICE_NAMESPACE)]
public interface IListService
Remember that you can create multiple data contracts inside a single service, and it is the best solution for a method that will require a reference to Customer(s) and Product(s).
It might help to take a look at MSDN's data contract example here.
Up until now I've only been using orchestrations in my BizTalk application and it's been working fine so far. But now I want to convert some of the unnecessary orchestrations to pure message routing instead in order to get better performance.
I've got a WCF service with only one method and that works fine because I can set the BtsActionMapping to only that single method. But the second WCF service I've got has two methods and now BizTalk doesn't know how to route my message. I've read everywhere that you need to set BTS.Operation in a custom pipeline to get it to work. But I've searched all over the place for a tutorial or example on how to do this.
I've been trying to implement the IBaseComponent, IComponentUI, IComponent and IPersistPropertyBag interfaces to do this. Am I going in the right direction or I'm I way off? Can anyone point me to an example or better yet show me how to do this?
The easiest way to get started writing a custom pipeline component is to use the BizTalk Server Pipeline Component Wizard; it will generate all the boilerplate for you. I've also got several custom pipeline components you can use as an example, a few that are very close to what you need (i.e. a component that just sets a custom message property) can be seen here.
As for setting the property, all you need to do is call message.Context.Write/Promote and pass in the namespace and name of the property, in this case those would be "http://schemas.microsoft.com/BizTalk/2003/system-properties" and "Operation" respectively.