List of usage examples for java.util LinkedHashMap get
public V get(Object key)
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String generalRequestXml4TJ(String id, ResourceBundle bundle) { int idInt = Integer.valueOf(id); // step 1 ?xml LinkedHashMap InventoryHead = new LinkedHashMap(); //?//from ww w . j av a 2s . c om List<LinkedHashMap> headList = snCommonManagerMapper.selectInventoryHead(idInt); if (headList != null) { LinkedHashMap item = headList.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_HEAD_" + key.toString())) { InventoryHead.put(bundle.getObject("TJ_HEAD_" + key.toString()), item.get(key)); } else { InventoryHead.put(key.toString(), item.get(key)); } } } } List<LinkedHashMap> InventoryList = new ArrayList<LinkedHashMap>(); //? List<LinkedHashMap> ItemList = snCommonManagerMapper.selectInventoryList(idInt); if (ItemList != null) { for (LinkedHashMap item : ItemList) { //book?? List<LinkedHashMap> bookInfoList = snCommonManagerMapper.selectInventoryListRelateBookInfo( item.get("ORDER_NO").toString(), item.get("ITEM_NO").toString()); for (LinkedHashMap bookInfo : bookInfoList) { //book? item.put("RECORD_NO", bookInfo.get("RECORD_NO")); item.put("GOODS_SERIALNO", bookInfo.get("GOODS_SERIALNO")); item.put("DECL_NO", bookInfo.get("DECL_NO")); LinkedHashMap Inventory = new LinkedHashMap(); //t_new_import_sku.unit2<qty2>????t_new_import_inventory_detail.qty2 //t_new_import_sku.unit2?<qty2>?t_new_import_inventory_detail.qty1 if (item.get("UNIT2") == null || item.get("UNIT2").toString().isEmpty()) { //?? } else { item.put("QTY2", item.get("QTY1")); } // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_LIST_" + key.toString())) { Inventory.put(bundle.getObject("TJ_LIST_" + key.toString()), item.get(key)); } else { Inventory.put(key.toString(), item.get(key)); } } } InventoryList.add(Inventory); } } } LinkedHashMap IODeclContainerList = new LinkedHashMap(); List<LinkedHashMap> IODeclContainerListTemp = snCommonManagerMapper.selectIODeclContainerList(idInt); if (IODeclContainerListTemp != null) { LinkedHashMap item = IODeclContainerListTemp.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_IO_" + key.toString())) { IODeclContainerList.put(bundle.getObject("TJ_IO_" + key.toString()), item.get(key)); } else { IODeclContainerList.put(key.toString(), item.get(key)); } } } } LinkedHashMap IODeclOrderRelationList = new LinkedHashMap(); List<LinkedHashMap> IODeclOrderRelationListTemp = snCommonManagerMapper .selectIODeclOrderRelationList(idInt); if (IODeclOrderRelationListTemp != null) { LinkedHashMap item = IODeclOrderRelationListTemp.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_IO_" + key.toString())) { IODeclOrderRelationList.put(bundle.getObject("TJ_IO_" + key.toString()), item.get(key)); } else { IODeclOrderRelationList.put(key.toString(), item.get(key)); } } } } LinkedHashMap BaseTransfer = snCommonManagerMapper.selectBaseTransfer(); String resultXmlString = XmlUtil.generalRequestXml4TJ_621(InventoryHead, InventoryList, IODeclContainerList, IODeclOrderRelationList, BaseTransfer, bundle); return resultXmlString; }
From source file:service.EventService.java
public void eventAppointSaveAll(Long campaignId, Long cabinetId, Long[] userIdArray, String[] clientNumArray) { if (userIdArray != null && clientNumArray != null) { LinkedHashMap<Long, Integer> userIdCountAssignedMap = new LinkedHashMap(); List<Event> events = getUnassignedEvent(campaignId, cabinetId); List<Event> eventsForUpdate = new ArrayList(); PersonalCabinet pk = personalCabinetDao.find(cabinetId); //int clientCount = 0; int summClient = 0; if (userIdArray.length > 0 && events.size() > 0 && clientNumArray.length > 0) { for (int i = 0; i < userIdArray.length; i++) { if (clientNumArray.length >= i) { int count = StringAdapter.toInteger(clientNumArray[i]); summClient += count; userIdCountAssignedMap.put(userIdArray[i], count); } else { userIdCountAssignedMap.put(userIdArray[i], 0); }// ww w. j av a 2 s. c o m } /// ? ?, ? ? ? - ? - // ? ? appointMap ? ? //??? ? ? ? ? ? /*for (int i = 0; i < clientNumArray.length; i++) { String df = clientNumArray[i]; if(df.equals("")||!df.matches("[0-9]*")){ df="0"; } Integer i2 = Integer.valueOf(df); summClient += i2; }*/ //Long eclId = (long)0; int sindx = 0; if (summClient <= events.size()) { for (Long userId : userIdCountAssignedMap.keySet()) { Integer eventsCountToAssign = userIdCountAssignedMap.get(userId); User user = userDao.getUserBelongsPk(pk, userId); if (user != null) { //int supCount = 0; for (int supCount = 0; supCount < eventsCountToAssign; supCount++) { Event ev = events.get(sindx); if (ev != null && supCount < eventsCountToAssign) { ev.setUser(user); ev.setStatus(Event.ASSIGNED); if (validate(ev)) { eventsForUpdate.add(ev); //supCount++; sindx++; } } } /*for (Event ev : events) { if (supCount < eventsCountToAssign && eclId < ev.getEventId()) { ev.setUser(user); ev.setStatus(Event.ASSIGNED); if (validate(ev)) { eventDao.save(ev); eclId = ev.getEventId(); } supCount++; } }*/ } else { addError("! id:" + userId + " !"); } } for (Event ev : eventsForUpdate) { eventDao.update(ev); User u = ev.getUser(); addEventComment( " " + u.getShortName() + "(" + u.getEmail() + ")", EventComment.ASSIGN, ev, cabinetId); } /*String str = ""; for(Map.Entry<Long,Integer> entry:userIdCountAssignedMap.entrySet()){ str+=entry.getKey()+"-"+entry.getValue()+"; "; } addError(str);*/ } else { addError("? " + summClient + " ? : " + events.size()); } } } }
From source file:org.talend.mdm.webapp.browserecords.server.actions.BrowseRecordsAction.java
@Override public List<Restriction> getForeignKeyPolymTypeList(String xpathForeignKey, String language) throws ServiceException { try {/*from ww w. j a v a 2 s .c o m*/ String fkEntityType; ReusableType entityReusableType = null; List<Restriction> ret = new ArrayList<Restriction>(); if (xpathForeignKey != null && xpathForeignKey.length() > 0) { if (xpathForeignKey.startsWith("/")) { //$NON-NLS-1$ xpathForeignKey = xpathForeignKey.substring(1); } String fkEntity; if (xpathForeignKey.contains("/")) {//$NON-NLS-1$ fkEntity = xpathForeignKey.substring(0, xpathForeignKey.indexOf("/"));//$NON-NLS-1$ } else { fkEntity = xpathForeignKey; } fkEntityType = SchemaWebAgent.getInstance().getBusinessConcept(fkEntity).getCorrespondTypeName(); if (fkEntityType != null) { entityReusableType = SchemaWebAgent.getInstance().getReusableType(fkEntityType); } if (entityReusableType != null) { entityReusableType.load(); } List<ReusableType> subtypes = SchemaWebAgent.getInstance().getMySubtypes(fkEntityType, true); if (fkEntityType != null && entityReusableType != null && !entityReusableType.isAbstract()) { subtypes.add(0, entityReusableType); } List<BusinessConcept> list = SchemaWebAgent.getInstance().getAllBusinessConcepts(); LinkedHashMap<String, String> businessConceptMap = new LinkedHashMap<String, String>(); if (list != null) { for (BusinessConcept businessConcept : list) { if (businessConcept.getCorrespondTypeName() != null && businessConcept.getCorrespondTypeName().trim().length() > 0) { businessConceptMap.put(businessConcept.getCorrespondTypeName(), businessConcept.getName()); } } } for (ReusableType reusableType : subtypes) { if (businessConceptMap.containsKey(reusableType.getName())) { Restriction re = new Restriction(); EntityModel entityModel = getEntityModel(businessConceptMap.get(reusableType.getName()), language); re.setName(entityModel.getConceptLabel(language)); re.setValue(entityModel.getConceptName()); ret.add(re); } } } return ret; } catch (Exception e) { LOG.error(e.getMessage(), e); throw new ServiceException(e.getLocalizedMessage()); } }
From source file:com.microsoft.windowsazure.mobileservices.sdk.testapp.test.MobileServiceSyncTableTests.java
public void testIncrementalPullSaveLastUpdatedAtDate() throws MalformedURLException, InterruptedException, ExecutionException, MobileServiceException { MobileServiceLocalStoreMock store = new MobileServiceLocalStoreMock(); ServiceFilterContainer serviceFilterContainer = new ServiceFilterContainer(); String queryKey = "QueryKey"; String incrementalPullStrategyTable = "__incrementalPullData"; MobileServiceClient client = new MobileServiceClient(appUrl, appKey, getInstrumentation().getTargetContext()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); String updatedAt1 = sdf.format(new Date()); String updatedAt2 = sdf.format(new Date()); client = client.withFilter(getTestFilter(serviceFilterContainer, false, "{\"count\":\"4\",\"results\":[{\"id\":\"abc\",\"String\":\"Hey\",\"__updatedAt\":\"" + updatedAt1 + "\"},{\"id\":\"def\",\"String\":\"World\",\"__updatedAt\":\"" + updatedAt1 + "\"}]}", "[{\"id\":\"abc\",\"String\":\"Hey\",\"__updatedAt\":\"" + updatedAt2 + "\"},{\"id\":\"def\",\"String\":\"World\",\"__updatedAt\":\"" + updatedAt2 + "\"}]" // remote//from ww w .j a v a 2 s. co m // item )); client.getSyncContext().initialize(store, new SimpleSyncHandler()).get(); MobileServiceSyncTable<StringIdType> table = client.getSyncTable(StringIdType.class); Query query = QueryOperations.tableName(table.getName()).top(2); table.pull(query, queryKey).get(); LinkedHashMap<String, JsonObject> tableContent = store.Tables.get(incrementalPullStrategyTable); JsonElement result = tableContent.get(table.getName() + "_" + queryKey); String stringMaxUpdatedDate = result.getAsJsonObject().get("maxupdateddate").getAsString(); assertEquals(updatedAt2, stringMaxUpdatedDate); }
From source file:com.atinternet.tracker.Builder.java
/** * Prepare the hit queryString//from ww w. j av a 2s . co m * * @return LinkedHashMap */ private LinkedHashMap<String, Object[]> prepareQuery() { LinkedHashMap<String, Object[]> formattedParameters = new LinkedHashMap<String, Object[]>(); ArrayList<Param> completeBuffer = new ArrayList<Param>() { { addAll(persistentParams); addAll(volatileParams); } }; ArrayList<Param> params = organizeParameters(completeBuffer); for (Param p : params) { String value = p.getValue().execute(); String key = p.getKey(); HashMap<String, String> plugins = PluginParam.get(tracker); if (plugins.containsKey(key)) { String pluginClass = plugins.get(key); Plugin plugin = null; try { plugin = (Plugin) Class.forName(pluginClass).newInstance(); plugin.execute(tracker); value = plugin.getResponse(); p.setType(Param.Type.JSON); key = Hit.HitParam.JSON.stringValue(); } catch (Exception e) { e.printStackTrace(); value = null; } } else if (key.equals(Hit.HitParam.UserId.stringValue())) { if (TechnicalContext.doNotTrackEnabled(Tracker.getAppContext())) { value = OPT_OUT; } else if (((Boolean) configuration.get(TrackerConfigurationKeys.HASH_USER_ID))) { value = Tool.SHA_256(value); } } if (p.getType() == Param.Type.Closure && Tool.parseJSON(value) != null) { p.setType(Param.Type.JSON); } if (value != null) { // Referrer processing if (key.equals(Hit.HitParam.Referrer.stringValue())) { value = value.replace("&", "$").replaceAll("[<>]", ""); } if (p.getOptions() != null && p.getOptions().isEncode()) { value = Tool.percentEncode(value); p.getOptions().setSeparator(Tool.percentEncode(p.getOptions().getSeparator())); } int duplicateParamIndex = -1; String duplicateParamKey = null; Set<String> keys = formattedParameters.keySet(); String[] keySet = keys.toArray(new String[keys.size()]); int length = keySet.length; for (int i = 0; i < length; i++) { if (keySet[i].equals(key)) { duplicateParamIndex = i; duplicateParamKey = key; break; } } if (duplicateParamIndex != -1) { List<Object[]> values = new ArrayList<Object[]>(formattedParameters.values()); Param duplicateParam = (Param) values.get(duplicateParamIndex)[0]; String str = ((String) formattedParameters.get(duplicateParamKey)[1]).split("=")[0] + "="; String val = ((String) formattedParameters.get(duplicateParamKey)[1]).split("=")[1]; if (p.getType() == Param.Type.JSON) { Object json = Tool.parseJSON(Tool.percentDecode(val)); Object newJson = Tool.parseJSON(Tool.percentDecode(value)); if (json != null && json instanceof JSONObject) { Map dictionary = Tool.toMap((JSONObject) json); if (newJson instanceof JSONObject) { Map newDictionary = Tool.toMap((JSONObject) newJson); dictionary.putAll(newDictionary); JSONObject jsonData = new JSONObject(dictionary); formattedParameters.put(key, new Object[] { duplicateParam, makeSubQuery(key, Tool.percentEncode(jsonData.toString())) }); } else { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to a dictionary"); } } else if (json != null && json instanceof JSONArray) { try { ArrayList<Object> array = new ArrayList<Object>(); JSONArray jArray = (JSONArray) json; for (int i = 0; i < jArray.length(); i++) { array.add(jArray.get(i).toString()); } if (newJson instanceof JSONArray) { jArray = (JSONArray) newJson; for (int i = 0; i < jArray.length(); i++) { array.add(jArray.get(i).toString()); } JSONObject jsonData = new JSONObject(array.toString()); formattedParameters.put(key, new Object[] { duplicateParam, makeSubQuery(key, Tool.percentEncode(jsonData.toString())) }); } else { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to an array"); } } catch (JSONException e) { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to an array"); } } else { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to a JSON Object"); } } else if (duplicateParam.getType() == Param.Type.JSON) { Tool.executeCallback(tracker.getListener(), CallbackType.warning, "Couldn't append value to a JSON Object"); } else { formattedParameters.put(key, new Object[] { duplicateParam, str + val + p.getOptions().getSeparator() + value }); } } else { formattedParameters.put(key, new Object[] { p, makeSubQuery(key, value) }); } } } return formattedParameters; }
From source file:jp.or.openid.eiwg.scim.operation.Operation.java
/** * ?/*from w w w .j av a 2s .co m*/ * * @param context * @param request * @param attributes * @param requestJson */ public LinkedHashMap<String, Object> createUserInfo(ServletContext context, HttpServletRequest request, String attributes, String requestJson) { LinkedHashMap<String, Object> result = null; Set<String> returnAttributeNameSet = new HashSet<>(); // ? setError(0, null, null); // ?? if (attributes != null && !attributes.isEmpty()) { // String[] tempList = attributes.split(","); for (int i = 0; i < tempList.length; i++) { String attributeName = tempList[i].trim(); // ??????? LinkedHashMap<String, Object> attributeSchema = SCIMUtil.getUserAttributeInfo(context, attributeName, true); if (attributeSchema != null && !attributeSchema.isEmpty()) { returnAttributeNameSet.add(attributeName); } else { // ??????? String message = String.format(MessageConstants.ERROR_INVALID_ATTRIBUTES, attributeName); setError(HttpServletResponse.SC_BAD_REQUEST, null, message); return result; } } } // ? if (requestJson == null || requestJson.isEmpty()) { // setError(HttpServletResponse.SC_BAD_REQUEST, null, MessageConstants.ERROR_INVALID_REQUEST); return result; } // (JSON)? ObjectMapper mapper = new ObjectMapper(); LinkedHashMap<String, Object> requestObject = null; try { requestObject = mapper.readValue(requestJson, new TypeReference<LinkedHashMap<String, Object>>() { }); } catch (JsonParseException e) { String datailMessage = e.getMessage(); datailMessage = datailMessage.substring(0, datailMessage.indexOf('\n')); setError(HttpServletResponse.SC_BAD_REQUEST, null, MessageConstants.ERROR_INVALID_REQUEST + "(" + datailMessage + ")"); return result; } catch (JsonMappingException e) { String datailMessage = e.getMessage(); datailMessage = datailMessage.substring(0, datailMessage.indexOf('\n')); setError(HttpServletResponse.SC_BAD_REQUEST, null, MessageConstants.ERROR_INVALID_REQUEST + "(" + datailMessage + ")"); return result; } catch (IOException e) { setError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null, MessageConstants.ERROR_UNKNOWN); return result; } // ? if (requestObject != null && !requestObject.isEmpty()) { Iterator<String> attributeIt = requestObject.keySet().iterator(); while (attributeIt.hasNext()) { // ??? String attributeName = attributeIt.next(); // ? LinkedHashMap<String, Object> attributeSchema = SCIMUtil.getUserAttributeInfo(context, attributeName, true); if (attributeSchema != null) { // ???? Object mutability = attributeSchema.get("mutability"); if (mutability != null && mutability.toString().equalsIgnoreCase("readOnly")) { // readOnly String message = String.format(MessageConstants.ERROR_READONLY_ATTRIBUTE, attributeName); setError(HttpServletResponse.SC_BAD_REQUEST, null, message); return result; } // ?? // () } else { // ???? String message = String.format(MessageConstants.ERROR_UNKNOWN_ATTRIBUTE, attributeName); setError(HttpServletResponse.SC_BAD_REQUEST, null, message); return result; } } } else { // setError(HttpServletResponse.SC_BAD_REQUEST, null, MessageConstants.ERROR_INVALID_REQUEST); return result; } // ? // () LinkedHashMap<String, Object> newUserInfo = new LinkedHashMap<String, Object>(); // id? UUID uuid = UUID.randomUUID(); newUserInfo.put("id", uuid.toString()); Iterator<String> attributeIt = requestObject.keySet().iterator(); while (attributeIt.hasNext()) { // ??? String attributeName = attributeIt.next(); // ? Object attributeValue = requestObject.get(attributeName); newUserInfo.put(attributeName, attributeValue); } // meta? LinkedHashMap<String, Object> metaValues = new LinkedHashMap<String, Object>(); // meta.resourceType metaValues.put("resourceType", "User"); // meta.created SimpleDateFormat xsdDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'"); xsdDateTime.setTimeZone(TimeZone.getTimeZone("UTC")); metaValues.put("created", xsdDateTime.format(new Date())); // meta.location String location = request.getScheme() + "://" + request.getServerName(); int serverPort = request.getServerPort(); if (serverPort != 80 && serverPort != 443) { location += ":" + Integer.toString(serverPort); } location += request.getContextPath(); location += "/scim/Users/" + uuid.toString(); metaValues.put("location", location); newUserInfo.put("meta", metaValues); // (??) @SuppressWarnings("unchecked") ArrayList<LinkedHashMap<String, Object>> users = (ArrayList<LinkedHashMap<String, Object>>) context .getAttribute("Users"); if (users == null) { users = new ArrayList<LinkedHashMap<String, Object>>(); } users.add(newUserInfo); context.setAttribute("Users", users); // ?? result = new LinkedHashMap<String, Object>(); attributeIt = newUserInfo.keySet().iterator(); while (attributeIt.hasNext()) { // ??? String attributeName = attributeIt.next(); // ? LinkedHashMap<String, Object> attributeSchema = SCIMUtil.getUserAttributeInfo(context, attributeName, true); Object returned = attributeSchema.get("returned"); if (returned != null && returned.toString().equalsIgnoreCase("never")) { continue; } // ? Object attributeValue = newUserInfo.get(attributeName); result.put(attributeName, attributeValue); } return result; }
From source file:com.sonicle.webtop.contacts.ContactsManager.java
@Override public Map<Integer, ShareFolderCategory> listIncomingCategoryFolders(String rootShareId) throws WTException { CoreManager coreMgr = WT.getCoreManager(getTargetProfileId()); LinkedHashMap<Integer, ShareFolderCategory> folders = new LinkedHashMap<>(); for (Integer folderId : shareCache.getFolderIdsByShareRoot(rootShareId)) { final String shareFolderId = shareCache.getShareFolderIdByFolderId(folderId); if (StringUtils.isBlank(shareFolderId)) continue; SharePermsFolder fperms = coreMgr.getShareFolderPermissions(shareFolderId); SharePermsElements eperms = coreMgr.getShareElementsPermissions(shareFolderId); if (folders.containsKey(folderId)) { final ShareFolderCategory shareFolder = folders.get(folderId); if (shareFolder == null) continue; shareFolder.getPerms().merge(fperms); shareFolder.getElementsPerms().merge(eperms); } else {//from w ww . jav a2 s. co m final Category category = getCategory(folderId); if (category == null) continue; folders.put(folderId, new ShareFolderCategory(shareFolderId, fperms, eperms, category)); } } return folders; }
From source file:net.jradius.client.gui.JRadiusSimulator.java
private void createAttributeTreeNodes(DefaultMutableTreeNode top) { DefaultMutableTreeNode standardTree = new DefaultMutableTreeNode("Standard Attributes"); DefaultMutableTreeNode vsaTree = new DefaultMutableTreeNode("Vendor Specific Attributes"); addAttributesToTable(standardTree, AttributeFactory.getAttributeNameMap(), true); top.add(standardTree);/*from ww w .ja v a 2s . c o m*/ Map<Long, VendorValue> vendors = AttributeFactory.getVendorValueMap(); LinkedHashMap<String, Map<String, Class<?>>> dictList = new LinkedHashMap<String, Map<String, Class<?>>>(); for (Iterator<VendorValue> i = vendors.values().iterator(); i.hasNext();) { VendorValue vendor = i.next(); try { VSADictionary dict = (VSADictionary) vendor.getDictClass().newInstance(); String vendorName = dict.getVendorName(); Map<String, Class<?>> map = vendor.getAttributeNameMap(); System.out.println("Loading vendor " + vendorName + " with " + map.size() + " attributes."); dictList.put(vendorName, map); } catch (Exception e) { e.printStackTrace(); } } LinkedList<String> list = new LinkedList<String>(dictList.keySet()); Collections.sort(list); for (Iterator<String> i = list.iterator(); i.hasNext();) { String vendorName = i.next(); DefaultMutableTreeNode vsaNode = new DefaultMutableTreeNode(vendorName); addAttributesToTable(vsaNode, dictList.get(vendorName), false); vsaTree.add(vsaNode); } top.add(vsaTree); }
From source file:gr.seab.r2rml.test.ComplianceTests.java
@Test public void testAll() { log.info("test all"); LinkedHashMap<String, String[]> tests = new LinkedHashMap<String, String[]>(); tests.put("D000-1table1column0rows", new String[] { "r2rml.ttl" }); tests.put("D001-1table1column1row", new String[] { "r2rmla.ttl", "r2rmlb.ttl" }); tests.put("D002-1table2columns1row", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl", "r2rmld.ttl", "r2rmle.ttl", "r2rmlf.ttl", "r2rmlg.ttl", "r2rmlh.ttl", "r2rmli.ttl", "r2rmlj.ttl" }); tests.put("D003-1table3columns1row", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl" }); tests.put("D004-1table2columns1row", new String[] { "r2rmla.ttl", "r2rmlb.ttl" }); tests.put("D005-1table3columns3rows2duplicates", new String[] { "r2rmla.ttl", "r2rmlb.ttl" }); tests.put("D006-1table1primarykey1column1row", new String[] { "r2rmla.ttl" }); tests.put("D007-1table1primarykey2columns1row", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl", "r2rmld.ttl", "r2rmle.ttl", "r2rmlf.ttl", "r2rmlg.ttl", "r2rmlh.ttl" }); tests.put("D008-1table1compositeprimarykey3columns1row", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl" }); tests.put("D009-2tables1primarykey1foreignkey", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl", "r2rmld.ttl" }); tests.put("D010-1table1primarykey3colums3rows", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl" }); tests.put("D011-M2MRelations", new String[] { "r2rmla.ttl", "r2rmlb.ttl" }); tests.put("D012-2tables2duplicates0nulls", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl", "r2rmld.ttl", "r2rmle.ttl" }); tests.put("D013-1table1primarykey3columns2rows1nullvalue", new String[] { "r2rmla.ttl" }); tests.put("D014-3tables1primarykey1foreignkey", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl", "r2rmld.ttl" }); tests.put("D015-1table3columns1composityeprimarykey3rows2languages", new String[] { "r2rmla.ttl", "r2rmlb.ttl" }); tests.put("D016-1table1primarykey10columns3rowsSQLdatatypes", new String[] { "r2rmla.ttl", "r2rmlb.ttl", "r2rmlc.ttl", "r2rmld.ttl", "r2rmle.ttl" }); tests.put("D017-I18NnoSpecialChars", new String[] {}); tests.put("D018-1table1primarykey2columns3rows", new String[] { "r2rmla.ttl" }); tests.put("D019-1table1primarykey3columns3rows", new String[] { "r2rmla.ttl", "r2rmlb.ttl" }); tests.put("D020-1table1column5rows", new String[] { "r2rmla.ttl", "r2rmlb.ttl" }); tests.put("D021-2tables2primarykeys1foreignkeyReferencesAllNulls", new String[] {}); tests.put("D022-2tables1primarykey1foreignkeyReferencesNoPrimaryKey", new String[] {}); tests.put("D023-2tables2primarykeys2foreignkeysReferencesToNon-primarykeys", new String[] {}); tests.put("D024-2tables2primarykeys1foreignkeyToARowWithSomeNulls", new String[] {}); tests.put("D025-3tables3primarykeys3foreignkeys", new String[] {}); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("test-context.xml"); int counter = 0; for (String key : tests.keySet()) { if (counter > 2 && counter < 26) { String folder = "src/test/resources/postgres/" + key + "/"; initialiseSourceDatabase(folder + "create.sql"); for (String mappingFile : tests.get(key)) { //Override property file Parser parser = (Parser) context.getBean("parser"); Properties p = parser.getProperties(); mappingFile = folder + mappingFile; if (new File(mappingFile).exists()) { p.setProperty("mapping.file", mappingFile); } else { log.error("File " + mappingFile + " does not exist."); }/*from w w w. j av a2 s. c om*/ p.setProperty("jena.destinationFileName", mappingFile.substring(0, mappingFile.indexOf(".") + 1) + "nq"); parser.setProperties(p); MappingDocument mappingDocument = parser.parse(); Generator generator = (Generator) context.getBean("generator"); generator.setProperties(parser.getProperties()); generator.setResultModel(parser.getResultModel()); log.info("--- generating " + p.getProperty("jena.destinationFileName") + " from " + mappingFile + " ---"); generator.createTriples(mappingDocument); } } counter++; } context.close(); }
From source file:net.jradius.client.gui.JRadiusSimulator.java
private void addAttributesToTable(DefaultMutableTreeNode node, Map<String, Class<?>> map, boolean skipVSA) { LinkedHashMap<String, String> attributeList = new LinkedHashMap<String, String>(); for (Iterator<Map.Entry<String, Class<?>>> i = map.entrySet().iterator(); i.hasNext();) { Map.Entry<String, Class<?>> entry = i.next(); String type = entry.getKey(); Class<?> clazz = entry.getValue(); try {//w w w .java 2 s .c om RadiusAttribute attribute = (RadiusAttribute) clazz.newInstance(); if (!skipVSA || (!(attribute instanceof VSAttribute) && attribute.getType() <= 255)) { String attributeName = attribute.getAttributeName(); if (attributeName.equals("Vendor-Specific")) continue; if (attributeName.startsWith("X-Ascend-")) continue; attributeList.put(type, attributeName); } } catch (Exception e) { e.printStackTrace(); } } LinkedList<String> list = new LinkedList<String>(attributeList.keySet()); Collections.sort(list); for (Iterator<String> i = list.iterator(); i.hasNext();) { node.add(new DefaultMutableTreeNode(attributeList.get(i.next()))); } }