/** * Returns a ProcIdentifer based on the profilename and object name & type. * * @param databaseIdentifier * @param dbObjectType @see <code>ProcIdentifier</code> * @param map all other information such as procedural object name, owner, etc * @return a ProcIdentifer object * @since 1.5 */ public ProcIdentifier getProcIdentifier( DatabaseIdentifier databaseIdentifier, int dbObjectType, Map map) { return new ProcIdentifierImpl(dbObjectType, databaseIdentifier, map); }
public String toString() { return encode(); }
/** * @return */ public String getCallableString() { return getCallableString(true); }
public String getCallableString(boolean quoted_id) { String s = getCallableStringWithoutGroupNumber(quoted_id); int number = getNumber(); if (number > 0) { return s + ";" + number; } else { return s; } }
public boolean equals(Object obj) { if (obj instanceof ProcIdentifierImpl) { ProcIdentifierImpl p = (ProcIdentifierImpl) obj; boolean e = getDatabaseIdentifier().equals(p.getDatabaseIdentifier()) && (getType() == p.getType()) && propertyMap.equals(p.propertyMap); return e; } return false; }
public String getLongDisplayString() { String s = ""; if (getType() == TYPE_TRIGGER && getTableName() != null && getTableName().length() > 0) { String tableOwner = getTableOwnerName(); if (tableOwner == null) { tableOwner = getOwnerName(); } s = NLS.bind(Messages.ProcIdentifierImpl_trigger_long_display_string, new Object[]{getProfileName(), getDatabaseName(), tableOwner, getTableName(), getDisplayString()}); } else { s = NLS.bind(Messages.ProcIdentifierImpl_long_display_string, new Object[]{getProfileName(), getDatabaseName(), getOwnerName(), getDisplayString()}); } return s; }
public static ProcIdentifier decodeWithNewProfile(String encoded,String profile) throws ParseException Map map = decodeMap(encoded); map.remove(PROP_PROFILE); String dbname = (String) map.remove(PROP_DBNAME); return new ProcIdentifierImpl(type, new DatabaseIdentifier(profile, dbname), map);
public String getCallableStringWithoutGroupNumber() { return getCallableStringWithoutGroupNumber(true); }
public String encode() { // TODO: currently this method is hard coded. Need to be more extendable. StringBuffer buffer = new StringBuffer(); Map temp = new HashMap(); temp.put(PROP_PROFILE, _database.getProfileName()); temp.put(PROP_DBNAME, _database.getDBname()); temp.put(PROP_TYPE, String.valueOf(_type)); encodeMap(buffer, temp); encodeMap(buffer, propertyMap); return buffer.toString(); }
/** * This method should only be called when is not adhoc sql. * * @param configuration * @return null if fail to read the proc id. * @throws CoreException */ public static ProcIdentifier readProcIdentifier(ILaunchConfiguration configuration) throws CoreException { if (isAdHocSQL(configuration)) { return null; } String encoded = configuration.getAttribute(ROUTINE_LAUNCH_PROCID, ""); try { return ProcIdentifierImpl.decode(encoded); } catch (ParseException e) { return null; } }
""); ProcIdentifier procId = ProcIdentifierImpl .decodeWithNewProfile(encodedProc, profile .getName()); copy
/** * Returns whether the given object equals to this ProcIdentifier object. * If the profile names are different, the comparison will base on the * server url. * @param obj * @return */ public boolean equalsByServer(Object obj) { if (obj instanceof ProcIdentifierImpl) { ProcIdentifierImpl p = (ProcIdentifierImpl) obj; boolean e = getDatabaseIdentifier().equals(p.getDatabaseIdentifier()); if (! e) { ServerIdentifier si1 = ProfileUtil.getServerIdentifier(getDatabaseIdentifier()); ServerIdentifier si2 = ProfileUtil.getServerIdentifier(p.getDatabaseIdentifier()); e = si1.equals(si2); } e = e && (getType() == p.getType()) && propertyMap.equals(p.propertyMap); return e; } return false; }
public static ProcIdentifier decode(String encoded) throws ParseException { Map map = decodeMap(encoded); String profile = (String)map.remove(PROP_PROFILE); String dbname = (String) map.remove(PROP_DBNAME); String typestr = (String) map.remove(PROP_TYPE); if (profile == null || dbname == null || typestr == null) { throw new ParseException(Messages.ProcIdentifierImpl_invalid_identifier_string, -1); } try { int type = Integer.parseInt(typestr); SQLDevToolsConfiguration config = SQLToolsFacade.getConfigurationByProfileName(profile); if (config != null) { DBHelper h = config.getDBHelper(); return h.getProcIdentifier(new DatabaseIdentifier(profile, dbname), type, map); } return new ProcIdentifierImpl(type, new DatabaseIdentifier(profile, dbname), map); } catch(NumberFormatException ex) { throw new ParseException(Messages.ProcIdentifierImpl_invalid_identifier_string, -1); } }
return new ProcIdentifierImpl(dbObjectType, databaseIdentifier, map);