Changing a text in multiple AEM pages at multiple locations - aem

I have a website hosted on AEM. I want to change a text that is present in almost all pages (say I want to change my product name which is present in all pages) . How can i do it. It can either be a Groovy/Java code or an ondeploy script or anything else. Because doing it manually on all pages at multiple locations is not feasible. Will AEM Bulk Editor solve the purpose?
Its like Find and replace functionality in office

Yes, you will need to have a set of queries to find most of the references and then make a POST to these pages with the new value.
Example with: curl -u $USER:$PASSWORD -F"PROPERTY=new value" "http://$HOST/content/mysite/en/page/jcr:content"
Of course, you can do it with Java, Groovy (look for Groovy Console for AEM, which is very convenient), or even bash for simpler cases.

You can write a query using the query builder api to get all the nodes where your particular property is present.
Then once you get the path to that property you can update that using the node api.

Related

How deactivate templates in AEM without modifying the users permissions

Hi AEM Community I'm trying to deactivate some templates without making changes on the users permissions, I try with the allowedPaths property (for instance using a regex like this: /b/B) but I got an issue, if we copy and paste (on the same path) one page of one of the templates with the restriction on the allowedPaths property you can by-pass the restriction and you will be able to have pages on undesire paths. Any idea of what can I do to fix this? or something new to deactivate templates without modifying the users permissions?
Thanks in advance.
K.
First. I'm assuming you are using the classic template system (not the newest ones, stored under /conf).
I do not recommend you to change your templates programmatically. These are stored in /apps so they are considered 'code' and not 'content'. Also you'll loose any change if you reinstall your AEM packages.
Instead you can use the cq:allowedTemplates property directly in the root of the content tree of your site. You just need to set that property in any point of your content with the list of templates that should be available, any template not in that list wont be available for creating new pages.

Export of all tags, not only your own

When you get a list of files through the Box API, you also get the tags assigned to those files in string format. These tags include your own Box tags as well as shared tags (My Tags vs All Tags).
However, if you want to verify in a later phase if some of these tags have been deleted for instance, that seems not possible. The 'export tags' API method only returns your own tags.
This makes it really difficult to keep tags in sync, and I don't see a good reason why you would be able to see tags in the Box UI but not in the API. In the end it's just another representation of the same data, or that's what you would expect.
Anyone knows a possible workaround for this?
There isn't a known workaround for this at this time, but we're in the process of building out tags support in our V2 API and will take this use case into consideration.

is it possible to get an xPages build number?

I do all development in a single application. when a new version is ready I create a template and give it a version number. this way I can store a history of all previous versions.
the development templates are used to push the new design to many applications via replace design.
Creating manual version number or template names is fine but I am looking for a more automatic way of finding out which build the different applications are inherited from
When I visit the different applications I would like to be able to see which build number each application are inherited from. is this possible?
A simple build time stamp could do, but is there a built in build number that can be used and that can be displayed on the xpage.
e.g Build 2012092712345
Update:
Thank you for all your answers, many good suggestions but it looks like all require manual work.
The best solution would be if there is a way to read (from ssjs) a timestamp from any file within the nsf that is always updated during a build. is this possible?
In classic notes, there was a method to add a shared field with a special name to the application. Cannot remember the details, but have it somewhere on the disk.
Then you can see the build number in the design tab of the application properties. And you can of course display the value in your applikation as well.
But you have to fill the item manually on each build. Or use teamstudio Buildmanager. This tool adds the value automatically.
And I also guess that you can write some code that changes the value whenever you create a new build.
Another option would be to use a versioning system like CVS/SVN. This is possible since 8.5.3.
Source control
I think I know what you are meaning. Your a pushing out design and want to check thru code what version each database has. I usually do this with a Build form. In this form I have computed fields with all the data I want to retrieve. Then I open the database with an agent create a document
and set the form field to "BuildForm" and do a computewithform.
Now I can see all information about this database.
I once wrote a rudimentary build system for "classic" Notes, and had the last part of the build pipeline create a form named _BUILDID_, and put the build id in the $Comment field.
The main reason to create a form instead of a shared field was that I could dynamically fetch the form using NotesDatabase.Forms, and open up the desired field.
I sure hope there are simpler solutions nowadays... :-)

generic CMS system - Does it exist?

I'm looking for the following... can anybody point me to anything that currently exists in this field? Trying not to reinvent the wheel.
Basically a CMS system where I can setup a Form type though an interface.
Basically say that this type of data has a text field called Name, a Date field called "Start Date" and an email field called "Owner". And that together is a Node type called "Project"
Then a data entry person can go and fill in multiple projects and perhaps save them into different categories.
And then I can export the results as XML or JSON.
Thats the wist list... does something like that exist? or am I going to have to program it fresh?
You could certainly take a look at the open source Hippo CMS - it allows you to create your own content types pretty much in the way you're describing (disclaimer: I'm CTO of the company).
A "document type" in Hippo CMS is both the type definition (which nodes go where, what are they called, what type are they) as well as the form to input the content into. The form is build up from different editing fields, and there are fields available for Date, String, HTML Field and so on. If you need a very specific kind of field, then you can create your own and add it to the installation as a plugin.
Hippo is based on the Java Content Repository specification (JCR), which deals with Nodes in a hierarchical structure. If you're looking for a Java solution - then this might be what you need. But from what you're writing, I think you won't even have the need to dive into the Java internals. You can use the XML Export from the Console web interface to get the content out, or add a REST API that exposes the content either as XML or as JSON. For this, you'll need to go a bit deeper. More info on this is available on the community website.
Feel free to try the online demo installation. After you've logged in as one of the 'admin' users, navigate to the "Browse" perspective and open up the "Configuration" accordeon (it's all the way in the bottom of the screen, right above "Taxonomies"). Here you can work with the Document Types.

Dynamically generated GET request to an external database

I'm asking for help to my problem. I am new to JSF and I have a simple JSF online store demo page. I don't even use navigation rules since I only include the page with search results beneath the searching tags fields. The problem is a have sth like 15 fields (input texts and menus) to perform a detailed search. After selecting the fields and clicking on the search button I have to generate a long GET request for the database (which is located on a different server than my page and uses REST), receive the response (xml format), extract the search results and publish them on the page. The search patter is sth like this:
http://serveradress/search/ [x1][x2][x3]....[xn]
Where x1-xn are the values for the search engine and have to be read from the page's fields, so it has to be generated dynamically. The get request can be very long since there are 15 fields and one can have some additional options. The data base is on a different server and responds with an xml script with search results.
I found some solutions on the internet on how to perform a GET request using params but don't really know how can it fit to my problem since I have to receive the results from an external data base and manage them rather inside the java bean for publishing (i do not want to change the url adres of my page).
I am using JSF 1.2, with Eclipse IDE and JBoss on Ubuntu. The search request has to be GET since the data base uses that REST interface.
I am asking for your help in this matter if someone is able to find a solution to this problem or provide me with some link. I would strongly appreciate an example code with the solution.
Use JBOSS resteasy RESTful API's