Bpmn-js 属性控制

我们可以通过bpmn-js来访问对应的BPMN图例的属性信息。对应的流程图中的每个图例元素(如开始、结束、中间/边界事件等都通过businessObject属性存储对基础BPMN元素的引用。业务对象是从BPMN 2.0 XML导入并在导出过程中序列化的实际元素。使用业务对象来读取和写入BPMN特定的属性。

属性读取

我们需要通过关系图的图例的引用来获取对应的属性值:

var elementRegistry = bpmnJS.get('elementRegistry');var sequenceFlowElement = elementRegistry.get('SequenceFlow_1'),sequenceFlow = sequenceFlowElement.businessObject;sequenceFlow.name; // 'YES'
sequenceFlow.conditionExpression; // ModdleElement { $type: 'bpmn:FormalExpression', ... }

属性设置

在进行属性设置之前,需要了解bpmn-js内置支持哪些元素,哪些属性,具体的元素和属性可参考:bpmn.json文件,其详细内容如下:

{"name": "BPMN20","uri": "http://www.omg.org/spec/BPMN/20100524/MODEL","prefix": "bpmn","associations": [],"types": [{"name": "Interface","superClass": ["RootElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "operations","type": "Operation","isMany": true},{"name": "implementationRef","isAttr": true,"type": "String"}]},{"name": "Operation","superClass": ["BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "inMessageRef","type": "Message","isReference": true},{"name": "outMessageRef","type": "Message","isReference": true},{"name": "errorRef","type": "Error","isMany": true,"isReference": true},{"name": "implementationRef","isAttr": true,"type": "String"}]},{"name": "EndPoint","superClass": ["RootElement"]},{"name": "Auditing","superClass": ["BaseElement"]},{"name": "GlobalTask","superClass": ["CallableElement"],"properties": [{"name": "resources","type": "ResourceRole","isMany": true}]},{"name": "Monitoring","superClass": ["BaseElement"]},{"name": "Performer","superClass": ["ResourceRole"]},{"name": "Process","superClass": ["FlowElementsContainer","CallableElement"],"properties": [{"name": "processType","type": "ProcessType","isAttr": true},{"name": "isClosed","isAttr": true,"type": "Boolean"},{"name": "auditing","type": "Auditing"},{"name": "monitoring","type": "Monitoring"},{"name": "properties","type": "Property","isMany": true},{"name": "laneSets","isMany": true,"replaces": "FlowElementsContainer#laneSets","type": "LaneSet"},{"name": "flowElements","isMany": true,"replaces": "FlowElementsContainer#flowElements","type": "FlowElement"},{"name": "artifacts","type": "Artifact","isMany": true},{"name": "resources","type": "ResourceRole","isMany": true},{"name": "correlationSubscriptions","type": "CorrelationSubscription","isMany": true},{"name": "supports","type": "Process","isMany": true,"isReference": true},{"name": "definitionalCollaborationRef","type": "Collaboration","isAttr": true,"isReference": true},{"name": "isExecutable","isAttr": true,"type": "Boolean"}]},{"name": "LaneSet","superClass": ["BaseElement"],"properties": [{"name": "lanes","type": "Lane","isMany": true},{"name": "name","isAttr": true,"type": "String"}]},{"name": "Lane","superClass": ["BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "partitionElementRef","type": "BaseElement","isAttr": true,"isReference": true},{"name": "partitionElement","type": "BaseElement"},{"name": "flowNodeRef","type": "FlowNode","isMany": true,"isReference": true},{"name": "childLaneSet","type": "LaneSet","xml": {"serialize": "xsi:type"}}]},{"name": "GlobalManualTask","superClass": ["GlobalTask"]},{"name": "ManualTask","superClass": ["Task"]},{"name": "UserTask","superClass": ["Task"],"properties": [{"name": "renderings","type": "Rendering","isMany": true},{"name": "implementation","isAttr": true,"type": "String"}]},{"name": "Rendering","superClass": ["BaseElement"]},{"name": "HumanPerformer","superClass": ["Performer"]},{"name": "PotentialOwner","superClass": ["HumanPerformer"]},{"name": "GlobalUserTask","superClass": ["GlobalTask"],"properties": [{"name": "implementation","isAttr": true,"type": "String"},{"name": "renderings","type": "Rendering","isMany": true}]},{"name": "Gateway","isAbstract": true,"superClass": ["FlowNode"],"properties": [{"name": "gatewayDirection","type": "GatewayDirection","default": "Unspecified","isAttr": true}]},{"name": "EventBasedGateway","superClass": ["Gateway"],"properties": [{"name": "instantiate","default": false,"isAttr": true,"type": "Boolean"},{"name": "eventGatewayType","type": "EventBasedGatewayType","isAttr": true,"default": "Exclusive"}]},{"name": "ComplexGateway","superClass": ["Gateway"],"properties": [{"name": "activationCondition","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "default","type": "SequenceFlow","isAttr": true,"isReference": true}]},{"name": "ExclusiveGateway","superClass": ["Gateway"],"properties": [{"name": "default","type": "SequenceFlow","isAttr": true,"isReference": true}]},{"name": "InclusiveGateway","superClass": ["Gateway"],"properties": [{"name": "default","type": "SequenceFlow","isAttr": true,"isReference": true}]},{"name": "ParallelGateway","superClass": ["Gateway"]},{"name": "RootElement","isAbstract": true,"superClass": ["BaseElement"]},{"name": "Relationship","superClass": ["BaseElement"],"properties": [{"name": "type","isAttr": true,"type": "String"},{"name": "direction","type": "RelationshipDirection","isAttr": true},{"name": "source","isMany": true,"isReference": true,"type": "Element"},{"name": "target","isMany": true,"isReference": true,"type": "Element"}]},{"name": "BaseElement","isAbstract": true,"properties": [{"name": "id","isAttr": true,"type": "String","isId": true},{"name": "documentation","type": "Documentation","isMany": true},{"name": "extensionDefinitions","type": "ExtensionDefinition","isMany": true,"isReference": true},{"name": "extensionElements","type": "ExtensionElements"}]},{"name": "Extension","properties": [{"name": "mustUnderstand","default": false,"isAttr": true,"type": "Boolean"},{"name": "definition","type": "ExtensionDefinition","isAttr": true,"isReference": true}]},{"name": "ExtensionDefinition","properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "extensionAttributeDefinitions","type": "ExtensionAttributeDefinition","isMany": true}]},{"name": "ExtensionAttributeDefinition","properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "type","isAttr": true,"type": "String"},{"name": "isReference","default": false,"isAttr": true,"type": "Boolean"},{"name": "extensionDefinition","type": "ExtensionDefinition","isAttr": true,"isReference": true}]},{"name": "ExtensionElements","properties": [{"name": "valueRef","isAttr": true,"isReference": true,"type": "Element"},{"name": "values","type": "Element","isMany": true},{"name": "extensionAttributeDefinition","type": "ExtensionAttributeDefinition","isAttr": true,"isReference": true}]},{"name": "Documentation","superClass": ["BaseElement"],"properties": [{"name": "text","type": "String","isBody": true},{"name": "textFormat","default": "text/plain","isAttr": true,"type": "String"}]},{"name": "Event","isAbstract": true,"superClass": ["FlowNode","InteractionNode"],"properties": [{"name": "properties","type": "Property","isMany": true}]},{"name": "IntermediateCatchEvent","superClass": ["CatchEvent"]},{"name": "IntermediateThrowEvent","superClass": ["ThrowEvent"]},{"name": "EndEvent","superClass": ["ThrowEvent"]},{"name": "StartEvent","superClass": ["CatchEvent"],"properties": [{"name": "isInterrupting","default": true,"isAttr": true,"type": "Boolean"}]},{"name": "ThrowEvent","isAbstract": true,"superClass": ["Event"],"properties": [{"name": "dataInputs","type": "DataInput","isMany": true},{"name": "dataInputAssociations","type": "DataInputAssociation","isMany": true},{"name": "inputSet","type": "InputSet"},{"name": "eventDefinitions","type": "EventDefinition","isMany": true},{"name": "eventDefinitionRef","type": "EventDefinition","isMany": true,"isReference": true}]},{"name": "CatchEvent","isAbstract": true,"superClass": ["Event"],"properties": [{"name": "parallelMultiple","isAttr": true,"type": "Boolean","default": false},{"name": "dataOutputs","type": "DataOutput","isMany": true},{"name": "dataOutputAssociations","type": "DataOutputAssociation","isMany": true},{"name": "outputSet","type": "OutputSet"},{"name": "eventDefinitions","type": "EventDefinition","isMany": true},{"name": "eventDefinitionRef","type": "EventDefinition","isMany": true,"isReference": true}]},{"name": "BoundaryEvent","superClass": ["CatchEvent"],"properties": [{"name": "cancelActivity","default": true,"isAttr": true,"type": "Boolean"},{"name": "attachedToRef","type": "Activity","isAttr": true,"isReference": true}]},{"name": "EventDefinition","isAbstract": true,"superClass": ["RootElement"]},{"name": "CancelEventDefinition","superClass": ["EventDefinition"]},{"name": "ErrorEventDefinition","superClass": ["EventDefinition"],"properties": [{"name": "errorRef","type": "Error","isAttr": true,"isReference": true}]},{"name": "TerminateEventDefinition","superClass": ["EventDefinition"]},{"name": "EscalationEventDefinition","superClass": ["EventDefinition"],"properties": [{"name": "escalationRef","type": "Escalation","isAttr": true,"isReference": true}]},{"name": "Escalation","properties": [{"name": "structureRef","type": "ItemDefinition","isAttr": true,"isReference": true},{"name": "name","isAttr": true,"type": "String"},{"name": "escalationCode","isAttr": true,"type": "String"}],"superClass": ["RootElement"]},{"name": "CompensateEventDefinition","superClass": ["EventDefinition"],"properties": [{"name": "waitForCompletion","isAttr": true,"type": "Boolean","default": true},{"name": "activityRef","type": "Activity","isAttr": true,"isReference": true}]},{"name": "TimerEventDefinition","superClass": ["EventDefinition"],"properties": [{"name": "timeDate","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "timeCycle","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "timeDuration","type": "Expression","xml": {"serialize": "xsi:type"}}]},{"name": "LinkEventDefinition","superClass": ["EventDefinition"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "target","type": "LinkEventDefinition","isReference": true},{"name": "source","type": "LinkEventDefinition","isMany": true,"isReference": true}]},{"name": "MessageEventDefinition","superClass": ["EventDefinition"],"properties": [{"name": "messageRef","type": "Message","isAttr": true,"isReference": true},{"name": "operationRef","type": "Operation","isAttr": true,"isReference": true}]},{"name": "ConditionalEventDefinition","superClass": ["EventDefinition"],"properties": [{"name": "condition","type": "Expression","xml": {"serialize": "xsi:type"}}]},{"name": "SignalEventDefinition","superClass": ["EventDefinition"],"properties": [{"name": "signalRef","type": "Signal","isAttr": true,"isReference": true}]},{"name": "Signal","superClass": ["RootElement"],"properties": [{"name": "structureRef","type": "ItemDefinition","isAttr": true,"isReference": true},{"name": "name","isAttr": true,"type": "String"}]},{"name": "ImplicitThrowEvent","superClass": ["ThrowEvent"]},{"name": "DataState","superClass": ["BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"}]},{"name": "ItemAwareElement","superClass": ["BaseElement"],"properties": [{"name": "itemSubjectRef","type": "ItemDefinition","isAttr": true,"isReference": true},{"name": "dataState","type": "DataState"}]},{"name": "DataAssociation","superClass": ["BaseElement"],"properties": [{"name": "sourceRef","type": "ItemAwareElement","isMany": true,"isReference": true},{"name": "targetRef","type": "ItemAwareElement","isReference": true},{"name": "transformation","type": "FormalExpression","xml": {"serialize": "property"}},{"name": "assignment","type": "Assignment","isMany": true}]},{"name": "DataInput","superClass": ["ItemAwareElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "isCollection","default": false,"isAttr": true,"type": "Boolean"},{"name": "inputSetRef","type": "InputSet","isMany": true,"isVirtual": true,"isReference": true},{"name": "inputSetWithOptional","type": "InputSet","isMany": true,"isVirtual": true,"isReference": true},{"name": "inputSetWithWhileExecuting","type": "InputSet","isMany": true,"isVirtual": true,"isReference": true}]},{"name": "DataOutput","superClass": ["ItemAwareElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "isCollection","default": false,"isAttr": true,"type": "Boolean"},{"name": "outputSetRef","type": "OutputSet","isMany": true,"isVirtual": true,"isReference": true},{"name": "outputSetWithOptional","type": "OutputSet","isMany": true,"isVirtual": true,"isReference": true},{"name": "outputSetWithWhileExecuting","type": "OutputSet","isMany": true,"isVirtual": true,"isReference": true}]},{"name": "InputSet","superClass": ["BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "dataInputRefs","type": "DataInput","isMany": true,"isReference": true},{"name": "optionalInputRefs","type": "DataInput","isMany": true,"isReference": true},{"name": "whileExecutingInputRefs","type": "DataInput","isMany": true,"isReference": true},{"name": "outputSetRefs","type": "OutputSet","isMany": true,"isReference": true}]},{"name": "OutputSet","superClass": ["BaseElement"],"properties": [{"name": "dataOutputRefs","type": "DataOutput","isMany": true,"isReference": true},{"name": "name","isAttr": true,"type": "String"},{"name": "inputSetRefs","type": "InputSet","isMany": true,"isReference": true},{"name": "optionalOutputRefs","type": "DataOutput","isMany": true,"isReference": true},{"name": "whileExecutingOutputRefs","type": "DataOutput","isMany": true,"isReference": true}]},{"name": "Property","superClass": ["ItemAwareElement"],"properties": [{"name": "name","isAttr": true,"type": "String"}]},{"name": "DataInputAssociation","superClass": ["DataAssociation"]},{"name": "DataOutputAssociation","superClass": ["DataAssociation"]},{"name": "InputOutputSpecification","superClass": ["BaseElement"],"properties": [{"name": "dataInputs","type": "DataInput","isMany": true},{"name": "dataOutputs","type": "DataOutput","isMany": true},{"name": "inputSets","type": "InputSet","isMany": true},{"name": "outputSets","type": "OutputSet","isMany": true}]},{"name": "DataObject","superClass": ["FlowElement","ItemAwareElement"],"properties": [{"name": "isCollection","default": false,"isAttr": true,"type": "Boolean"}]},{"name": "InputOutputBinding","properties": [{"name": "inputDataRef","type": "InputSet","isAttr": true,"isReference": true},{"name": "outputDataRef","type": "OutputSet","isAttr": true,"isReference": true},{"name": "operationRef","type": "Operation","isAttr": true,"isReference": true}]},{"name": "Assignment","superClass": ["BaseElement"],"properties": [{"name": "from","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "to","type": "Expression","xml": {"serialize": "xsi:type"}}]},{"name": "DataStore","superClass": ["RootElement","ItemAwareElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "capacity","isAttr": true,"type": "Integer"},{"name": "isUnlimited","default": true,"isAttr": true,"type": "Boolean"}]},{"name": "DataStoreReference","superClass": ["ItemAwareElement","FlowElement"],"properties": [{"name": "dataStoreRef","type": "DataStore","isAttr": true,"isReference": true}]},{"name": "DataObjectReference","superClass": ["ItemAwareElement","FlowElement"],"properties": [{"name": "dataObjectRef","type": "DataObject","isAttr": true,"isReference": true}]},{"name": "ConversationLink","superClass": ["BaseElement"],"properties": [{"name": "sourceRef","type": "InteractionNode","isAttr": true,"isReference": true},{"name": "targetRef","type": "InteractionNode","isAttr": true,"isReference": true},{"name": "name","isAttr": true,"type": "String"}]},{"name": "ConversationAssociation","superClass": ["BaseElement"],"properties": [{"name": "innerConversationNodeRef","type": "ConversationNode","isAttr": true,"isReference": true},{"name": "outerConversationNodeRef","type": "ConversationNode","isAttr": true,"isReference": true}]},{"name": "CallConversation","superClass": ["ConversationNode"],"properties": [{"name": "calledCollaborationRef","type": "Collaboration","isAttr": true,"isReference": true},{"name": "participantAssociations","type": "ParticipantAssociation","isMany": true}]},{"name": "Conversation","superClass": ["ConversationNode"]},{"name": "SubConversation","superClass": ["ConversationNode"],"properties": [{"name": "conversationNodes","type": "ConversationNode","isMany": true}]},{"name": "ConversationNode","isAbstract": true,"superClass": ["InteractionNode","BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "participantRef","type": "Participant","isMany": true,"isReference": true},{"name": "messageFlowRefs","type": "MessageFlow","isMany": true,"isReference": true},{"name": "correlationKeys","type": "CorrelationKey","isMany": true}]},{"name": "GlobalConversation","superClass": ["Collaboration"]},{"name": "PartnerEntity","superClass": ["RootElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "participantRef","type": "Participant","isMany": true,"isReference": true}]},{"name": "PartnerRole","superClass": ["RootElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "participantRef","type": "Participant","isMany": true,"isReference": true}]},{"name": "CorrelationProperty","superClass": ["RootElement"],"properties": [{"name": "correlationPropertyRetrievalExpression","type": "CorrelationPropertyRetrievalExpression","isMany": true},{"name": "name","isAttr": true,"type": "String"},{"name": "type","type": "ItemDefinition","isAttr": true,"isReference": true}]},{"name": "Error","superClass": ["RootElement"],"properties": [{"name": "structureRef","type": "ItemDefinition","isAttr": true,"isReference": true},{"name": "name","isAttr": true,"type": "String"},{"name": "errorCode","isAttr": true,"type": "String"}]},{"name": "CorrelationKey","superClass": ["BaseElement"],"properties": [{"name": "correlationPropertyRef","type": "CorrelationProperty","isMany": true,"isReference": true},{"name": "name","isAttr": true,"type": "String"}]},{"name": "Expression","superClass": ["BaseElement"],"isAbstract": false,"properties": [{"name": "body","isBody": true,"type": "String"}]},{"name": "FormalExpression","superClass": ["Expression"],"properties": [{"name": "language","isAttr": true,"type": "String"},{"name": "evaluatesToTypeRef","type": "ItemDefinition","isAttr": true,"isReference": true}]},{"name": "Message","superClass": ["RootElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "itemRef","type": "ItemDefinition","isAttr": true,"isReference": true}]},{"name": "ItemDefinition","superClass": ["RootElement"],"properties": [{"name": "itemKind","type": "ItemKind","isAttr": true},{"name": "structureRef","isAttr": true,"type": "String"},{"name": "isCollection","default": false,"isAttr": true,"type": "Boolean"},{"name": "import","type": "Import","isAttr": true,"isReference": true}]},{"name": "FlowElement","isAbstract": true,"superClass": ["BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "auditing","type": "Auditing"},{"name": "monitoring","type": "Monitoring"},{"name": "categoryValueRef","type": "CategoryValue","isMany": true,"isReference": true}]},{"name": "SequenceFlow","superClass": ["FlowElement"],"properties": [{"name": "isImmediate","isAttr": true,"type": "Boolean"},{"name": "conditionExpression","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "sourceRef","type": "FlowNode","isAttr": true,"isReference": true},{"name": "targetRef","type": "FlowNode","isAttr": true,"isReference": true}]},{"name": "FlowElementsContainer","isAbstract": true,"superClass": ["BaseElement"],"properties": [{"name": "laneSets","type": "LaneSet","isMany": true},{"name": "flowElements","type": "FlowElement","isMany": true}]},{"name": "CallableElement","isAbstract": true,"superClass": ["RootElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "ioSpecification","type": "InputOutputSpecification","xml": {"serialize": "property"}},{"name": "supportedInterfaceRef","type": "Interface","isMany": true,"isReference": true},{"name": "ioBinding","type": "InputOutputBinding","isMany": true,"xml": {"serialize": "property"}}]},{"name": "FlowNode","isAbstract": true,"superClass": ["FlowElement"],"properties": [{"name": "incoming","type": "SequenceFlow","isMany": true,"isReference": true},{"name": "outgoing","type": "SequenceFlow","isMany": true,"isReference": true},{"name": "lanes","type": "Lane","isMany": true,"isVirtual": true,"isReference": true}]},{"name": "CorrelationPropertyRetrievalExpression","superClass": ["BaseElement"],"properties": [{"name": "messagePath","type": "FormalExpression"},{"name": "messageRef","type": "Message","isAttr": true,"isReference": true}]},{"name": "CorrelationPropertyBinding","superClass": ["BaseElement"],"properties": [{"name": "dataPath","type": "FormalExpression"},{"name": "correlationPropertyRef","type": "CorrelationProperty","isAttr": true,"isReference": true}]},{"name": "Resource","superClass": ["RootElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "resourceParameters","type": "ResourceParameter","isMany": true}]},{"name": "ResourceParameter","superClass": ["BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "isRequired","isAttr": true,"type": "Boolean"},{"name": "type","type": "ItemDefinition","isAttr": true,"isReference": true}]},{"name": "CorrelationSubscription","superClass": ["BaseElement"],"properties": [{"name": "correlationKeyRef","type": "CorrelationKey","isAttr": true,"isReference": true},{"name": "correlationPropertyBinding","type": "CorrelationPropertyBinding","isMany": true}]},{"name": "MessageFlow","superClass": ["BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "sourceRef","type": "InteractionNode","isAttr": true,"isReference": true},{"name": "targetRef","type": "InteractionNode","isAttr": true,"isReference": true},{"name": "messageRef","type": "Message","isAttr": true,"isReference": true}]},{"name": "MessageFlowAssociation","superClass": ["BaseElement"],"properties": [{"name": "innerMessageFlowRef","type": "MessageFlow","isAttr": true,"isReference": true},{"name": "outerMessageFlowRef","type": "MessageFlow","isAttr": true,"isReference": true}]},{"name": "InteractionNode","isAbstract": true,"properties": [{"name": "incomingConversationLinks","type": "ConversationLink","isMany": true,"isVirtual": true,"isReference": true},{"name": "outgoingConversationLinks","type": "ConversationLink","isMany": true,"isVirtual": true,"isReference": true}]},{"name": "Participant","superClass": ["InteractionNode","BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "interfaceRef","type": "Interface","isMany": true,"isReference": true},{"name": "participantMultiplicity","type": "ParticipantMultiplicity"},{"name": "endPointRefs","type": "EndPoint","isMany": true,"isReference": true},{"name": "processRef","type": "Process","isAttr": true,"isReference": true}]},{"name": "ParticipantAssociation","superClass": ["BaseElement"],"properties": [{"name": "innerParticipantRef","type": "Participant","isAttr": true,"isReference": true},{"name": "outerParticipantRef","type": "Participant","isAttr": true,"isReference": true}]},{"name": "ParticipantMultiplicity","properties": [{"name": "minimum","default": 0,"isAttr": true,"type": "Integer"},{"name": "maximum","default": 1,"isAttr": true,"type": "Integer"}],"superClass": ["BaseElement"]},{"name": "Collaboration","superClass": ["RootElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "isClosed","isAttr": true,"type": "Boolean"},{"name": "participants","type": "Participant","isMany": true},{"name": "messageFlows","type": "MessageFlow","isMany": true},{"name": "artifacts","type": "Artifact","isMany": true},{"name": "conversations","type": "ConversationNode","isMany": true},{"name": "conversationAssociations","type": "ConversationAssociation"},{"name": "participantAssociations","type": "ParticipantAssociation","isMany": true},{"name": "messageFlowAssociations","type": "MessageFlowAssociation","isMany": true},{"name": "correlationKeys","type": "CorrelationKey","isMany": true},{"name": "choreographyRef","type": "Choreography","isMany": true,"isReference": true},{"name": "conversationLinks","type": "ConversationLink","isMany": true}]},{"name": "ChoreographyActivity","isAbstract": true,"superClass": ["FlowNode"],"properties": [{"name": "participantRef","type": "Participant","isMany": true,"isReference": true},{"name": "initiatingParticipantRef","type": "Participant","isAttr": true,"isReference": true},{"name": "correlationKeys","type": "CorrelationKey","isMany": true},{"name": "loopType","type": "ChoreographyLoopType","default": "None","isAttr": true}]},{"name": "CallChoreography","superClass": ["ChoreographyActivity"],"properties": [{"name": "calledChoreographyRef","type": "Choreography","isAttr": true,"isReference": true},{"name": "participantAssociations","type": "ParticipantAssociation","isMany": true}]},{"name": "SubChoreography","superClass": ["ChoreographyActivity","FlowElementsContainer"],"properties": [{"name": "artifacts","type": "Artifact","isMany": true}]},{"name": "ChoreographyTask","superClass": ["ChoreographyActivity"],"properties": [{"name": "messageFlowRef","type": "MessageFlow","isMany": true,"isReference": true}]},{"name": "Choreography","superClass": ["Collaboration","FlowElementsContainer"]},{"name": "GlobalChoreographyTask","superClass": ["Choreography"],"properties": [{"name": "initiatingParticipantRef","type": "Participant","isAttr": true,"isReference": true}]},{"name": "TextAnnotation","superClass": ["Artifact"],"properties": [{"name": "text","type": "String"},{"name": "textFormat","default": "text/plain","isAttr": true,"type": "String"}]},{"name": "Group","superClass": ["Artifact"],"properties": [{"name": "categoryValueRef","type": "CategoryValue","isAttr": true,"isReference": true}]},{"name": "Association","superClass": ["Artifact"],"properties": [{"name": "associationDirection","type": "AssociationDirection","isAttr": true},{"name": "sourceRef","type": "BaseElement","isAttr": true,"isReference": true},{"name": "targetRef","type": "BaseElement","isAttr": true,"isReference": true}]},{"name": "Category","superClass": ["RootElement"],"properties": [{"name": "categoryValue","type": "CategoryValue","isMany": true},{"name": "name","isAttr": true,"type": "String"}]},{"name": "Artifact","isAbstract": true,"superClass": ["BaseElement"]},{"name": "CategoryValue","superClass": ["BaseElement"],"properties": [{"name": "categorizedFlowElements","type": "FlowElement","isMany": true,"isVirtual": true,"isReference": true},{"name": "value","isAttr": true,"type": "String"}]},{"name": "Activity","isAbstract": true,"superClass": ["FlowNode"],"properties": [{"name": "isForCompensation","default": false,"isAttr": true,"type": "Boolean"},{"name": "default","type": "SequenceFlow","isAttr": true,"isReference": true},{"name": "ioSpecification","type": "InputOutputSpecification","xml": {"serialize": "property"}},{"name": "boundaryEventRefs","type": "BoundaryEvent","isMany": true,"isReference": true},{"name": "properties","type": "Property","isMany": true},{"name": "dataInputAssociations","type": "DataInputAssociation","isMany": true},{"name": "dataOutputAssociations","type": "DataOutputAssociation","isMany": true},{"name": "startQuantity","default": 1,"isAttr": true,"type": "Integer"},{"name": "resources","type": "ResourceRole","isMany": true},{"name": "completionQuantity","default": 1,"isAttr": true,"type": "Integer"},{"name": "loopCharacteristics","type": "LoopCharacteristics"}]},{"name": "ServiceTask","superClass": ["Task"],"properties": [{"name": "implementation","isAttr": true,"type": "String"},{"name": "operationRef","type": "Operation","isAttr": true,"isReference": true}]},{"name": "SubProcess","superClass": ["Activity","FlowElementsContainer","InteractionNode"],"properties": [{"name": "triggeredByEvent","default": false,"isAttr": true,"type": "Boolean"},{"name": "artifacts","type": "Artifact","isMany": true}]},{"name": "LoopCharacteristics","isAbstract": true,"superClass": ["BaseElement"]},{"name": "MultiInstanceLoopCharacteristics","superClass": ["LoopCharacteristics"],"properties": [{"name": "isSequential","default": false,"isAttr": true,"type": "Boolean"},{"name": "behavior","type": "MultiInstanceBehavior","default": "All","isAttr": true},{"name": "loopCardinality","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "loopDataInputRef","type": "ItemAwareElement","isReference": true},{"name": "loopDataOutputRef","type": "ItemAwareElement","isReference": true},{"name": "inputDataItem","type": "DataInput","xml": {"serialize": "property"}},{"name": "outputDataItem","type": "DataOutput","xml": {"serialize": "property"}},{"name": "complexBehaviorDefinition","type": "ComplexBehaviorDefinition","isMany": true},{"name": "completionCondition","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "oneBehaviorEventRef","type": "EventDefinition","isAttr": true,"isReference": true},{"name": "noneBehaviorEventRef","type": "EventDefinition","isAttr": true,"isReference": true}]},{"name": "StandardLoopCharacteristics","superClass": ["LoopCharacteristics"],"properties": [{"name": "testBefore","default": false,"isAttr": true,"type": "Boolean"},{"name": "loopCondition","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "loopMaximum","type": "Integer","isAttr": true}]},{"name": "CallActivity","superClass": ["Activity","InteractionNode"],"properties": [{"name": "calledElement","type": "String","isAttr": true}]},{"name": "Task","superClass": ["Activity","InteractionNode"]},{"name": "SendTask","superClass": ["Task"],"properties": [{"name": "implementation","isAttr": true,"type": "String"},{"name": "operationRef","type": "Operation","isAttr": true,"isReference": true},{"name": "messageRef","type": "Message","isAttr": true,"isReference": true}]},{"name": "ReceiveTask","superClass": ["Task"],"properties": [{"name": "implementation","isAttr": true,"type": "String"},{"name": "instantiate","default": false,"isAttr": true,"type": "Boolean"},{"name": "operationRef","type": "Operation","isAttr": true,"isReference": true},{"name": "messageRef","type": "Message","isAttr": true,"isReference": true}]},{"name": "ScriptTask","superClass": ["Task"],"properties": [{"name": "scriptFormat","isAttr": true,"type": "String"},{"name": "script","type": "String"}]},{"name": "BusinessRuleTask","superClass": ["Task"],"properties": [{"name": "implementation","isAttr": true,"type": "String"}]},{"name": "AdHocSubProcess","superClass": ["SubProcess"],"properties": [{"name": "completionCondition","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "ordering","type": "AdHocOrdering","isAttr": true},{"name": "cancelRemainingInstances","default": true,"isAttr": true,"type": "Boolean"}]},{"name": "Transaction","superClass": ["SubProcess"],"properties": [{"name": "protocol","isAttr": true,"type": "String"},{"name": "method","isAttr": true,"type": "String"}]},{"name": "GlobalScriptTask","superClass": ["GlobalTask"],"properties": [{"name": "scriptLanguage","isAttr": true,"type": "String"},{"name": "script","isAttr": true,"type": "String"}]},{"name": "GlobalBusinessRuleTask","superClass": ["GlobalTask"],"properties": [{"name": "implementation","isAttr": true,"type": "String"}]},{"name": "ComplexBehaviorDefinition","superClass": ["BaseElement"],"properties": [{"name": "condition","type": "FormalExpression"},{"name": "event","type": "ImplicitThrowEvent"}]},{"name": "ResourceRole","superClass": ["BaseElement"],"properties": [{"name": "resourceRef","type": "Resource","isReference": true},{"name": "resourceParameterBindings","type": "ResourceParameterBinding","isMany": true},{"name": "resourceAssignmentExpression","type": "ResourceAssignmentExpression"},{"name": "name","isAttr": true,"type": "String"}]},{"name": "ResourceParameterBinding","properties": [{"name": "expression","type": "Expression","xml": {"serialize": "xsi:type"}},{"name": "parameterRef","type": "ResourceParameter","isAttr": true,"isReference": true}],"superClass": ["BaseElement"]},{"name": "ResourceAssignmentExpression","properties": [{"name": "expression","type": "Expression","xml": {"serialize": "xsi:type"}}],"superClass": ["BaseElement"]},{"name": "Import","properties": [{"name": "importType","isAttr": true,"type": "String"},{"name": "location","isAttr": true,"type": "String"},{"name": "namespace","isAttr": true,"type": "String"}]},{"name": "Definitions","superClass": ["BaseElement"],"properties": [{"name": "name","isAttr": true,"type": "String"},{"name": "targetNamespace","isAttr": true,"type": "String"},{"name": "expressionLanguage","default": "http://www.w3.org/1999/XPath","isAttr": true,"type": "String"},{"name": "typeLanguage","default": "http://www.w3.org/2001/XMLSchema","isAttr": true,"type": "String"},{"name": "imports","type": "Import","isMany": true},{"name": "extensions","type": "Extension","isMany": true},{"name": "rootElements","type": "RootElement","isMany": true},{"name": "diagrams","isMany": true,"type": "bpmndi:BPMNDiagram"},{"name": "exporter","isAttr": true,"type": "String"},{"name": "relationships","type": "Relationship","isMany": true},{"name": "exporterVersion","isAttr": true,"type": "String"}]}],"enumerations": [{"name": "ProcessType","literalValues": [{"name": "None"},{"name": "Public"},{"name": "Private"}]},{"name": "GatewayDirection","literalValues": [{"name": "Unspecified"},{"name": "Converging"},{"name": "Diverging"},{"name": "Mixed"}]},{"name": "EventBasedGatewayType","literalValues": [{"name": "Parallel"},{"name": "Exclusive"}]},{"name": "RelationshipDirection","literalValues": [{"name": "None"},{"name": "Forward"},{"name": "Backward"},{"name": "Both"}]},{"name": "ItemKind","literalValues": [{"name": "Physical"},{"name": "Information"}]},{"name": "ChoreographyLoopType","literalValues": [{"name": "None"},{"name": "Standard"},{"name": "MultiInstanceSequential"},{"name": "MultiInstanceParallel"}]},{"name": "AssociationDirection","literalValues": [{"name": "None"},{"name": "One"},{"name": "Both"}]},{"name": "FormalExpression"literalValues": [{"name": "Parallel"},{"name": "Sequential"}]}],"xml": {"tagAlias": "lowerCase","typePrefix": "t"}
}

其元素类型如下:

元素名父类支持属性
OperationBaseElementname: String
inMessageRef: Message
outMessageRef: Message
errorRef: Message
implementationRef: String
BaseElementRootElementname: String
operations: 一对多Operation类型
implementationRef: String
EndPointRootElement
AuditingBaseElement
GlobalTaskCallableElementresources: 一对多,ResourceRole
MonitoringBaseElement
PerformerResourceRole
ProcessFlowElementsContainer
CallableElement
processType: ProcessType
isClosed: Boolean
auditing: Auditing
monitoring: Monitoring
properties: 一对多,Property
laneSets: 一对多,LaneSet
flowElements: 一对多,FlowElement
artifacts: 一对多,Artifact
resources: 一对多,ResourceRole
correlationSubscriptions:一对多,CorrelationSubscription
supports:一对多,Process
definitionalCollaborationRef:Collaboration
isExecutable:Boolean
LaneSetBaseElementlanes:一对多,Lane
name: String
LaneBaseElementname:String
partitionElementRef: BaseElement
partitionElement: BaseElement
flowNodeRef: 一对多,FlowNode
childLaneSet: LaneSet
GlobalManualTaskGlobalTask
ManualTaskTask
UserTaskTaskrenderings:一对多,Rendering
implementation: String
RenderingBaseElement
HumanPerformerPerformer
PotentialOwnerHumanPerformer
GlobalUserTaskGlobalTaskimplementation:String
renderings:一对多,Rendering
GatewayFlowNodegatewayDirection:GatewayDirection
EventBasedGatewayGatewayinstantiate: Boolean
eventGatewayType: EventBasedGatewayType
ComplexGatewayGatewayactivationCondition: Expression
default:SequenceFlow
ExclusiveGatewayGatewaydefault:SequenceFlow
InclusiveGatewayGatewaydefault:SequenceFlow
ParallelGatewayGateway
RootElementBaseElement
RelationshipBaseElementtype:String
direction:RelationshipDirection
source:Element
target:Element
BaseElementid:String
documentation:一对多,Documentation
extensionDefinitions:一对多,ExtensionDefinition
extensionElements:ExtensionElements
抽象的,不可直接创建
ExtensionmustUnderstand: Boolean
definition: ExtensionDefinition
ExtensionDefinitionname:String
extensionAttributeDefinitions:一对多,ExtensionAttributeDefinition
ExtensionAttributeDefinitionname:String
type:String
isReference:Boolean
extensionDefinition:ExtensionDefinition
ExtensionElementsvalueRef:Element
values:一对多,Element
extensionAttributeDefinition:ExtensionAttributeDefinition
DocumentationBaseElementtext:String
textFormat:String
……

当无需撤回操作支持的时候,可以使用如下方式写入属性:

var moddle = bpmnJS.get('moddle');var newCondition = moddle.create('bpmn:FormalExpression', {body: '${ value > 100 }'
});// write property, no undo support
sequenceFlow.conditionExpression = newCondition;

为了获得undo/redo支持,我们需要通过modeling来获取更新属性:

var modeling = bpmnJS.get('modeling');modeling.updateProperties(sequenceFlowElement, {conditionExpression: newCondition
});

无论通过如上哪种方式更新,其最终都会将其生成xml文件进行保存。

测试示例

如下为截取官网的一个测试设置的Demo示例供参考,示例代码如下:

import {bootstrapModeler,inject
} from '../TestHelper';import coreModule from 'bpmn-js/lib/core';
import modelingModule from 'bpmn-js/lib/features/modeling';describe('bpmn properties', function() {var testModules = [coreModule,modelingModule];var diagramXML = require('./diagram.bpmn');beforeEach(bootstrapModeler(diagramXML, {modules: testModules}));describe('read properties', function() {it('should read name', inject(function(elementRegistry) {// givenvar sequenceFlowElement = elementRegistry.get('SequenceFlow_1'),sequenceFlow = sequenceFlowElement.businessObject;// whenvar name = sequenceFlow.name;// thenexpect(name).to.eql('FOO > BAR?');}));it('should read conditionExpression', inject(function(elementRegistry) {// givenvar sequenceFlowElement = elementRegistry.get('SequenceFlow_1'),sequenceFlow = sequenceFlowElement.businessObject;// whenvar condition = sequenceFlow.conditionExpression;// thenexpect(condition.body).to.eql('${foo > bar}');}));});describe('write properties', function() {it('should write conditionExpression', inject(function(elementRegistry, moddle, modeling) {// givenvar sequenceFlowElement = elementRegistry.get('SequenceFlow_2'),sequenceFlow = sequenceFlowElement.businessObject;var newCondition = moddle.create('bpmn:FormalExpression', {body: '${ value > 100 }'});// assumeexpect(sequenceFlow.conditionExpression).not.to.exist;// whenmodeling.updateProperties(sequenceFlowElement, {conditionExpression: newCondition});// thenexpect(sequenceFlow.conditionExpression).to.equal(newCondition);}));it('should undo write conditionExpression', inject(function(elementRegistry, moddle, modeling, commandStack) {// givenvar sequenceFlowElement = elementRegistry.get('SequenceFlow_2'),sequenceFlow = sequenceFlowElement.businessObject;var newCondition = moddle.create('bpmn:FormalExpression', {body: '${ value > 100 }'});modeling.updateProperties(sequenceFlowElement, {conditionExpression: newCondition});// whencommandStack.undo();// thenexpect(sequenceFlow.conditionExpression).not.to.exist;}));});});

示例生成的xml数据如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vendor="http://vendor" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"><bpmn:outgoing>SequenceFlow_1</bpmn:outgoing></bpmn:startEvent><bpmn:task id="Task_1"><bpmn:incoming>SequenceFlow_1</bpmn:incoming><bpmn:outgoing>SequenceFlow_2</bpmn:outgoing></bpmn:task><bpmn:sequenceFlow id="SequenceFlow_1" sourceRef="StartEvent_1" targetRef="Task_1" name="FOO &gt; BAR?"><bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${foo > bar}]]></bpmn:conditionExpression></bpmn:sequenceFlow><bpmn:endEvent id="EndEvent_1"><bpmn:incoming>SequenceFlow_2</bpmn:incoming></bpmn:endEvent><bpmn:sequenceFlow id="SequenceFlow_2" sourceRef="Task_1" targetRef="EndEvent_1" /></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds x="173" y="102" width="36" height="36" /></bpmndi:BPMNShape><bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1"><dc:Bounds x="319" y="80" width="100" height="80" /></bpmndi:BPMNShape><bpmndi:BPMNEdge id="SequenceFlow_1_di" bpmnElement="SequenceFlow_1"><di:waypoint xsi:type="dc:Point" x="209" y="120" /><di:waypoint xsi:type="dc:Point" x="319" y="120" /><bpmndi:BPMNLabel><dc:Bounds x="219" y="110" width="90" height="20" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge><bpmndi:BPMNShape id="EndEvent_1_di" bpmnElement="EndEvent_1"><dc:Bounds x="531" y="102" width="36" height="36" /><bpmndi:BPMNLabel><dc:Bounds x="504" y="138" width="90" height="20" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNEdge id="SequenceFlow_2_di" bpmnElement="SequenceFlow_2"><di:waypoint xsi:type="dc:Point" x="419" y="120" /><di:waypoint xsi:type="dc:Point" x="531" y="120" /><bpmndi:BPMNLabel><dc:Bounds x="430" y="110" width="90" height="20" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge></bpmndi:BPMNPlane></bpmndi:BPMNDiagram>
</bpmn:definitions>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/687678.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

如何减少HTTP请求次数

资料来源 : 小林coding 小林官方网站 : 小林coding (xiaolincoding.com) 如何减少HTTP请求次数? 减少 HTTP 请求次数自然也就提升了 HTTP 性能&#xff0c;可以从这 3 个方面入手: 减少重定向请求次数合并请求延迟发送请求 减少重定向请求次数 我们先来看看什么是重定向请…

美相关 APT 组织分析报告

获取方式&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/1AsysdggUIbvB3PZ41MaJaQ?pwd8euh 提取码&#xff1a;8euh

Debug Monitor中断详细解析

文章目录 0 基本术语1 相关寄存器和指令1.1 Debug Halting Control and Status Register (DHCSR), 0xE000EDF01.2 Debug Exception and Monitor Control Register (DEMCR), 0xE000EDFC1.3 Debug Fault Status Register, DFSR, 0xE000ED301.4 BKPT指令 2 Debug Monitor中断示例2…

解读OpenAI视频生成模型Sora背后的原理:Diffusion Transformer

Diffusion Models视频生成-博客汇总 前言&#xff1a;OpenAI最近推出的视频生成模型Sora在效果上实现了真正的遥遥领先&#xff0c;很多博主都介绍过Sora&#xff0c;但是深入解读背后原理的博客却非常少。Sora的原理最主要的是核心模型主干《Scalable Diffusion Models with T…

Code Composer Studio (CCS) - Breakpoint (断点)

Code Composer Studio [CCS] - Breakpoint [断点] 1. BreakpointReferences 1. Breakpoint 选中断点右键 -> Breakpoint Properties… Skip Count&#xff1a;跳过断点总数&#xff0c;在断点执行之前设置总数 Current Count&#xff1a;当前跳过断电累计值 References […

CCF编程能力等级认证GESP—C++7级—20231209

CCF编程能力等级认证GESP—C7级—20231209 单选题&#xff08;每题 2 分&#xff0c;共 30 分&#xff09;判断题&#xff08;每题 2 分&#xff0c;共 20 分&#xff09;编程题 (每题 25 分&#xff0c;共 50 分)商品交易纸牌游戏 答案及解析单选题判断题编程题1编程题2 单选题…

Vue实现多个input输入,光标自动聚焦到下一个input

遇到一个需求&#xff0c;需要实现和移动端短信输入一样&#xff0c;输入内容后&#xff0c;光标会进入下一个输入框 需要用到2个事件 keydown事件发生在键盘的键被按下的时候 keyup 事件在按键被释放的时候触发 <template><div class"box"><el-fo…

OpenAI重磅发布Sora——首个视频生成模型:利用文本-视频人工智能将想象变为现实

想象一下&#xff0c;现在你有一段文本话描述的故事&#xff0c;通过输入这段文本&#xff0c;就可以立刻展开一个生动详细的视频。这就是 OpenAI 神奇的 Sora&#xff0c;一个革命性的文本到视频的 AI 模型。Sora于2024年2月推出&#xff0c;凭借其仅凭文字提示就能生成现实和…

CSS 不同颜色的小圆角方块组成的旋转加载动画

<template><!-- 创建一个装载自定义旋转加载动画的容器 --><view class="spinner"><!-- 定义外部包裹容器,用于实现整体旋转动画 --><view class="outer"><!-- 定义四个内部小方块以形成十字形结构 --><view clas…

攻防演练后的一点随记

攻防演练 攻防演练算是告一段落了&#xff0c;各位红队和蓝队的兄弟们都辛苦了&#xff0c;写一点随记&#xff0c;供大家参考。 记得第一次参加攻防演练是在2018年&#xff0c;当时被派到北京&#xff0c;在某个政企单位做攻防演练支撑工作&#xff0c;然后2020年又被紧急派到…

Vue首屏优化,12个提速建议

文章目录 代码拆分和懒加载&#xff1a;代码拆分懒加载 图片优化&#xff1a;组件懒渲染&#xff1a;数据预获取和缓存&#xff1a;服务器端渲染&#xff08;SSR&#xff09;&#xff1a;代码压缩和合并&#xff1a;使用 CDN 加速&#xff1a;监控和性能分析&#xff1a;代码优…

AIGC实战——能量模型(Energy-Based Model)

AIGC实战——能量模型 0. 前言1. 能量模型1.1 模型原理1.2 MNIST 数据集1.3 能量函数 2. 使用 Langevin 动力学进行采样2.1 随机梯度 Langevin 动力学2.2 实现 Langevin 采样函数 3. 利用对比散度训练小结系列链接 0. 前言 能量模型 (Energy-based Model, EBM) 是一类常见的生…

c++开发基础之保障多线程编程中的原子操作InterlockedIncrement和InterlockedDecrement用法详解

一、介绍 在多线程编程中&#xff0c;确保对共享变量进行原子操作是至关重要的。当多个线程同时访问和修改同一共享资源时&#xff0c;如果没有合适的同步机制&#xff0c;可能会导致数据竞争、内存一致性问题&#xff0c;甚至造成程序崩溃。为了解决这个问题&#xff0c;C提供…

公众号,h5 链接直接在浏览器打开 拒绝下载视频解决方案

公众号&#xff0c;h5 链接直接在浏览器打开 拒绝下载视频 1.微信打开公众号 2.在微信上打开浏览器 3.F12打开页面 4.播放视频 5.找到video标签代码 6.去掉video标签的属性controlslist“nodownload” 7.全屏播放 8.下载

【个人博客搭建】butterfly主题配置

目录 一、基础配置 (一) 模板配置 1. 文章模板 2. 页面模板 (二) 创建页面和文章 1. 标签页【可选】 2. 分类页【可选】 3. 友链页【可选】 4. 404页面【可选】 5. 文章 (三) 导航栏设置 1. 基础项 2. 菜单项 (四) 页面设置 1. 代码框设置 2. 社交图标设置 3.…

win10下wsl2使用记录(系统迁移到D盘、配置国内源、安装conda环境、配置pip源、安装pytorch-gpu环境、安装paddle-gpu环境)

wsl2 安装好后环境测试效果如下&#xff0c;支持命令nvidia-smi&#xff0c;不支持命令nvcc&#xff0c;usr/local目录下没有cuda文件夹。 系统迁移到非C盘 wsl安装的系统默认在c盘&#xff0c;为节省c盘空间进行迁移。 1、输出wsl -l 查看要迁移的系统名称 2、执行导出命…

JDK8 升级至JDK19

优质博文IT-BLOG-CN 目前部分项目使用JDK8&#xff0c;部分项目使用JDK19因此&#xff0c;环境变量中还是保持JDK8&#xff0c;只需要下载JDK19免安装版本&#xff0c;通过配置IDEA就可以完成本地开发。 一、IDEA 环境设置 【1】通过快捷键CTRL SHIFT ALT S或者File->P…

如何免费访问和使用Gemini API?

Gemini是谷歌开发的一个新模型。有了Gemini可以为查询提供图像、音频和文本&#xff0c;获得几乎完美的答案。 我们在本教程中将学习Gemini API以及如何在机器上设置它。我们还将探究各种Python API函数&#xff0c;包括文本生成和图像理解。 Gemini AI模型介绍 Gemini是谷歌…

两种方法判断Python的位数是32位还是64位

Python从1991年发布以来&#xff0c;凭借其简洁、清晰、易读的语法、丰富的标准库和第三方工具&#xff0c;在Web开发、自动化测试、人工智能、图形识别、机器学习等领域发展迅猛。     Python是一种胶水语言&#xff0c;通过Cython库与C/C语言进行链接&#xff0c;通过Jytho…

[Java][算法 滑动窗口]Day 03---LeetCode 热题 100---08~09

第一题 无重复字符串的最长子串 思路 其实就是在字符串S中 找到没有重复的最长子串的长度 这道题的难点就是在于如何判断最长并且无重复 首先 最长长度 可以使用变量max记录保存 再者 判断有无重复 最简单的方法就是 暴力遍历法 即对于每次找的子串都再次寻找遍历…