• involved users database

  • He we will discuss about how to make customization and improvement to the OpenKM source code.
He we will discuss about how to make customization and improvement to the OpenKM source code.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #19286  by ciropom
 
For a very specific use case I need to add to OpenKM a new module on the lateral menu in the GWT interface.
That menu will contain the 'involved users database', a database of users to be that are not users of the system,
but are involved in the project.

I need to save all the personal data like phone, email, street address, city etc
and visualize them in a tabular structure.

All the users of the system with adequate rights can see this menu and add/remove/edit an entry.

These users then can be used for reports generation (as an example: report directed to one or other involved user with all the data automatically filled)

I ask your help:
how do you think that this should be done?

Thank you for your time.
 #19308  by jllort
 
We're working on record management but until next year will not be released ( january or february is realistic time ).

Some metadata can be shown in extended columns ( but it's only available in professional version ). But the major problem is that we work with tree objects nodes ( folder / document / mail ... record is not yet completed and will help you on it, but now is not possible ). To be shown this kind of information on desktop tables should be needed create a new kind of object.

Before continuing explaining which source code changes should be done, sincerally I would like to understand the problem not the solution you propose. Why do you need to see table list in desktop and not in Dashboard or and extra panel ( there's easy to add some iframe and put there your own jsp application ). I will be waiting your feedback.
 #19313  by ciropom
 
jllort wrote: Before continuing explaining which source code changes should be done, sincerally I would like to understand the problem not the solution you propose. Why do you need to see table list in desktop and not in Dashboard or and extra panel ( there's easy to add some iframe and put there your own jsp application ). I will be waiting your feedback.
I do not need to see a table list in the desktop.
It was only an example, also dashboard is fine..

I've not understood why a normal NodeBase-derived object cannot suit this purpose.
We can see a table like a folder, and each node inside that folder as a row in the folder.
The only thing that changes is the way of visualizing it.
The derived class should only implement the table row specifications:
- schema constraint (if needed..)
- and the format check for each node (to avoid inserting a normal file as a row)

Please correct me if I forgot some important aspect.
Thank you for your time.
 #19342  by jllort
 
If it's right to you to see in other panel than desktop then your solution is to implement your own application and embeded into openkm across iframe ( that's the easies way to get it ). When I get some time I will share at wiki some minimal functional project to shown how it must be done.

Meanwhile if you want you can start working on your own application and then with minimal changes in source code you will embeded it into. Other kind of integration from nodebase etc... are more complex ( if you want to take this way I will suggest some class to start looking )
 #19346  by ciropom
 
jllort wrote:If it's right to you to see in other panel than desktop then your solution is to implement your own application and embeded into openkm across iframe ( that's the easies way to get it ). When I get some time I will share at wiki some minimal functional project to shown how it must be done.
Thank you very much.
jllort wrote: Meanwhile if you want you can start working on your own application and then with minimal changes in source code you will embeded it into. Other kind of integration from nodebase etc... are more complex ( if you want to take this way I will suggest some class to start looking )
I need integration between the two: the "involved users database" should be accessible to OpenKM functions (as an example we want to label a file with a list of involved users, probably to be shown in the properties panel).
 #19375  by jllort
 
- First you need is create a class which extends TabWorkspaceExtension http://wiki.openkm.com/index.php/Frontend_extensions and some jsp in webapps ( show some minimal text )
- Register the extension http://wiki.openkm.com/index.php/Enable ... extensions
- Change Customization.java to take effects your extension
- Compile and run.

Here the expected results is to see new tab with some text.

In second the objective is create some jsp at webapp and change the class which extends TabWorkspaceExtension and declare into and Iframe object to include the webapps jsp ... from here I think you can start without major problem with your source code.

I will make some videos and share some source code about it. But beeing optimist I think until next month will not be published because we got some pending list to be done and after release a video and source code about it is mandatory finish others ( step by step ).
 #19393  by ciropom
 
A general question:
this extra panel need another table in the database.
How can I add it to the schema?

I followed the guide:
1. added class InvolvedUsers.java in extension/frontend/client
2. created InvovedUsers.gwt.xml
3. edited customization.java adding extensions.add(new InvolvedUsers());
4. edited customization.gwt.xml adding <inherits name="com.openkm.extension.frontend.InvolvedUsers"/>
5. executed INSERT INTO OKM_EXTENSION (EXT_UUID,EXT_NAME) VALUES('fde98f00-3254-11e2-81c1-0800200c9a66','Involved Users');
6. selected from default profile the extension "involved users"

But it didn't work (no "Involved Users" tab appeared near to desktop.
The TabWorkspaceExtension does not have a getUUID method, maybe this is the reason?


Thank you.
 #19412  by jllort
 
1- point 2 and 4 is not needed
2- I will need take a look at your TabWorkspaceExtension, but the problem is not undefined getUUID and really if you have added directely as extensions.add(new InvolvedUsers()); then has no sence insert into OKM_EXTENSION and enable in profiles because you're force to be enabled always.

I suggest configure GWT shell to debug your start up
 #19413  by ciropom
 
jllort wrote:1- point 2 and 4 is not needed
why?
jllort wrote: 2- I will need take a look at your TabWorkspaceExtension, but the problem is not undefined getUUID and really if you have added directely as extensions.add(new InvolvedUsers()); then has no sence insert into OKM_EXTENSION and enable in profiles because you're force to be enabled always.

I suggest configure GWT shell to debug your start up
ok i got it.. the guid is used to check if the extension should be enabled or not.
It turned out to be a cache problem (this morning the new tab appeared!).
I don't know howto run directly from apache (tomcat starts but does not deploy openkm), so i build openkm.war from eclipse, then I copy it into the tomcat-xx/webapps folder, and lastly I start openkm with ./bin/startup.sh
 #19444  by jllort
 
1- I suggest - if you're in linux - you make a link (ln -s ) between target/OpenKM and /webapps ( remove from there the war file ). That's the best configuration.
2- Take a look at DatabaseMetadataServlet.java, there you got full api use.
3- Finally take a look here DatabaseMetadataMap.java ( for date value ).

Note: Probably is strange way of using metadata, but is thinked to use from GWT classes ( for it the conversions etc... )
 #19453  by ciropom
 
jllort wrote: 1- I suggest - if you're in linux - you make a link (ln -s ) between target/OpenKM and /webapps ( remove from there the war file ). That's the best configuration.
ok thank you.
jllort wrote: 2- Take a look at DatabaseMetadataServlet.java, there you got full api use.
I saw that class, and there is no "insert" method.. I need it to insert my contacts. How can I do?
jllort wrote: 3- Finally take a look here DatabaseMetadataMap.java ( for date value ).

Note: Probably is strange way of using metadata, but is thinked to use from GWT classes ( for it the conversions etc... )
In the wiki is written: "When you create an extension, the need for a database to store data is very common. You can create tables, but also need to create a bean with Hibernate XML mapping or annotations, a DAO, etc. The other way is creating meta-tables"

so I choosed this path to be quicker..
If this is the wrong way please drive me in the right direction.
(I did not manage to insert data programmatically using DatabaseMetadataUtils)

Thank you
 #19478  by jllort
 
The idea is something like it:

SQL to add metadata
Code: Select all
-- 
-- MUNICIPIO
DELETE FROM OKM_DB_METADATA_TYPE WHERE DMT_TABLE='municipio';
INSERT INTO OKM_DB_METADATA_TYPE (DMT_ID, DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES (HIBERNATE_SEQUENCE.nextval, 'municipio', 'col00', 'integer', 'mun_prov_id');
INSERT INTO OKM_DB_METADATA_TYPE (DMT_ID, DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES (HIBERNATE_SEQUENCE.nextval, 'municipio', 'col01', 'text', 'mun_provincia');
INSERT INTO OKM_DB_METADATA_TYPE (DMT_ID, DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES (HIBERNATE_SEQUENCE.nextval, 'municipio', 'col02', 'integer', 'mun_id');
INSERT INTO OKM_DB_METADATA_TYPE (DMT_ID, DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES (HIBERNATE_SEQUENCE.nextval, 'municipio', 'col03', 'text', 'mun_nombre');
INSERT INTO OKM_DB_METADATA_TYPE (DMT_ID, DMT_TABLE, DMT_REAL_COLUMN, DMT_TYPE, DMT_VIRTUAL_COLUMN) VALUES (HIBERNATE_SEQUENCE.nextval, 'municipio', 'col04', 'text', 'mun_autonomia');

GWTMunicipio class
Code: Select all
public class 

 extends DatabaseMetadataCommon implements IsSerializable {
	// Metadata Virtual Name mapping 
	public static final String MV_TABLE_NAME				= "municipio";
	public static final String MV_COLUMN_NAME_ID			= "mun_id";
	public static final String MV_COLUMN_NAME_PROVINCIA_ID	= "mun_prov_id";
	public static final String MV_COLUMN_NAME_NOMBRE		= "mun_nombre";
	public static final String MV_COLUMN_NAME_AUTONOMIA		= "mun_autonomia";
	
	private Integer id;
	private Integer provinciaId;
	private String nombre;
	private String autonomia;

	@Override
	public void loadFromMap(Map<String, String> map) {
		super.loadFromMap(map);
		if (map.containsKey(MV_COLUMN_NAME_ID)) {
			setId(DatabaseMetadataMap.getIntegerValue(map.get(MV_COLUMN_NAME_ID)));
		}
		if (map.containsKey(MV_COLUMN_NAME_PROVINCIA_ID)) {
			setProvinciaId(DatabaseMetadataMap.getIntegerValue(map.get(MV_COLUMN_NAME_PROVINCIA_ID)));
		}
		if (map.containsKey(MV_COLUMN_NAME_NOMBRE)) {
			setNombre(map.get(MV_COLUMN_NAME_NOMBRE));
		}
		if (map.containsKey(MV_COLUMN_NAME_AUTONOMIA)) {
			setAutonomia(map.get(MV_COLUMN_NAME_AUTONOMIA));
		}
	}
	
	@Override
	public Map<String, String> restoreToMap() {
		Map<String,String> map = super.restoreToMap();
		return map;
	}
	
	public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	
	public Integer getProvinciaId() {
		return provinciaId;
	}
	
	public void setProvinciaId(Integer provinciaId) {
		this.provinciaId = provinciaId;
	}
	
	public String getNombre() {
		return nombre;
	}
	
	public void setNombre(String nombre) {
		this.nombre = nombre;
	}
	
	public String getAutonomia() {
		return autonomia;
	}

	public void setAutonomia(String autonomia) {
		this.autonomia = autonomia;
	}
}
then create something like:
Code: Select all
GWTMunicipio municipio = new GWTMunicipio();
// fill values
municipio.setAutonomia=...;
metadataService.createValue(municipio.restoreToMap(), new AsyncCallback<Double>() {
						@Override
						public void onSuccess(Double result) {
							// added
						}
						@Override
						public void onFailure(Throwable caught) {
							
						}									
					});
see like data data which arrives to server is a map, if you call directly the api ( not from GWT ) you should take it in consideration.

Hope this make it more clear.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.