getSolutionName

Hi,

Think I brought this up before, but cannot seem to find it now, so I’m asking (maybe again :) )

Would it be possible to get such a function, returning the reas solution name (not the displayed title)?

Paul

you are talking about the plugin api i take?

No, not this time :D

just in Developer…

Paul

BTW: If the last time I asked I was told that there was no need for the function, because you could just code it in your solution, I now have a reason why I think it should be a function:

I have a module that relies on the solution name for some processes. If this module would be for sale, for example, I have no way of influencing the proper setting of a global from my module with the solutionname.

Offcourse I can show an input dialog, but who ever is using the solution could put any value in, thus breaking the logic in my module.

Paul :)

btw I would also like this in the plugin api…

why would you have this in the developer as what?
application.getSolutionName()???

Why would you have that?
Because when you do that call (in a script method) then that script method belogns to a form and that form belongs to a solution…
So you aready know the solution name!

i can think of something for this in the plugin api But for scripting in servoy itself it isn’t needed

and why would you know the solution name in a module?
A module should never do stuff for a solution.. It should be a standalone piece of code.

See, I think we had this discusion before… :D

How would a script know the solution name is, if the script can only get the formname? I don’t understand what you mean…

As for why you would need it: consider a Security module, with a function to store in a DB the solution, with related to it it’s forms and then related to it, it’s (named) elements. Start of that exercise is the solution name and the Module has no way of knowing it, except if the user fills it in manually… And manual matching is the thing I want to prevent…

Paul

first: controller.getname is only there because of the currentcontroller…
in a form method saying: controller.getName() is a bit strange because you already know the formname.. Ok maybe it is a bit saver if you rename the form…

We can provide it ofcourse but i still don’t see what you would do wit hit.
Because you are also saying “Store in the DB the solution with related to its forms..” But how would you get all that information?

a module doesn’t run by itself.. It is triggered
So a module should have a method:

initSecurity(solutionname)

then the main solution should call that method with its names. No user handling needed.

The controller.getName is not really relevant here, IMHO.

How you would get all the info? loop through forms and loop though the form elements. I know it’s a hefty operation, but I designed it so that this proces will happen only once after a new release/first import of a solution.

I understand that the module will not be triggered, unless you specify that in the main application.

if you could add it, please do. I really see the purpose of having it, but I assume you got that allready :)

Paul

i know controller.getName is not relevant for what you want i only pointed out that getName is only relevant because we have a currentcontroller thing.. Because of that it is handy to do getName()…

Looping through all the forms is a really really really i can’t say it enough really really bad idea.. Because then ALL the forms and everything is loaded in a tied loop. This shouldn’t be done.

I still don’t see the real need for it because the main solution should just call a method of the security solution with its own name..
So you don’t gain much.

I understand looping through all forms and their elements is heavy. Is it anything but that? Will it break stuff? Or is it only a heavy load on the applicaation Server/Client machine, because all forms need to be loaded into memory?

As I said, this looping though forms and their elements needs to happen only once, after a new release is create. after that, never, untill you create a new release.

As for the getsolutionName function: as the whole discussion prior to the post indicates: I would really like to have it. Yes, you can rely on a user/developer tp hardocde it, but having the function is neater and no change for errors. In my opinion, that means gaining some…

Paul

there are a lot of things created when you do that.
The memory consumption on a client machine can go up very high if the solution has 100+ forms..

but i added application.getSolutionName()

Tnx for adding the getApplicationName :)

Regarding the looping through forms: I understand the memory issue. Is it possible then to solve this by getting the function to retrieve the names and types of (named) elements on a form?

I’m thinking of: getNamedFormElements(String formname), returning a JSDataset. The dataset would contain two columns: elementname and elementtype. The elementtype is, for example: ScriptButton, PDFDecoder, SpecialTabPanel or JSplitPane.

I currently have found a way to retrieve these elementtypes, but that would still entail caching all forms in memory.

If this would be possible, the need to loop through forms is gone from my side…

Tnx in advance,

Paul

why are you wanting these things?

Just use servoy security for this.

Servoy’s Security is only available in the Developer.

I’m used to, and thus want to have that in servoy as well, having Security settings manageable by SuperUsers. I do not want to give SuperUsers access to Developer.

Secondly, the Security functions I envision are not only related to elements on a form being editable or visible, but are also in the area of setting for who can view which records, settings in the area of navigation: A custom controller that is based on records in the database and by configuring the records, a specific User is shown more or less items to navigate to.

All in all, the Security I’m setting up goes further that Servoys and I would like to have it all administerable in the same place, by Users that do not have access to developer.

Paul

Hi Johan,

Didn’t get any response on this.. but it’s still something relevant, at least to me.

Would it be possible to add these function?

I’m thinking of: getNamedFormElements(String formname), returning a JSDataset. The dataset would contain two columns: elementname and elementtype. The elementtype is, for example: ScriptButton, PDFDecoder, SpecialTabPanel or JSplitPane.

Paul

Very nice feature, this would be.

Please also add element.getColumnName and element.getTableName to return the real table name instead of table_a_to_b.column.

The elementtype functionality should also allow to figure out if we have a dataprovider based field in hands or some other element. I have to do a try/catch in conjunction with getDataproviderID in order to be able to figure out all database fields…

If you can get the element type, you allready know if it’s an element based on a dataprovider, because of the elementtype being a datafield :)

Paul

DataField just wasn’t in your list of examples up there, so I wanted to make sure we are all talking about the same issue :wink: