List of usage examples for java.util LinkedHashMap get
public V get(Object key)
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
public TreeMap<String, String> getSchematrons() { TreeMap<String, String> targetSystems = new TreeMap<String, String>(); LinkedHashMap<String, String> appInfos = getAppInfos(ICoreConstants.X_Schematron); Set<String> keys = appInfos.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); String v = appInfos.get(key); if (v == null || v.trim().length() == 0) { continue; }//w w w. j a v a2s . c om targetSystems.put(key, appInfos.get(key)); } return targetSystems; }
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
public TreeMap<String, String> getWriteAccesses() { TreeMap<String, String> writeAccesses = new TreeMap<String, String>(); LinkedHashMap<String, String> appInfos = getAppInfos("X_Write");//$NON-NLS-1$ Set<String> keys = appInfos.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); writeAccesses.put(key, appInfos.get(key)); }// w w w . j a va 2 s.co m return writeAccesses; }
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
public TreeMap<String, String> getHiddenAccesses() { TreeMap<String, String> hiddenAccesses = new TreeMap<String, String>(); LinkedHashMap<String, String> appInfos = getAppInfos("X_Hide");//$NON-NLS-1$ Set<String> keys = appInfos.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); hiddenAccesses.put(key, appInfos.get(key)); }//from w ww . ja v a 2s .c o m return hiddenAccesses; }
From source file:com.alibaba.wasp.plan.parser.druid.DruidDDLParser.java
/** * Process Alter Table Statement and generate Execute Plan * /* w w w . j a v a 2 s . com*/ */ private void getAlterTablePlan(ParseContext context, MySqlAlterTableStatement sqlAlterTableStatement, MetaEventOperation metaEventOperation) throws IOException { SQLExprTableSource tableSource = sqlAlterTableStatement.getTableSource(); String tableName = parseFromClause(tableSource); // check if table exists and get Table info FTable oldTable = metaEventOperation.checkAndGetTable(tableName, true); FTable newTable = FTable.clone(oldTable); List<SQLAlterTableItem> items = sqlAlterTableStatement.getItems(); for (SQLAlterTableItem item : items) { if (item instanceof WaspSqlAlterTableChangeColumn) { // Alter Table Change Column WaspSqlAlterTableChangeColumn changeColumn = (WaspSqlAlterTableChangeColumn) item; SQLName columnName = changeColumn.getColumnName(); LinkedHashMap<String, Field> ftableColumns = newTable.getColumns(); String oldColumnName = parseName(columnName); // Table have this column and this column is not primary key metaEventOperation.checkFieldExists(oldTable, oldColumnName); metaEventOperation.checkFieldNotInPrimaryKeys(oldTable, oldColumnName); // Check column not in a index metaEventOperation.checkColumnNotInIndex(oldTable, oldColumnName); // Which column(index) to change Field field = ftableColumns.get(oldColumnName); // Change this Field SQLColumnDefinition newColumnDefinition = changeColumn.getNewColumnDefinition(); // ColumnFamily specify do not supported. if (newColumnDefinition instanceof WaspSqlColumnDefinition) { WaspSqlColumnDefinition waspSqlColumnDefinition = (WaspSqlColumnDefinition) newColumnDefinition; if (waspSqlColumnDefinition.getColumnFamily() != null) { throw new UnsupportedException("Alter Table, columnFamily specify do not supported."); } } if (newColumnDefinition.getDataType() != null) { field.setType(parse(newColumnDefinition.getDataType())); } String newColumnName = parseName(newColumnDefinition.getName()); if (!oldColumnName.equals(newColumnName)) { // Change column name for (Field f : ftableColumns.values()) { if (f.getName().equalsIgnoreCase(newColumnName)) { throw new UnsupportedException( "Unsupported. Rename one column to a column that already column " + newColumnName); } } field.setName(newColumnName); } } else if (item instanceof MySqlAlterTableAddColumn) { // Alter Table Add Column MySqlAlterTableAddColumn addColumn = (MySqlAlterTableAddColumn) item; List<SQLColumnDefinition> columns = addColumn.getColumns(); boolean first = addColumn.isFirst(); SQLName afterColumn = addColumn.getAfterColumn(); LinkedHashMap<String, Field> ftableColumns = newTable.getColumns(); List<Field> addFields = convertColumnDefForAlterTable(columns); // check Duplicate column name metaEventOperation.areLegalTableColumns(ftableColumns.values(), addFields); // Do not support add ColumnFamily dynamic right now. metaEventOperation.checkColumnFamilyName(ftableColumns.values(), addFields); if (first) { this.addFieldByPosition(-1, addFields, ftableColumns, newTable); } else if (afterColumn != null) { int index = getIndex(parseName(afterColumn), ftableColumns); this.addFieldByPosition(index, addFields, ftableColumns, newTable); } else { int index = ftableColumns.size() - 1; this.addFieldByPosition(index, addFields, ftableColumns, newTable); } } else if (item instanceof SQLAlterTableDropColumnItem) { // Alter Table Drop Column SQLAlterTableDropColumnItem dropColumn = (SQLAlterTableDropColumnItem) item; SQLName columnName = dropColumn.getColumnName(); String cname = parseName(columnName); // This column is not primary key metaEventOperation.checkFieldNotInPrimaryKeys(oldTable, cname); // Check column not in a index, if you want to drop the column you // should drop the index first metaEventOperation.checkColumnNotInIndex(oldTable, cname); LinkedHashMap<String, Field> ftableColumns = newTable.getColumns(); Field field = ftableColumns.remove(cname); if (field == null) { throw new UnsupportedException("Unsupported Do not find this column " + SQLUtils.toSQLString(((SQLAlterTableDropColumnItem) item).getColumnName())); } newTable.setColumns(ftableColumns); } else { throw new UnsupportedException(SQLUtils.toSQLString(item) + " SQLAlterTableItem Unsupported"); } } AlterTablePlan alterTable = new AlterTablePlan(oldTable, newTable); context.setPlan(alterTable); LOG.debug("AlterTablePlan " + alterTable.toString()); }
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
public boolean setLabels(LinkedHashMap<String, String> labels) { boolean somethingChanged = false; Set<String> isoCodes = labels.keySet(); for (Iterator<String> iter = isoCodes.iterator(); iter.hasNext();) { String code = iter.next(); String label = labels.get(code); somethingChanged = somethingChanged | setLabel(code, label); }//w w w . j a va 2s. c o m hasChanged = hasChanged | somethingChanged; return somethingChanged; }
From source file:gate.util.reporting.DocTimeReporter.java
/** * Organizes the valid data extracted from the log entries into LinkedHashMap. * * @param store//from ww w.j a v a2 s . co m * A global LinkedHashMap containing the processing elements (with * time in milliseconds) in hierarchical structure. * @param matchedPR * A PR matching the given search string. * @param bTime * Time taken by the specific processing element. * @param docName * Name of the document being processed. */ @SuppressWarnings("unchecked") private void organizeEntries(LinkedHashMap<String, Object> store, String matchedPR, String bTime, String docName) { allDocs.add(docName); if (store.containsKey(matchedPR)) { ((LinkedHashMap<String, Object>) store.get(matchedPR)).put(docName, bTime); } else { LinkedHashMap<String, Object> tempLHM = new LinkedHashMap<String, Object>(); tempLHM.put(docName, bTime); store.put(matchedPR, tempLHM); } }
From source file:br.ufrgs.inf.dsmoura.repository.model.loadData.LoadLists.java
private static void loadSystemProperties() { LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(); values.put(SystemPropertyEnum.FEEDBACK_EMAIL.getKey(), "lavoi@mydomain.com"); values.put(SystemPropertyEnum.REPOSITORY_SUBTITLE.getKey(), "Lavoi Reuse Repository"); values.put(SystemPropertyEnum.REPOSITORY_URL.getKey(), "http://localhost:8080/lavoi"); values.put(SystemPropertyEnum.HOME_PAGE_URL.getKey(), "https://github.com/dsmoura/lavoi"); values.put(SystemPropertyEnum.SMTP_HOSTNAME.getKey(), "smtp.mydomain.com"); values.put(SystemPropertyEnum.SMTP_SSL.getKey(), "true"); values.put(SystemPropertyEnum.EMAIL_DOMAIN_RESTRICTION.getKey(), "@mydomain.com"); values.put(SystemPropertyEnum.REPOSITORY_EMAIL.getKey(), "lavoi@mydomain.com"); values.put(SystemPropertyEnum.REPOSITORY_EMAIL_PASSWORD.getKey(), "password"); values.put(SystemPropertyEnum.REPOSITORY_EMAIL_USER.getKey(), "lavoi@mydomain.com"); values.put(SystemPropertyEnum.REPOSITORY_EMAIL_PASSWORD.getKey(), "password"); values.put(SystemPropertyEnum.SOLR_SERVER_URL.getKey(), "http://localhost:8080/solr/"); values.put(SystemPropertyEnum.USER_AUTHENTICATION_MODE.getKey(), "DATABASE"); values.put(SystemPropertyEnum.USER_AUTHENTICATION_DOMAIN_PREFIX.getKey(), "mydomain-"); for (String key : values.keySet()) { SystemPropertyDTO systemPropertyDTO = new SystemPropertyDTO(); systemPropertyDTO.setKey(key);// w w w. j a v a2 s. c o m systemPropertyDTO.setValue(values.get(key)); GenericDAO.getInstance().insert(systemPropertyDTO); logger.info("Property inserted: " + systemPropertyDTO.getKey() + " -> " + systemPropertyDTO.getValue()); } }
From source file:com.concursive.connect.web.modules.members.portlets.InviteMembersPortlet.java
/** * @param request/*from w w w .jav a 2 s .c o m*/ */ private boolean buildMatches(ActionRequest request) throws SQLException { Connection db = PortalUtils.useConnection(request); String[] membersToInvite = request.getParameter(MEMBERS_TO_INVITE).split(","); LinkedHashMap<String, String> members = new LinkedHashMap<String, String>(); LinkedHashMap<String, String> membersPresent = new LinkedHashMap<String, String>(); boolean hasMultipleMatches = false; for (String member : membersToInvite) { members.put(member.trim(), NO_MATCH_FOUND); } //1. Profile Id based Query Iterator<String> keyIterator = members.keySet().iterator(); while (keyIterator.hasNext()) { String profileId = keyIterator.next(); if (members.get(profileId).equals(NO_MATCH_FOUND) && profileId.contains("(")) { // Find user by unique profileId String[] arrNameProfile = profileId.split("\\("); int endIndex = arrNameProfile[1].indexOf(")") < 0 ? arrNameProfile[1].length() : arrNameProfile[1].indexOf(")"); arrNameProfile[1] = arrNameProfile[1].substring(0, endIndex); Project project = ProjectUtils.loadProject(arrNameProfile[1]); if (project == null) { continue; } int userId = project.getOwner(); if (userId > -1) { members = updateMemberList(request, profileId, String.valueOf(userId), members, membersPresent); } } } //2. Email based Query keyIterator = members.keySet().iterator(); while (keyIterator.hasNext()) { String email = keyIterator.next(); if (members.get(email).equals(NO_MATCH_FOUND) && email.contains("@")) { // Find user by email address String strEmail = email.trim(); HashMap<String, String> mapEmail = DimDimUtils.processEmail(strEmail); strEmail = StringUtils.hasText(mapEmail.get(DimDimUtils.EMAIL)) ? mapEmail.get(DimDimUtils.EMAIL) : strEmail; int userId = User.getIdByEmailAddress(db, strEmail); if (userId > -1) { members = updateMemberList(request, email, String.valueOf(userId), members, membersPresent); } } } //3. Name based Query based on first and last name //for the items that did not match in 1.get the names (i.e., first and last names) only (i.e., filter out the emails) //Fetch from users by matching first name and last name if more than one character exists in the last name keyIterator = members.keySet().iterator(); while (keyIterator.hasNext()) { String name = keyIterator.next(); if (members.get(name).equals(NO_MATCH_FOUND) && !name.contains("@")) { String[] nameParts = name.split(" "); UserList userList = new UserList(); if (nameParts.length == 1) { //search first and last name fields UserSearchBean userSearch = new UserSearchBean(); userSearch.setName(nameParts[0]); userList.setSearchCriteria(userSearch); } else if (nameParts.length == 2) { userList.setFirstName(nameParts[0]); userList.setLastName(nameParts[1]); } userList.buildList(db); if (userList.size() > 0) { if (userList.size() > 1) { hasMultipleMatches = true; } StringBuffer idStringBuffer = new StringBuffer(); for (User user : userList) { idStringBuffer.append("," + user.getId()); } members = updateMemberList(request, name, idStringBuffer.toString().substring(1), members, membersPresent); } } } request.getPortletSession().setAttribute(MEMBERS, members); request.getPortletSession().setAttribute(HAS_MULTIPLE_MATCHES, String.valueOf(hasMultipleMatches)); request.getPortletSession().setAttribute(MEMBERS_PRESENT, membersPresent); return members.isEmpty(); }
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
/**************************************************************************** * X_Deny_Create// ww w .ja va2 s.co m ****************************************************************************/ public TreeMap<String, String> getDenyCreate() { TreeMap<String, String> writeAccesses = new TreeMap<String, String>(); LinkedHashMap<String, String> appInfos = getAppInfos("X_Deny_Create");//$NON-NLS-1$ Set<String> keys = appInfos.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); writeAccesses.put(key, appInfos.get(key)); } return writeAccesses; }
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
public TreeMap<String, String> getLookupFields() { TreeMap<String, String> writeAccesses = new TreeMap<String, String>(); LinkedHashMap<String, String> appInfos = getAppInfos("X_Lookup_Field");//$NON-NLS-1$ Set<String> keys = appInfos.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); writeAccesses.put(key, appInfos.get(key)); }/*from www. j a v a2 s. co m*/ return writeAccesses; }