public class DefaultDeployFilter implements DeployFilter {
public void beforeDeploy(ProcessDefinition definition, ProcessTransactionContext tc, String folder, boolean isNew) throws Exception {
ProcessDefinitionDAO procDef = (ProcessDefinitionDAO) tc.findSynchronizedDAO("bpm_procdef", "defid", definition.getBelongingDefinitionId(), ProcessDefinitionDAO.class);
if (isNew) {
RevisionInfo ri = (RevisionInfo) definition.getRevisionInfoList().get(0);
AclManager acl = AclManager.getInstance();
acl.setPermission(
Integer.parseInt(definition.getBelongingDefinitionId()),
AclManager.ACL_FIELD_EMP, ri.getAuthorId(),
new String[]{AclManager.PERMISSION_MANAGEMENT + ""}
);
if (UEngineUtil.isNotEmpty(ri.getAuthorCompany())) {
acl.setPermission(
Integer.parseInt(definition.getBelongingDefinitionId()),
AclManager.ACL_FIELD_COM, ri.getAuthorCompany(),
new String[]{AclManager.PERMISSION_INITIATE + "", AclManager.PERMISSION_VIEW + ""}
);
procDef.setComCode(ri.getAuthorCompany());
}
} else {
procDef.setName(definition.getName().getText());
procDef.setDescription(definition.getDescription().getText());
}
}