maven-enforcer-plugin <requireProperty> -> <requireProperty> - pom.xml

I'm using the maven-enforcer-plugin and its working well.
I'm trying to understand how to make some properties required and some optional.
For ex. I have a property called useGit.
When useGit = true I wish that only the GIT properties will be enforced.
When useGit = false I wish that only the SVN properties will be enforced.
Thanks!

Related

Setting swagger config parameters in SpringDoc

I am trying to override Swagger configuration in SpringDoc as described in:
https://springdoc.org/#swagger-ui-properties
I am setting these in the code in (kotlin class) init block
init {
System.setProperty("springdoc.swagger-ui.path", "/services/$serviceName")
System.setProperty("springdoc.swagger-ui.url", "/services/$serviceName/v3/api-docs")
System.setProperty("springdoc.swagger-ui.configUrl", "/services/$serviceName/v3/api-docs/swagger-config")
// Controls the display of extensions (pattern, maxLength, minLength, maximum, minimum) fields and values for Parameters.
System.setProperty("springdoc.swagger-ui.showCommonExtensions", "true")
}
However it seems to be completely ignored and none of the fields are taken into account. What is the place these should be set correctly?
Note that I need to set the config properties according to the SERVICE_NAME env var, so I cannot use the static properties file.
Full config here: https://gist.github.com/knyttl/852f67f1688ea6e808b8eb89068e90d1
As suggested by the SpringDoc author in https://github.com/springdoc/springdoc-openapi/issues/1485, this can be done as follows:
#Bean
open fun swaggerUiConfig(config: SwaggerUiConfigProperties): SwaggerUiConfigProperties {
// For details, see https://springdoc.org/#swagger-ui-properties
// Controls the display of extensions (pattern, maxLength, minLength, maximum, minimum) fields and values for Parameters.
config.showCommonExtensions = true
// Allows to configure source for the documentation via query params (?url=/v3/api-docs).
config.queryConfigEnabled = true
return config
}

How to set a property in ant if another property start with a specific charcter?

I am new to ant I am currently rewriting a stuff which was written in groovy. I have a scenario where i want to set a property if some other property start with a charter c
if(version.startsWith('c')) {
test_version = version.substring(1)
}
else
{
test_version =version
}
I tried with conditional property but it seems I lost the way
Any pointer on this will be helpful

How to get a list of all Reflux actions names and a preEmit hook for all of them?

I know using Reflux.__keep.createdActions I get a list of all actions created. Is there a way to know the name of these actions?
Is there a way to define a preEmit hook for all actions?
Important Note: Reflux.__keep was actually originally created to support another feature that never materialized. However it was also creating memory leaks in some programs. Therefore it was recently made to NOT store anything by default. To make it store anything you have to use Reflux.__keep.useKeep() in latest versions of reflux and reflux-core. Reflux.__keep is not a documented part of the API, and as such changes to it do not necessarily follow semantic versioning. From v5.0.2 of Reflux onward the useKeep() is needed for Reflux.__keep to store anything.
On to the question though:
1) In Reflux.__keep there is a createdActions property, which is an Array holding all created actions so far (if you did the useKeep() thing, of course). Every action should have on it an actionName property telling you that action's name which you supplied when you created it:
Reflux.__keep.useKeep()
Reflux.createActions(['firstAction', 'secondAction']);
console.log(Reflux.__keep.createdActions[0].actionName) // <-- firstAction
console.log(Reflux.__keep.createdActions[1].actionName) // <-- secondAction
2) preEmit hooks can be assigned to actions after-the-fact, so assigning them to actions within Reflux.__keep.createdActions would be a simple matter of a loop:
Reflux.__keep.useKeep()
var Actions = Reflux.createActions(['firstAction', 'secondAction']);
var total = Reflux.__keep.createdActions.length;
for (var i=0; i<total; i++) {
Reflux.__keep.createdActions[i].preEmit = function(arg) { console.log(arg); };
}
Actions.firstAction('Hello'); // <- preEmit outputs "Hello"
Actions.secondAction('World!'); // <- preEmit outputs "World!"

How to control Parse ACLs on public level

Parse just updated to V 1.1.0 and this was listed as a change:
Converted PFACL's publicReadAccess and publicWriteAccess methods to
properties.
Now I don't know how to change ACLs on a public level. It used to be this:
acl.setPublicReadAccess(true)
foo.ACL?.setPublicWriteAccess(true)
How do I achieve these effects now?
Thanks!
acl.publicReadAccess = true
foo.ACL?.publicWriteAccess = true

Breeze not updating nullable datetime field

I'm setting a nullable datetime field on the server but that field is not being updated in my database.
private bool BeforeSaveLeaseEntry(Lease leaseEntry, EntityInfo info)
{
if (info.EntityState == EntityState.Added)
{
leaseEntry.CreatedDate = DateTime.UtcNow.ToLocalTime();
}
if (info.EntityState == EntityState.Modified)
{
leaseEntry.LastUpdatedDate = DateTime.UtcNow.ToLocalTime();
}
return true;
}
CreatedDate is not nullable and is updated.
LastUpdatedDate is nullable and is never updated.
The code is hit but when I run a tracer on my SQL server that field is never included in the update code.
exec sp_executesql N'update [dbo].[Leases]
set [ContractNo] = #0
where ([LeaseID] = #1)
',N'#0 varchar(25),#1 int',#0='test6',#1=27415
Sorry about this, in Breeze v 1.1.3 we added a the EntityInfo.ForceUpdate boolean property but it never made it into the main Breeze documentation, it only appeared in the release notes.
This property may be used to force a server side update of an entire entity when server side modification has been made to any property of an existing entity. The other approach that may be used is to explicitly update the EntityInfo.OriginalValuesMap.
The idea behind both of these is that on an update Breeze only creates an update statement for those se properties that have been changed. Any client side changes are automatically detected because of Breeze's tracking mechanism which adds an entry into an 'originalValuesMap', but this cannot be done automatically for server side changes because the server side entities are not instrumented to perform notification about property changes.
The "EntityInfo.ForceUpdate" method forces the generation of an update statement for every property on the entity, whereas directly updating the EntityInfo.OriginalValuesMap will only update those properties found in the map.

Resources