List of usage examples for org.hibernate.id UUIDHexGenerator UUIDHexGenerator
public UUIDHexGenerator()
From source file:com.znsx.cms.service.impl.DeviceManagerImpl.java
public Dvr readDvrCells(Row row, int rowIndex, Organ organ, String standardNumber, List<Manufacturer> manufs, List<String> snList) { Dvr dvr = new Dvr(); VideoDeviceProperty property = new VideoDeviceProperty(); Cell cell = row.getCell(0);//from ww w. j a va2 s . c o m row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); dvr.setName(cell.getStringCellValue()); cell = row.getCell(1); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 2 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",subType is not null"); } else { Integer subType = 1; try { row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); subType = Integer.parseInt(cell.getStringCellValue()); } catch (NumberFormatException n) { n.printStackTrace(); throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 2 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",parameter subType[" + cell.getStringCellValue() + "] invalid !"); } dvr.setSubType("0" + subType); } cell = row.getCell(2); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",maxConnect is not null"); } else { Integer maxConnect = 10; try { row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); maxConnect = Integer.parseInt(cell.getStringCellValue()); if (maxConnect < 1 || maxConnect > 32) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",parameter maxConnect[" + cell.getStringCellValue() + "] invalid !"); } } catch (NumberFormatException n) { n.printStackTrace(); throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",parameter maxConnect[" + cell.getStringCellValue() + "] invalid !"); } dvr.setMaxConnect(maxConnect); } property.setHeartCycle(120); cell = row.getCell(3); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",channelAmount is not null"); } else { Integer channelAmount = 1; try { row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); channelAmount = Integer.parseInt(cell.getStringCellValue()); if (channelAmount < 1 || channelAmount > 1000) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",parameter channelAmount[" + cell.getStringCellValue() + "] invalid !"); } } catch (NumberFormatException n) { n.printStackTrace(); throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",parameter channelAmount[" + cell.getStringCellValue() + "] invalid !"); } dvr.setChannelAmount(channelAmount); } cell = row.getCell(4); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 5 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",userName is not null"); } else { row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); String userName = cell.getStringCellValue(); property.setUserName(userName); } cell = row.getCell(5); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 6 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",password is not null"); } else { row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); String password = cell.getStringCellValue(); property.setPassword(Base64Utils.getBASE64(password.getBytes())); } cell = row.getCell(6); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 7 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",manufacturer is not null"); } else { String manufacturerId = "1"; try { row.getCell(6).setCellType(Cell.CELL_TYPE_STRING); manufacturerId = cell.getStringCellValue(); } catch (NumberFormatException n) { n.printStackTrace(); throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 7 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",parameter manufacturer[" + cell.getStringCellValue() + "] invalid !"); } Manufacturer manuf = findManuf(manufs, manufacturerId, rowIndex, 7, 1); dvr.setManufacturer(manuf); } cell = row.getCell(7); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 8 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",ip is not null"); } else { row.getCell(7).setCellType(Cell.CELL_TYPE_STRING); if (!isIp(cell.getStringCellValue())) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 8 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",ip error"); } else { String lanIp = cell.getStringCellValue(); dvr.setLanIp(lanIp); } } cell = row.getCell(8); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 9 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",port is not null"); } else { Integer port = 8000; try { row.getCell(8).setCellType(Cell.CELL_TYPE_STRING); port = Integer.parseInt(cell.getStringCellValue()); } catch (NumberFormatException n) { n.printStackTrace(); throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 9 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",parameter port[" + cell.getStringCellValue() + "] invalid !"); } dvr.setPort(port + ""); } cell = row.getCell(9); if (cell != null) { row.getCell(9).setCellType(Cell.CELL_TYPE_STRING); } dvr.setLocation(cell == null ? " " : cell.getStringCellValue()); cell = row.getCell(10); if (cell != null) { row.getCell(10).setCellType(Cell.CELL_TYPE_STRING); } dvr.setNote(cell == null ? "" : cell.getStringCellValue()); cell = row.getCell(11); row.getCell(11).setCellType(Cell.CELL_TYPE_STRING); dvr.setLinkType(cell.getStringCellValue()); cell = row.getCell(12); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 12 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",ccs is not null"); } row.getCell(12).setCellType(Cell.CELL_TYPE_STRING); LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>(); params.put("standardNumber", cell.getStringCellValue()); dvr.setCcs(ccsDAO.findByPropertys(params).get(0)); cell = row.getCell(13); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 14 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",transport is not null"); } row.getCell(13).setCellType(Cell.CELL_TYPE_STRING); dvr.setTransport(cell.getStringCellValue()); cell = row.getCell(14); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 15 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",mode is not null"); } row.getCell(14).setCellType(Cell.CELL_TYPE_STRING); dvr.setMode(cell.getStringCellValue()); cell = row.getCell(15); if (cell == null) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 16 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",mode is not null"); } row.getCell(15).setCellType(Cell.CELL_TYPE_STRING); property.setDecode(cell.getStringCellValue()); property.setProtocol(cell.getStringCellValue()); cell = row.getCell(16); if (null != cell) { row.getCell(16).setCellType(Cell.CELL_TYPE_STRING); String cellSn = cell.getStringCellValue(); if (StringUtils.isNotBlank(cellSn)) { for (String sn : snList) { if (sn.equals(cell.getStringCellValue())) { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex:" + 17 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_ERROR + ",sn error"); } } dvr.setStandardNumber(cellSn); } else { dvr.setStandardNumber(standardNumber); } } else { dvr.setStandardNumber(standardNumber); } dvr.setOrgan(organ); dvr.setProperty(property); String id = (String) new UUIDHexGenerator().generate(null, null); dvr.setId(id); dvr.setType(TypeDefinition.DEVICE_TYPE_DVR); return dvr; }
From source file:com.znsx.cms.service.impl.TmDeviceManagerImpl.java
private FireDetector readFireDetector(Row row, int rowIndex) { FireDetector entity = new FireDetector(); Cell cell = row.getCell(0);/*w ww.j av a2 s . c om*/ if (cell != null) { row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); String name = row.getCell(0).getStringCellValue(); entity.setName(name); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 1 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",name is not null"); } cell = row.getCell(1); if (cell != null) { row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); String dasSn = row.getCell(1).getStringCellValue(); Das das = dasDAO.findBySN(dasSn); entity.setDas(das); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 2 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",dasSn is not null"); } cell = row.getCell(2); if (cell != null) { row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); String organSn = row.getCell(2).getStringCellValue(); Organ organf = organDAO.findBySN(organSn); entity.setOrgan(organf); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",organSn is not null"); } cell = row.getCell(3); if (cell != null) { row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); String sn = row.getCell(3).getStringCellValue(); entity.setStandardNumber(sn); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",sn is not null"); } cell = row.getCell(4); if (cell != null) { row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); String stakeNumber = row.getCell(4).getStringCellValue(); entity.setStakeNumber(stakeNumber); } cell = row.getCell(5); if (cell != null) { row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); String period = row.getCell(5).getStringCellValue(); entity.setPeriod(Integer.parseInt(period)); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 6 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",period is not null"); } cell = row.getCell(6); if (cell != null) { row.getCell(6).setCellType(Cell.CELL_TYPE_STRING); String navigation = row.getCell(6).getStringCellValue(); entity.setNavigation(navigation); } cell = row.getCell(7); if (cell != null) { row.getCell(7).setCellType(Cell.CELL_TYPE_STRING); String reserve = row.getCell(7).getStringCellValue(); entity.setReserve(reserve); } cell = row.getCell(8); if (cell != null) { row.getCell(8).setCellType(Cell.CELL_TYPE_STRING); String note = row.getCell(8).getStringCellValue(); entity.setNote(note); } cell = row.getCell(9); if (cell != null) { row.getCell(9).setCellType(Cell.CELL_TYPE_STRING); String ip = row.getCell(9).getStringCellValue(); entity.setIp(ip); } cell = row.getCell(10); if (cell != null) { row.getCell(10).setCellType(Cell.CELL_TYPE_STRING); String port = row.getCell(10).getStringCellValue(); entity.setPort(Integer.parseInt(port)); } cell = row.getCell(11); if (cell != null) { row.getCell(11).setCellType(Cell.CELL_TYPE_STRING); String latitude = row.getCell(11).getStringCellValue(); entity.setLatitude(latitude); } cell = row.getCell(12); if (cell != null) { row.getCell(12).setCellType(Cell.CELL_TYPE_STRING); String longitude = row.getCell(12).getStringCellValue(); entity.setLongitude(longitude); } String id = (String) new UUIDHexGenerator().generate(null, null); entity.setId(id); return entity; }
From source file:com.znsx.cms.service.impl.TmDeviceManagerImpl.java
private ControlDeviceLight readControlDeviceLightWb(Row row, int rowIndex) { ControlDeviceLight entity = new ControlDeviceLight(); Cell cell = row.getCell(0);//from ww w . j av a 2s .c om if (cell != null) { row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); String name = row.getCell(0).getStringCellValue(); entity.setName(name); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 1 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",name is not null"); } cell = row.getCell(1); if (cell != null) { row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); String dasSn = row.getCell(1).getStringCellValue(); Das das = dasDAO.findBySN(dasSn); entity.setDas(das); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 2 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",dasSn is not null"); } cell = row.getCell(2); if (cell != null) { row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); String organSn = row.getCell(2).getStringCellValue(); Organ organf = organDAO.findBySN(organSn); entity.setOrgan(organf); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",organSn is not null"); } cell = row.getCell(3); if (cell != null) { row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); String sn = row.getCell(3).getStringCellValue(); entity.setStandardNumber(sn); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",sn is not null"); } cell = row.getCell(4); if (cell != null) { row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); String stakeNumber = row.getCell(4).getStringCellValue(); entity.setStakeNumber(stakeNumber); } cell = row.getCell(5); if (cell != null) { row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); String period = row.getCell(5).getStringCellValue(); entity.setPeriod(Integer.parseInt(period)); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 6 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",period is not null"); } cell = row.getCell(6); if (cell != null) { row.getCell(6).setCellType(Cell.CELL_TYPE_STRING); String navigation = row.getCell(6).getStringCellValue(); entity.setNavigation(navigation); } cell = row.getCell(7); if (cell != null) { row.getCell(7).setCellType(Cell.CELL_TYPE_STRING); String reserve = row.getCell(7).getStringCellValue(); entity.setReserve(reserve); } cell = row.getCell(8); if (cell != null) { row.getCell(8).setCellType(Cell.CELL_TYPE_STRING); String note = row.getCell(8).getStringCellValue(); entity.setNote(note); } cell = row.getCell(9); if (cell != null) { row.getCell(9).setCellType(Cell.CELL_TYPE_STRING); String subType = row.getCell(9).getStringCellValue(); entity.setSubType(Short.parseShort(subType)); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 10 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",subType is not null"); } cell = row.getCell(10); if (cell != null) { row.getCell(10).setCellType(Cell.CELL_TYPE_STRING); String sectionType = row.getCell(10).getStringCellValue(); entity.setSectionType(Short.parseShort(sectionType)); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 11 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",sectionType is not null"); } cell = row.getCell(11); if (cell != null) { row.getCell(11).setCellType(Cell.CELL_TYPE_STRING); String ip = row.getCell(11).getStringCellValue(); entity.setIp(ip); } cell = row.getCell(12); if (cell != null) { row.getCell(12).setCellType(Cell.CELL_TYPE_STRING); String port = row.getCell(12).getStringCellValue(); entity.setPort(Integer.parseInt(port)); } cell = row.getCell(13); if (cell != null) { row.getCell(13).setCellType(Cell.CELL_TYPE_STRING); String latitude = row.getCell(13).getStringCellValue(); entity.setLatitude(latitude); } cell = row.getCell(14); if (cell != null) { row.getCell(14).setCellType(Cell.CELL_TYPE_STRING); String longitude = row.getCell(14).getStringCellValue(); entity.setLongitude(longitude); } String id = (String) new UUIDHexGenerator().generate(null, null); entity.setId(id); return entity; }
From source file:com.znsx.cms.service.impl.TmDeviceManagerImpl.java
private ControlDeviceWp readControlDeviceWp(Row row, int rowIndex) { ControlDeviceWp entity = new ControlDeviceWp(); Cell cell = row.getCell(0);/*from w w w .j av a 2s . co m*/ if (cell != null) { row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); String name = row.getCell(0).getStringCellValue(); entity.setName(name); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 1 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",name is not null"); } cell = row.getCell(1); if (cell != null) { row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); String dasSn = row.getCell(1).getStringCellValue(); Das das = dasDAO.findBySN(dasSn); entity.setDas(das); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 2 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",dasSn is not null"); } cell = row.getCell(2); if (cell != null) { row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); String organSn = row.getCell(2).getStringCellValue(); Organ organf = organDAO.findBySN(organSn); entity.setOrgan(organf); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",organSn is not null"); } cell = row.getCell(3); if (cell != null) { row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); String sn = row.getCell(3).getStringCellValue(); entity.setStandardNumber(sn); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",sn is not null"); } cell = row.getCell(4); if (cell != null) { row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); String stakeNumber = row.getCell(4).getStringCellValue(); entity.setStakeNumber(stakeNumber); } cell = row.getCell(5); if (cell != null) { row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); String period = row.getCell(5).getStringCellValue(); entity.setPeriod(Integer.parseInt(period)); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 6 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",period is not null"); } cell = row.getCell(6); if (cell != null) { row.getCell(6).setCellType(Cell.CELL_TYPE_STRING); String navigation = row.getCell(6).getStringCellValue(); entity.setNavigation(navigation); } cell = row.getCell(7); if (cell != null) { row.getCell(7).setCellType(Cell.CELL_TYPE_STRING); String reserve = row.getCell(7).getStringCellValue(); entity.setReserve(reserve); } cell = row.getCell(8); if (cell != null) { row.getCell(8).setCellType(Cell.CELL_TYPE_STRING); String note = row.getCell(8).getStringCellValue(); entity.setNote(note); } cell = row.getCell(9); if (cell != null) { row.getCell(9).setCellType(Cell.CELL_TYPE_STRING); String ip = row.getCell(9).getStringCellValue(); entity.setIp(ip); } cell = row.getCell(10); if (cell != null) { row.getCell(10).setCellType(Cell.CELL_TYPE_STRING); String port = row.getCell(10).getStringCellValue(); entity.setPort(Integer.parseInt(port)); } cell = row.getCell(11); if (cell != null) { row.getCell(11).setCellType(Cell.CELL_TYPE_STRING); String latitude = row.getCell(11).getStringCellValue(); entity.setLatitude(latitude); } cell = row.getCell(12); if (cell != null) { row.getCell(12).setCellType(Cell.CELL_TYPE_STRING); String longitude = row.getCell(12).getStringCellValue(); entity.setLongitude(longitude); } String id = (String) new UUIDHexGenerator().generate(null, null); entity.setId(id); return entity; }
From source file:com.znsx.cms.service.impl.TmDeviceManagerImpl.java
private PushButton readPushButtonWb(Row row, int rowIndex) { PushButton entity = new PushButton(); Cell cell = row.getCell(0);/*from www .j a v a2 s .c o m*/ if (cell != null) { row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); String name = row.getCell(0).getStringCellValue(); entity.setName(name); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 1 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",name is not null"); } cell = row.getCell(1); if (cell != null) { row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); String dasSn = row.getCell(1).getStringCellValue(); Das das = dasDAO.findBySN(dasSn); entity.setDas(das); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 2 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",dasSn is not null"); } cell = row.getCell(2); if (cell != null) { row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); String organSn = row.getCell(2).getStringCellValue(); Organ organf = organDAO.findBySN(organSn); entity.setOrgan(organf); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",organSn is not null"); } cell = row.getCell(3); if (cell != null) { row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); String sn = row.getCell(3).getStringCellValue(); entity.setStandardNumber(sn); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",sn is not null"); } cell = row.getCell(4); if (cell != null) { row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); String stakeNumber = row.getCell(4).getStringCellValue(); entity.setStakeNumber(stakeNumber); } cell = row.getCell(5); if (cell != null) { row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); String period = row.getCell(5).getStringCellValue(); entity.setPeriod(Integer.parseInt(period)); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 6 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",period is not null"); } cell = row.getCell(6); if (cell != null) { row.getCell(6).setCellType(Cell.CELL_TYPE_STRING); String navigation = row.getCell(6).getStringCellValue(); entity.setNavigation(navigation); } cell = row.getCell(7); if (cell != null) { row.getCell(7).setCellType(Cell.CELL_TYPE_STRING); String reserve = row.getCell(7).getStringCellValue(); entity.setReserve(reserve); } cell = row.getCell(8); if (cell != null) { row.getCell(8).setCellType(Cell.CELL_TYPE_STRING); String note = row.getCell(8).getStringCellValue(); entity.setNote(note); } cell = row.getCell(9); if (cell != null) { row.getCell(9).setCellType(Cell.CELL_TYPE_STRING); String ip = row.getCell(9).getStringCellValue(); entity.setIp(ip); } cell = row.getCell(10); if (cell != null) { row.getCell(10).setCellType(Cell.CELL_TYPE_STRING); String port = row.getCell(10).getStringCellValue(); entity.setPort(Integer.parseInt(port)); } cell = row.getCell(11); if (cell != null) { row.getCell(11).setCellType(Cell.CELL_TYPE_STRING); String latitude = row.getCell(11).getStringCellValue(); entity.setLatitude(latitude); } cell = row.getCell(12); if (cell != null) { row.getCell(12).setCellType(Cell.CELL_TYPE_STRING); String longitude = row.getCell(12).getStringCellValue(); entity.setLongitude(longitude); } String id = (String) new UUIDHexGenerator().generate(null, null); entity.setId(id); return entity; }
From source file:com.znsx.cms.service.impl.TmDeviceManagerImpl.java
private ControlDeviceLil readControlDeviceLilWb(Row row, int rowIndex) { ControlDeviceLil entity = new ControlDeviceLil(); Cell cell = row.getCell(0);/* w w w . jav a 2 s . c o m*/ if (cell != null) { row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); String name = row.getCell(0).getStringCellValue(); entity.setName(name); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 1 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",name is not null"); } cell = row.getCell(1); if (cell != null) { row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); String dasSn = row.getCell(1).getStringCellValue(); Das das = dasDAO.findBySN(dasSn); entity.setDas(das); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 2 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",dasSn is not null"); } cell = row.getCell(2); if (cell != null) { row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); String organSn = row.getCell(2).getStringCellValue(); Organ organf = organDAO.findBySN(organSn); entity.setOrgan(organf); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",organSn is not null"); } cell = row.getCell(3); if (cell != null) { row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); String sn = row.getCell(3).getStringCellValue(); entity.setStandardNumber(sn); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",sn is not null"); } cell = row.getCell(4); if (cell != null) { row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); String stakeNumber = row.getCell(4).getStringCellValue(); entity.setStakeNumber(stakeNumber); } cell = row.getCell(5); if (cell != null) { row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); String period = row.getCell(5).getStringCellValue(); entity.setPeriod(Integer.parseInt(period)); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 6 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",period is not null"); } cell = row.getCell(6); if (cell != null) { row.getCell(6).setCellType(Cell.CELL_TYPE_STRING); String navigation = row.getCell(6).getStringCellValue(); entity.setNavigation(navigation); } cell = row.getCell(7); if (cell != null) { row.getCell(7).setCellType(Cell.CELL_TYPE_STRING); String reserve = row.getCell(7).getStringCellValue(); entity.setReserve(reserve); } cell = row.getCell(8); if (cell != null) { row.getCell(8).setCellType(Cell.CELL_TYPE_STRING); String note = row.getCell(8).getStringCellValue(); entity.setNote(note); } cell = row.getCell(9); if (cell != null) { row.getCell(9).setCellType(Cell.CELL_TYPE_STRING); String ip = row.getCell(9).getStringCellValue(); entity.setIp(ip); } cell = row.getCell(10); if (cell != null) { row.getCell(10).setCellType(Cell.CELL_TYPE_STRING); String port = row.getCell(10).getStringCellValue(); entity.setPort(Integer.parseInt(port)); } cell = row.getCell(11); if (cell != null) { row.getCell(11).setCellType(Cell.CELL_TYPE_STRING); String latitude = row.getCell(11).getStringCellValue(); entity.setLatitude(latitude); } cell = row.getCell(12); if (cell != null) { row.getCell(12).setCellType(Cell.CELL_TYPE_STRING); String longitude = row.getCell(12).getStringCellValue(); entity.setLongitude(longitude); } String id = (String) new UUIDHexGenerator().generate(null, null); entity.setId(id); return entity; }
From source file:com.znsx.cms.service.impl.TmDeviceManagerImpl.java
private ControlDeviceFan readControlDeviceFanWb(Row row, int rowIndex) { ControlDeviceFan entity = new ControlDeviceFan(); Cell cell = row.getCell(0);//from ww w.ja v a 2s.co m if (cell != null) { row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); String name = row.getCell(0).getStringCellValue(); entity.setName(name); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 1 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",name is not null"); } cell = row.getCell(1); if (cell != null) { row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); String dasSn = row.getCell(1).getStringCellValue(); Das das = dasDAO.findBySN(dasSn); entity.setDas(das); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 2 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",dasSn is not null"); } cell = row.getCell(2); if (cell != null) { row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); String organSn = row.getCell(2).getStringCellValue(); Organ organf = organDAO.findBySN(organSn); entity.setOrgan(organf); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 3 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",organSn is not null"); } cell = row.getCell(3); if (cell != null) { row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); String sn = row.getCell(3).getStringCellValue(); entity.setStandardNumber(sn); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 4 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",sn is not null"); } cell = row.getCell(4); if (cell != null) { row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); String stakeNumber = row.getCell(4).getStringCellValue(); entity.setStakeNumber(stakeNumber); } cell = row.getCell(5); if (cell != null) { row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); String period = row.getCell(5).getStringCellValue(); entity.setPeriod(Integer.parseInt(period)); } else { throw new BusinessException(ErrorCode.EXCEL_CONTENT_ERROR, "excel row:" + (rowIndex + 1) + ",cellIndex: " + 6 + "," + TypeDefinition.DVR_TEMPLATE + "," + TypeDefinition.PARAMETER_NULL + ",period is not null"); } cell = row.getCell(6); if (cell != null) { row.getCell(6).setCellType(Cell.CELL_TYPE_STRING); String navigation = row.getCell(6).getStringCellValue(); entity.setNavigation(navigation); } cell = row.getCell(7); if (cell != null) { row.getCell(7).setCellType(Cell.CELL_TYPE_STRING); String reserve = row.getCell(7).getStringCellValue(); entity.setReserve(reserve); } cell = row.getCell(8); if (cell != null) { row.getCell(8).setCellType(Cell.CELL_TYPE_STRING); String note = row.getCell(8).getStringCellValue(); entity.setNote(note); } cell = row.getCell(9); if (cell != null) { row.getCell(9).setCellType(Cell.CELL_TYPE_STRING); String ip = row.getCell(9).getStringCellValue(); entity.setIp(ip); } cell = row.getCell(10); if (cell != null) { row.getCell(10).setCellType(Cell.CELL_TYPE_STRING); String port = row.getCell(10).getStringCellValue(); entity.setPort(Integer.parseInt(port)); } cell = row.getCell(11); if (cell != null) { row.getCell(11).setCellType(Cell.CELL_TYPE_STRING); String latitude = row.getCell(11).getStringCellValue(); entity.setLatitude(latitude); } cell = row.getCell(12); if (cell != null) { row.getCell(12).setCellType(Cell.CELL_TYPE_STRING); String longitude = row.getCell(12).getStringCellValue(); entity.setLongitude(longitude); } String id = (String) new UUIDHexGenerator().generate(null, null); entity.setId(id); return entity; }
From source file:de.innovationgate.webgate.api.jdbc.WGDatabaseImpl.java
License:Open Source License
/** * @throws WGAPIException //from w w w . j a v a 2 s .co m * @see de.innovationgate.webgate.api.WGDatabaseCore#createStructEntry(WGDocument, * WGContentType) */ public WGDocumentCore createStructEntry(Object key, WGDocument reference, WGContentType contentType) throws WGAPIException { StructEntry newStructEntry = new StructEntry(); if (contentType != null) { ContentType contentTypeEntity = (ContentType) ((WGDocumentImpl) contentType.getCore()).getEntity(); newStructEntry.setContenttype(contentTypeEntity); } if (key != null) { newStructEntry.setKey(String.valueOf(key)); } else { UUIDHexGenerator idGenerator = new UUIDHexGenerator(); newStructEntry.setKey(String.valueOf(idGenerator .generate((org.hibernate.engine.spi.SessionImplementor) getSession(), newStructEntry))); } if (reference instanceof WGArea) { Area area = (Area) ((WGDocumentImpl) reference.getCore()).getEntity(); newStructEntry.setArea(area); if (_ddlVersion < WGDatabase.CSVERSION_WGA5) { area.getRootentries().put(newStructEntry.getKey(), newStructEntry); } } else { StructEntry parentEntry = (StructEntry) getEntity(reference); newStructEntry.setParententry(parentEntry); if (_ddlVersion < WGDatabase.CSVERSION_WGA5) { parentEntry.getChildentries().put(newStructEntry.getKey(), newStructEntry); } } newStructEntry.setReaders(new ArrayList()); newStructEntry.setChildeditors(new ArrayList()); newStructEntry.setPageeditors(new ArrayList()); newStructEntry.setPublished(new HashMap()); newStructEntry.setContent(new HashSet()); newStructEntry.setChildentries(new HashMap()); return createDocumentImpl(newStructEntry); }
From source file:de.innovationgate.webgate.api.jdbc.WGDatabaseImpl.java
License:Open Source License
/** * @see de.innovationgate.webgate.api.WGDatabaseCore#createUserProfile(String, * int)//from w w w . j ava 2 s .c om */ public WGDocumentCore createUserProfile(String name, int type) throws WGAPIException, WGAuthorisationException, WGCreationException { UserProfile newProfile = new UserProfile(); if (name != null) { newProfile.setName(name); } else { UUIDHexGenerator idGenerator = new UUIDHexGenerator(); newProfile.setName(String.valueOf(idGenerator.generate((SessionImplementor) getSession(), newProfile))); } newProfile.setType(new Integer(type)); newProfile.setHits(new Integer(0)); newProfile.setSessions(new Integer(0)); newProfile.setLanguages(new ArrayList<String>()); newProfile.setPortletkeys(new ArrayList<String>()); newProfile.setItems(new HashMap<String, UserProfileItem>()); newProfile.setPortlets(new HashMap<String, UserProfilePortlet>()); return createDocumentImpl(newProfile); }