private ConstantTableItem findOrCreateLocationByCode(String locCode) { if (locCode == null || locCode.length() == 0) return null; if (locations == null) { locations = ConstantPool.getInstance().findConstantTableByName(ConstantTables.LOCATION); } ConstantTableItem result = locations.findItemByCode(locCode); if (result == null) { try { result = new ConstantTableItem(); result.setCode(locCode); result.setConstantTableDefinition(locations.getId()); result.setEnable(true); result.setEnglishItemName("Rasa auto generated location for code: " + locCode); locations.getTableItems().add(result); locations = ConstantPool.getInstance().saveConstantTableDefinition(locations); result = locations.findItemByCode(locCode); } catch (Exception e) { e.printStackTrace(); } if (result != null) logger.info("A new location item has been generated for code: " + locCode, null); else logger.error("Could not create or find location item for code:" + locCode, null); } return result; }
/** * <code>guiInit()</code> defined for component initialization and setting up actions and models * of each component */ private void guiInit() { setTitle(props.getProperty("page.name")); ButtonGroup typeButtonGroup = new ButtonGroup(); typeButtonGroup.add(rdoCopyrightReq); typeButtonGroup.add(rdoDepositReq); ButtonGroup isAnsweredButtonGroup = new ButtonGroup(); isAnsweredButtonGroup.add(rdoAnswerReq); isAnsweredButtonGroup.add(rdoNoAnswerReq); ButtonGroup hasNumberButtonGroup = new ButtonGroup(); hasNumberButtonGroup.add(rdoHasNumber); hasNumberButtonGroup.add(rdoNoNumber); lblNumberSufix.setText( StringConsts.LRM + String.valueOf('\u062D') + " " + StringConsts.LRM + WorkflowConstants.NO_DATA); ConstantTableDefinition docType = ConstantPool.getInstance().findConstantTableByName(ConstantTables.COPYRIGHT_NONE_BOOK_TYPE); cmbDocType = ComponentFactory.createConstantTableCombo( docType, new Dimension(150, 16), true, screenLocale); cmbDocType.setSelectedIndex(0); componentsInit(); btnSelectUser.setIcon(WorkflowUiUtils.SELECT_USER_ICON); btnSelectUser.setBorder(null); setGridColumns(); setGridActions(); }