private void setUUID(String prefix, AbstractMetadataRecord record) { // it is possible that metadata about UUID is already set. if (record.getUUID() != null && !record.getUUID().startsWith("tid:")) { return; } int lsb = 0; if (record.getParent() != null) { lsb = record.getParent().getUUID().hashCode(); } lsb = 31*lsb + record.getName().hashCode(); String uuid = prefix+"-"+MetadataFactory.hex(lsb, 8) + "-" + MetadataFactory.hex(this.count++, 8); //$NON-NLS-1$ //$NON-NLS-2$ record.setUUID(uuid); }
private void addCommonOptions(StringBuilder sb, AbstractMetadataRecord record) { if (record.isUUIDSet() && record.getUUID() != null && !record.getUUID().startsWith("tid:")) { //$NON-NLS-1$ addOption(sb, UUID, record.getUUID()); } if (record.getAnnotation() != null) { addOption(sb, ANNOTATION, record.getAnnotation()); } if (record.getNameInSource() != null) { addOption(sb, NAMEINSOURCE, record.getNameInSource()); } }
/** * WARNING - The name returned by this method may be ambiguous and * is not SQL safe - it may need quoted/escaped */ public String getFullName() { AbstractMetadataRecord parent = getParent(); if (parent != null) { String result = parent.getFullName() + NAME_DELIM_CHAR + getName(); return result; } return name; }
public String getName(AbstractMetadataRecord table) { if (table.getNameInSource() != null) { return table.getNameInSource(); } return table.getName(); } }
private static void removeCommonProperty(String key, AbstractMetadataRecord c) { if (key.equals(DDLConstants.UUID)) { c.setUUID(null); } else if (key.equals(DDLConstants.ANNOTATION)) { c.setAnnotation(null); } else if (key.equals(DDLConstants.NAMEINSOURCE)) { c.setNameInSource(null); } }
public MetadataRepository getMetadataRepository(AbstractMetadataRecord target, VDBMetaData vdb) { String modelName = null; while (target.getParent() != null) { target = target.getParent(); } modelName = target.getName(); if (modelName != null) { ModelMetaData model = vdb.getModel(modelName); if (model != null) { return model.getAttachment(MetadataRepository.class); } } return null; }
public String toString() { StringBuffer sb = new StringBuffer(100); sb.append(getClass().getSimpleName()); sb.append(" name="); //$NON-NLS-1$ sb.append(getName()); sb.append(", nameInSource="); //$NON-NLS-1$ sb.append(getNameInSource()); sb.append(", uuid="); //$NON-NLS-1$ sb.append(getUUID()); return sb.toString(); }
@Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; return metadataRecord.getName(); }
static Long getDataTtl(AbstractMetadataRecord record) { String value = record.getProperty(DataModifiable.DATA_TTL, false); if (value != null) { try { return Long.valueOf(value); } catch (NumberFormatException e) { if (LogManager.isMessageToBeRecorded(LogConstants.CTX_RUNTIME, MessageLevel.DETAIL)) { LogManager.logDetail(LogConstants.CTX_RUNTIME, "Invalid data ttl specified for ", record.getFullName()); //$NON-NLS-1$ } } } if (record.getParent() != null) { return getDataTtl(record.getParent()); } return null; }
String uuid = metadataRecord.getUUID(); metadataRecord.setAnnotation(this.annotationCache.get(uuid)); metadataRecord.setProperties(this.extensionCache.get(uuid));
final String parentObjectID) { record.setUUID(getObjectValue(objectID)); String parentName = fullName; if (fullName != null) { record.setName(name); record.setNameInSource(getObjectValue(nameInSource));
String generated = record.getProperty(GENERATED, false); if (generated != null && Boolean.valueOf(generated)) { continue; if (this.filter != null && !filter.matcher(record.getName()).matches()) { continue;
@Override protected void fillRow(AbstractMetadataRecord s, List<Object> rowBuffer) { rowBuffer.add(s.getUUID()); }
public Properties getExtensionProperties(final Object metadataID) throws TeiidComponentException, QueryMetadataException { AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) metadataID; Map<String, String> result = metadataRecord.getProperties(); if (result == null) { return EMPTY_PROPS; } Properties p = new Properties(); p.putAll(result); return p; }
private Boolean isAccessible(AbstractMetadataRecord record, CommandContext commandContext, PermissionType action) { Boolean result = commandContext.isAccessible(record); if (result != null) { return result; } HashSet<String> resources = new HashSet<String>(2); resources.add(record.getFullName()); return this.policyDecider.getInaccessibleResources(action, resources, Context.METADATA, commandContext).isEmpty(); }
public String getNameInSource(final Object metadataID) throws TeiidComponentException, QueryMetadataException { return ((AbstractMetadataRecord) metadataID).getNameInSource(); }
@Override public String getExtensionProperty(Object metadataID, String key, boolean checkUnqualified) { return ((AbstractMetadataRecord)metadataID).getProperty(key, checkUnqualified); }
public void getSQLString(StringBuilder sb) { AbstractMetadataRecord parent = getParent(); if (parent != null) { parent.getSQLString(sb); sb.append(NAME_DELIM_CHAR); } sb.append('"').append(StringUtil.replace(name, "\"", "\"\"")).append('"'); //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Get the name in source or the name if * the name in source is not set. * @return */ public static String getRecordName(AbstractMetadataRecord object) { return object.getSourceName(); }
public Object getModelID(final Object groupOrElementID) throws TeiidComponentException, QueryMetadataException { AbstractMetadataRecord metadataRecord = (AbstractMetadataRecord) groupOrElementID; AbstractMetadataRecord parent = metadataRecord.getParent(); if (parent instanceof Schema) { return parent; } if (parent == null) { throw createInvalidRecordTypeException(groupOrElementID); } parent = parent.getParent(); if (parent instanceof Schema) { return parent; } throw createInvalidRecordTypeException(groupOrElementID); }