ALF Basic module

The Alfresco Basic module is a standard generic module, usefull for all customers. Is istalls generic features not available in the standard Alfresco.

Users

OCR document

The OCR function creates a searchable PDF document. The source document can be a TIF or PDF document. The result is always a PDF document.

Step 1 For the TIF and PDF document a OCR action is activated. Click on the action button.

_images/ALF-basic-OCR-step1.png

Step 2 You get a pop-up askthe new filename. Normaly de defaut will do. It reuses the orginal filename with “-ocr” add to the filename.

_images/ALF-basic-OCR-step2.png

Step 3 The resulting file has an icon so you can see the file is ocr’ed. See the file “Uittresel KVK-ocr.pdf” on the picture below.

_images/ALF-basic-OCR-step3.png

Administrator

VirtOrg search webscript

In the basic module is an webscript for searching the repository. Is is based on the slingshot search webscript. But this variant automaticly return also the custom model fields. The can be used in Aikau pages. But if desired the webscript is also available for external applicaties. The webscript is uses GET on URL http://localhost:8080/alfresco/s/virtorg/search?term=test

There are several parameters:
term can be used for free text search but also for en search string See ALSO: ????

The result is presented in JSON. Below is an example.

{
        "totalRecords": 1,
        "totalRecordsUpper": -1,
        "startIndex": 0,
        "numberFound": 1,
        "facets": {},
        "items":
        [
        {
                        "sys:store-protocol": "workspace",
                        "sys:node-dbid": 920,
                        "cm:content": "org.alfresco.repo.template.BaseContentNode$TemplateContentData@4334a511",
                        "cm:name": "test01.odt",
                        "cm:modified": "2016-08-24T10:26:11.460+02:00",
                        "cm:creator": "admin",
                        "sys:locale": "en_US",
                        "cm:autoVersionOnUpdateProps": false,
                        "cm:created": "2016-08-24T10:26:11.460+02:00",
                        "cm:autoVersion": true,
                        "cm:initialVersion": true,
                        "sys:store-identifier": "SpacesStore",
                        "cm:modifier": "admin",
                        "cm:versionLabel": "1.0",
                        "sys:node-uuid": "4f15eae1-f4c8-49fd-844d-c35bcb84a0d5",
                        "nodeRef": "workspace:\/\/SpacesStore\/4f15eae1-f4c8-49fd-844d-c35bcb84a0d5"
                },
        ],
        "spellcheck": {}
}

VirtOrg Configuration in memory

Virtorg Configuration in memory is available as from version 1.2.

Alfresco has an standaard configuration mechanismn. Is is based on the global.properties and XML configurations used with webservices. We had the need of a configuration feature, which is loaded on boot time and whenever the configuration is changed. In this way we have the maximum performance and the flebility of changing the settings without rebooting the server.

config-file

The configuration file “alfresco_config.xml” is placed in the folder “Data Dictionay/VirtOrg Config”. The root must be <config>, and within the root you have complete freedom of using tags.

1
2
3
4
<?xml version="1.0" encoding="UTF-8"?>
<config>
   <parameter name="first">parm value</parameter>
</config>

show config

There is a webservice to check the current configuration. This is done with the webservice on URL http://localhost:8080/alfresco/s/virtorg/config.html.

Using the config in JAVA

Using the configuration in JAVA is a matter of getting the bean and read the org.jdom2.Document document. A jdom2 document has an root. In our case always “config”. The root can have 0 or more children (Element). A child can have attributes, value’s and other children as in a normal XML file.

For using the VirtOrg Config Component add it as a bean parameter in the config.

<beans>
   <bean id="webscript.com.virtorg.config.config.get" class="com.virtorg.alf.basic.config.webscripts.ConfigWebscript" parent="webscript">
      <property name="configComponent"><ref bean="ConfigComponent" /></property>
   </bean>
</beans>

For showing how to use the component see this JUnit4 test class.

@Test
public void loadTest() {
   ConfigComponent config = new ConfigComponent();
   assertNotNull(config);

   String xml = "<config><test><parameter>test param</parameter></test></config>";
   InputStream is = new ByteArrayInputStream(xml.getBytes());
   assertNotNull(is);

   // loading ...
   config.loadXMLContent(is);
   //System.out.println("Config: ...\n" + config.getConfig());

   // use config
   Document doc = config.getConfigDoc();
   assertTrue("The document has no rootElement...", doc.hasRootElement());

   Element root = doc.getRootElement();
   assertEquals("root element should be CONFIG...", "config", root.getName());

   Element testElement = root.getChild("test");
   assertNotNull(testElement);
   assertEquals("testElement should have ONE child...", 1, testElement.getChildren().size());

   Element paramElement = testElement.getChild("parameter");
   assertNotNull(paramElement);
   assertEquals("Readed value does not match \"test param\"", "test param", paramElement.getValue());
}

Using the config in Javascript

Not supported yet!!!