if (obj == null)
{
if (part.isRequired())
{
throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
}
return null;
}
if (derivedPart instanceof CompositeMessagePart)
{
metaclass = (Metaclass)getSystemAttributeValue((CompositeMessagePart)derivedPart,
(TransferObject)obj, ObjectMessagePartMapping.ATTR_CLASS);
}
if (m_context.isSecure())
{
if (attribute != null)
{
attribute.checkReadAccess(m_context.getPrivilegeSet());
}
if (metaclass != null)
{
metaclass.checkReadAccess(m_context.getPrivilegeSet());
}
}
if (derivedPart instanceof PrimitiveMessagePart)
{
Object validatedValue = ((PrimitiveMessagePart)derivedPart).validateValue(obj);
if (attribute == null)
{
return validatedValue;
}
validatedValue = attribute.getType().convert(validatedValue);
int nMaxLength = attribute.getMaxLength();
if (nMaxLength > 0 && mapping.isTruncated())
{
if (validatedValue instanceof String)
{
String sValue = (String) validatedValue;
if (sValue.length() > nMaxLength)
{
validatedValue = sValue.substring(0, nMaxLength);
if (s_logger.isDebugEnabled())
{
s_logger.debug("Value of attribute " + attribute.getName()
+ " has been truncated to maximum allowed length " + nMaxLength
+ ". The original value is \"" + sValue + "\".");
}
}
}
else if (validatedValue instanceof Binary)
{
byte[] binaryValue = ((Binary) validatedValue).getData();
if (binaryValue.length > nMaxLength)
{
byte[] truncatedValue = new byte[nMaxLength];
System.arraycopy(binaryValue, 0, truncatedValue, 0, nMaxLength);
validatedValue = new Binary(truncatedValue);
if (s_logger.isDebugEnabled())
{
s_logger.debug("Value of attribute " + attribute.getName()
+ " has been truncated to maximum allowed length " + nMaxLength
+ ". The original value is \"" + binaryValue + "\".");
}
}
}
}
return validatedValue;
}
}
CompositeMessagePart composite = (CompositeMessagePart)derivedPart;
TransferObject tobj = (TransferObject)obj;
Instance instance = (Instance)m_instanceByTobjMap.get(tobj);
if (instance == null && "delete".equals(tobj.getEventName())) // Obsolete delete
{
if (part.isRequired())
{
throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
}
return null;
}