本文整理匯總了Java中org.pentaho.di.repository.ObjectId.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectId.equals方法的具體用法?Java ObjectId.equals怎麽用?Java ObjectId.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.pentaho.di.repository.ObjectId
的用法示例。
在下文中一共展示了ObjectId.equals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: equals
import org.pentaho.di.repository.ObjectId; //導入方法依賴的package包/類
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
UIRepositoryDirectory other = (UIRepositoryDirectory) obj;
ObjectId id = getObjectId();
ObjectId otherId = other.getObjectId();
if (id == null) {
if (otherId != null)
return false;
} else if (!id.equals(otherId))
return false;
return true;
}
示例2: renameDirectory
import org.pentaho.di.repository.ObjectId; //導入方法依賴的package包/類
/**
* Move / rename a directory in the repository
*
* @param id_directory Id of the directory to be moved/renamed
* @param id_directory_parent Id of the new parent directory (null if the parent does not change)
* @param newName New name for this directory (null if the name does not change)
* @throws KettleException
*/
public synchronized void renameDirectory(ObjectId id_directory, ObjectId id_directory_parent, String newName)
throws KettleException {
if (id_directory.equals(id_directory_parent)) {
// Make sure the directory cannot become its own parent
throw new KettleException("Failed to copy directory into itself");
} else {
// Make sure the directory does not become a descendant of itself
RepositoryDirectory rd = new RepositoryDirectory();
loadRepositoryDirectory(rd, id_directory);
if (rd.findDirectory(id_directory_parent) != null) {
// The parent directory is a child of this directory. Do not proceed
throw new KettleException("Directory cannot become a child to itself");
} else {
// Check for duplication
RepositoryDirectory newParent = new RepositoryDirectory();
loadRepositoryDirectory(newParent, id_directory_parent);
RepositoryDirectory child = newParent.findChild(newName == null ? rd.getName() : newName);
if (child != null) {
throw new KettleException("Destination directory already contains a diectory with requested name");
}
}
}
if (id_directory_parent != null || newName != null) {
RowMetaAndData r = new RowMetaAndData();
String sql = "UPDATE " + quoteTable(KettleDatabaseRepository.TABLE_R_DIRECTORY) + " SET ";
boolean additionalParameter = false;
if (newName != null) {
additionalParameter = true;
sql += quote(KettleDatabaseRepository.FIELD_DIRECTORY_DIRECTORY_NAME) + " = ?";
r.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_DIRECTORY_DIRECTORY_NAME,
ValueMetaInterface.TYPE_STRING), newName);
}
if (id_directory_parent != null) {
// Add a parameter separator if the first parm was added
if (additionalParameter) {
sql += ", ";
}
sql += quote(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY_PARENT) + " = ?";
r.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY_PARENT,
ValueMetaInterface.TYPE_INTEGER), id_directory_parent);
}
sql += " WHERE " + quote(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY) + " = ? ";
r.addValue(new ValueMeta("id_directory", ValueMetaInterface.TYPE_INTEGER), Long.valueOf(id_directory.toString()));
repository.connectionDelegate.getDatabase().execStatement(sql, r.getRowMeta(), r.getData());
}
}
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:60,代碼來源:KettleDatabaseRepositoryDirectoryDelegate.java