public boolean equals(Object obj) { if (!(obj instanceof RoleAndFunction)) return false; if (this == obj) return true; RoleAndFunction other = (RoleAndFunction) obj; if (StringUtil.different(this.role, other.role)) return false; if (StringUtil.different(this.function, other.function)) return false; return true; }
/** * @inheritDoc */ public int[] parseLayoutHints() { try { if (m_layoutHints == null) { return null; } String[] parts = StringUtil.split(m_layoutHints, ","); if (parts.length < 2) { return null; } int[] rv = new int[2]; rv[0] = Integer.parseInt(parts[0]); rv[1] = Integer.parseInt(parts[1]); return rv; } catch (Exception t) { return null; } }
protected String getGroupNameFromContext(String context) { String retVal = ""; if (context != null) { int index = context.indexOf("group-"); if (index != -1) { String[] parts = StringUtil.splitFirst(context, "-"); if (parts.length > 1) { retVal = parts[1]; } } else { retVal = context; } } return retVal; }
String prefix[] = StringUtil.splitFirst((id.length() > 1) ? id.substring(1) : "", Entity.SEPARATOR); if (prefix.length > 0) String parts[] = StringUtil.split(id, Entity.SEPARATOR); boolean checkForAlias = true; boolean checkForUserIdEid = false; String newId = StringUtil.unsplit(parts, Entity.SEPARATOR); String newId = StringUtil.unsplit(parts, Entity.SEPARATOR);
rv[0] = StringUtil.referencePath(((ContentResource) r).getId()); rv[1] = ((BasicGroupAwareEdit) r).getContext(); rv[2] = Long.valueOf(((ContentResource) r).getContentLength()); rv[3] = ((BasicGroupAwareEdit) r).getResourceType(); rv[4] = StringUtil.trimToZero(((BaseResourceEdit) r).m_filePath); return rv; rv[0] = StringUtil.referencePath(((ContentResource) r).getId()); rv[1] = ((BasicGroupAwareEdit) r).getContext(); rv[2] = Long.valueOf(((ContentResource) r).getContentLength()); rv[0] = StringUtil.referencePath(((ContentResource) r).getId()); rv[1] = StringUtil.trimToZero(((BaseResourceEdit) r).m_filePath); return rv; rv[0] = StringUtil.referencePath(((ContentResource) r).getId()); return rv;
@SuppressWarnings("deprecation") public Collection<Group> getSubmitterGroupList(String searchFilterOnly, String allOrOneGroup, String searchString, String aRef, String contextString) { Collection<Group> rv = new ArrayList<Group>(); allOrOneGroup = StringUtil.trimToNull(allOrOneGroup); searchString = StringUtil.trimToNull(searchString); boolean bSearchFilterOnly = "true".equalsIgnoreCase(searchFilterOnly); try
/** * Create a full reference from a relative reference merged with a root reference. * * @param root * The root reference, which is the root of the full reference. * @param relative * The relative reference, to add to the path of the root. * @return A full reference from the root and relative references. */ public static String fullReference(String root, String relative) { String full = referencePath(root); full += relative; return full; }
/** * Check this User object to see if it is selected by the criteria. * * @param criteria * The critera. * @return True if the User object is selected by the criteria, false if not. */ protected boolean selectedBy(String criteria) { if (StringUtil.containsIgnoreCase(getSortName(), criteria) || StringUtil.containsIgnoreCase(getDisplayName(), criteria) || StringUtil.containsIgnoreCase(getEid(), criteria) || StringUtil.containsIgnoreCase(getEmail(), criteria)) { return true; } return false; }
s.getGradeDisplay(), s.getTimeSubmittedString(), latenessStatus); if (StringUtil.trimToNull(submitterString) != null) submittersName = submittersName.concat(StringUtil.trimToNull(submitterString)); submittedText = s.getSubmittedText();
/** * Collect the fields that need to be stored outside the XML (for the resource). * * @return An array of field values to store in the record outside the XML (for the resource). */ public Object[] storageFields(Entity r) { Object[] rv = new Object[1]; rv[0] = StringUtil.referencePath(((ContentCollection) r).getId()); return rv; }
/** * Count all the aliases with id or target matching criteria. * * @param criteria * The search criteria. * @return The count of all aliases with id or target matching criteria. */ public int countSearch(String criteria) { List all = super.getAllResources(); Vector rv = new Vector(); for (Iterator i = all.iterator(); i.hasNext();) { Alias a = (Alias) i.next(); if (StringUtil.containsIgnoreCase(a.getId(), criteria) || StringUtil.containsIgnoreCase(a.getTarget(), criteria)) { rv.add(a); } } return rv.size(); }
/** * Configuration - set the list of tool ids to be "stealthed". A stealthed tool does not show up in a category * list of tools. The list of stealthed tools is set by the Sakai distribution. * If a deployment wishes to override the values set they should use the {@link #setHiddenTools(String)} and * {@link #setVisibleTools(String)} * * @param toolIds * The comma-separated list of tool ids to be stealthed. */ public void setStealthTools(String toolIds) { if ((toolIds == null) || (toolIds.length() == 0)) { m_stealthToolIds = null; } else { m_stealthToolIds = new Vector<String>(); String[] items = StringUtil.split(toolIds, ","); for (int i = 0; i < items.length; i++) { m_stealthToolIds.add(items[i]); } } }
public boolean equals(Object obj) { if (!(obj instanceof UserAndRole)) return false; if (this == obj) return true; UserAndRole other = (UserAndRole) obj; if (StringUtil.different(this.role, other.role)) return false; if (this.provided != other.provided) return false; if (this.active != other.active) return false; if (StringUtil.different(this.userId, other.userId)) return false; return true; }
/** * Find a user object who has this email address. Update the object with the information found. * * @param email * The email address string. * @return true if the user object was found and information updated, false if not. */ public boolean findUserByEmail(UserEdit edit, String email) { if (m_requirelocalaccount) return false; // lets not get messed up with spaces or cases String test = email.toLowerCase().trim(); // if the email ends with "domain.tld" (even if it's from somebody@foo.bar.domain.tld) // use the local part as a user id. if (!test.endsWith(m_domain)) return false; // split the string once at the first "@" String parts[] = StringUtil.splitFirst(test, "@"); edit.setEid(parts[0]); return getUser(edit); } // findUserByEmail
String assignmentReference = StringUtil.trimToNull(oMessage.getProperties().getProperty(AnnouncementService.ASSIGNMENT_REFERENCE)); if (toBeImported && assignmentReference != null)
/** * Search for aliases with id or target matching criteria, in range. * * @param criteria * The search criteria. * @param first * The first record position to return. * @param last * The last record position to return. * @return The List (BaseAliasEdit) of all alias. */ public List search(String criteria, int first, int last) { List all = super.getAllResources(); List rv = new Vector(); for (Iterator i = all.iterator(); i.hasNext();) { Alias a = (Alias) i.next(); if (StringUtil.containsIgnoreCase(a.getId(), criteria) || StringUtil.containsIgnoreCase(a.getTarget(), criteria)) { rv.add(a); } } Collections.sort(rv); // subset by position if (first < 1) first = 1; if (last >= rv.size()) last = rv.size(); rv = rv.subList(first - 1, last); return rv; }
/** * Configuration - set the list of tool ids to be hidden. * * @param toolIds * The comma-separated list of tool ids to be hidden. */ public void setHiddenTools(String toolIds) { if ((toolIds == null) || (toolIds.length() == 0)) { m_hiddenToolIds = null; } else { m_hiddenToolIds = new Vector<String>(); String[] items = StringUtil.split(toolIds, ","); for (int i = 0; i < items.length; i++) { m_hiddenToolIds.add(items[i]); } } }
public boolean equals(Object obj) { if (!(obj instanceof RoleAndDescription)) return false; if (this == obj) return true; RoleAndDescription other = (RoleAndDescription) obj; if (StringUtil.different(this.role, other.role)) return false; if (StringUtil.different(this.description, other.description)) return false; if (this.providerOnly != other.providerOnly) return false; return true; }
String parts[] = StringUtil.splitFirst(configs[i], "."); if ((parts != null) && (parts.length == 2))
public int countSearch(String criteria) { // if we have to be concerned with old stuff, we cannot let the db do the search and count if (m_checkOld) { List all = getAll(); List rv = new Vector(); for (Iterator i = all.iterator(); i.hasNext();) { Alias a = (Alias) i.next(); if (StringUtil.containsIgnoreCase(a.getId(), criteria) || StringUtil.containsIgnoreCase(a.getTarget(), criteria)) { rv.add(a); } } return rv.size(); } Object[] fields = new Object[2]; fields[0] = "%" + criteria.toUpperCase() + "%"; fields[1] = fields[0]; int rv = super.countSelectedResources("UPPER(ALIAS_ID) LIKE ? OR UPPER(TARGET) LIKE ?", fields); return rv; }