Java Code Examples for org.apache.commons.lang.ObjectUtils#equals()

The following examples show how to use org.apache.commons.lang.ObjectUtils#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToDoRight.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
private boolean hasAccess(final PFUserDO user, final ToDoDO toDo, final OperationType operationType)
{
  if (toDo == null) {
    return true;
  }
  if (ObjectUtils.equals(user.getId(), toDo.getAssigneeId()) == true || ObjectUtils.equals(user.getId(), toDo.getReporterId()) == true) {
    return true;
  }
  if (toDo.getGroup() != null && UserRights.getUserGroupCache().isUserMemberOfGroup(user.getId(), toDo.getGroupId()) == true) {
    return true;
  }
  if (toDo.getTaskId() != null) {
    return UserRights.getAccessChecker().hasPermission(user, toDo.getTaskId(), AccessType.TASKS, operationType, false);
  } else {
    return false;
  }
}
 
Example 2
Source File: WorkflowEngineFacadeImpl.java    From telekom-workflow-engine with MIT License 5 votes vote down vote up
private void validateClusterNameOfWorkflowInstance( long woinRefNum ){
    WorkflowInstance woin = workflowInstanceService.find( woinRefNum );
    String clusterName = config.getClusterName();
    if( !ObjectUtils.equals( clusterName, woin.getClusterName() ) ){
        throw new IllegalArgumentException( "The workflow instance " + woinRefNum + " is not executed by this cluster " + clusterName );
    }
}
 
Example 3
Source File: ShareService.java    From subsonic with GNU General Public License v3.0 5 votes vote down vote up
public List<Share> getSharesForUser(User user) {
    List<Share> result = new ArrayList<Share>();
    for (Share share : getAllShares()) {
        if (user.isAdminRole() || ObjectUtils.equals(user.getUsername(), share.getUsername())) {
            result.add(share);
        }
    }
    return result;
}
 
Example 4
Source File: left_IssueSearch_1.65.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
/**
 * Set the value of maxId.
 * @param v  Value to assign to maxId.
 */
public void setMaxId(String  v) 
{
    if ( v != null && v.length() == 0 ) 
    {
        v = null;
    }
    if (!ObjectUtils.equals(v, this.maxId)) 
    {
        modified = true;
        this.maxId = v;
    }
}
 
Example 5
Source File: Kost2ArtDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * return true if id is equal, otherwise false;
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override
public boolean equals(final Object o)
{
  if (o instanceof Kost2ArtDO) {
    final Kost2ArtDO other = (Kost2ArtDO) o;
    return (ObjectUtils.equals(this.id, other.id));
  }
  return false;
}
 
Example 6
Source File: AbstractRechnungsPositionDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean equals(final Object o)
{
  if (o instanceof AbstractRechnungsPositionDO) {
    final AbstractRechnungsPositionDO other = (AbstractRechnungsPositionDO) o;
    if (ObjectUtils.equals(this.getNumber(), other.getNumber()) == false) {
      return false;
    }
    if (ObjectUtils.equals(this.getRechnungId(), other.getRechnungId()) == false) {
      return false;
    }
    return true;
  }
  return false;
}
 
Example 7
Source File: ModulaEditor.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void buildSettingsReload(IProject p) {
	IEditorInput editorInput = getEditorInput();
	if (ObjectUtils.equals(p, CoreEditorUtils.getIProjectFrom(editorInput))) {
		ParseTask parseTask = ParseTaskFactory.create(editorInput);
		parseTask.setNeedModulaAst(true);
		SymbolModelManager.instance().scheduleParse(parseTask, null);
	}
}
 
Example 8
Source File: AuftragsPositionDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean equals(final Object o)
{
  if (o instanceof AuftragsPositionDO) {
    final AuftragsPositionDO other = (AuftragsPositionDO) o;
    if (ObjectUtils.equals(this.getNumber(), other.getNumber()) == false) {
      return false;
    }
    if (ObjectUtils.equals(this.getAuftragId(), other.getAuftragId()) == false) {
      return false;
    }
    return true;
  }
  return false;
}
 
Example 9
Source File: right_IssueSearch_1.66.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
/**
 * Set the value of sortPolarity.
 * @param v  Value to assign to sortPolarity.
 */
public void setSortPolarity(String  v) 
{
    if (!ObjectUtils.equals(v, this.sortPolarity)) 
    {
        modified = true;
        this.sortPolarity = v;
    }
}
 
Example 10
Source File: left_IssueSearch_1.65.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
/**
 * Set the value of searchWords.
 * @param v  Value to assign to searchWords.
 */
public void setSearchWords(String  v) 
{
    if (!ObjectUtils.equals(v, this.searchWords)) 
    {
        modified = true;
        this.searchWords = v;
    }
}
 
Example 11
Source File: TaskNode.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean equals(final Object o)
{
  if (o instanceof TaskNode) {
    final TaskNode other = (TaskNode) o;
    return ObjectUtils.equals(this.getParentId(), other.getParentId()) == true
        && ObjectUtils.equals(this.getTask().getTitle(), other.getTask().getTitle()) == true;
  }
  return false;
}
 
Example 12
Source File: RuleExtensionBo.java    From rice with Educational Community License v2.0 5 votes vote down vote up
public boolean equals(Object o) {
    if (o == null) return false;
    if (!(o instanceof RuleExtensionBo)) return false;
    RuleExtensionBo pred = (RuleExtensionBo) o;
    return ObjectUtils.equals(ruleBaseValues.getRuleTemplate(), pred.getRuleBaseValues().getRuleTemplate()) &&
           ObjectUtils.equals(ruleTemplateAttribute, pred.getRuleTemplateAttribute()) &&
           CollectionUtils.collectionsEquivalent(extensionValues, pred.getExtensionValues());
}
 
Example 13
Source File: TimesheetDao.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Checks if there exists any time sheet protection on the corresponding task or one of the ancestor tasks. If the times sheet is
 * protected and the duration of this time sheet is modified, and AccessException will be thrown. <br/>
 * Checks insert, update and delete operations. If an existing time sheet has to be modified, the check will only be done, if any
 * modifications of the time stamps is done (e. g. descriptions of the task are allowed if the start and stop time is untouched).
 * @param timesheet
 * @param oldTimesheet (null for delete and insert)
 * @param throwException If true and the time sheet protection is violated then an AccessException will be thrown.
 * @return true, if no time sheet protection is violated or if the logged in user is member of the finance group.
 * @see ProjectForgeGroup#FINANCE_GROUP
 */
public boolean checkTimesheetProtection(final PFUserDO user, final TimesheetDO timesheet, final TimesheetDO oldTimesheet,
    final OperationType operationType, final boolean throwException)
{
  if (accessChecker.isUserMemberOfGroup(user, ProjectForgeGroup.FINANCE_GROUP) == true
      && accessChecker.userEquals(user, timesheet.getUser()) == false) {
    // Member of financial group are able to book foreign time sheets.
    return true;
  }
  if (operationType == OperationType.UPDATE) {
    if (timesheet.getStartTime().getTime() == oldTimesheet.getStartTime().getTime()
        && timesheet.getStopTime().getTime() == oldTimesheet.getStopTime().getTime()
        && ObjectUtils.equals(timesheet.getKost2Id(), oldTimesheet.getKost2Id()) == true) {
      return true;
    }
  }
  final TaskNode taskNode = taskTree.getTaskNodeById(timesheet.getTaskId());
  Validate.notNull(taskNode);
  final List<TaskNode> list = taskNode.getPathToRoot();
  list.add(0, taskTree.getRootTaskNode());
  for (final TaskNode node : list) {
    final Date date = node.getTask().getProtectTimesheetsUntil();
    if (date == null) {
      continue;
    }
    final DateHolder dh = new DateHolder(date);
    dh.setEndOfDay();
    if (timesheet.getStartTime().before(dh.getDate()) == true) {
      if (throwException == true) {
        throw new AccessException("timesheet.error.timesheetProtectionVioloation", node.getTask().getTitle()
            + " (#"
            + node.getTaskId()
            + ")", DateHelper.formatIsoDate(dh.getDate()));
      }
      return false;
    }
  }
  return true;
}
 
Example 14
Source File: left_IssueSearch_1.65.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
/**
 * Set the value of stateChangeToDate.
 * @param v  Value to assign to stateChangeToDate.
 */
public void setStateChangeToDate(String  v) 
{
    if ( v != null && v.length() == 0 ) 
    {
        v = null;
    }
    if (!ObjectUtils.equals(v, this.stateChangeToDate)) 
    {
        modified = true;
        this.stateChangeToDate = v;
    }
}
 
Example 15
Source File: PropertyStateSupport.java    From ymate-platform-v2 with Apache License 2.0 4 votes vote down vote up
public void setNewValue(Object newValue) {
    this.newValue = newValue;
    this.changed = !ObjectUtils.equals(this.originalValue, newValue);
}
 
Example 16
Source File: ValueChangeCondition.java    From CloverETL-Engine with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public boolean isFulFilled() {
	return !ObjectUtils.equals(prevValue, curValue);
}
 
Example 17
Source File: MyListPageSortableDataProvider.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int, int)
 */
@SuppressWarnings("unchecked")
@Override
public Iterator<T> iterator(final long first, final long count)
{
  if ((this.first != null && this.first != first) || (this.count != null && this.count != count)) {
    this.completeList = null; // Force to load all elements from data-base (avoid lazy initialization exceptions).
  }
  final SortParam<String> sp = getSort();
  if (ObjectUtils.equals(sortParam, sp) == false) {
    // The sort parameters were changed, force reload from data-base:
    reloadList();
  }
  this.first = first;
  this.count = count;
  if (idList == null) {
    return null;
  }
  List<T> result;
  int fromIndex = (int) first;
  if (fromIndex < 0) {
    fromIndex = 0;
  }
  int toIndex = (int) (first + count);
  if (this.completeList != null) {
    // The completeList is already load, don't need to load objects from data-base:
    result = completeList;
    if (toIndex > idList.size()) {
      toIndex = idList.size();
    }
    result = new LinkedList<T>();
    for (final T entry : completeList.subList(fromIndex, toIndex)) {
      result.add(entry);
    }
    this.completeList = null; // Don't store the complete list on the server anymore.
    return result.iterator();
  } else {
    if (toIndex > idList.size()) {
      toIndex = idList.size();
    }
    final Object baseDao = listPage.getBaseDao();
    if (baseDao instanceof BaseDao) {
      final List<T> list = (List<T>) ((BaseDao< ? >) baseDao).internalLoad(idList.subList(fromIndex, toIndex));
      sortList(list);
      return list.iterator();
    } else {
      // Can't load objects from BaseDao, have to load complete list from scratch:
      reloadList();
      result = completeList;
      if (toIndex > idList.size()) {
        toIndex = idList.size();
      }
      return result.subList(fromIndex, toIndex).iterator();
    }
  }
}
 
Example 18
Source File: DefaultArtifactPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public boolean equals(Object o) {
    ArtifactKey other = (ArtifactKey) o;
    return ObjectUtils.equals(type, other.type) && ObjectUtils.equals(classifier, other.classifier);
}
 
Example 19
Source File: RuleExtensionValue.java    From rice with Educational Community License v2.0 4 votes vote down vote up
public boolean equals(Object o) {
    if (o == null) return false;
    if (!(o instanceof RuleExtensionValue)) return false;
    RuleExtensionValue pred = (RuleExtensionValue) o;
    return ObjectUtils.equals(key, pred.key) && ObjectUtils.equals(value, pred.value);
}
 
Example 20
Source File: LuteceUser.java    From lutece-core with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
/**
 * equals implementation
 * 
 * @param object
 *            The object to compare
 * @return true if equal, otherwise false
 */
@Override
public boolean equals( Object object )
{
    // FIXME : use LuteceUser property instead of object.toString()
    return ObjectUtils.equals( this.toString( ), ObjectUtils.toString( object ) );
}