Uploaded image for project: 'MidPoint'
  1. MidPoint
  2. MID-5912

Existing jpegPhoto cannot be replaced in strong Resource Inbound Mapping

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 4.0.1
    • 4.1
    • None
    • None
    • Active subscription
    • M2

    Description

      I am getting "Object <focus.getOid()> already contains photo" when I try to replace an existing jpegPhoto in an focal object (service)

       

      <attribute>
      	<c:ref>ri:photoData</c:ref>
      	<displayName>Badge Photo</displayName>
      	<tolerant>false</tolerant>
      	<exclusiveStrong>false</exclusiveStrong>
      	<inbound>
      		<name>Badge Photo Mapping</name>
      		<authoritative>true</authoritative>
      		<exclusive>false</exclusive>
      		<strength>strong</strength>
      		<expression>
      			<script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType">
      				<code>
      					return java.util.Base64.getDecoder().decode(input);
      				</code>
      			</script>
      		</expression>
      		<target>
      			<c:path>$focus/jpegPhoto</c:path>
      		</target>
      		<condition>
      			<script>
      				<code>input != null</code>
      			</script>
      		</condition>
      	</inbound>
      </attribute>
      

       

      Workaround: 

      1) return null from the above expression

      2) add a second inbound mapping:

      <inbound>
      	<name>Badge Photo Mapping 2</name>
      	<authoritative>true</authoritative>
      	<exclusive>false</exclusive>
      	<strength>strong</strength>
      	<expression>
      		<script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType">
      			<code>
      				return java.util.Base64.getDecoder().decode(input);
      			</code>
      		</script>
      	</expression>
      	<target>
      		<c:path>$focus/extension/photo</c:path>
      	</target>
      	<condition>
      		<script>
      			<code>input != null</code>
      		</script>
      	</condition>
      </inbound>
      

       3) Add inducement to relevant archetype containing a focusMapping

      	<inducement>
      		<focusMappings>
      			<mapping>
      				<name>extension/photo to jpegPhoto</name>
      				<strength>strong</strength>
      				<source>
      					<path>$focus/extension/photo</path>
      				</source>
      				<target>
      					<path>$focus/jpegPhoto</path>
      				</target>
      			</mapping>
      		</focusMappings>
      		<focusType>c:ServiceType</focusType>
      	</inducement>
      

       

      This re-uses the extension photo that was added because of: MID-5772

      First clearing the value in the mapping and then setting it in the archetype seems to work because of the Mapping Evaluation Order. But I would expect that jpegPhoto can be replaced with a strong mapping just like any other attribute (e.g. the extension/photo itself)

       

      Best regards,

      Martin

       

      Attachments

        Issue Links

          Activity

            People

              hoffm_ma Martin Hoffmann
              hoffm_ma Martin Hoffmann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: