/** * @param dataMapping * @param allInMappings * @param maPath * @return */ private Path createDMSDataMapping( DataMapping dataMapping, List<Object> allInMappings, ManualActivityPath maPath) { if (ModelUtils.isDocumentType(getModel(), dataMapping)) // Document { if (!isWriteOnly(dataMapping, allInMappings)) { DocumentType documentType = org.eclipse.stardust.ui.web.viewscommon.utils.ModelUtils.getDocumentTypeFromData( getModel(), getModel().getData(dataMapping.getDataId())); if (documentType == null) { trace.debug( "Could not resolve type for Document:, " + dataMapping.getQualifiedId() + ". It may be set defualt by design"); } return new DocumentPath( maPath, dataMapping.getId(), documentType, null, Direction.IN == dataMapping.getDirection()); } else { trace.warn( "Skipping Data Mapping - Found it as Write Only - " + dataMapping.getId() + ":" + dataMapping.getName()); } } else if (ModelUtils.isFolderType(getModel(), dataMapping)) // Folder { // Skip, Not supported } else // Only Meta Data { Path docTypePath = null; Data documentData = getModel().getData(dataMapping.getDataId()); String metaDataTypeId = (String) documentData.getAttribute(DmsConstants.RESOURCE_METADATA_SCHEMA_ATT); if (StringUtils.isNotEmpty(metaDataTypeId)) { TypeDeclaration typeDeclaration = getModel().getTypeDeclaration(metaDataTypeId); Set<TypedXPath> allXPaths = StructuredTypeRtUtils.getAllXPaths(getModel(), typeDeclaration); for (TypedXPath path : allXPaths) { if ("properties".equals(dataMapping.getDataPath())) // Mapping to entire properties { if (null == path.getParentXPath()) { docTypePath = new XsdPath( maPath, path, dataMapping.getId(), Direction.IN == dataMapping.getDirection()); break; } } else if (dataMapping .getDataPath() .equals("properties/" + path.getXPath())) // Mapping to nested item in properties { docTypePath = new XsdPath( maPath, path, dataMapping.getId(), Direction.IN == dataMapping.getDirection()); break; } } } // if null means - Mapping to documenmt's attributes e.g. id, owner, etc if (null == docTypePath) { // This is the only possibility, but still check if (ModelUtils.isPrimitiveType(getModel(), dataMapping)) { docTypePath = createPrimitiveDataMapping(dataMapping, maPath); } } return docTypePath; } return null; }