In Alfresco 4.0, I'd like to extend Share Doclib Filter webscript to add my own customized filter.
Is there a simple way to add my own filter in the share-config-custom.xml?
How do I define my own filter on the repository side?
There are 2 steps involved:
Adding the link by customizing the document library with your own module(see alfresco Help):
<customization>
<targetPackageRoot>org.alfresco.components.documentlibrary</targetPackageRoot>
<sourcePackageRoot>com.company.components.documentlibrary</sourcePackageRoot>
</customization>
extend the webscripts filter.get.js and repo-filter.get.js (add them in web-extension / site-webscripts / com / company/ components / documentlibrary / )
var filters = model.filters;
filters.push(
{
id: 'myExtension',
data: '',
label: 'link.myExtension'
});
model.filters = filters;
extend the property file with your own labels
Override the repository webscript to add your own filter interpretation:
in alfresco / templates / webscripts / org / alfresco / slingshot / documentlibrary-v2 /
Copy paste the filters.lib.js and add your logic:
case "myExtension":
filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";
filterQuery += "+#blabla\\:isLikeThat:\"FALSE\"";
filterParams.query = filterQuery + filterQueryDefaults;
break;
Related
In Alfresco users can use rules to link categories to files. There isn't an option to unlink categories from a file.
How do I programmatically remove (unlink) categories from a file without removing the classification aspect?
If a script is required, do you have an example?
I am using Alfresco 7.0 Share/Community version
take a look into the node browser:
Alfresco stores the categories on a node as an array of nodeRefs to the category nodes.
If you want to remove specific category from a node you need to save the array without the nodeRef for that category.
To illustrate that: the following example removes the category /Regions/EUROPE from a given document node:
var categories= document.properties["cm:categories"];
for (var i = 0; i < categories.length; i++) {
var categoryPath = categories[i].displayPath + '/' + categories[i].name;
logger.log(categoryPath);
if (categoryPath == '/categories/General/Regions/EUROPE'){
categories.splice(i, 1)
}
}
document.properties["cm:categories"]= categories;
document.save();
I'm working on switching OpenAPI v2 to Open API 3, we'll be using MicroProfile 2.0 with Projects as the plugin that will generate the OAS from the code.
Now, we have different headers that are needed as a kind of authorization. I know I can put them on each resource, that seems just a lot of repetition, so I thought it was a good idea to put in the JaxRSConfiguration file as a #SecurityScheme and add them as security to the #OpenApiDefinition.
#OpenAPIDefinition(
info = #Info(
...
)
),
security = {
#SecurityRequirement(name = Header1),
#SecurityRequirement(name = Header2)
},
components = #Components(
securitySchemes = {
#SecurityScheme( apiKeyName = Header1 ... ) ,
#SecurityScheme( apiKeyName = Header2 ....)
}),
...
)
This is working, however it generates an OR, while it should be an AND (without the - )
security:
- Header1: []
- Header2: []
I thought I could use #SecurityRequirementsSet inside security in the #OpenApiDefinition, but unfortunately this is not allowed. I know I can use it on each call or on top of the class of the different calls but as this is still a sort of repetition, I would prefer to have it as a general authentication security.
Does anybody know how I can achieve this ?
I have some Files out side my Module that I need to have on my classpath for testing.
Listing all possibilities (mill resolve tests._) I think to extend resources is the way to go.
I tried a lot - here my last attempt:
object test extends Tests {
override def resources =
new Sources({
super.resources.self.map(_ :+ (millSourcePath / up / 'data / 'global / 'bpmn))
},
super.resources.ctx
)
...
}
Is overwriting resources the way to go?
How is it done correctly?
resources is a "task of sources" as defined here. Thus, in order to add something to the resources path you can do
override def resources = T.sources {
super.resources() :+ PathRef(millSourcePath / up / 'data / 'global / 'bpm)
}
I tried to search how i can change the web editor for my Xtext project. But it seems there is missing some documentation.
My question is how can I change the default web editor ace to my prefered editor orion ?
you need to do two things
adapt the workflow to use orion webSupport = { framework = "Orion"} (best done before first generation since generate once files will not be overriden)
since there is no webjar for orion you need to download/unpack it manually and or separately depending on your build system.
you may have a look at the Yeoman generator-xtext (https://github.com/itemis/generator-xtext) which allows you to create a gradle + xtext + web + orion project.
Workflow {
component = XtextGenerator {
...
language = StandardLanguage {
name = "org.xtext.example.mydsl.MyDsl"
fileExtensions = "mydsl"
serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
webSupport = {
framework = "Orion"
}
}
}
}
The CQ.tagging.TagInputField provided two configuration parameter which won't work in combination:
tagsBasePath
namespaces
Using the OOTB facebook tags as example, I want to restric the dialog to only display the Favorite Teams. The Structure is this:
So I set tagBasePath to /etc/tags/facebook and namespaces to [favorite_teams]. This does what it is supposed to do and only shows the two teams in the dialog. But when you click on it, a JavaScript exceptions is thrown. The problem lies in the following method defined in /libs/cq/tagging/widgets/source/CQ.tagging.js
CQ.tagging.parseTag = function(tag, isPath) {
var tagInfo = {
namespace: null,
local: tag,
getTagID: function() {
return this.namespace + ":" + this.local;
}
};
// parse tag pattern: namespace:local
var colonPos = tag.indexOf(isPath ? '/' : ':');
if (colonPos > 0) {
// the first colon ":" delimits a namespace
// don't forget to trim the strings (in case of title paths)
tagInfo.namespace = tag.substring(0, colonPos).trim();
tagInfo.local = tag.substring(colonPos + 1).trim();
}
return tagInfo;
};
It does not respect the configurations set on the widget and returns a tagInfo where the namespace is null. I then overlayed the method in my authoring JavaScripts, but this is of course not working in the SiteAdmin as my custom JS are not included.
So, do I really have to overwrite the CQ.tagging.js below libs or can I somehow inject my overlay into the SiteAdmin so the PageProperties Dialog opened from there works as well?
UPDATE: I had a chat with Adobe support regarding this and it was pointed out that if you use tagsBasePath you need to place it somewhere else than below /etc/tags. But this won't work as well as the TagListServlet will return no tags as /etc/tags is also fixed in the TagManager as the tagsBasePath. I now overwrite the above mentioned js at its location, being well aware that I need to check it if we install a hotfix or an update. Is someone has a more elegant solution I'd be still thankful.