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


Java Registry.bind方法代码示例

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


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

示例1: getReadSerializer

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private static Serializer getReadSerializer() throws Exception {
	if (readSerializer == null) {
	Log.d("hv", "Begin Creating Serializer");
       RegistryMatcher matcher = new RegistryMatcher();
       matcher.bind(Date.class, new DateFormatTransformer());

       Registry registry = new Registry();
       registry.bind(String.class, SimpleXMLStringConverter.class);
       Strategy strategy = new RegistryStrategy(registry);

       Serializer s = new Persister(strategy, matcher);
	Log.d("hv", "Done Creating Serializer");
	
	readSerializer = s;
	}
       return readSerializer;
}
 
开发者ID:Microsoft,项目名称:healthvault-java-sdk,代码行数:18,代码来源:XmlSerializer.java

示例2: importContacts

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void importContacts(File f) throws Exception {
	log.info("Private message folder import complete, starting user contacts import");
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);

	registry.bind(User.class, new UserConverter(userDao, userMap));

	List<UserContact> list = readList(serializer, f, "userContacts.xml", "usercontacts", UserContact.class);
	for (UserContact uc : list) {
		Long ucId = uc.getId();
		UserContact storedUC = userContactDao.get(ucId);

		if (storedUC == null && uc.getContact() != null && uc.getContact().getId() != null) {
			uc.setId(null);
			if (uc.getOwner() != null && uc.getOwner().getId() == null) {
				uc.setOwner(null);
			}
			uc = userContactDao.update(uc);
			userContactMap.put(ucId, uc.getId());
		}
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:24,代码来源:BackupImport.java

示例3: importRoomFiles

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void importRoomFiles(File f) throws Exception {
	log.info("Poll import complete, starting room files import");
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);

	registry.bind(BaseFileItem.class, new BaseFileItemConverter(fileItemDao, fileItemMap));

	List<RoomFile> list = readList(serializer, f, "roomFiles.xml", "RoomFiles", RoomFile.class, true);
	for (RoomFile rf : list) {
		Room r = roomDao.get(roomMap.get(rf.getRoomId()));
		if (r == null || rf.getFile() == null || rf.getFile().getId() == null) {
			continue;
		}
		if (r.getFiles() == null) {
			r.setFiles(new ArrayList<>());
		}
		rf.setId(null);
		rf.setRoomId(r.getId());
		r.getFiles().add(rf);
		roomDao.update(r, null);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:24,代码来源:BackupImport.java

示例4: importRoomGroups

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void importRoomGroups(File f) throws Exception {
	log.info("Room import complete, starting room groups import");
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);

	registry.bind(Group.class, new GroupConverter(groupDao, groupMap));
	registry.bind(Room.class, new RoomConverter(roomDao, roomMap));

	List<RoomGroup> list = readList(serializer, f, "rooms_organisation.xml", "room_organisations", RoomGroup.class);
	for (RoomGroup ro : list) {
		Room r = roomDao.get(ro.getRoom().getId());
		if (r == null || ro.getGroup() == null || ro.getGroup().getId() == null) {
			continue;
		}
		if (r.getGroups() == null) {
			r.setGroups(new ArrayList<>());
		}
		ro.setId(null);
		ro.setRoom(r);
		r.getGroups().add(ro);
		roomDao.update(r, null);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:25,代码来源:BackupImport.java

示例5: getSerializer

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private Serializer getSerializer() throws AETException {
  Registry registry = new Registry();
  Serializer serializer = new Persister(new RegistryStrategy(registry));
  try {
    registry.bind(Collect.class, new CollectConverter());
    registry.bind(Compare.class, new CompareConverter());
  } catch (Exception e) {
    throw new AETException("Error while serializing test suite.", e);
  }
  return serializer;
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:12,代码来源:XmlTestSuiteParser.java

示例6: importCalendars

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void importCalendars(File f) throws Exception {
	log.info("Chat messages import complete, starting calendar import");
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);
	registry.bind(User.class, new UserConverter(userDao, userMap));
	List<OmCalendar> list = readList(serializer, f, "calendars.xml", "calendars", OmCalendar.class, true);
	for (OmCalendar c : list) {
		Long id = c.getId();
		c.setId(null);
		c = calendarDao.update(c);
		calendarMap.put(id, c.getId());
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:15,代码来源:BackupImport.java

示例7: createSerializer

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
public Serializer createSerializer() {
    Registry registry = new Registry();

    try {
        registry.bind(Vector2.class, VectorConverter.class);
    } catch (Exception e) {
        throw new RuntimeException("Error binding converters!");
    }

    Strategy strategy = new RegistryStrategy(registry);
    return new Persister(strategy);
}
 
开发者ID:reloZid,项目名称:android-anuto,代码行数:13,代码来源:SerializerFactory.java

示例8: bindDate

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private static <T> void bindDate(Registry registry, List<T> list, Function<T, ?> func) throws Exception {
	if (list != null) {
		for (T e : list) {
			Object d = func.apply(e);
			if (d != null) {
				Class<?> dateClass = d.getClass();
				registry.bind(dateClass, DateConverter.class);
				break;
			}
		}
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:13,代码来源:BackupExport.java

示例9: importAppointments

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void importAppointments(File f) throws Exception {
	log.info("Calendar import complete, starting appointement import");
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);

	registry.bind(User.class, new UserConverter(userDao, userMap));
	registry.bind(Appointment.Reminder.class, AppointmentReminderTypeConverter.class);
	registry.bind(Room.class, new RoomConverter(roomDao, roomMap));
	registry.bind(Date.class, DateConverter.class);
	registry.bind(OmCalendar.class, new OmCalendarConverter(calendarDao, calendarMap));

	List<Appointment> list = readList(serializer, f, "appointements.xml", "appointments", Appointment.class);
	for (Appointment a : list) {
		Long appId = a.getId();

		// We need to reset this as openJPA reject to store them otherwise
		a.setId(null);
		if (a.getOwner() != null && a.getOwner().getId() == null) {
			a.setOwner(null);
		}
		if (a.getRoom() == null || a.getRoom().getId() == null) {
			log.warn("Appointment without room was found, skipping: {}", a);
			continue;
		}
		if (a.getStart() == null || a.getEnd() == null) {
			log.warn("Appointment without start/end time was found, skipping: {}", a);
			continue;
		}
		a = appointmentDao.update(a, null, false);
		appointmentMap.put(appId, a.getId());
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:34,代码来源:BackupImport.java

示例10: exportRoom

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void exportRoom(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);

	registry.bind(User.class, UserConverter.class);
	registry.bind(Room.Type.class, RoomTypeConverter.class);
	List<Room> list = roomDao.get();
	bindDate(registry, list);
	writeList(serializer, zos, "rooms.xml", "rooms", list);
	progressHolder.setProgress(15);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:13,代码来源:BackupExport.java

示例11: importFiles

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private List<FileItem> importFiles(File f) throws Exception {
	log.info("Private message import complete, starting file explorer item import");
	List<FileItem> result = new ArrayList<>();
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	RegistryMatcher matcher = new RegistryMatcher();
	Serializer ser = new Persister(strategy, matcher);

	matcher.bind(Long.class, LongTransform.class);
	matcher.bind(Integer.class, IntegerTransform.class);
	registry.bind(Date.class, DateConverter.class);
	List<FileItem> list = readList(ser, f, "fileExplorerItems.xml", "fileExplorerItems", FileItem.class);
	for (FileItem file : list) {
		Long fId = file.getId();
		// We need to reset this as openJPA reject to store them otherwise
		file.setId(null);
		Long roomId = file.getRoomId();
		file.setRoomId(roomMap.containsKey(roomId) ? roomMap.get(roomId) : null);
		if (file.getOwnerId() != null) {
			file.setOwnerId(userMap.get(file.getOwnerId()));
		}
		if (file.getParentId() != null && file.getParentId().longValue() <= 0L) {
			file.setParentId(null);
		}
		if (Strings.isEmpty(file.getHash())) {
			file.setHash(UUID.randomUUID().toString());
		}
		file = fileItemDao.update(file);
		result.add(file);
		fileItemMap.put(fId, file.getId());
	}
	return result;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:34,代码来源:BackupImport.java

示例12: exportRoomFile

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void exportRoomFile(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);

	registry.bind(FileItem.class, BaseFileItemConverter.class);
	registry.bind(Recording.class, BaseFileItemConverter.class);

	writeList(serializer, zos, "roomFiles.xml", "RoomFiles", roomDao.getFiles());
	progressHolder.setProgress(17);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:12,代码来源:BackupExport.java

示例13: importMeetingMembers

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void importMeetingMembers(File f) throws Exception {
	log.info("Appointement import complete, starting meeting members import");
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer ser = new Persister(strategy);

	registry.bind(User.class, new UserConverter(userDao, userMap));
	registry.bind(Appointment.class, new AppointmentConverter(appointmentDao, appointmentMap));
	List<MeetingMember> list = readList(ser, f, "meetingmembers.xml", "meetingmembers", MeetingMember.class);
	for (MeetingMember ma : list) {
		ma.setId(null);
		meetingMemberDao.update(ma);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:15,代码来源:BackupImport.java

示例14: exportAppointment

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void exportAppointment(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
	List<Appointment> list = appointmentDao.get();
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);

	registry.bind(User.class, UserConverter.class);
	registry.bind(Appointment.Reminder.class, AppointmentReminderTypeConverter.class);
	registry.bind(Room.class, RoomConverter.class);
	bindDate(registry, list);

	writeList(serializer, zos, "appointements.xml", "appointments", list);
	progressHolder.setProgress(25);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:15,代码来源:BackupExport.java

示例15: exportMeetingMember

import org.simpleframework.xml.convert.Registry; //导入方法依赖的package包/类
private void exportMeetingMember(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
	Registry registry = new Registry();
	Strategy strategy = new RegistryStrategy(registry);
	Serializer serializer = new Persister(strategy);

	registry.bind(User.class, UserConverter.class);
	registry.bind(Appointment.class, AppointmentConverter.class);

	writeList(serializer, zos, "meetingmembers.xml",
			"meetingmembers", meetingMemberDao.getMeetingMembers());
	progressHolder.setProgress(30);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:13,代码来源:BackupExport.java


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