Search text in particular web form content This will search the text in all the sub-folders of ROOT in the current web project and will also search in a specific, selected web form as s
Trang 1Search text in ROOT folder and for all web forms
This will search in all of the sub-folders of ROOT in the current web project and will also search for all the web forms The Reset All button will reset all search criteria
Search will return the search results with the filename and corresponding path The following screenshot shows a snap of the search screen, which searches for the text Alfresco in the current web project's Staging Sandbox
Search text in particular web form content
This will search the text in all the sub-folders of ROOT in the current web
project and will also search in a specific, selected web form as shown in the
following screenshot:
Trang 2Search text in particular folder of web project
This will search the specified text in the particular selected folder within the web project The Folder Tree component allows you to choose the folder in which you want to search the text The following screenshot shows the Folder Tree component and the search result:
Trang 3Search text in particular web form and in particular folder of web project
This will search the specified text in a particular folder selected with the help of the Folder Tree component and also search the content created using the specified web
form The Select WebForm combo box will fetch all web forms associated with the
current web project:
Metadata extraction for WCM
The case study we discussed in the previous section was for the free text search with advanced search criteria in the WCM In this section, we will discuss how
we can perform the search based on the metadata of particular content Alfresco provides some of the metadata extractors, which are responsible for extracting the metadata from the added or updated content at the server side Alfresco has different extractors for handling different types of mimetypes for DM
Trang 4In this section, we will see how we can configure XML Metadata Extractor for WCM
We will take the example of news content, which we are creating with the help of a news web form
1 To Activate metadata extraction for WCM, rename the wcm-xml-metadata-extracter-context.xml.sample file available in the <alf_home>/tomcat/ shared/classes/alfresco/extension folder to wcm-xml-metadata-extracter-context.xml This file will have bean declaration for WCM Metadata extraction, as follows:
<bean id="avmMetadataExtracterRegistry"
class="org.alfresco.repo.content.metadata
MetadataExtracterRegistry" />
.
<property name="invokePolicies">
<value>true</value>
</property>
.
<property name="metadataExtracterRegistry">
<ref bean="avmMetadataExtracterRegistry" />
</property>
.
</bean>
2 The AVMNodeService fires policies for content creation and update that are listened to by avmMetadataExtractors, which is responsible for initiating the metadata extraction for content newly created or updated
3 To configure an extractor to handle XML content, first we need to configure
XpathMetadataExtracter, as follows:
<property name="xpathMappingProperties">
<bean class="org.springframework.beans.factory.config
PropertiesFactoryBean">
<property name="location">
<value>
classpath:alfresco/extension/News-Xpath-Mappings
properties
</value>
</property>
</bean>
</property>
Trang 5Here, News-Xpath-Mappings.properties stored in the alfresco/
extension folder will have mappings of XPath as follows:
# Name Space
namespace.prefix.trn=http://www.alfrescobook.com/webforms
# XPATH Mappings
short_title=news/shortTitle/text()
content_header=news/contentHeader/text()
content_sub_header=news/contentSubHeader/text()
news_date=news/newsDate/text()
4 Now we need to map this property with the properties of a content model; for that again, we need to configure property as follows:
<property name="mappingProperties">
<bean class="org.springframework.beans.factory.config
PropertiesFactoryBean">
<property name="location">
<value>classpath:alfresco/extension/Content-Model-Mappings properties
</value>
</property>
</bean>
</property>
5 Here Content-Model-Mappings.properties stored in the alfresco/ extension folder will have a mapping of properties of the content model as:
namespace.prefix.cignex=http://www.cignex.com
# Mappings
short_title=shortTitle
content_header=contentHeader
content_sub_header=contentSubHeader
news_date=newsDate
6 Now we need to select the extractor as XMLMetadataExtractor and
configure bean for this as:
<bean id="extracter.xml.sample.XMLMetadataExtracter"
class="org.alfresco.repo.content.metadata.xml.
XmlMetadataExtracter"
parent="baseMetadataExtracter">
<property name="registry">
<ref bean="avmMetadataExtracterRegistry" />
</property>
<property name="overwritePolicy">
Trang 6<ref bean="extracter.xml.sample.selector.XPathSelector" /> </list>
</property>
</bean>
7 We also need to create a custom content model to define our custom
properties In this example, we are considering news as one content type, so
we need to create a custom aspect with the properties of news as:
<aspect name="cignex:news">
<title>Cignex News</title>
<properties>
<property name="cignex:shortTitle">
<title>Short Title</title>
<type>d:text</type>
<index enabled="true"/>
</property>
<property name="cignex:contentHeader">
<title>Content Header</title>
<type>d:text</type>
<index enabled="true"/>
</property>
<property name="cignex:contentSubHeader">
<title>Content Sub Header</title>
<type>d:text</type>
<index enabled="true"/>
</property>
<property name="cignex:newsDate">
<title>News Date</title>
<type>d:date</type>
<index enabled="true"/>
</property>
</properties>
</aspect>
8 Now we can search based on any custom property (metadata) You can add search criteria as:
@cignex\:shortTitle:"CignexNews",@cignex\:contentHeader:"Cignex*"
9 You can use any of the previously mentioned approaches using Java
or JavaScript API, among others, to perform the search by providing
this criteria
Download the sample code files for the WCM metadata extractor from the Packt website
Trang 7As Alfresco itself provides many services, using WCM as part of Alfresco we can leverage all these services and capabilities of Alfresco DM in WCM and can use WCM as an enhanced repository In this chapter, we learned the following points:
• Leveraging Membership and Security Mechanism along with the
LDAP example
• FFMPEG Integration with Alfresco and using DM Business Rules
• Copying content from DM to WCM
• Using image transformation in WCM
• Leveraging Advance Search with custom UI
• Using WCM Metadata Extractor to allow metadata search in WCM
In the next chapter, we will discuss the Administrative tasks to maintain and upgrade the system
Trang 8WCM Administration
Maintaining and upgrading the system is as equally important as implementing it
A well-maintained system will give the highest return on investments This chapter provides a high-level overview of administering and maintaining your Alfresco implementation It includes information about backing up your valuable content, upgrading your system to newer versions, enabling full audit trail, and setting up a multi-tenant system configuration You will also find general maintenance tips such
as maintaining log files and periodically updating your admin password
By the end of this chapter you will have learned how to:
• Back up your data on a regular basis for storage and retrieval
• Perform general maintenance tasks such as examining log files
• Upgrade your Alfresco application to newer versions
• Provide Administrator rights
• Clean up deployment history
Data backup
This is one of the most important, yet also one of the most neglected, areas
of computing Backing up your data should be at the top of your computer
maintenance list—right next to virus protection Without data backup, you are running the risk of losing your data
Data loss can happen in many ways One of the most common causes is the physical failure of the media that the data is stored on In some situations, users of the system might have deleted the content due to some error No matter what, your data is your intellectual property and you need to protect it by doing proper backups regularly
Trang 9List of items to back up
Alfresco stores the content information in both the database and the filesystem You need to back up both the filesystem and relational database As a part of the implementation, you might have customized Alfresco, and hence you need to back
up customization files If you have used an external membership system such as Active Directory or OpenLDAP, then you might have to back up the user and group data as well
You can set up automated processes to back up data periodically On Linux
operating systems, you can write a cron job to run a back-up script on a regular basis Similarly, all other operating systems support back-up utilities
Most often, people tend to store the back-up data on the same server This might create issues when the server crashes Hence, it is recommended to move the back-up data on to some other external server to store it
Now, let's examine various types of data which need to be backed up
Content stored in filesystem
Typically, the content in the filesystem is stored in your <install_folder>/
alf_data folder as shown in the following screenshot The folder contentstore
contains the binary content with all of the versions The folders lucene-indexes and
backup-lucene-indexes contain search information The folder audit.contentstore
contains audit trail details:
Trang 10You need to back up the entire folder alf_data and the contents Most of the
operating systems provide back-up utilities
If you are a Windows user, you may use the back-up utility that comes with
Microsoft Windows XP (it is installed by default with the XP Home version) You
will find it from the Start menu under All Programs | Accessories | System Tools |
Backup When you start it, you are presented with the back-up wizard.
Metadata stored in a relational database
A relational database contains a bunch of tables defined as per the Alfresco schema These tables hold information about users, security, audit, spaces, metadata, rules, scripts, and various business processes (jBPM)
Most of the database vendors (commercial or open source) provide utilities to take the database dump Based on the database you have selected during installation (MySQL, Oracle, or MS SQL Server), you can use an appropriate utility to take the database dump
The MySQL database provides a utility called mysqldump to back up both the
database table definitions and contents It can be used to dump a database or a collection of databases for backup or for transferring the data to another SQL server (not necessarily a MySQL server) The dump contains SQL statements to create the table or populate it, or both
The following is the command to take database backup in MySQL:
Syntax: mysqldump [options] db_name [tables] [> output_file_name]
An example command is:
> mysqldump alfresco > alfresco_outfile.sql
Customization files
You might be customizing your Alfresco application over a period of time Typically, you might have added or updated the following files:
• Logos, images, and stylesheets
• JSP files (dashboard)
• Presentation templates
• Configuration files, property files
• Files in the extension folder
• Custom application code (WAR file, source Java files, and so on)