Hi YvanLussaud,
I also want to create logical components by p4c, and I used the following code,
java_part = create_e_object_from(get_e_classifier("http://www.polarsys.org/capella/core/cs/" + capella_version(), "Part"))
java_part.setType(lc.get_java_object())
lc_pkg.get_java_object().getOwnedParts().add(java_part)
but Capella reported an error, like this
raise Py4JError(
py4j.protocol.Py4JError: An error occurred while calling o46.setType. Trace:
py4j.Py4JException: Method setType([class org.polarsys.capella.core.data.la.impl.LogicalComponentImpl]) does not exist
I used the following code to check the methods of “java_part”, but I cannot find “setType”.
print(dir(java_part))
output:
['basicGetAbstractType', 'basicGetAssociation', 'basicGetOwnedAbstractType',
'basicGetStatus', 'basicGetType', 'basicSetOwnedAbstractType',
'basicSetOwnedDefaultValue', 'basicSetOwnedMaxCard',
'basicSetOwnedMaxLength', 'basicSetOwnedMaxValue',
'basicSetOwnedMinCard', 'basicSetOwnedMinLength', 'basicSetOwnedMinValue',
'basicSetOwnedNullValue',
'destroy', 'eAdapters', 'eAllContents', 'eBaseStructuralFeatureID',
'eBasicRemoveFromContainer', 'eBasicRemoveFromContainerFeature',
'eBasicSetContainer', 'eClass', 'eContainer', 'eContainerFeatureID',
'eContainingFeature', 'eContainmentFeature', 'eContains', 'eContents',
'eCrossReferences', 'eDeliver', 'eDerivedOperationID',
'eDerivedStructuralFeatureID', 'eDirectResource',
'eDynamicBasicRemoveFromContainer', 'eDynamicGet',
'eDynamicInverseAdd', 'eDynamicInverseRemove', 'eDynamicInvoke',
'eDynamicIsSet', 'eDynamicSet', 'eDynamicUnset', 'eGet', 'eInternalContainer',
'eInternalResource', 'eInverseAdd', 'eInverseRemove', 'eInvoke', 'eIsProxy',
'eIsSet', 'eNotificationRequired', 'eNotify', 'eObjectForURIFragmentSegment',
'eOpenGet', 'eOpenIsSet', 'eOpenSet', 'eOpenUnset', 'eProxyURI',
'eResolveProxy', 'eResource', 'eSet', 'eSetClass', 'eSetDeliver',
'eSetProxyURI', 'eSetResource', 'eSetStore', 'eSetting', 'eStore',
'eURIFragmentSegment', 'eUnset', 'eVirtualGet', 'eVirtualIsSet',
'eVirtualSet', 'eVirtualUnset', 'equals', 'getAbstractType', 'getAggregationKind', 'getAppliedPropertyValueGroups', 'getAppliedPropertyValues',
'getAppliedRequirements', 'getAssociation', 'getClass', 'getConstraints',
'getDeployedParts', 'getDeployingLinks', 'getDeployingParts', 'getDeploymentLinks',
'getDescription', 'getFeatures', 'getFullLabel', 'getId', 'getIncomingInformationFlows', 'getIncomingTraces', 'getInformationFlows', 'getInvolvingInvolvements', 'getLabel', 'getName', 'getOutgoingInformationFlows',
'getOutgoingTraces', 'getOwnedAbstractType', 'getOwnedConstraints',
'getOwnedDefaultValue', 'getOwnedDeploymentLinks', 'getOwnedEnumerationPropertyTypes',
'getOwnedExtensions', 'getOwnedMaxCard', 'getOwnedMaxLength',
'getOwnedMaxValue', 'getOwnedMigratedElements', 'getOwnedMinCard',
'getOwnedMinLength',
'getOwnedMinValue', 'getOwnedNullValue', 'getOwnedPropertyValueGroups', 'getOwnedPropertyValues', 'getProvidedInterfaces', 'getRepresentingInstanceRoles', 'getRequiredInterfaces',
'getReview', 'getSid', 'getStatus', 'getSummary', 'getType', 'getVisibility',
'hasUnnamedLabel', 'hashCode', 'isFinal', 'isIsAbstract', 'isIsDerived',
'isIsPartOfKey', 'isIsReadOnly', 'isIsStatic',
'isMaxInclusive', 'isMinInclusive', 'isOrdered', 'isUnique', 'isVisibleInDoc',
'isVisibleInLM', 'notify', 'notifyAll', 'setAbstractType', 'setAggregationKind',
'setDescription', 'setFinal',
'setId', 'setIsAbstract', 'setIsDerived', 'setIsPartOfKey', 'setIsReadOnly',
'setIsStatic', 'setMaxInclusive', 'setMinInclusive', 'setName', 'setOrdered',
'setOwnedAbstractType', 'setOwnedDefaultValue', 'setOwnedMaxCard',
'setOwnedMaxLength', 'setOwnedMaxValue',
'setOwnedMinCard', 'setOwnedMinLength', 'setOwnedMinValue',
'setOwnedNullValue', 'setReview', 'setSid', 'setStatus', 'setSummary',
'setUnique', 'setVisibility', 'setVisibleInDoc', 'setVisibleInLM', 'toString',
'wait']
Could you tell me which method is correct?