|
From: Irina Z. <i_z...@us...> - 2004-04-21 13:37:29
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26326/src/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Methods for buddylist and interests attributes of user Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- UserManagerImpl.java 16 Apr 2004 09:25:00 -0000 1.8 +++ UserManagerImpl.java 21 Apr 2004 13:36:33 -0000 1.9 @@ -46,6 +46,9 @@ import org.cobricks.user.attribute.AttributeDescriptor; import org.cobricks.user.attribute.AttributeDescriptorManager; import org.cobricks.user.attribute.UserJoin; +import org.globus.test.otherTypes.OtherType; + +import org.omg.PortableInterceptor.USER_EXCEPTION; /** * @author michael.koch @@ -428,6 +431,17 @@ new Integer(objectIdToDelete)); dbAccess.sqlDelete(attributeDescriptor.getTableName(), attrs); + + if (attrname.equalsIgnoreCase(User.INTERESTS)) { + //for attribute interests.categories: delete entry in the table cat_attrsuser + attrs.clear(); + attrs.put("auserid", new Integer(userid)); + attrs.put("catid", new Integer(objectIdToDelete)); + dbAccess.sqlDelete("cat_attrsuser", attrs); + } + + removeUserObjectFromCache(userid); + getUser(userid); } /** @@ -457,6 +471,23 @@ attrs.put(ANAME, attrname); dbAccess.sqlInsert(attributeDescriptor.getTableName(), attrs); + + if (attrname.equalsIgnoreCase(User.INTERESTS)) { + //for attribute interests.categories: insert entry for the table cat_attrsuser + attrs.clear(); + attrs.put("auserid", new Integer(userid)); + attrs.put("catid", new Integer(objectidToAdd)); + attrs.put(CONTEXTCLASS, attributeDescriptor.getContextClassName()); + attrs.put(ANAME, attrname); + dbAccess.sqlInsert("cat_attrsuser", attrs); + } + + //user must be "updated" + removeUserObjectFromCache(userid); + + User currentUser = getUser(userid); + + //currentUser.setAttributeLocally(attrname, ) } /** @@ -690,6 +721,10 @@ return result; } + if (userid < 1) { + return null; + } + result = new User(userid); try { @@ -740,6 +775,7 @@ result.setAttributeLocally(User.USERCLASS, tmps); } + //loop over all tables excepting user_main for (int k = 1; k < (userTables.length - 1); k++) { List userAttrs = new ArrayList(); userAttrs = dbAccess.sqlQuery("select aname, " @@ -747,33 +783,52 @@ + " where userid = " + Integer.toString(userid)); String aname = ""; + String anamePrev = ""; Object avalue = null; + boolean isSet = false; + //loop over result for one table for (Iterator i = userAttrs.iterator(); i.hasNext();) { Map elem = (Map)i.next(); + aname = (String)elem.get(ANAME); AttributeDescriptor attrDescriptor = getAttributeDescriptorManager(result .getAttribute(User.USERCLASS)) .getAttributeDescriptorFor(aname); + isSet = attrDescriptor.getOntologyDataType().isSet(); - if ((avalue != null) - && (attrDescriptor.getOntologyDataType() - .isSet())) { - ((Set)avalue).add(elem.get(userTablesValues[k - 1])); - } else { - if (attrDescriptor.getOntologyDataType().isSet()) { + if ((!(aname.equalsIgnoreCase(anamePrev)) + && (!anamePrev.equalsIgnoreCase("")) && isSet) + || (!i.hasNext() + && (!anamePrev.equalsIgnoreCase("")) && isSet)) { + result.setAttributeLocally(aname, avalue); + } + + anamePrev = aname; + + /*if ((avalue != null) + && (attrDescriptor.getOntologyDataType() + .isSet()))*/ + if (isSet) { + if (avalue != null) { + ((Set)avalue).add(elem.get( + userTablesValues[k - 1])); + } else { //Set avalueSet = new HashSet(); avalue = new HashSet(); ((Set)avalue).add(elem.get( userTablesValues[k - 1])); - } else { - avalue = elem.get(userTablesValues[k - 1]); + + if (!i.hasNext()) { + result.setAttributeLocally(aname, avalue); + } } + } else { + avalue = elem.get(userTablesValues[k - 1]); + result.setAttributeLocally(aname, avalue); } } - - result.setAttributeLocally(aname, avalue); } setUserObjectInCache(result); @@ -853,7 +908,33 @@ } /** - * returns true if user with this userlogin exists param userlogin + * Method for checking if the user with + * + * @param userLogin and + * @param email exist, for "forgot password" function of the plattform + * + * @return user, if it exist, o/w null + **/ + public User checkUser(String userLogin, String email) { + int userid = getUserIdForUserLogin(userLogin); + + if (userid > 0) { + User user = getUser(userid); + + if (user.getAttribute(User.EMAIL).equalsIgnoreCase(email)) { + return user; + } + + return null; + } + + return null; + } + + /** + * @param userlogin + * + * @return true if user with this userlogin exists **/ public boolean checkUser(String userlogin) throws Exception { @@ -976,6 +1057,7 @@ // adding of created user to the UserCache setUserObjectInCache(newUser); + logger.debug("rasmer User cache" + userObjects.size()); return newUser; } @@ -990,7 +1072,7 @@ public Object generateCredential() { Random randomGenerator = new Random(); - //The length of password is between 6 and 8 symbols + //The length of password must be between 6 and 8 symbols int lengthOfPassword = randomGenerator.nextInt(3) + 6; int tmp; StringBuffer sb = new StringBuffer(""); @@ -1173,13 +1255,71 @@ } /** + * This method update * + * @param user with all it's attributes an delete attributes that are not + * longer defined **/ public void updateUser(User user) { + Map attrsNew = new HashMap(); + Map attrsOld = new HashMap(); + Map toDelete = new HashMap(); + attrsNew = user.getAttributes(); + AttributeDescriptor attributeDescriptor = null; + + int userid = user.getId(); + String userclass = user.getAttribute(User.USERCLASS); + + removeUserObjectFromCache(userid); + + User userOld = getUser(userid); + attrsOld = userOld.getAttributes(); + + //the user was not changed + if (attrsOld.equals(attrsNew)) { + return; + } else { + for (Iterator i = attrsOld.entrySet().iterator(); i.hasNext();) { + Map.Entry attribute = (Map.Entry)i.next(); + String aname = (String)attribute.getKey(); + + if (!attrsNew.containsKey(aname)) { + toDelete.put(aname, attribute.getValue()); + } + } + + try { + updateUser(userid, attrsNew); + } catch (CobricksException cE) { + logger.error("ERROR in updateUser(user) ", cE); + } + Map userMainAttrsToDelete = new HashMap(); + Map otherTableAttrsToDelete = new HashMap(); + for (Iterator i = toDelete.entrySet().iterator(); i.hasNext();) { + Map.Entry attrToDelete = (Map.Entry) i.next(); + String aname = (String)attrToDelete.getKey(); + try{ + attributeDescriptor = getAttributeDescriptorManager(userclass).getAttributeDescriptorFor(aname); + }catch (Exception e){} + if (attributeDescriptor.getTableName().equalsIgnoreCase(TABLE_USER_MAIN)){ + userMainAttrsToDelete.put(aname, attrToDelete.getValue()); + } + else{ + otherTableAttrsToDelete.clear(); + otherTableAttrsToDelete.put(User.USERID, new Integer(userid)); + otherTableAttrsToDelete.put(attributeDescriptor.getConditionFieldName(), aname); + dbAccess.sqlDelete(attributeDescriptor.getTableName(), otherTableAttrsToDelete); + } + + } + } } /** + * This method update user with * + * @param userid , just change the attributes in + * @param attrs **/ public void updateUser(int userid, Map attrs) throws CobricksException { @@ -1187,24 +1327,13 @@ String where; AttributeDescriptor attrDesc = null; Map attrsToUpdate = new HashMap(); + StringBuffer where_ = new StringBuffer(); - /* - List attrnames_main = new ArrayList(); - List attrnames_attr = new ArrayList(); - List attrnames_attrcategory = new ArrayList(); - List attrnames_attritem = new ArrayList(); - List attrnames_attruser = new ArrayList(); - List attrnames_attrdate = new ArrayList(); - Map attrs_main = new HashMap(); - Map attrs_attr = new HashMap(); - Map attrs_attrcategory = new HashMap(); - Map attrs_attritem = new HashMap(); - Map attrs_attruser = new HashMap(); - Map attrs_attrdate = new HashMap(); - */ for (Iterator i = attrs.entrySet().iterator(); i.hasNext();) { Map.Entry mEntry = (Map.Entry)i.next(); String aname = (String)(mEntry.getKey()); + String attrColumnName; + Map attrsForTable = new HashMap(); Map uClass = new HashMap(); uClass = dbAccess.sqlQuerySingleRow( @@ -1214,40 +1343,98 @@ User.USERCLASS)).getAttributeDescriptorFor(aname); tableName = attrDesc.getTableName(); + attrColumnName = attrDesc.getValueFieldName(); if (logger.isDebugEnabled()) { logger.debug( "table in UserManagerImpl in updateUser for attr " - + aname + " is " + tableName); + + aname + " (" + attrColumnName + ") " + " is " + + tableName); } - if (attrsToUpdate.containsKey(tableName)) { - ((Map)attrsToUpdate.get(tableName)).put(mEntry.getKey(), - mEntry.getValue()); + if (where_.length() > 0) { + where_.delete(0, where_.length()); + } + + if (!tableName.equalsIgnoreCase(TABLE_USER_MAIN)) { + Map entryToUpdate = new HashMap(); + Object value = mEntry.getValue(); + entryToUpdate.put(attrColumnName, value); + + if (tableName.equalsIgnoreCase(TABLE_USER_ATTR)) { + String avaluepref = (String)value; + + if (avaluepref.length() > 100) { + entryToUpdate.put(AVALUEPREFIX, + avaluepref.substring(0, 99)); + } else { + entryToUpdate.put(AVALUEPREFIX, avaluepref); + } + } + + where_.append(" aname = '"); + where_.append((String)mEntry.getKey()); + where_.append("' and "); + where_.append("userid = "); + where_.append(userid); + where = where_.toString(); + dbAccess.sqlUpdate(tableName, entryToUpdate, where); } else { - attrsForTable.put(mEntry.getKey(), mEntry.getValue()); - attrsToUpdate.put(tableName, attrsForTable); + if (attrsToUpdate.containsKey(tableName)) { + ((Map)attrsToUpdate.get(tableName)).put(attrColumnName, + mEntry.getValue()); + } else { + attrsForTable.put(attrColumnName, mEntry.getValue()); + attrsToUpdate.put(tableName, attrsForTable); + } } } - StringBuffer where_ = new StringBuffer("where userid = "); + /* + for (Iterator i = attrsToUpdate.entrySet().iterator(); i.hasNext();) { + Map.Entry tablesAttrs = (Map.Entry) i.next(); + tableName = (String) tablesAttrs.getKey(); + Map tableMap = (Map) tablesAttrs.getValue(); + StringBuffer where_ = new StringBuffer(""); + if(!tableName.equalsIgnoreCase(TABLE_USER_MAIN)){ + for (Iterator j = tableMap.entrySethasNext(); j.hasNext()){ + Map.Entry tableEntry = (Map.Entry) j.next(); + String anameForUpdate = + Map entryForUpdate = (Map)tableEntry; + } + where_.append(" and aname = " + aname ); + } + where_.append(userid); + } + + StringBuffer where_ = new StringBuffer(""); + if(!tableName.equalsIgnoreCase(TABLE_USER_MAIN)){ + where_.append(" and aname = " + aname ); + } + where_.append(userid); + */ + where_ = where_.delete(0, where_.length()); + where_.append(" userid = "); where_.append(userid); where = where_.toString(); for (Iterator i = attrsToUpdate.entrySet().iterator(); i.hasNext();) { - Map attrsToTable = (Map)i.next(); + Map.Entry entry = (Map.Entry)i.next(); - for (Iterator j = attrsToTable.entrySet().iterator(); - j.hasNext();) { - Map.Entry entry = (Map.Entry)j.next(); - String table = (String)entry.getKey(); - dbAccess.sqlUpdate(table, (Map)entry.getValue(), where); + // for (Iterator j = attrsToTable.entrySet().iterator(); + // j.hasNext();) { + // Map.Entry entry = (Map.Entry)j.next(); + String table = (String)entry.getKey(); + dbAccess.sqlUpdate(table, (Map)entry.getValue(), where); - if (logger.isDebugEnabled()) { - logger.debug("update table " + table); - } + //userObjects.r + if (logger.isDebugEnabled()) { + logger.debug("update table " + table); } } + + removeUserObjectFromCache(userid); + getUser(userid); } /** |
|
From: Irina Z. <i_z...@us...> - 2004-04-21 14:06:45
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32750/src/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: updateUser(user) Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- UserManagerImpl.java 21 Apr 2004 13:36:33 -0000 1.9 +++ UserManagerImpl.java 21 Apr 2004 14:05:55 -0000 1.10 @@ -46,6 +46,7 @@ import org.cobricks.user.attribute.AttributeDescriptor; import org.cobricks.user.attribute.AttributeDescriptorManager; import org.cobricks.user.attribute.UserJoin; + import org.globus.test.otherTypes.OtherType; import org.omg.PortableInterceptor.USER_EXCEPTION; @@ -1265,6 +1266,7 @@ Map attrsOld = new HashMap(); Map toDelete = new HashMap(); attrsNew = user.getAttributes(); + AttributeDescriptor attributeDescriptor = null; int userid = user.getId(); @@ -1293,25 +1295,35 @@ } catch (CobricksException cE) { logger.error("ERROR in updateUser(user) ", cE); } + Map userMainAttrsToDelete = new HashMap(); Map otherTableAttrsToDelete = new HashMap(); + for (Iterator i = toDelete.entrySet().iterator(); i.hasNext();) { - Map.Entry attrToDelete = (Map.Entry) i.next(); + Map.Entry attrToDelete = (Map.Entry)i.next(); String aname = (String)attrToDelete.getKey(); - try{ - attributeDescriptor = getAttributeDescriptorManager(userclass).getAttributeDescriptorFor(aname); - }catch (Exception e){} - if (attributeDescriptor.getTableName().equalsIgnoreCase(TABLE_USER_MAIN)){ - userMainAttrsToDelete.put(aname, attrToDelete.getValue()); + + try { + attributeDescriptor = getAttributeDescriptorManager(userclass) + .getAttributeDescriptorFor(aname); + } catch (Exception e) { } - else{ + + if (attributeDescriptor.getTableName().equalsIgnoreCase(TABLE_USER_MAIN)) { + userMainAttrsToDelete.put(aname, attrToDelete.getValue()); + } else { otherTableAttrsToDelete.clear(); - otherTableAttrsToDelete.put(User.USERID, new Integer(userid)); - otherTableAttrsToDelete.put(attributeDescriptor.getConditionFieldName(), aname); - dbAccess.sqlDelete(attributeDescriptor.getTableName(), otherTableAttrsToDelete); + otherTableAttrsToDelete.put(User.USERID, + new Integer(userid)); + otherTableAttrsToDelete.put(attributeDescriptor + .getConditionFieldName(), aname); + dbAccess.sqlDelete(attributeDescriptor.getTableName(), + otherTableAttrsToDelete); } - } + //user_main handle + //for + } } |
|
From: Irina Z. <i_z...@us...> - 2004-04-27 17:42:31
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22690/src/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- UserManagerImpl.java 26 Apr 2004 22:44:07 -0000 1.11 +++ UserManagerImpl.java 27 Apr 2004 17:42:22 -0000 1.12 @@ -1550,75 +1550,7 @@ PreparedStatement preparedStatement) { } - /** - * takes a list of attributes the searched users have to match and - * returns a list of userids of the matching users (as Integer objects) - * - * @param query - Map of attributes of query - * @param orflag - * - * @return List of userids (as Integer objects) - * - * @yahoo.de - **/ - private Collection getUnsortedUserIdList(Map query, boolean orflag) { // TBD: extend profileManager to support orflag and sortby - - Set result = new HashSet(); - List resultTmp = new ArrayList(); - - // for the result of sqlQuery - List of Maps - List fields = new ArrayList(); - fields.add(User.USERID); - fields.add(ANAME); - fields.add(AVALUE); - - int querySize = query.size(); - - if (orflag) { - querySize = 1; - } - - if (!query.isEmpty()) { - resultTmp = dbAccess.sqlSelect(TABLE_USER_ATTR, query, fields); - - if (!resultTmp.isEmpty()) { - // Iterator k = resultTmp.iterator(); - int resultTmpSize = resultTmp.size(); - - logger.debug("result size is " + resultTmpSize); - - Map res = new HashMap(); - String key = ""; - Integer controlUserid = new Integer(0); - int sumOfMatchedCond = 0; - - for (Iterator i = resultTmp.iterator(); i.hasNext();) { - Integer currentUserId = (Integer)((Map)i.next()).get(User.USERID); - - if (currentUserId != null) { - if (orflag) { - result.add(currentUserId); - } else if (!(controlUserid.equals(currentUserId))) { - if (sumOfMatchedCond == querySize) { - result.add(controlUserid); - } - - controlUserid = currentUserId; - sumOfMatchedCond = 1; - } else { - sumOfMatchedCond++; - } - } - } - } else { //redirect to message "There are no users with this attributes" - logger.debug("There are no users with this attributes"); - } - } - - // TBD - return result; - } - + private void doSqlInsert(String tableName, Map fields, Object customFieldValue, String customFieldName) { if (!(customFieldValue instanceof Set)) { @@ -1759,149 +1691,4 @@ return userHandler; } - /** - * - */ - public static class UserPropertiesComparator - implements Comparator { - private static final int SORT_ORDER_ASC = 1; - private static final int SORT_ORDER_DESC = -1; - public static final String SORT_ORDER_NAME_ASC = "asc"; - public static final String SORT_ORDER_NAME_DESC = "desc"; - private String attrNames[]; - private int orders[]; - private boolean userLoginAvialable = false; - private int conditionsAmount; - - public UserPropertiesComparator(String conditions) { - StringTokenizer commaTokenizer = new StringTokenizer(conditions, - ","); - int count = 0; - conditionsAmount = commaTokenizer.countTokens(); - attrNames = new String[conditionsAmount + 1]; - orders = new int[attrNames.length]; - - while (commaTokenizer.hasMoreTokens()) { - String token = commaTokenizer.nextToken(); - int order = SORT_ORDER_ASC; - StringTokenizer spaceTokenizer = new StringTokenizer(token, - " "); - String attrName = spaceTokenizer.nextToken(); - - if (attrName.equals("")) { - attrName = spaceTokenizer.nextToken(); - } - - if (spaceTokenizer.hasMoreTokens()) { - String orderToken = spaceTokenizer.nextToken(); - - if (orderToken.equalsIgnoreCase(SORT_ORDER_NAME_DESC)) { - order = SORT_ORDER_DESC; - } else if (!orderToken.equalsIgnoreCase( - SORT_ORDER_NAME_ASC)) { - logger.warn("unknown sorting order: '" + orderToken - + "' . Assuming ascending order"); - } - } - - attrNames[count] = attrName; - orders[count] = order; - - if (attrName.equalsIgnoreCase(User.USERLOGIN)) { - userLoginAvialable = true; - } - - count++; - } - - if (!userLoginAvialable) { - attrNames[count] = User.USERLOGIN; - orders[count] = SORT_ORDER_ASC; - conditionsAmount++; - } else { - String newAttrNames[] = new String[conditionsAmount]; - int newOrders[] = new int[conditionsAmount]; - - for (int i = 0; i < conditionsAmount; i++) { - newAttrNames[i] = attrNames[i]; - newOrders[i] = orders[i]; - } - - attrNames = newAttrNames; - orders = newOrders; - } - } - - /** - * @return - **/ - public boolean isConditionVoid() { - return (!userLoginAvialable && (attrNames.length == 1)); - } - - public String[] getSortingFields() { - return attrNames; - } - - public int compare(Object o1, Object o2) { - Map user1 = (Map)o1; - - Map user2 = (Map)o2; - - for (int i = 0; i < attrNames.length; i++) { - int comparisonResult = comparePrimitives(user1.get( - attrNames[i]), user2.get(attrNames[i])) * orders[i]; - - if (comparisonResult != 0) { - return comparisonResult; - } - } - - logger.error("MAY DAY!!!"); - - return 0; - } - - private int comparePrimitives(Object o1, Object o2) { - if (o1 == null) { - if (o2 == null) { - return 0; - } else { - return -1; - } - } else if (o2 == null) { - return 1; - } - - if (!o1.getClass().equals(o2.getClass())) { - throw new ArrayIndexOutOfBoundsException("can not compare " - + o1.getClass().getName() + " with " - + o2.getClass().getName()); - } - - if (o1 instanceof String) { - String s1 = (String)o1; - String s2 = (String)o2; - - return s1.compareTo(s2); - } - - if (o1 instanceof Integer) { - Integer i1 = (Integer)o1; - Integer i2 = (Integer)o2; - - return i1.compareTo(i2); - } - - if (o1 instanceof java.sql.Timestamp) { - java.sql.Timestamp t1 = (java.sql.Timestamp)o1; - java.sql.Timestamp t2 = (java.sql.Timestamp)o2; - - return t1.compareTo(t2); - } - - // TBD - return 0; - } - } -} + } |
|
From: Irina Z. <i_z...@us...> - 2004-04-30 14:33:56
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24326/src/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- UserManagerImpl.java 30 Apr 2004 13:37:19 -0000 1.14 +++ UserManagerImpl.java 30 Apr 2004 14:33:43 -0000 1.15 @@ -434,14 +434,6 @@ dbAccess.sqlDelete(attributeDescriptor.getTableName(), attrs); - if (attrname.equalsIgnoreCase(User.INTERESTS)) { - //for attribute interests.categories: delete entry in the table cat_attrsuser - attrs.clear(); - attrs.put("auserid", new Integer(userid)); - attrs.put("catid", new Integer(objectIdToDelete)); - dbAccess.sqlDelete("cat_attrsuser", attrs); - } - removeUserObjectFromCache(userid); getUser(userid); } @@ -474,16 +466,6 @@ dbAccess.sqlInsert(attributeDescriptor.getTableName(), attrs); - if (attrname.equalsIgnoreCase(User.INTERESTS)) { - //for attribute interests.categories: insert entry for the table cat_attrsuser - attrs.clear(); - attrs.put("auserid", new Integer(userid)); - attrs.put("catid", new Integer(objectidToAdd)); - attrs.put(CONTEXTCLASS, attributeDescriptor.getContextClassName()); - attrs.put(ANAME, attrname); - dbAccess.sqlInsert("cat_attrsuser", attrs); - } - //user must be "updated" removeUserObjectFromCache(userid); |
|
From: Irina Z. <i_z...@us...> - 2004-06-21 17:15:09
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27296/src/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- UserManagerImpl.java 6 Jun 2004 22:09:46 -0000 1.18 +++ UserManagerImpl.java 21 Jun 2004 17:15:00 -0000 1.19 @@ -9,7 +9,6 @@ * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. */ - package org.cobricks.user; import java.io.File; @@ -53,10 +52,11 @@ import org.omg.PortableInterceptor.USER_EXCEPTION; /** - * @author mic...@ac... + * @author michael.koch * @version $Date$ + * + * @acm.org **/ - public class UserManagerImpl extends ComponentManagerAdaptor implements UserManager { @@ -100,6 +100,7 @@ "itemid", "avalue" }; + public static final Map userTablesValuesCorresponding = new HashMap(); /** * user_main table fields names @@ -466,7 +467,13 @@ //set attribute for user in cache User currentUser = getUser(userid); - Set attribute = (Set)currentUser.getAttributes().get(attrname); + Set attribute = new HashSet(); + attribute = (Set)currentUser.getAttributes().get(attrname); + + if (attribute == null) { + attribute = new HashSet(); + } + attribute.add(new Integer(objectidToAdd)); // currentUser.getAttributes().remove(attrname); @@ -593,7 +600,6 @@ String sql; //String userclass = UNIVERSITY_USER_ONTOLOGY_CLASS_NAME; - //zwischenergebnis List result; @@ -753,12 +759,15 @@ List userAttrs = new ArrayList(); userAttrs = dbAccess.sqlQuery("select aname, " + userTablesValues[k - 1] + " from " + userTables[k] - + " where userid = " + Integer.toString(userid)); + + " where userid = " + Integer.toString(userid) + + " order by aname"); String aname = ""; String anamePrev = ""; Object avalue = null; + boolean isSet = false; + boolean prevIsSet = false; //loop over result for one table for (Iterator i = userAttrs.iterator(); i.hasNext();) { @@ -769,25 +778,33 @@ AttributeDescriptor attrDescriptor = getAttributeDescriptorManager(result .getAttribute(User.USERCLASS)) .getAttributeDescriptorFor(aname); + AttributeDescriptor prevAttrDesc = getAttributeDescriptorManager(result + .getAttribute(User.USERCLASS)) + .getAttributeDescriptorFor(anamePrev); isSet = attrDescriptor.getOntologyDataType().isSet(); + prevIsSet = prevAttrDesc.getOntologyDataType().isSet(); - if ((!(aname.equalsIgnoreCase(anamePrev)) - && (!anamePrev.equalsIgnoreCase("")) && isSet) - || (!i.hasNext() - && (!anamePrev.equalsIgnoreCase("")) && isSet - && (aname.equalsIgnoreCase(anamePrev)))) { - result.setAttributeLocally(aname, avalue); + if (avalue instanceof Set) { + if ((!(aname.equalsIgnoreCase(anamePrev)) + && (!anamePrev.equalsIgnoreCase("")) + && prevIsSet) + || (!i.hasNext() + && (!anamePrev.equalsIgnoreCase("")) + && prevIsSet + && (aname.equalsIgnoreCase(anamePrev)))) { + result.setAttributeLocally(anamePrev, avalue); + } + } + + if (!aname.equalsIgnoreCase(anamePrev)) { + avalue = null; } - if (!aname.equalsIgnoreCase(anamePrev)){ - avalue = null; - } anamePrev = aname; /*if ((avalue != null) && (attrDescriptor.getOntologyDataType() .isSet()))*/ - if (isSet) { if (avalue != null) { ((Set)avalue).add(elem.get( @@ -1034,8 +1051,8 @@ newUser.setAttributesLocally(attrs); //and sending of an event - ComponentEvent event = - new ComponentEventImpl("user", "user", "create"); + ComponentEvent event = new ComponentEventImpl("user", "user", + "create"); event.setObjectId(userId); if (newUser != null) { @@ -1237,7 +1254,8 @@ List idResult = new ArrayList(); try { - idResult = getUserIdList(attrs, orFlag, sortby, numberOfResults, userclass); + idResult = getUserIdList(attrs, orFlag, sortby, numberOfResults, + userclass); } catch (Exception e) { logger.error("Exception in searchUsers()" + e); } @@ -1349,6 +1367,7 @@ for (Iterator i = attrs.entrySet().iterator(); i.hasNext();) { Map.Entry mEntry = (Map.Entry)i.next(); String aname = (String)(mEntry.getKey()); + Object avalue = mEntry.getValue(); Map attrsForTable = new HashMap(); @@ -1356,67 +1375,75 @@ attrDesc = getAttributeDescriptorManager(uClass) .getAttributeDescriptorFor(aname); - tableName = attrDesc.getTableName(); - attrColumnName = attrDesc.getValueFieldName(); + if (!attrDesc.getOntologyDataType().isSet()) { + tableName = attrDesc.getTableName(); + attrColumnName = attrDesc.getValueFieldName(); - if (!oldAttrs.containsKey(aname)) { - attrDesc = getAttributeDescriptorManager(uClass) - .getAttributeDescriptorFor(aname); + if (!oldAttrs.containsKey(aname)) { + attrDesc = getAttributeDescriptorManager(uClass) + .getAttributeDescriptorFor(aname); - if (tableName.equalsIgnoreCase(TABLE_USER_MAIN)) { - attrsToUpdate.put(attrColumnName, avalue); - } else { - if (toInsert.containsKey(tableName)) { - ((Map)toInsert.get(tableName)).put(aname, avalue); + if (tableName.equalsIgnoreCase(TABLE_USER_MAIN)) { + attrsToUpdate.put(attrColumnName, avalue); } else { - attrsForTable.put(aname, avalue); - toInsert.put(tableName, attrsForTable); - } + if (toInsert.containsKey(tableName)) { + ((Map)toInsert.get(tableName)).put(aname, avalue); + } else { + attrsForTable.put(aname, avalue); + toInsert.put(tableName, attrsForTable); + } - updateUser.setAttributeLocally(aname, avalue); - } - } else { - if (logger.isDebugEnabled()) { - /*logger.debug( - "table in UserManagerImpl in updateUser for attr " - + aname + " (" + attrColumnName + ") " + " is " - + tableName); - */ - } + if (aname.equalsIgnoreCase(User.USERLOGIN)) { + updateUser.setUserLogin((String)mEntry.getValue()); + } else { + updateUser.setAttributeLocally(aname, avalue); + } + } + } else { + if (logger.isDebugEnabled()) { + /*logger.debug( + "table in UserManagerImpl in updateUser for attr " + + aname + " (" + attrColumnName + ") " + " is " + + tableName); + */ + } - if (where_.length() > 0) { - where_.delete(0, where_.length()); - } + if (where_.length() > 0) { + where_.delete(0, where_.length()); + } - if (!tableName.equalsIgnoreCase(TABLE_USER_MAIN)) { - Map entryToUpdate = new HashMap(); - Object value = mEntry.getValue(); - entryToUpdate.put(attrColumnName, value); + if (!tableName.equalsIgnoreCase(TABLE_USER_MAIN)) { + Map entryToUpdate = new HashMap(); + Object value = mEntry.getValue(); + entryToUpdate.put(attrColumnName, value); - if (tableName.equalsIgnoreCase(TABLE_USER_ATTR)) { - String avaluepref = (String)value; + if (tableName.equalsIgnoreCase(TABLE_USER_ATTR)) { + String avaluepref = (String)value; - if (avaluepref.length() > 100) { - entryToUpdate.put(AVALUEPREFIX, - avaluepref.substring(0, 99)); - } else { - entryToUpdate.put(AVALUEPREFIX, avaluepref); + if (avaluepref.length() > 100) { + entryToUpdate.put(AVALUEPREFIX, + avaluepref.substring(0, 99)); + } else { + entryToUpdate.put(AVALUEPREFIX, avaluepref); + } } + + where_.append(" aname = '"); + where_.append((String)mEntry.getKey()); + where_.append("' and "); + where_.append(" userid = "); + where_.append(userid); + where = where_.toString(); + dbAccess.sqlUpdate(tableName, entryToUpdate, where); + } else { // user_main only!!! + attrsToUpdate.put(attrColumnName, mEntry.getValue()); } - where_.append(" aname = '"); - where_.append((String)mEntry.getKey()); - where_.append("' and "); - where_.append(" userid = "); - where_.append(userid); - where = where_.toString(); - dbAccess.sqlUpdate(tableName, entryToUpdate, where); - } else { // user_main only!!! - attrsToUpdate.put(attrColumnName, mEntry.getValue()); + //update attribute of user Object in cache + updateUser.setAttributeLocally(aname, mEntry.getValue()); } - - //update attribute of user Object in cache - updateUser.setAttributeLocally(aname, mEntry.getValue()); + } else { + updateSetAttribute(userid, aname, avalue); } } @@ -1430,7 +1457,9 @@ //for (Iterator i = attrsToUpdate.entrySet().iterator(); i.hasNext();) { // Map.Entry entry = (Map.Entry)i.next(); // String table = (String)entry.getKey(); - dbAccess.sqlUpdate(TABLE_USER_MAIN, attrsToUpdate, where); + if (!attrsToUpdate.isEmpty()) { + dbAccess.sqlUpdate(TABLE_USER_MAIN, attrsToUpdate, where); + } if (logger.isDebugEnabled()) { logger.debug("update table " + TABLE_USER_MAIN); @@ -1457,6 +1486,80 @@ } /** + * help function for updating of user attributes of type Set + **/ + private void updateSetAttribute(int userid, String attrname, + Object attrvalue) { + User currentUser = getUser(userid); + String userclass = currentUser.getAttribute(attrname); + AttributeDescriptor attrDesc = null; + List oldValues = new ArrayList(); + List newValues = new ArrayList(); + + try { + attrDesc = getAttributeDescriptorManager(userclass) + .getAttributeDescriptorFor(attrname); + } catch (CobricksException ce1) { + } + + if (!attrDesc.getOntologyDataType().isSet()) { + return; + } else { + String table = attrDesc.getTableName(); + List oldValuesTmp = dbAccess.sqlQuery("select " + + getValueForTable(table) + " from " + table + + " where userid = " + Integer.toString(userid) + + " and aname = " + "'" + attrname + "'"); + + for (Iterator i = oldValuesTmp.iterator(); i.hasNext();) { + Map entry = (Map)i.next(); + + for (Iterator j = entry.entrySet().iterator(); j.hasNext();) { + Map.Entry mEntry = (Map.Entry)j.next(); + oldValues.add(mEntry.getValue()); + } + } + + StringTokenizer commaTokenizer = new StringTokenizer(((String)attrvalue) + .trim(), ","); + + while (commaTokenizer.hasMoreTokens()) { + newValues.add(commaTokenizer.nextToken().trim()); + } + + for (Iterator i = newValues.iterator(); i.hasNext();) { + String value = (String)i.next(); + + if (!oldValues.contains(value)) { + Map insertValue = new HashMap(); + + if (table.equalsIgnoreCase(TABLE_USER_ATTR)) { + insertValue.put(ANAME, attrname); + insertValue.put(AVALUEPREFIX, value); + insertValue.put(AVALUE, value); + insertValue.put("userid", new Integer(userid)); + } + + dbAccess.sqlInsert(table, insertValue); + } + } + + for (Iterator i = oldValues.iterator(); i.hasNext();) { + String value = (String)i.next(); + + if (!newValues.contains(value)) { + Map deleteValue = new HashMap(); + deleteValue.put(ANAME, attrname); + deleteValue.put("userid", new Integer(userid)); + dbAccess.sqlDelete(table, deleteValue); + } + } + + currentUser.setAttributeLocally(attrname, newValues); + } + } + + /** * caching user objects **/ protected User getUserObjectFromCache(int userid) { @@ -1689,4 +1792,15 @@ return userHandler; } + + private String getValueForTable(String value) { + if (userTablesValuesCorresponding.isEmpty()) { + for (int i = 0; i < userTables.length; i++) { + userTablesValuesCorresponding.put(userTables[i + 1], + userTablesValues[i]); + } + } + + return (String)userTablesValuesCorresponding.get(value); + } } |
|
From: Michael K. <ko...@us...> - 2004-07-09 11:40:56
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10964 Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- UserManagerImpl.java 30 Jun 2004 07:48:20 -0000 1.21 +++ UserManagerImpl.java 9 Jul 2004 11:40:48 -0000 1.22 @@ -48,10 +48,6 @@ import org.cobricks.user.attribute.AttributeDescriptorManager; import org.cobricks.user.attribute.UserJoin; -import org.globus.test.otherTypes.OtherType; - -import org.omg.PortableInterceptor.USER_EXCEPTION; - /** * @author michael.koch * @version $Date$ |
|
From: Michael K. <ko...@us...> - 2004-09-01 13:28:52
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15020 Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- UserManagerImpl.java 27 Aug 2004 07:08:10 -0000 1.28 +++ UserManagerImpl.java 1 Sep 2004 13:28:43 -0000 1.29 @@ -1591,7 +1591,11 @@ if (table.equalsIgnoreCase(TABLE_USER_ATTR)) { insertValue.put(ANAME, attrname); - insertValue.put(AVALUEPREFIX, value); + String valueprefix = value; + if (valueprefix.length() > 100) { + valueprefix = valueprefix.substring(0, 99); + } + insertValue.put(AVALUEPREFIX, valueprefix); insertValue.put(AVALUE, value); insertValue.put("userid", new Integer(userid)); } @@ -1756,7 +1760,11 @@ Object o = data.getValue(); if (o == null) continue; String value = o.toString(); - tableData.put(AVALUEPREFIX, attrDesc.valueToCondition(value)); + String valueprefix = value; + if (valueprefix.length() > 100) { + valueprefix = valueprefix.substring(0, 99); + } + tableData.put(AVALUEPREFIX, attrDesc.valueToCondition(valueprefix)); OntologyDataType odt = attrDesc.getOntologyDataType(); int len = odt.getMaxLength(); if (len > 0 && value.length()>len) |
|
From: Michael K. <ko...@us...> - 2004-10-26 00:55:49
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14141 Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- UserManagerImpl.java 26 Oct 2004 00:46:35 -0000 1.32 +++ UserManagerImpl.java 26 Oct 2004 00:55:39 -0000 1.33 @@ -1213,7 +1213,8 @@ // if the main table(s) have been created, then add a admin user // with all access rights ... if (newmaintable) { - logger.info("newmain...ende"); + logger.info("Creating admin user and access permissions"); + // 1. add the user String userlogin = "admin"; Map attrs = new HashMap(); @@ -1247,7 +1248,6 @@ } } - logger.info("...ende"); } /** |
|
From: Michael K. <ko...@us...> - 2004-12-17 14:26:32
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15173 Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- UserManagerImpl.java 10 Dec 2004 17:27:17 -0000 1.38 +++ UserManagerImpl.java 17 Dec 2004 14:26:22 -0000 1.39 @@ -725,7 +725,6 @@ User result = getUserObjectFromCache(userid); if (result != null) { - logger.info("Return user object from cache"); return result; } |
|
From: Michael K. <ko...@us...> - 2005-01-19 15:56:51
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4033 Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- UserManagerImpl.java 17 Dec 2004 14:26:22 -0000 1.39 +++ UserManagerImpl.java 19 Jan 2005 15:56:27 -0000 1.40 @@ -315,10 +315,36 @@ User user = getUser(userid); if (user == null) return null; // handle rules ... currently we just check the aname+".acc" attribute - // for a substring "web" String acc = user.getAttribute(aname+".acc"); if (acc == null) return user.getAttribute(aname); - if (acc.indexOf("web")>-1) return user.getAttribute(aname); + if (acc.equals("1")) return user.getAttribute(aname); + return null; + } + + /** + * Return the value of a user attribute for a display destination. + * The rule for determining the result is to check the user attribute + * aname+".acc."+destinationid - if it is "1" or not defined + * then return the value, otherwise (other value) return null. + * + * @param userid The id of the user. + * @param aname The name of the attribute. + * @param requserid The id of the requesting user. + * @param destinationid The id of the destination, e.g. "mm" for + * the meeting mirror + * @return The value of the user attribute. + */ + public Object getUserAttr(int userid, String aname, int requserid, + String destinationid) + { + User user = getUser(userid); + if (user == null) return null; + String anameacc = aname+".acc"; + if (destinationid!=null && destinationid.length()>0) + anameacc = anameacc + "." + destinationid.trim(); + String acc = user.getAttribute(anameacc); + if (acc == null) return user.getAttribute(aname); + if (acc.equals("1")) return user.getAttribute(aname); return null; } |
|
From: Michael K. <ko...@us...> - 2005-02-08 16:20:14
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15015/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- UserManagerImpl.java 25 Jan 2005 14:33:27 -0000 1.41 +++ UserManagerImpl.java 8 Feb 2005 16:20:04 -0000 1.42 @@ -1204,21 +1204,14 @@ super.init(componentId, managerId, properties, coreManager, dbAccess); // load the user ontology - File file = new File((String)properties.get("configdir") - + File.separator + componentId + File.separator - + "userontology.xml"); - - //ontology = coreManager.parseOntologyFile(file); - //ontology = coreManager.parseOntologyFile(file, UserProfileModel.class); ontology = coreManager.loadOntology("user", UserProfileModel.class); - if (ontology == null) { logger.warn("Did not load user ontology"); } // now check for the user component database tables logger.info("Checking and updating the user component database" - + " tables"); + + " tables"); boolean newmaintable = false; Set set = dbAccess.getComponentTableNames(getComponentId()); @@ -1837,7 +1830,7 @@ if (pos < 0) { // check if there is a default user handler // - if not, then return - if (getProperty("user.domain.default.class")==null) + if (getProperty("user.domain.default.class") == null) return null; } else { domain = (userlogin.substring(pos + 1)).trim(); @@ -1856,11 +1849,11 @@ // instantiate class String handlerClassName = getProperty("user.domain." + domain + ".class"); - if (handlerClassName == null) { return null; } + logger.debug("Instantiate UserHandler from class "+handlerClassName); try { Class c = Class.forName(handlerClassName); userHandler = (UserHandler)c.newInstance(); |
|
From: Michael K. <ko...@us...> - 2005-02-21 15:57:23
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13710 Modified Files: UserManagerImpl.java Log Message: Changes and additions for supporting Liberty Alliance Single Sign-On. Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- UserManagerImpl.java 11 Feb 2005 14:43:23 -0000 1.43 +++ UserManagerImpl.java 21 Feb 2005 15:56:41 -0000 1.44 @@ -47,10 +47,10 @@ import org.cobricks.core.exceptions.CobricksException; import org.cobricks.core.util.IOUtil; import org.cobricks.core.util.LogUtil; - import org.cobricks.user.attribute.AttributeDescriptor; import org.cobricks.user.attribute.AttributeDescriptorManager; import org.cobricks.user.attribute.UserJoin; +import org.cobricks.user.liberty.idff.LAIdffBridge; /** * @@ -1878,4 +1878,17 @@ } return (String)userTablesValuesCorresponding.get(value); } + + + /** + * Function needed for Liberty Alliance Single Sign-On (org.cobricks.user.liberty.idff) + * to get an instance of LDIdffBridge in the Velocity templates. + */ + public LAIdffBridge getLAIdffBridge() + { + LAIdffBridge bridge = LAIdffBridge.getSingleInstance(); + return bridge; + } + + } |
|
From: Michael K. <ko...@us...> - 2005-04-13 16:09:25
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27608 Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- UserManagerImpl.java 12 Apr 2005 13:09:24 -0000 1.46 +++ UserManagerImpl.java 13 Apr 2005 16:09:13 -0000 1.47 @@ -1870,7 +1870,15 @@ String handlerClassName = getProperty("user.domain." + domain + ".class"); if (handlerClassName == null) { - return null; + // check default handler + if (getProperty("user.domain.default.class") == null) + return null; + domain = "default"; + handlerClassName = getProperty("user.domain." + domain + + ".class"); + if (handlerClassName == null) { + return null; + } } logger.debug("Instantiate UserHandler from class "+handlerClassName); |
|
From: Michael K. <ko...@us...> - 2005-11-29 07:18:46
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2355/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- UserManagerImpl.java 21 Oct 2005 15:56:46 -0000 1.51 +++ UserManagerImpl.java 29 Nov 2005 07:18:38 -0000 1.52 @@ -1863,9 +1863,16 @@ } } + /** * */ + public void resetCache() + { + userObjects = new HashMap(); + } + + /** * */ |
|
From: lochmann <loc...@us...> - 2006-02-12 19:43:47
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28352/src/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Social Networks. Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- UserManagerImpl.java 12 Feb 2006 19:08:26 -0000 1.56 +++ UserManagerImpl.java 12 Feb 2006 19:43:39 -0000 1.57 @@ -173,7 +173,7 @@ private LinkedHashMap userGraphCacheOutgoing; /* Maximum size of paths */ - private static final int USER_GRAPH_MAX_PATH_SIZE = 8; + private static final int USER_GRAPH_MAX_PATH_SIZE = 10; /* * Class that overrides LinkedHashMap. |
|
From: Michael K. <ko...@us...> - 2006-02-16 15:21:16
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8500/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- UserManagerImpl.java 12 Feb 2006 19:43:39 -0000 1.57 +++ UserManagerImpl.java 16 Feb 2006 15:21:08 -0000 1.58 @@ -1166,18 +1166,14 @@ newUser.setAttributesLocally(attrs); //and sending of an event - ComponentEvent event = new ComponentEventImpl("user", "user", - "create"); - event.setObjectId(userId); - if (newUser != null) { + ComponentEvent event = + new ComponentEventImpl("user", "user", "create"); + event.setObject(newUser); event.setUserId(userId); - } else { - event.setUserId(0); + this.publishEvent(event); } - this.publishEvent(event); - return newUser; } } @@ -1217,6 +1213,8 @@ public void deleteUser(int userid) throws Exception { + User user = getUser(userid); + Map conditions = new HashMap(); conditions.put(User.USERID, new Integer(userid)); @@ -1236,8 +1234,9 @@ removeUserObjectFromCache(userid); //event sending - ComponentEvent event = new ComponentEventImpl("user", "user", "delete"); - event.setObjectId(0); + ComponentEvent event = + new ComponentEventImpl("user", "user", "delete"); + event.setObject(user); this.publishEvent(event); } @@ -1601,14 +1600,13 @@ } // and finally send an event - ComponentEvent event = new ComponentEventImpl("user", "user", "update"); - event.setObjectId(userid); if (updateUser != null) { + ComponentEvent event = + new ComponentEventImpl("user", "user", "update"); + event.setObject(updateUser); event.setUserId(userid); - } else { - event.setUserId(0); + this.publishEvent(event); } - this.publishEvent(event); } |
|
From: lochmann <loc...@us...> - 2006-02-26 15:51:24
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3768/src/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Social Networks (Floyd-Warshall-Algorithm) Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- UserManagerImpl.java 16 Feb 2006 15:21:08 -0000 1.58 +++ UserManagerImpl.java 26 Feb 2006 15:51:14 -0000 1.59 @@ -34,6 +34,7 @@ import java.util.StringTokenizer; import java.util.TreeSet; import java.util.LinkedHashMap; +import java.util.TreeMap; import org.apache.log4j.Logger; @@ -55,2342 +56,2470 @@ import org.cobricks.user.attribute.UserJoin; import org.cobricks.user.liberty.idff.LAIdffBridge; [...4522 lines suppressed...] + // + from + // + "-" + // + intermed + // + "-" + // + to); + floydWarshallMatrix[from][to] = new ArrayList( + floydWarshallMatrix[from][intermed]); + floydWarshallMatrix[from][to].add(new Integer( + intermed)); + floydWarshallMatrix[from][to] + .addAll(floydWarshallMatrix[intermed][to]); + } + } + } + } + } + } + } +} \ No newline at end of file |
|
From: Michael K. <ko...@us...> - 2006-05-08 07:48:04
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2881/org/cobricks/user Modified Files: UserManagerImpl.java Log Message: Index: UserManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/user/UserManagerImpl.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- UserManagerImpl.java 12 Mar 2006 22:57:59 -0000 1.60 +++ UserManagerImpl.java 8 May 2006 07:48:00 -0000 1.61 @@ -880,7 +880,9 @@ if (tmpdate != null) { result.setAttributeLocally(User.REGTIME, tmpdate); } - tmpdate = (Date) map.get("lastlogin"); + try { + tmpdate = (Date) map.get("lastlogin"); + } catch (Exception e) { } if (tmpdate != null) { result.setAttributeLocally(User.LASTLOGIN, tmpdate); } |