当前位置: 首页>>代码示例>>Java>>正文


Java ObjectContainer.delete方法代码示例

本文整理汇总了Java中com.db4o.ObjectContainer.delete方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectContainer.delete方法的具体用法?Java ObjectContainer.delete怎么用?Java ObjectContainer.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.db4o.ObjectContainer的用法示例。


在下文中一共展示了ObjectContainer.delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteStudent

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Delete student.
 *
 * @param studentID
 *            the student id
 * @param hostName
 *            the host name
 */
public static void deleteStudent(String studentID, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps != null)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(studentID))
				{
					db.delete(dbRep);
					break;
				}
			}
		}
	}
	finally
	{
		db.close();
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:32,代码来源:DatabaseActivity.java

示例2: moveStudent

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Move student.
 *
 * @param studentID
 *            the student id
 * @param newClass
 *            the new class
 * @param hostName
 *            the host name
 */
public static void moveStudent(String studentID, String newClass, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps.size() > 0)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(studentID))
				{
					dbRep.setClassname(newClass);
					db.delete(dbRep);
					db.store(dbRep);
					break;
				}
			}
		}
	}
	finally
	{
		db.close();
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:36,代码来源:DatabaseActivity.java

示例3: removeStudentsOfClass

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Removes the students of class.
 *
 * @param className
 *            the class name
 * @param hostName
 *            the host name
 */
public static void removeStudentsOfClass(String className, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps != null)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getClassName().equalsIgnoreCase(className))
				{
					db.delete(dbRep);
				}
			}
		}
	}
	finally
	{
		db.close();
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:31,代码来源:DatabaseActivity.java

示例4: clearSystem

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
public synchronized void clearSystem()
{
    ObjectContainer conn = createConnection();
    ObjectSet<CentralAuthority> systems = conn.query(CentralAuthority.class); // Change to the object you want to save
    CentralAuthority system;
    if (systems.size() == 0){
        system = ConfigureCentralAuthority.initialize();  // If there's no System in the record, create a new one
        
    }
    else{
        system = systems.get(0);
    }
    conn.delete(system);
    conn.close();
    
}
 
开发者ID:abhishek-nandgaonkar,项目名称:HealTech,代码行数:17,代码来源:DB4OUtil.java

示例5: put

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
@Override
public void put(final K key, V value) throws StorageOperationException {
	ObjectContainer db = Db4oEmbedded.openFile(getConfiguration(), source);
	ObjectSet<V> set = db.query(new Predicate<V>() {
		@Override
		public boolean match(V v) {
			if (key.match(v))
				return true;
			else
				return false;
		}
	});
	db.delete(set);
	db.store(value);
	db.close();
}
 
开发者ID:kboom,项目名称:setphrase,代码行数:17,代码来源:DB4oObjectStorage.java

示例6: delete

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
@Override
public void delete(ScriptableObject obj, String type) {
    //TODO delete by _id_
    ObjectContainer con = getDB(type);

    final HashMap<Object, Object> map = new HashMap<>();
    for (Object id : obj.getAllIds()) {
        map.put(id, obj.get(id));
    }
    ObjectSet<HashMap<Object, Object>> maps = con.query(new Predicate<HashMap<Object, Object>>() {
        @Override
        public boolean match(HashMap<Object, Object> et) {
            for (Object key : map.keySet()) {
                if (!(et.containsKey(key) && et.get(key).equals(map.get(key)))) {
                    return false;
                }
            }
            return true;
        }
    });
    while (maps.hasNext()) {
        con.delete(maps.next());
    }
    con.commit();
}
 
开发者ID:govu,项目名称:govu,代码行数:26,代码来源:DB4OProvider.java

示例7: modifyStudent

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Modify student.
 *
 * @param student
 *            the student
 * @param hostName
 *            the host name
 */
public static void modifyStudent(Student student, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps != null)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(student.getStudentID()))
				{
					ArrayList<GalleryItemDatabaseFormat> galleryItems = dbRep.getGalleryItems();
					db.delete(dbRep);
					StudentDatabaseFormat dbRepNew = studentTodb(student);
					for (GalleryItemDatabaseFormat galleryItem : galleryItems)
					{
						dbRepNew.addGalleryItem(galleryItem);
					}
					db.store(dbRepNew);
					break;
				}
			}
		}
	}
	finally
	{
		db.close();
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:39,代码来源:DatabaseActivity.java

示例8: updateStudentRep

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Update student rep.
 *
 * @param student
 *            the student
 * @param hostName
 *            the host name
 */
public static void updateStudentRep(final StudentRepresentation student, final String hostName)
{
	Thread cachingThread = new Thread(new Runnable()
	{
		@Override
		public void run()
		{
			ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
			try
			{
				List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);

				if (dbReps != null)
				{
					for (StudentDatabaseFormat dbRep : dbReps)
					{
						if (dbRep.getStudentID().equals(student.getStudentId()))
						{
							db.delete(dbRep);
							StudentDatabaseFormat dbRepToStore = studentRepTodb(student);
							db.store(dbRepToStore);
							break;
						}
					}
				}
			}
			finally
			{
				db.close();
			}
		}
	});
	cachingThread.start();
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:43,代码来源:DatabaseActivity.java

示例9: deleteObj

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
@Override
public void deleteObj(ScriptableObject obj, String type) {
    ObjectContainer con = getDB(type);

    final HashMap<Object, Object> map = new HashMap<>();
    for (Object id : obj.getAllIds()) {
        map.put(id, obj.get(id));
    }

    ObjectSet<HashMap<Object, Object>> maps = con.query(new Predicate<HashMap<Object, Object>>() {
        @Override
        public boolean match(HashMap<Object, Object> et) {
            for (Object key : map.keySet()) {
                if (!(et.containsKey(key) && et.get(key).equals(map.get(key)))) {
                    return false;
                }
            }
            return true;
        }
    });

    if (maps.hasNext()) {
        con.delete(maps.next());
        con.commit();
    }

}
 
开发者ID:govu,项目名称:govu,代码行数:28,代码来源:DB4OProvider.java


注:本文中的com.db4o.ObjectContainer.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。