You are saying "DB" but I will assume you mean "properties on an object stored in the Alfresco repository". If so, from JavaScript embedded in your workflow you can check a property value. If a property is named "foo:someProperty" then you can get it using doc.properties['foo:someProperty']. And you can get the object from the workflow package. All of the documents in your workflow are in an array which is accessible with bpm_package.children.
The code would look something like:
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
for (var i = 0; i < bpm_package.children.length; i++)
{
var doc = bpm_package.children[i];
if (doc.properties['foo:someProperty'] === 'some value') {
doc.properties['foo:someProperty'] = 'some other value';
doc.save();
}
}
</activiti:string>
</activiti:field>
For more info on the Alfresco JavaScript API, see the docs.
If you did not mean an object in the repository and you really did mean a relational database, then you'll have to implement a custom task listener using Java, and from there use JDBC or some other API to query your database and update records in the database.
If that's what you need to do, then you might take a look at this workflow tutorial. There is a class called ExternalReviewNotification that shows how to implement a custom task listener in Java. You could implement your own task listener that makes the JDBC call to your database.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…