OSGI HengSin/UUID Generator

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
  • From now on, your DB Tables will have new UUID fields such as seen in this generated PackOut.xml.
  • Here you will see how to do that with OSGI HengSin latest enhancement.

UUIDGenerator.png

  • UUID or Universal Unique IDentifier has been a long term issue when it comes to 2Pack or integrating or merging modules of multiple differing instances as the PKs and FKs will overlap and IDNameLookUp is cumbersome.
  • You have to run the org.adempiere.process.UUIDGenerator process.
  • You have to create a Report & Process item in your System Menu first.
  • Checkout OSGI HengSin to get the code called org.adempiere.process.UUIDGenerator.

Setting Parameter for Table

As can be seen in the code, there is an option to select the table:

	protected void prepare() {
		ProcessInfoParameter[] parameters = getProcessInfo().getParameter();
		if (parameters == null || parameters.length == 0)
			return;
		for(ProcessInfoParameter param : parameters) {
			if (param.getParameterName().equals("TableName")) {
				tableName = param.getParameter().toString();
				break;
			}
		}

	}
  • But if no table param is given, the code will do it for all tables. That can take quite a long while.
  • Backup your data first (on 2nd thought, don't ;) ).
	protected String doIt() throws Exception {
		if (tableName == null || tableName.trim().length() == 0)
			tableName = "%";
  • At the end of the execution, you can see a final report stating the number of tables processed and an option to print the results.

UUIDsGenerated.png

Links