Creating liferay service builder without configuring any database - liferay

Is it possible to create liferay service builder without any configuring any database tables in service.xml file.
Actually purpose here is to create a service layer using liferay service builder. And there is no database interaction directly in this service layer.

Yes, and it's quite simple. While you still need an entity (which provides the name for your service) you can leave this entity definition empty.
This will create the service (local or remote, as configured in the entity) but no model, no persistence and no database table.
One of the situations where this comes in really handy is when you want to add another method to an existing service (which you can't) - you just create a new service with your custom methods and delegate to the original service.

I agree with #Olaf Kock answare in which say that it is possible have an empty model with service builder. Furthermore have an empty entity you can benefit of have the same transactional context of your portal and benefit of cluster managing and benefit of a complete integration with liferay portal.
If you have the same transactional enviroment of the portal you can image of create a service that agregate native liferay service and you get the assurance that the transactional context is the same of the portal.
I hop that this reflection can add value.

Its highly recommended that If you're creating Service.xml then at least one entity should be there. Otherwise no need to add that configuration.

Able to create service builder without real entities.
As provided in the link it is possible to create service builder without entities.
Also discussed more in detail in this forum
Hope it helps some one. Thanks

Related

How Modifying Azure Analysis services roles using a logic app?

With Azure Data Factory I have built a pipeline to orchestrate the processing of my Azure Analysis Services model trough a dedicated Logic App as explicated in this article, and it works properly.
Now, always using Azure Data Factory (through Logic App), I wish I could also update the list of the user in a specific roles.
In the article mentioned above, to process the Azure Analysis Services models, the Logic App calls a specific API that has the following format:
https:// <rollout>.asazure.windows.net/servers/<serverName>/models/<resource>/refreshes
but this API doesn't seem to work for update the model's roles.
Is there anyone who knows the correct method to be able to update model roles using a specific Logic App?
Thanks for any suggestions
If you don't necessarily need to use the logic app for this, I think it might be possible using Azure automation and the powershell cmdlets for managing azure analysis services:
https://learn.microsoft.com/en-us/azure/analysis-services/analysis-services-refresh-azure-automation
https://learn.microsoft.com/en-us/azure/analysis-services/analysis-services-powershell
https://learn.microsoft.com/en-us/powershell/module/sqlserver/Add-RoleMember?view=sqlserver-ps
One alternative approach might be to have fixed AD groups as members of the tabular model roles and add / remove members from those AD groups. Therefore the tabular model roles would not need to be refreshed, it would simply be a matter of adding or removing members from the AD groups as part of your governance process.
A second approach would be to use dynamic row-level security. Adding records to a Azure SQL DB table is perfectly possible with Logic Apps and could be used to drive security, depending on your requirements. You can then refresh your security dimension with the Logic App. See here for more details:
https://learn.microsoft.com/en-us/power-bi/desktop-tutorial-row-level-security-onprem-ssas-tabular
To answer your question however, the Azure Analysis Services REST API is useful but is not that fully featured, ie it does not contain all possible operations for tabular models or the service. One other missing example I found was backups, ie although it is possible to trigger a pause or resume of the service, it is not possible to trigger a backup of a tabular model via the REST API. I do not believe it is possible to alter role members or at least, the operation is not listed in the REST API, although happy to be corrected if I am wrong. To be more specific, Roles is not mentioned in the list of available objects which can be passed in to the Objects array using the POST / Refreshes eg here. table and partition are the only ones I'm aware of.
There are also no examples on the MS github site:
https://github.com/microsoft/Analysis-Services
Finally, consider calling TMSL via Powershell in an Azure Function, which you can call from Azure Data Factory.
HTH

Azure Mobile Services with existing database + table controller

I have created Azure Mobile Service using Azure portal and selected a existing database.
Now I have few questions:
Whenever I'll run the application, database gets cleared as ClearDatabaseSchemaIfModelChanges has configured for Database Initializer in WebApiConfig. Can I use database first approach for Entity Framework?
My existing database has default schema is dbo but it will create a new schema for all tables same as service name. How to overcome this scenario?
Finally, TableController is tightly bind to a table. But output requires in my case is bit complex as I require data from multiple table using join each other. And I also wants to add some logic before giving return the result.
And a tightly bound table also requires some common columns like CreatedAt, UpdatedAt, Id, Deleted as it inherit from EntityData class. But In my existing tables, columns are not there.
Help me out !!
You can do the following:
1) Create the custom API for your operations (that are not so tightly connected with the HTTP verbs and the table)
2) Manipulate the DB manually - it is just a SQL Azure database that can be managed by SQL Servre Management Studio, Visual Studio or queries.
So, shortly, if you need the flexibility of doing what you need with the database, you can do it, but Mobile Services is a service, so there are some limitations.
Hope that helps. If not, please elaborate the issue.
first, you should be using Azure Mobile Apps instead of Azure Mobile Services.
You can follow what Alexandr has mentioned, or you can stick with using Mobile App by extending your existing tables to add the required columns (especially if you want to do sync).
The TableControllers are just plain WebAPI controllers, you can certainly extend it.
Have a look at this link for a more guided step on how reuse an existing database.

Push Data into CRM 2011 from Another System

How should data be pushed into CRM 2011 from another system?
I would like to pass the data to a web service.
I have thought of 2 options so far:
Create a custom entity and create records of this entity by calling the Organization service from the other system. A workflow can handle everything from that point.
Create a WCF service and host it somewhere. The other system passes data to this service and the service interacts with CRM.
The client will just pass us records, so validation must happen on the CRM side.
EDIT:
If the client is an old system (in Cobol or something) is it still possible to connect to the CRM service?
Just to expand on Predro's answer:
I have actually done both with CRM 4. I would highly reccommend that you create your own sevice for the client to call which in turn calls the CRM services.
This gives you an extra layer of abstraction for when things change later - and they will.
If your client calls the CRM services directly it will be difficult/impossible for you to change your internal data structures or move servers around in the farm. Esecially true if you currently use a singer-server infrastructre.
Also don't map the service you create directly to the entity data structure, use an intermidiate model.
So if you wanted the client to pass Account details in, have your service expect an XML document that you convert in to an Account Entity, rather than expose the Account Entity and have your client submit that.
The second choice for me is the best way to handle with this situation, because you can control and validate everything in your side. You can host the WCF service in the same server of CRM Dynamics or in another server with access to CRM Dynamics and interact with with CRM through CRM Web Services.
I think you don't have any better solution.
Assuming the client has a login to your CRM system, I would actually go with the option #1 first. Why?
You can still validate the data in the Pre-Validation plugin stage.
This is by far the easiest and fastest way to get going. Will things change? Maybe! But:
You are going to spend lots and lots of hours getting a custom WCF service up and running
Somebody has to deploy it
Somebody has to maintain it
Your client has to learn how to connect to a proprietary WCF service instead of saying "Here's a bunch of published info on how to connect to CRM's webservices."
It becomes a "hidden silo" of business logic instead of it all existing in CRM. Any good CRM developer would be able to work on option number one. Number two requires additional skills.
If it really does change over time so much that it needs its own WCF service, you haven't really wasted that much time. All your business logic would be ported from a plugin to the WCF service. But it is much harder to go from the more complex solution (#2) to the simpler solution (#1) if it turns out that you don't need it.
I promise you that your customer wants this done faster and simpler (cheaper) rather than longer and more complex (expensive).

Creating Organization using Liferay API

Which of the following util is suitable for creating an organization using Liferay API.
i) OrganizationUtil
ii) OrganizationServiceUtil
iii) OrganizationLocalServiceUtil
Basically, I want to know the difference between these three.
i) OrganizationUtil: com.liferay.portal.service.persistence.OrganizationUtil
The classes from the persistence layer directly talk to the Database and hence are good to be used from the service layer and also if you care about transaction.
Following are the words from the documentation:
The persistence utility for the organization service. This utility wraps OrganizationPersistenceImpl and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
ii) OrganizationServiceUtil: com.liferay.portal.service.OrganizationServiceUtil
It can be called from any layer as such. This class also does permission checks (based on Permissions given in Liferay) which may be useful in some cases. This can also be used through web-service.
Well lets see what liferay's documentation has to say:
The utility for the organization remote service. This utility wraps com.liferay.portal.service.impl.OrganizationServiceImpl and is the primary access point for service operations in application layer code running on a remote server.
This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
iii) OrganizationLocalServiceUtil: com.liferay.portal.service.OrganizationLocalServiceUtil
This can also be used if you don't want any permission checks. The OrganizationServiceUtil ultimately makes a call to the localService layer.
Liferay's Documentation:
The utility for the organization local service. This utility wraps com.liferay.portal.service.impl.OrganizationLocalServiceImpl and is the primary access point for service operations in application layer code running on the local server.
This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
Conclusion
Use OrganizationUtil if you care about transaction i.e. have to update multiple tables in a transaction then use this.
Use OrganizationServiceUtil if you creating Organization outside liferay or if you need permission checks & you don't care about transaction (i.e. transaction with your custom code)
Use OrganizationLocalServiceUtil if you are not using a web-service and you don't care about transaction or permissions.
Hope this gives you a fair idea. Let me know if it is still unclear.

In Domain Driven Design the factory classes can access to infraestructure?

If necessary, a factory can access elements of the infrastructure to build an object?. In a particular case, I have an object that I need to add email signature that is stored as a parameter in the configuration layer of the application.
In DDD, a Factory is at the same architectural level as a Repository, but for creating new objects instead of loading existing objects. So it can call infrastructure services just like the repository.
There is no one correct answer to this problem. If the factory itself is part of your application layer this should be fine. You can also add an application service that hands the email signature down into your domain when needed.

Resources