Skip to content

Commit

Permalink
update 13 to fix issue #423
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobuzzi committed Jul 2, 2021
1 parent 6dfb262 commit 3a4a2e2
Show file tree
Hide file tree
Showing 203 changed files with 1,638 additions and 16 deletions.
4 changes: 4 additions & 0 deletions repository/BpmWebRestApiLayer.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
other
defaultAction
"The receiver answer a Xml string noting a BAD xml configuration in <xmlDocument> to set external variables of <aBpmProcessInstance>"
| xmlWriter |

xmlWriter := XMLWriter new.

xmlWriter tag: 'response' with: [
xmlWriter tag: 'result' with: 'Error: Bad Xml Configuration to set variables'.
xmlWriter tag: 'processid' with: process id printString.

xmlDocument ifNotNil: [xmlWriter tag: 'query' with: [xmlWriter cdata: xmlDocument printString]].

].

^xmlWriter contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
"defaultAction" : "brunobb 11/27/2018 06:47" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "BpmWebRestApiLayer",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "BadExternalVariableConfigException",
"pools" : [
],
"super" : "BpmServiceException",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*bpmWebRestApiLayer
registerRestComponents

WABpmPersistenceOrbeonLayer register.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*bpmWebRestApiLayer
unregisterRestComponents

WABpmPersistenceOrbeonLayer unregister.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"class" : {
"registerRestComponents" : "brunobb 04/11/2019 05:49",
"unregisterRestComponents" : "brunobb 04/11/2019 05:51" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "BpmAppLinuxScripts" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
other
associateFormWithTask: aBpmTaskInstance forProcess: aBpmProcessInstace
"The receiver associate the task <aBpmTaskInstance> with it's form instance in the process <aBpmProcessInstace>.
This method is used in anonymous process creation.
If the form <formInstance> is not set with an assignment --> the search will Fail. But an anonymous form does not have anAssignment so here one assignment is enforced"
| formInstance assigment role |

formInstance := aBpmTaskInstance externalObject.

role := aBpmTaskInstance rolesIfEmpty: [TaskWithNoRoleException signal: 'No roles for this task' ] ifNotEmpty: [:value | value first].

assigment := (BpmTaskAssignment
newFor: aBpmProcessInstace
task: aBpmTaskInstance
in: (self getFinishedMatrixForApplication: formInstance getApplicationName))
role: role;
canUnassign: aBpmTaskInstance canUnassign;
yourself.

formInstance assignment: assigment.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
other
doIt
"The receiver creates a new <BpmProcessInstance> with the first task already done.
The form of the task was sent anonymously to the REST service."
| application formInstance procDefinition currentTask |

application := self getOrbeonApplicationClass applicationNamed: appName ifNone: [^NoApplicationException signal: 'No such application [', appName, ']'].
formInstance := application getAnyInstanceWithId: id of: formName ifNone: [^NoOrbeonFormException signal: 'No such form [', id, ']'].

procDefinition := self defaultProcessDefinitionClass getProcessDefinitionWith: processId in: appName.
procDefinition isAnonymousStartEnabled ifFalse: [^FormToProcessDefinitionMappingException signal: 'There is NO <BpmProcessDefinition> mapped to form [', formName, '] in Application [', appName, '] for anonymous start'].
procDefinition isAvailable ifFalse: [^ProcessNotAvailableException signal: 'This Process is currently unavailable'].
newBpmProcess := procDefinition createAndStartProcessInstance: nil "anonymous user ".
newBpmProcess currentActivities isEmpty ifTrue: [^NoRunningTaskException signal: 'The BpmProcessInstance can not be executed because the collection <currentActivities> is empty'].
currentTask := newBpmProcess currentActivities last.

currentTask externalObject: formInstance.
self associateFormWithTask: currentTask forProcess: newBpmProcess.
currentTask performFinalization.
newBpmProcess generateNextTransitionsFrom: currentTask.
procDefinition updateFieldsOf: formInstance. "the first task is already done --> the indexes of the BpmProcessDefinition are updated here"

^self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Updating
newBpmProcess: newValue
newBpmProcess := newValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Accessing
newBpmProcess
^newBpmProcess
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Updating
processId: newValue
processId := newValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Accessing
processId
^processId
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"class" : {
},
"instance" : {
"associateFormWithTask:forProcess:" : "brunobb 07/31/2020 10:47",
"doIt" : "brunobb 02/05/2020 03:33",
"newBpmProcess" : "brunobb 12/04/2018 09:10",
"newBpmProcess:" : "brunobb 12/04/2018 09:10",
"processId" : "brunobb 12/04/2018 09:10",
"processId:" : "brunobb 12/04/2018 09:10" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"category" : "BpmWebRestApiLayer",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"newBpmProcess",
"processId" ],
"name" : "BpmCreateNewProcessApi",
"pools" : [
],
"super" : "BpmServiceOperationApi",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
other
answerXMLErrorWith: uuidToken

" ^'<result>
<error>', uuidToken,'</error>
</result>'
"

^'<result>
<formid></formid>
<username></username>
</result>'
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
other
doIt
"The security GET service take an uuid as a parameter <token> and:
1- Check via lookup if it has associated XML.
2- If it so then answer the XML string associate with the token.
3- If not then answer a XML string with the same structure as 2 but with empty nodes values."
| serviceRegistry serviceValue |

serviceRegistry := BpmOrbeonTempTokenRegistry default.
"get the XML associate with the token <token> and remove the token <token> for security reasons -can not be used again-"
serviceValue := serviceRegistry getSecureValueForToken: token.
"if the token <token> is not registered then answer an empty XML with the same structure"
serviceValue ifNil: [^self answerXMLErrorWith: token].

^serviceValue "the XML associated with token <token> with the values of the Orbeon form"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Updating
token: newValue
token := newValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Accessing
token
^token
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"class" : {
},
"instance" : {
"answerXMLErrorWith:" : "brunobb 12/04/2018 04:07",
"doIt" : "brunobb 12/06/2018 04:16",
"token" : "brunobb 03/27/2018 07:32",
"token:" : "brunobb 03/27/2018 07:32" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "BpmWebRestApiLayer",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"token" ],
"name" : "BpmGetXmlDataFromTokenApi",
"pools" : [
],
"super" : "BpmServiceOperationApi",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
other
doItIfNotFound: aBlock
"The receiver publish the form named <formName> in application named <app> with id <id> title <title> description <description> and xml <xmlString>.
The version of the form is in <headerVersion> - orbeon parameter.
* Calculate the version number & create <anOrbeonSavedFormDefinition>
* Compare latest published version with the new one --> [update the current |or| add the new one]"
| message |

super doItIfNotFound: aBlock.

message := BpmOrbeonFormDefinitionUpdatedMessage newFromSystemIn: application bpmEnvironment.
message application: application;
formName: publishedFormDefinition formName;
affectedProcesses: (self getAffectedProcessesBy: publishedFormDefinition).

application backofficeRolesDo: [:bpmRole | message addRecipients: bpmRole].

message bePublishSubject;
createMessageBody;
send.

^self
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
other
getAffectedProcessesBy: anOrbeonPublishedFormDefinition
"Answer a collection of <BpmProcessDefinition> that includes the form <anOrbeonPublishedFormDefinition> in its definition"

^application bpmEnvironment getAllProcessDefinitions select: [:procDefinition |
procDefinition getOrbeonTaskNames includes: anOrbeonPublishedFormDefinition formName.
].
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
other
isCreationRejectedFor: latestDefinition
"The creation is rejected for <latestDefinition> when already exist a form definition named <formName> in application named <appName> but the <ids> are different.
This case happend when a pair <appName,formName> is saved with different id. [IN THIS PERSISTENCE LAYER THIS IS FORBIDDEN BY CODE]"

^latestDefinition notNil and: [latestDefinition isCreationRejectedByBpmFor: self getFormName withId: id in: self getApplicationName]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"class" : {
},
"instance" : {
"doItIfNotFound:" : "brunobb 09/28/2020 09:52",
"getAffectedProcessesBy:" : "brunobb 02/05/2020 09:48",
"isCreationRejectedFor:" : "brunobb 06/26/2020 13:54" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "BpmWebRestApiLayer",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "BpmOrbeonFormBuilderPublishApi",
"pools" : [
],
"super" : "OrbeonFormBuilderPublishApi",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
other
createOrbeonSavedDefinition

^self defaultSavedFormDefinitionClass newNamed: self getFormName inBpmAppNamed: self getApplicationName
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
other
doIt
"This service is called by Orbeon when a user click on -Save- inside the Form Builder.
A Form Definition has been saved "
| message application |

super doIt.

application := savedFormDefinition application.
message := BpmOrbeonFormDefinitionUpdatedMessage newFromSystemIn: application bpmEnvironment.
message application: application;
formName: savedFormDefinition formName;
affectedProcesses: (self getAffectedProcessesBy: savedFormDefinition).

application backofficeRolesDo: [:bpmRole | message addRecipients: bpmRole].

message beSavedSubject;
createMessageBody;
send.

^self
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
other
getAffectedProcessesBy: anOrbeonPublishedFormDefinition
"Answer a collection of <BpmProcessDefinition> that includes the form <anOrbeonPublishedFormDefinition> in its definition"

"issue #1162"
anOrbeonPublishedFormDefinition hasBpmEnvironment
ifFalse: [ | env |
env := systemRoot getExistingEnvironmentOrCreateNewNamed: anOrbeonPublishedFormDefinition applicationName.
env registerApplication: anOrbeonPublishedFormDefinition application ifPresent: [] ifTaken: []].

^anOrbeonPublishedFormDefinition application bpmEnvironment getAllProcessDefinitions select: [:procDefinition |
procDefinition getOrbeonTaskNames includes: anOrbeonPublishedFormDefinition formName.
].
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
other
isCreationRejectedFor: latestDefinition
"The creation is rejected for <latestDefinition> when already exist a form definition named <formName> in application named <appName> but the <ids> are different.
This case happend when a pair <appName,formName> is saved with different id. [IN THIS PERSISTENCE LAYER THIS IS FORBIDDEN BY CODE]"

^latestDefinition notNil and: [latestDefinition isCreationRejectedByBpmFor: self getFormName withId: id in: self getApplicationName]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"class" : {
},
"instance" : {
"createOrbeonSavedDefinition" : "brunobb 04/27/2021 13:08",
"doIt" : "brunobb 08/19/2020 10:12",
"getAffectedProcessesBy:" : "brunobb 07/02/2021 13:12",
"isCreationRejectedFor:" : "brunobb 06/26/2020 13:54" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "BpmWebRestApiLayer",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "BpmOrbeonFormBuilderSaveApi",
"pools" : [
],
"super" : "OrbeonFormBuilderSaveApi",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
other
doIt
| application definition instance |

application := self getOrbeonApplicationClass applicationNamed: appName ifNone: [^self signalNoApplicationException: appName].

definition := application getDefinitionNamed: formName withVersion: version ifNone: [^self signalNoFormException].

instance := definition getInstanceWithId: id ifNone: [definition getDraftWithId: id ifNone: [OrbeonFormInstance newFor: definition withId: id]].

"execute the audit options. if <xmlString> is nil --> is a new form"
(instance xmlString notNil and:[self getOrbeonWebServerConfiguration isInstanceAuditEnableFor: formName in: appName])
ifTrue: [self auditStorage addInstanceAudit: instance cloneForAudit].

instance xmlString: xmlString;
draft: 'N';
definition: definition;
version: version;
username: username; "BUG - creator set only one time"
modifiedUser: modifiedUser;
groupname: groupname;
isValid: isValid;
updateLastModifiedTime;
buildForm.

definition removeDraft: instance. "this is the final version so we remove the current draft if any"

^instance xmlString.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Updating
groupname: newValue
groupname := newValue
Loading

0 comments on commit 3a4a2e2

Please sign in to comment.