/* * @see org.teiid.query.metadata.QueryMetadataInterface#getExtensionProperties(java.lang.Object) */ @Override public Properties getExtensionProperties(Object metadataID) { CoreArgCheck.isInstanceOf(MetadataRecord.class, metadataID); MetadataRecord metadataRecord = (MetadataRecord) metadataID; String uuid = metadataRecord.getUUID(); EObject eObj = lookupEObject(uuid); Properties extProps = new Properties(); // Create get annotation for the EObject and lookup properties if (eObj != null && eObj.eResource() != null && eObj.eResource() instanceof EmfResource) { EmfResource emfResource = (EmfResource) eObj.eResource(); ModelContents contents = new ModelContents(emfResource); Annotation annotation = contents.getAnnotation(eObj); if (annotation != null) { Iterator entryIter = annotation.getTags().entrySet().iterator(); while (entryIter.hasNext()) { Map.Entry entry = (Map.Entry) entryIter.next(); extProps.setProperty((String) entry.getKey(), (String) entry.getValue()); } } } return extProps; }
/** * @see * org.teiid.designer.core.metamodel.aspect.sql.SqlTableAspect#isSystem(org.eclipse.emf.ecore.EObject) */ @Override public boolean isSystem(EObject eObject) { CoreArgCheck.isInstanceOf(InputSet.class, eObject); String modelName = getModelName(eObject); if (modelName != null && SystemVdbUtility.isSystemModelWithSystemTableType(modelName)) { return true; } return false; }
/** * @see * org.teiid.designer.core.metamodel.aspect.sql.SqlTableAspect#canBeTransformationSource(org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.EObject) * @since 4.3 */ @Override public boolean canBeTransformationSource(EObject source, EObject target) { CoreArgCheck.isInstanceOf(InputSet.class, source); CoreArgCheck.isNotNull(target); if (target instanceof MappingClass && !(target instanceof StagingTable)) { return true; } return false; }
/** * @see * org.teiid.designer.core.validation.ObjectValidationRule#validate(org.eclipse.emf.ecore.EObject, * org.teiid.designer.core.validation.ValidationContext) * @since 4.2 */ public void validate(EObject eObject, ValidationContext context) { CoreArgCheck.isInstanceOf(XClass.class, eObject); final XClass xclass = (XClass) eObject; // Make sure the name is set ... final String name = xclass.getName(); if (name == null || name.trim().length() == 0) { final ValidationResult result = new ValidationResultImpl(xclass); final String msg = ModelerCore.Util.getString("XClassNameRule.MissingName"); // $NON-NLS-1$ final ValidationProblem problem = new ValidationProblemImpl(0, IStatus.ERROR, msg); result.addProblem(problem); context.addResult(result); return; } }
/** * @see * org.teiid.designer.core.validation.ObjectValidationRule#validate(org.eclipse.emf.ecore.EObject, * org.teiid.designer.core.validation.ValidationContext) * @since 4.2 */ @Override public void validate(final EObject eObject, final ValidationContext context) { CoreArgCheck.isNotNull(context); CoreArgCheck.isInstanceOf(ModelAnnotation.class, eObject); final ModelEditor editor = ModelerCore.getModelEditor(); String uuidString = ModelerCore.getObjectIdString(eObject); if (uuidString == null) { final String pathInModel = editor.getModelRelativePathIncludingModel(eObject).toString(); final ValidationResult result = new ValidationResultImpl(eObject); // create validation problem and add it to the result final ValidationProblem problem = new ValidationProblemImpl( 0, IStatus.ERROR, ModelerCore.Util.getString("ModelAnnotationUuidRule.0", pathInModel)); // $NON-NLS-1$ result.addProblem(problem); context.addResult(result); } else { boolean isDuplicate = context.containsUuid(uuidString); if (isDuplicate) { final String pathInModel = editor.getModelRelativePathIncludingModel(eObject).toString(); final ValidationResult result = new ValidationResultImpl(eObject); String modelName = editor.getModelName(eObject); // create validation problem and addit to the result final ValidationProblem problem = new ValidationProblemImpl( 0, IStatus.ERROR, ModelerCore.Util.getString( "ModelAnnotationUuidRule.1", pathInModel, uuidString, modelName)); //$NON-NLS-1$ result.addProblem(problem); context.addResult(result); } else { context.addUuidToContext(uuidString); } } }
/** * Return the first part of the UUID as a long. * * @return first part of the UUID as a long */ public static long getPart2(ObjectID id) { CoreArgCheck.isInstanceOf(UUID.class, id, UNPARSABLE_MESSAGE); UUID uuid = (UUID) id; return uuid.uuid.getLeastSignificantBits(); }
public static int getVersion(ObjectID id) { CoreArgCheck.isInstanceOf(UUID.class, id, NOT_UUID_MESSAGE); UUID uuid = (UUID) id; return uuid.uuid.version(); }
/** * @see * org.teiid.designer.core.metamodel.aspect.sql.SqlAspect#getName(org.eclipse.emf.ecore.EObject) */ @Override public String getName(EObject eObject) { CoreArgCheck.isInstanceOf(InputSet.class, eObject); return INPUT_SET_FULL_NAME; }
/** * @see * org.teiid.designer.core.metamodel.aspect.sql.SqlTableAspect#canAcceptTransformationSource(org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.EObject) * @since 4.3 */ @Override public boolean canAcceptTransformationSource(EObject target, EObject source) { CoreArgCheck.isInstanceOf(InputSet.class, target); CoreArgCheck.isNotNull(source); return false; }
/* * @See org.teiid.designer.core.metamodel.aspect.sql.SqlTableAspect#getTableType(org.eclipse.emf.ecore.EObject) */ @Override public int getTableType(EObject eObject) { CoreArgCheck.isInstanceOf(InputSet.class, eObject); return MetadataConstants.TABLE_TYPES.XML_MAPPING_CLASS_TYPE; }
/** * @see * org.teiid.designer.core.metamodel.aspect.sql.SqlTableAspect#getColumns(org.eclipse.emf.ecore.EObject) */ @Override public List getColumns(EObject eObject) { CoreArgCheck.isInstanceOf(InputSet.class, eObject); InputSet inputSet = (InputSet) eObject; return inputSet.getInputParameters(); }