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

The following are Jave code examples for showing how to use equals() of the org.apache.commons.lang.ObjectUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: alfresco-repository   File: ActivitiPropertyConverter.java   View Source Code Vote up 6 votes
/**
 * @param task Task
 * @param properties Map<QName, Serializable>
 */
private void setTaskOwner(Task task, Map<QName, Serializable> properties)
{
    QName ownerKey = ContentModel.PROP_OWNER;
    if (properties.containsKey(ownerKey))
    {
        Serializable owner = properties.get(ownerKey);
        if (owner != null && !(owner instanceof String))
        {
            throw getInvalidPropertyValueException(ownerKey, owner);
        }
        String assignee = (String) owner;
        String currentAssignee = task.getAssignee();
        // Only set the assignee if the value has changes to prevent
        // triggering assignementhandlers when not needed
        if (ObjectUtils.equals(currentAssignee, assignee)==false)
        {
            activitiUtil.getTaskService().setAssignee(task.getId(), assignee);
        }
    }
}
 
Example 2
Project: morf   File: TableDataHomology.java   View Source Code Vote up 6 votes
/**
 * Compare all the columns for these records.
 *
 * @param table the active {@link Table}
 * @param recordNumber The current record number
 * @param record1 The first record
 * @param record2 The second record
 */
private void compareRecords(Table table, int recordNumber, Record record1, Record record2, List<Column> primaryKeys) {

  for (Column column : FluentIterable.from(table.columns()).filter(excludingExcludedColumns())) {
    String columnName = column.getName();

    Object value1 = convertToComparableType(column, record1);
    Object value2 = convertToComparableType(column, record2);

    if (!ObjectUtils.equals(value1, value2)) {
      differences.add(String.format(
        "Table [%s]: Mismatch on key %s column [%s] row [%d]: [%s]<>[%s]",
        table.getName(),
        keyColumnsIds(record1, record2, primaryKeys),
        columnName,
        recordNumber,
        value1,
        value2
      ));
    }
  }
}
 
Example 3
Project: OpenCyclos   File: WhitelistValidator.java   View Source Code Vote up 6 votes
/**
 * Check if the given request is allowed on the whitelist
 */
public boolean isAllowed(final String host, final String addr) {
    final boolean allowed = isAllowed(addr);
    if (allowed) {
        return true;
    }
    if (ObjectUtils.equals(host, addr)) {
        // Try to resolve the host name to one of the known hosts
        for (final String current : getAllowedHosts()) {
            try {
                // Check if one of the addresses on the whitelisted hosts is the request address
                final InetAddress[] addresses = InetAddress.getAllByName(current);
                for (final InetAddress address : addresses) {
                    if (address.getHostAddress().equals(addr)) {
                        return true;
                    }
                }
            } catch (final UnknownHostException e) {
                // Go on
            }
        }
        return false;
    } else {
        return isAllowed(host);
    }
}
 
Example 4
Project: linkbinder   File: SetupPage.java   View Source Code Vote up 6 votes
@Override
public void execute() throws ServiceAbortException {
    page.clearErrorMessageList();
    String password = page.getPassword();
    String passwordConf = page.getPasswordConf();

    if (!ObjectUtils.equals(password, passwordConf)) {
        throw new ServiceAbortException(ApplicationMessageCode.PASSWORD_UNMATCH);
    } else {
        page.setContextUser(SETUP_USER_ID);

        List<SysUsers> userList = new ArrayList<>();
        userList.add(setupUserDto());
        page.userService.save(userList);

        page.setVisibled(3);
        page.setPageTitle(3);
        page.setBackPage(2);
    }
}
 
Example 5
Project: cosmic   File: ConfigDepotImpl.java   View Source Code Vote up 6 votes
private void createOrupdateConfigObject(final Date date, final String componentName, final ConfigKey<?> key, final String value) {
    ConfigurationVO vo = _configDao.findById(key.key());
    if (vo == null) {
        vo = new ConfigurationVO(componentName, key);
        vo.setUpdated(date);
        if (value != null) {
            vo.setValue(value);
        }
        _configDao.persist(vo);
    } else {
        if (vo.isDynamic() != key.isDynamic() || !ObjectUtils.equals(vo.getDescription(), key.description()) || !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue()) ||
                !ObjectUtils.equals(vo.getScope(), key.scope().toString()) ||
                !ObjectUtils.equals(vo.getComponent(), componentName)) {
            vo.setDynamic(key.isDynamic());
            vo.setDescription(key.description());
            vo.setDefaultValue(key.defaultValue());
            vo.setScope(key.scope().toString());
            vo.setComponent(componentName);
            vo.setUpdated(date);
            _configDao.persist(vo);
        }
    }
}
 
Example 6
Project: subsonic   File: MultiController.java   View Source Code Vote up 6 votes
private void updatePortAndContextPath(HttpServletRequest request) {

        int port = Integer.parseInt(System.getProperty("subsonic.port", String.valueOf(request.getLocalPort())));
        int httpsPort = Integer.parseInt(System.getProperty("subsonic.httpsPort", "0"));

        String contextPath = request.getContextPath().replace("/", "");

        if (settingsService.getPort() != port) {
            settingsService.setPort(port);
            settingsService.save();
        }
        if (settingsService.getHttpsPort() != httpsPort) {
            settingsService.setHttpsPort(httpsPort);
            settingsService.save();
        }
        if (!ObjectUtils.equals(settingsService.getUrlRedirectContextPath(), contextPath)) {
            settingsService.setUrlRedirectContextPath(contextPath);
            settingsService.save();
        }
    }
 
Example 7
Project: TranskribusSwtGui   File: GuiUtil.java   View Source Code Vote up 6 votes
public static boolean isEqualStyle(TextStyleType s1, TextStyleType s2) {
    return (
    		ObjectUtils.equals(s1.getFontFamily(), s2.getFontFamily()) &&
    		ObjectUtils.equals(s1.isSerif(), s2.isSerif()) &&
    		ObjectUtils.equals(s1.isMonospace(), s2.isMonospace()) &&
    		ObjectUtils.equals(s1.getFontSize(), s2.getFontSize()) &&
    		ObjectUtils.equals(s1.getKerning(), s2.getKerning()) &&
    		ObjectUtils.equals( s1.getTextColour(), s2.getTextColour()) &&
    		ObjectUtils.equals(s1.getBgColour(), s2.getBgColour()) &&
    		ObjectUtils.equals(s1.isReverseVideo(), s2.isReverseVideo()) &&
    		ObjectUtils.equals(s1.isBold(), s2.isBold()) &&
    		ObjectUtils.equals(s1.isItalic(), s2.isItalic()) &&
    		ObjectUtils.equals(s1.isUnderlined(), s2.isUnderlined()) &&
    		ObjectUtils.equals(s1.isSubscript(), s2.isSubscript()) &&
    		ObjectUtils.equals(s1.isSuperscript(), s2.isSuperscript()) &&
    		ObjectUtils.equals(s1.isStrikethrough(), s2.isStrikethrough()) &&
    		ObjectUtils.equals(s1.isSmallCaps(), s2.isSmallCaps()) &&
    		ObjectUtils.equals(s1.isLetterSpaced(), s2.isLetterSpaced())
    );
}
 
Example 8
Project: FinanceAnalytics   File: ForexOptionSingleBarrierDefinition.java   View Source Code Vote up 6 votes
@Override
public boolean equals(final Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final ForexOptionSingleBarrierDefinition other = (ForexOptionSingleBarrierDefinition) obj;
  if (_barrier != other._barrier) {
    return false;
  }
  if (Double.doubleToLongBits(_rebate) != Double.doubleToLongBits(other._rebate)) {
    return false;
  }
  if (!ObjectUtils.equals(_underlyingOption, other._underlyingOption)) {
    return false;
  }
  return true;
}
 
Example 9
Project: Genji   File: BaseTTemplatePerson.java   View Source Code Vote up 6 votes
/**
 * Set the value of Person
 *
 * @param v new value
 */
public void setPerson(Integer v) throws TorqueException
{

    if (!ObjectUtils.equals(this.person, v))
    {
        this.person = v;
        setModified(true);
    }


    if (aTPerson != null && !ObjectUtils.equals(aTPerson.getObjectID(), v))
    {
        aTPerson = null;
    }

}
 
Example 10
Project: Genji   File: BaseTMailTemplateDef.java   View Source Code Vote up 6 votes
/**
 * Set the value of MailTemplate
 *
 * @param v new value
 */
public void setMailTemplate(Integer v) throws TorqueException
{

    if (!ObjectUtils.equals(this.mailTemplate, v))
    {
        this.mailTemplate = v;
        setModified(true);
    }


    if (aTMailTemplate != null && !ObjectUtils.equals(aTMailTemplate.getObjectID(), v))
    {
        aTMailTemplate = null;
    }

}
 
Example 11
Project: FinanceAnalytics   File: EquityDefinition.java   View Source Code Vote up 6 votes
@Override
public boolean equals(final Object obj) {
  if (this == obj) {
    return true;
  }
  if (!(obj instanceof EquityDefinition)) {
    return false;
  }
  final EquityDefinition other = (EquityDefinition) obj;
  if (Double.compare(_numberOfShares, other._numberOfShares) != 0) {
    return false;
  }
  if (!ObjectUtils.equals(_currency, other._currency)) {
    return false;
  }
  if (!ObjectUtils.equals(_entity, other._entity)) {
    return false;
  }
  return true;
}
 
Example 12
Project: Reer   File: DefaultModuleDependencySpec.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    DefaultModuleDependencySpec that = (DefaultModuleDependencySpec) o;
    return ObjectUtils.equals(group, that.group)
        && ObjectUtils.equals(name, that.name)
        && ObjectUtils.equals(version, that.version);
}
 
Example 13
Project: Reer   File: DefaultLibraryBinaryDependencySpec.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    DefaultLibraryBinaryDependencySpec that = (DefaultLibraryBinaryDependencySpec) o;
    return ObjectUtils.equals(projectPath, that.projectPath)
        && ObjectUtils.equals(libraryName, that.libraryName)
        && ObjectUtils.equals(variant, that.variant);
}
 
Example 14
Project: Reer   File: DefaultProjectDependencySpec.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    DefaultProjectDependencySpec that = (DefaultProjectDependencySpec) o;
    return ObjectUtils.equals(projectPath, that.projectPath)
        && ObjectUtils.equals(libraryName, that.libraryName);
}
 
Example 15
Project: Reer   File: ValidatingMavenPublisher.java   View Source Code Vote up 5 votes
private void checkNotDuplicate(MavenNormalizedPublication publication, Set<MavenArtifact> artifacts, String extension, String classifier) {
    for (MavenArtifact artifact : artifacts) {
        if (ObjectUtils.equals(artifact.getExtension(), extension) && ObjectUtils.equals(artifact.getClassifier(), classifier)) {
            String message = String.format(
                    "multiple artifacts with the identical extension and classifier ('%s', '%s').", extension, classifier
            );
            throw new InvalidMavenPublicationException(publication.getName(), message);
        }
    }
}
 
Example 16
Project: airsonic   File: ShareService.java   View Source Code Vote up 5 votes
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 17
Project: airsonic   File: Pair.java   View Source Code Vote up 5 votes
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    Pair pair = (Pair) o;

    return ObjectUtils.equals(first, pair.first) && ObjectUtils.equals(second, pair.second);
}
 
Example 18
Project: RobotServer   File: SmsService.java   View Source Code Vote up 5 votes
public void checkVerifyCode(String phoneNumber, String verifyCode) throws ApplicationException {
	String cachVerifyCode = redisService.lpop(RedisEnum.SMS_VERIFY_CODES_FROM_phoneno, phoneNumber);
	if (!ObjectUtils.equals(verifyCode, cachVerifyCode)) {
		LOGGER.info("Sms verify error. {}, {}, {}", phoneNumber, verifyCode, cachVerifyCode);
		throw new ApplicationException(ErrorCodeEnum.SMS_VERIFY_ERROR, "nequals");
	}
}
 
Example 19
Project: morf   File: SchemaValidator.java   View Source Code Vote up 5 votes
/**
 * {@inheritDoc}
 *
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override
public boolean equals(Object obj) {
  if (!(obj instanceof IndexSignature)) return false;

  IndexSignature other = (IndexSignature) obj;

  return ObjectUtils.equals(other.index.columnNames(), index.columnNames()) && other.index.isUnique() == index.isUnique();
}
 
Example 20
Project: engerek   File: ItemPathResolver.java   View Source Code Vote up 5 votes
String addJoin(JpaLinkDefinition joinedItemDefinition, String currentHqlPath) throws QueryException {
    RootHibernateQuery hibernateQuery = context.getHibernateQuery();
    String joinedItemJpaName = joinedItemDefinition.getJpaName();
    String joinedItemFullPath = currentHqlPath + "." + joinedItemJpaName;
    String joinedItemAlias;
    if (!joinedItemDefinition.isMultivalued()) {
        /*
         * Let's check if we were already here i.e. if we had already created this join.
         * This is to avoid useless creation of redundant joins for singleton items.
         *
         * But how can we be sure that item is singleton if we look only at the last segment (which is single-valued)?
         * Imagine we are creating join for single-valued entity of u.abc.(...).xyz.ent where
         * ent is single-valued and not embedded (so we are to create something like "left join u.abc.(...).xyz.ent e").
         * Then "u" is certainly a single value: either the root object, or some value pointed to by Exists restriction.
         * Also, abc, ..., xyz are surely single-valued: otherwise they would be connected by a join. So,
         * u.abc.(...).xyz.ent is a singleton.
         *
         * Look at it in other way: if e.g. xyz was multivalued, then we would have something like:
         * left join u.abc.(...).uvw.xyz x
         * left join x.ent e
         * And, therefore we would not be looking for u.abc.(...).xyz.ent.
         */

        JoinSpecification existingJoin = hibernateQuery.getPrimaryEntity().findJoinFor(joinedItemFullPath);
        if (existingJoin != null) {
            // but let's check the condition as well
            String existingAlias = existingJoin.getAlias();
            // we have to create condition for existing alias, to be matched to existing condition
            Condition conditionForExistingAlias = createJoinCondition(existingAlias, joinedItemDefinition, hibernateQuery);
            if (ObjectUtils.equals(conditionForExistingAlias, existingJoin.getCondition())) {
                LOGGER.trace("Reusing alias '{}' for joined path '{}'", existingAlias, joinedItemFullPath);
                return existingAlias;
            }
        }
    }
    joinedItemAlias = hibernateQuery.createAlias(joinedItemDefinition);
    Condition condition = createJoinCondition(joinedItemAlias, joinedItemDefinition, hibernateQuery);
    hibernateQuery.getPrimaryEntity().addJoin(new JoinSpecification(joinedItemAlias, joinedItemFullPath, condition));
    return joinedItemAlias;
}
 
Example 21
Project: OpenCyclos   File: ServiceClientServiceImpl.java   View Source Code Vote up 5 votes
private boolean resolveAddress(final ServiceClient client) {
    final String hostname = client.getHostname();
    final AddressType addressType = InternetAddressHelper.resolveAddressType(hostname);
    if (addressType == null) {
        // Invalid ?!?
        return false;
    }
    final String addressBegin = client.getAddressBegin();
    final String addressEnd = client.getAddressBegin();
    switch (addressType) {
        case HOSTNAME:
            try {
                // Resolve the ip address
                final InetAddress[] addr = InetAddress.getAllByName(hostname);
                final String ip = InternetAddressHelper.padAddress(addr[0].getHostAddress());
                client.setAddressBegin(ip);
                client.setAddressEnd(ip);
            } catch (final UnknownHostException e) {
                // Error resolving ip address. Leave the previous one
            }
            break;
        case SIMPLE_IP:
            // It's a fixed ip
            final String paddedAddress = InternetAddressHelper.padAddress(hostname);
            client.setAddressBegin(paddedAddress);
            client.setAddressEnd(paddedAddress);
            break;
        case IP_RANGE:
            // An ip range
            final String[] range = InternetAddressHelper.getRangeBoundaries(hostname);
            client.setAddressBegin(InternetAddressHelper.padAddress(range[0]));
            client.setAddressEnd(InternetAddressHelper.padAddress(range[1]));
            break;
    }
    return !ObjectUtils.equals(client.getAddressBegin(), addressBegin) || !ObjectUtils.equals(client.getAddressEnd(), addressEnd);
}
 
Example 22
Project: OpenCyclos   File: PermissionServiceImpl.java   View Source Code Vote up 5 votes
@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof CacheKey)) {
        return false;
    }
    CacheKey key = (CacheKey) obj;
    return accessType == key.accessType && ObjectUtils.equals(group, key.group) && ObjectUtils.equals(qualifier, key.qualifier);
}
 
Example 23
Project: OpenCyclos   File: UpdateCardAction.java   View Source Code Vote up 5 votes
@Override
protected void validateForm(final ActionContext context) {
    final CardForm form = context.getForm();
    final boolean usesTransactionPassword = context.isTransactionPasswordEnabled();

    final ValidationException e = new ValidationException();
    e.setPropertyKey("securityCode", "card.changeCardCode.newCode1");
    e.setPropertyKey("securityCodeConfirmation", "card.changeCardCode.newCode2");
    e.setPropertyKey("login.transactionPassword", "login.transactionPassword");

    if (usesTransactionPassword) {
        context.validateTransactionPassword();
        if (StringUtils.isEmpty(form.getPassword())) {
            e.addPropertyError("login.transactionPassword", new RequiredError());
        }
    }

    final String operation = form.getOperation();
    final Card card = cardService.load(form.getCardId(), Relationships.CARD_TYPE);
    final boolean cardWithManualCodeActivation = card.getCardType().getCardSecurityCode() == CardSecurityCode.MANUAL && operation.equals("activate");

    if (operation.equals("changeCardCode") || cardWithManualCodeActivation) {
        final String securityCode = form.getSecurityCode();
        if (StringUtils.isEmpty(securityCode)) {
            e.addPropertyError("securityCode", new RequiredError());
        }
        if (!card.getCardType().isShowCardSecurityCode()) {
            final String securityCodeConfirmation = form.getSecurityCodeConfirmation();
            if (StringUtils.isEmpty(securityCodeConfirmation)) {
                e.addPropertyError("securityCodeConfirmation", new RequiredError());
            }
            if (!ObjectUtils.equals(securityCode, securityCodeConfirmation)) {
                e.addGeneralError(new ValidationError("card.updateCard.cardCodesAreNotEqual"));
            }
        }
    }
    e.throwIfHasErrors();
}
 
Example 24
Project: moql   File: MatcherWindow.java   View Source Code Vote up 5 votes
@Override public synchronized void push(T entity) {
  entityMap.putEntity(eventStreamName, entity);
  Object value = operand.operate(entityMap);
  if (!ObjectUtils.equals(curValue, value)) {
    if (curBucket.size() != 0) {
      operate();
      updateBuckets();
    }
    curValue = value;
  }
  curBucket.add(entity);
}
 
Example 25
Project: moql   File: OtherCaculation.java   View Source Code Vote up 5 votes
public boolean isGroupChanged(Object[] record) {
  for (int i = 0; i < groups.length; i++) {
    if (!ObjectUtils.equals(groups[i], record[groupIndexes[i]]))
      return true;
  }
  return false;
}
 
Example 26
Project: OpenCyclos   File: InvoiceServiceImpl.java   View Source Code Vote up 5 votes
@Override
public boolean canAccept(final Invoice invoice) {
    // Test the basic action
    if (!testAction(invoice, true)) {
        return false;
    }
    boolean asUser = false;
    if (invoice.isToSystem()) {
        // Member to system
        if (!permissionService.hasPermission(AdminMemberPermission.INVOICES_ACCEPT)) {
            return false;
        }
    } else {
        Member member = invoice.getToMember();
        if (invoice.isFromSystem()) {
            // System to member invoice
            if (!permissionService.permission(member)
                    .admin(AdminMemberPermission.INVOICES_ACCEPT_AS_MEMBER_FROM_SYSTEM)
                    .broker(BrokerPermission.INVOICES_ACCEPT_AS_MEMBER_FROM_SYSTEM)
                    .member()
                    .operator(OperatorPermission.INVOICES_MANAGE)
                    .hasPermission()) {
                return false;
            }
        } else {
            if (!permissionService.permission(member)
                    .admin(AdminMemberPermission.INVOICES_ACCEPT_AS_MEMBER_FROM_MEMBER)
                    .broker(BrokerPermission.INVOICES_ACCEPT_AS_MEMBER_FROM_MEMBER)
                    .member()
                    .operator(OperatorPermission.INVOICES_MANAGE)
                    .hasPermission()) {
                return false;
            }
        }
        asUser = !ObjectUtils.equals(LoggedUser.member(), member);
    }
    // To this point, the invoice is in an 'acceptable' state, and the user has permission. The check to go is for transfer types
    return hasTTPermission(invoice, asUser);
}
 
Example 27
Project: moql   File: ClassPathResource.java   View Source Code Vote up 5 votes
/**
 * compares the underlying class path locations.
 */
public boolean equals(Object obj) {
	if (obj == this) {
		return true;
	}
	if (obj instanceof ClassPathResource) {
		ClassPathResource otherRes = (ClassPathResource) obj;
		return (this.path.equals(otherRes.path) &&
				ObjectUtils.equals(this.classLoader, otherRes.classLoader) &&
				ObjectUtils.equals(this.clazz, otherRes.clazz));
	}
	return false;
}
 
Example 28
Project: subsonic   File: ShareService.java   View Source Code Vote up 5 votes
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 29
Project: Genji   File: BaseTScreenConfig.java   View Source Code Vote up 5 votes
/**
 * Set the value of ObjectID
 *
 * @param v new value
 */
public void setObjectID(Integer v) 
{

    if (!ObjectUtils.equals(this.objectID, v))
    {
        this.objectID = v;
        setModified(true);
    }


}
 
Example 30
Project: Genji   File: BaseTScreenConfig.java   View Source Code Vote up 5 votes
/**
 * Returns the associated TScreen object.
 * If it was not retrieved before, the object is retrieved from
 * the database
 *
 * @return the associated TScreen object
 * @throws TorqueException
 */
public TScreen getTScreen()
    throws TorqueException
{
    if (aTScreen == null && (!ObjectUtils.equals(this.screen, null)))
    {
        aTScreen = TScreenPeer.retrieveByPK(SimpleKey.keyFor(this.screen));
    }
    return aTScreen;
}
 
Example 31
Project: Genji   File: BaseTDepartment.java   View Source Code Vote up 5 votes
/**
 * Set the value of Parent
 *
 * @param v new value
 */
public void setParent(Integer v) 
{

    if (!ObjectUtils.equals(this.parent, v))
    {
        this.parent = v;
        setModified(true);
    }


}
 
Example 32
Project: Genji   File: BaseTProjectType.java   View Source Code Vote up 5 votes
/**
 * Set the value of NotifyManagerLevel
 *
 * @param v new value
 */
public void setNotifyManagerLevel(Integer v) 
{

    if (!ObjectUtils.equals(this.notifyManagerLevel, v))
    {
        this.notifyManagerLevel = v;
        setModified(true);
    }


}
 
Example 33
Project: Genji   File: BaseTMSProjectExchange.java   View Source Code Vote up 5 votes
/**
 * Returns the associated TPerson object.
 * If it was not retrieved before, the object is retrieved from
 * the database
 *
 * @return the associated TPerson object
 * @throws TorqueException
 */
public TPerson getTPerson()
    throws TorqueException
{
    if (aTPerson == null && (!ObjectUtils.equals(this.changedBy, null)))
    {
        aTPerson = TPersonPeer.retrieveByPK(SimpleKey.keyFor(this.changedBy));
    }
    return aTPerson;
}
 
Example 34
Project: FinanceAnalytics   File: EquityIndexOption.java   View Source Code Vote up 5 votes
@Override
public boolean equals(final Object obj) {
  if (this == obj) {
    return true;
  }
  if (!(obj instanceof EquityIndexOption)) {
    return false;
  }
  final EquityIndexOption other = (EquityIndexOption) obj;
  if (Double.compare(_strike, other._strike) != 0) {
    return false;
  }
  if (Double.compare(_timeToExpiry, other._timeToExpiry) != 0) {
    return false;
  }
  if (_isCall != other._isCall) {
    return false;
  }
  if (_exerciseType != other._exerciseType) {
    return false;
  }
  if (_settlementType != other._settlementType) {
    return false;
  }
  if (Double.compare(_timeToSettlement, other._timeToSettlement) != 0) {
    return false;
  }
  if (Double.compare(_unitAmount, other._unitAmount) != 0) {
    return false;
  }
  if (!ObjectUtils.equals(_currency, other._currency)) {
    return false;
  }
  return true;
}
 
Example 35
Project: Genji   File: BaseTOutlineTemplateDef.java   View Source Code Vote up 5 votes
/**
 * Returns the associated TOutlineTemplate object.
 * If it was not retrieved before, the object is retrieved from
 * the database
 *
 * @return the associated TOutlineTemplate object
 * @throws TorqueException
 */
public TOutlineTemplate getTOutlineTemplate()
    throws TorqueException
{
    if (aTOutlineTemplate == null && (!ObjectUtils.equals(this.outlineTemplate, null)))
    {
        aTOutlineTemplate = TOutlineTemplatePeer.retrieveByPK(SimpleKey.keyFor(this.outlineTemplate));
    }
    return aTOutlineTemplate;
}
 
Example 36
Project: Genji   File: BaseTPersonBasket.java   View Source Code Vote up 5 votes
/**
 * Set the value of MoreProps
 *
 * @param v new value
 */
public void setMoreProps(String v) 
{

    if (!ObjectUtils.equals(this.moreProps, v))
    {
        this.moreProps = v;
        setModified(true);
    }


}
 
Example 37
Project: Genji   File: BaseTWorkItemLock.java   View Source Code Vote up 5 votes
/**
 * Set the value of HttpSession
 *
 * @param v new value
 */
public void setHttpSession(String v) 
{

    if (!ObjectUtils.equals(this.httpSession, v))
    {
        this.httpSession = v;
        setModified(true);
    }


}
 
Example 38
Project: Reer   File: DefaultArtifactPom.java   View Source Code Vote up 4 votes
@Override
public boolean equals(Object o) {
    ArtifactKey other = (ArtifactKey) o;
    return ObjectUtils.equals(type, other.type) && ObjectUtils.equals(classifier, other.classifier);
}
 
Example 39
Project: Reer   File: ValidatingIvyPublisher.java   View Source Code Vote up 4 votes
private boolean hasCoordinates(IvyArtifact one, String name, String extension, String type, String classifier) {
    return ObjectUtils.equals(one.getName(), name)
            && ObjectUtils.equals(one.getType(), type)
            && ObjectUtils.equals(one.getExtension(), extension)
            && ObjectUtils.equals(one.getClassifier(), classifier);
}
 
Example 40
Project: Reer   File: DiffUtil.java   View Source Code Vote up 4 votes
@VisibleForTesting
static boolean checkEquality(Object obj1, Object obj2) {
    return ObjectUtils.equals(obj1, obj2) || checkEnumEquality(obj1, obj2);
}
 
Example 41
Project: airsonic   File: MediaScannerService.java   View Source Code Vote up 4 votes
private void updateAlbum(MediaFile file, MusicFolder musicFolder, Date lastScanned, Map<String, Integer> albumCount) {
    String artist = file.getAlbumArtist() != null ? file.getAlbumArtist() : file.getArtist();
    if (file.getAlbumName() == null || artist == null || file.getParentPath() == null || !file.isAudio()) {
        return;
    }

    Album album = albumDao.getAlbumForFile(file);
    if (album == null) {
        album = new Album();
        album.setPath(file.getParentPath());
        album.setName(file.getAlbumName());
        album.setArtist(artist);
        album.setCreated(file.getChanged());
    }
    if (file.getYear() != null) {
        album.setYear(file.getYear());
    }
    if (file.getGenre() != null) {
        album.setGenre(file.getGenre());
    }
    MediaFile parent = mediaFileService.getParentOf(file);
    if (parent != null && parent.getCoverArtPath() != null) {
        album.setCoverArtPath(parent.getCoverArtPath());
    }

    boolean firstEncounter = !lastScanned.equals(album.getLastScanned());
    if (firstEncounter) {
        album.setFolderId(musicFolder.getId());
        album.setDurationSeconds(0);
        album.setSongCount(0);
        Integer n = albumCount.get(artist);
        albumCount.put(artist, n == null ? 1 : n + 1);
    }
    if (file.getDurationSeconds() != null) {
        album.setDurationSeconds(album.getDurationSeconds() + file.getDurationSeconds());
    }
    if (file.isAudio()) {
        album.setSongCount(album.getSongCount() + 1);
    }
    album.setLastScanned(lastScanned);
    album.setPresent(true);
    albumDao.createOrUpdateAlbum(album);
    if (firstEncounter) {
        searchService.index(album);
    }

    // Update the file's album artist, if necessary.
    if (!ObjectUtils.equals(album.getArtist(), file.getAlbumArtist())) {
        file.setAlbumArtist(album.getArtist());
        mediaFileDao.createOrUpdateMediaFile(file);
    }
}
 
Example 42
Project: linkbinder   File: UserSettingsPage.java   View Source Code Vote up 4 votes
/**
 * 入力された値をチェックする.
 */
public void validatePassword(String password, String passwordConf) throws ServiceAbortException {
    if (!ObjectUtils.equals(password, passwordConf)) {
        throw new ServiceAbortException(ApplicationMessageCode.PASSWORD_UNMATCH);
    }
}
 
Example 43
Project: OpenCyclos   File: Transfer.java   View Source Code Vote up 4 votes
public boolean isProcessedAtDifferentDate() {
    return !ObjectUtils.equals(getDate(), getProcessDate());
}
 
Example 44
Project: OpenCyclos   File: PermissionHelper.java   View Source Code Vote up 4 votes
/**
 * Throws a {@link PermissionDeniedException} allowed is empty or not contains the given element
 */
public static void checkEquals(final Object expected, final Object actual) {
    if (!ObjectUtils.equals(expected, actual)) {
        throw new PermissionDeniedException();
    }
}
 
Example 45
Project: story-inspector   File: SaveManagerBase.java   View Source Code Vote up 4 votes
@Override
public boolean hasUnsavedChanges() {
	return !ObjectUtils.equals(this.savedEntity, this.trackedContainer.getSavableEntity());
}
 
Example 46
Project: communote-server   File: ConfigurationManagementImpl.java   View Source Code Vote up 4 votes
/**
 * {@inheritDoc}
 *
 */
@Override
public void setPrimaryAuthentication(String externalSystemId, boolean allowDBAuth,
        String currentPrimaryAuthentication) throws PrimaryAuthenticationException {
    ExternalSystemConfiguration externalSystemConfiguration = null;
    ExternalSystemConfiguration currentPrimaryExternalSystemConfiguration = null;
    if (StringUtils.isNotBlank(externalSystemId)) {
        externalSystemConfiguration = assertExternalSystemConfiguration(externalSystemId);
        // assert that there are enough admins if DB fallback is deactivated
        if (!allowDBAuth) {
            if (userManagement.getActiveUserCount(externalSystemId,
                    UserRole.ROLE_KENMEI_CLIENT_MANAGER) == 0) {
                throw new PrimaryAuthenticationException(
                        "There must be at least one active admin for the external system.",
                        externalSystemId,
                        PrimaryAuthenticationException.Reasons.NOT_ENOUGH_ADMINS);
            }
        }
    }
    if (StringUtils.isNotBlank(currentPrimaryAuthentication)) {
        if (currentPrimaryAuthentication.equals(externalSystemId)) {
            currentPrimaryExternalSystemConfiguration = externalSystemConfiguration;
        } else {
            currentPrimaryExternalSystemConfiguration = assertExternalSystemConfiguration(
                    currentPrimaryAuthentication);
        }
    }
    // check if the primary system changed
    if (!ObjectUtils.equals(externalSystemConfiguration,
            currentPrimaryExternalSystemConfiguration)) {
        // when setting another primary system it must be active
        if (externalSystemConfiguration != null) {
            if (!externalSystemConfiguration.isAllowExternalAuthentication()) {
                throw new PrimaryAuthenticationException(
                        "External authentication for the given system is not activated.",
                        externalSystemId,
                        PrimaryAuthenticationException.Reasons.EXTERNAL_AUTH_NOT_ALLOWED);
            }
            externalSystemConfiguration.setPrimaryAuthentication(true);
        }
        // deactivate current primary authentication
        if (currentPrimaryExternalSystemConfiguration != null) {
            currentPrimaryExternalSystemConfiguration.setPrimaryAuthentication(false);
        }
    }

    updateClientConfigSetting(ClientPropertySecurity.ALLOW_DB_AUTH_ON_EXTERNAL,
            Boolean.toString(allowDBAuth));
}
 
Example 47
Project: Genji   File: BaseTScreen.java   View Source Code Vote up 4 votes
/**
 * Set the value of ObjectID
 *
 * @param v new value
 */
public void setObjectID(Integer v) throws TorqueException
{

    if (!ObjectUtils.equals(this.objectID, v))
    {
        this.objectID = v;
        setModified(true);
    }



    // update associated TScreenTab
    if (collTScreenTabs != null)
    {
        for (int i = 0; i < collTScreenTabs.size(); i++)
        {
            ((TScreenTab) collTScreenTabs.get(i))
                    .setParent(v);
        }
    }

    // update associated TScreenConfig
    if (collTScreenConfigs != null)
    {
        for (int i = 0; i < collTScreenConfigs.size(); i++)
        {
            ((TScreenConfig) collTScreenConfigs.get(i))
                    .setScreen(v);
        }
    }

    // update associated TWorkflowActivity
    if (collTWorkflowActivitys != null)
    {
        for (int i = 0; i < collTWorkflowActivitys.size(); i++)
        {
            ((TWorkflowActivity) collTWorkflowActivitys.get(i))
                    .setScreen(v);
        }
    }
}
 
Example 48
Project: Genji   File: BaseTField.java   View Source Code Vote up 4 votes
/**
 * Set the value of ObjectID
 *
 * @param v new value
 */
public void setObjectID(Integer v) throws TorqueException
{

    if (!ObjectUtils.equals(this.objectID, v))
    {
        this.objectID = v;
        setModified(true);
    }



    // update associated TFieldConfig
    if (collTFieldConfigs != null)
    {
        for (int i = 0; i < collTFieldConfigs.size(); i++)
        {
            ((TFieldConfig) collTFieldConfigs.get(i))
                    .setField(v);
        }
    }

    // update associated TAttributeValue
    if (collTAttributeValues != null)
    {
        for (int i = 0; i < collTAttributeValues.size(); i++)
        {
            ((TAttributeValue) collTAttributeValues.get(i))
                    .setField(v);
        }
    }

    // update associated TScreenField
    if (collTScreenFields != null)
    {
        for (int i = 0; i < collTScreenFields.size(); i++)
        {
            ((TScreenField) collTScreenFields.get(i))
                    .setField(v);
        }
    }
}
 
Example 49
Project: Genji   File: BaseTPriority.java   View Source Code Vote up 4 votes
/**
 * Set the value of ObjectID
 *
 * @param v new value
 */
public void setObjectID(Integer v) throws TorqueException
{

    if (!ObjectUtils.equals(this.objectID, v))
    {
        this.objectID = v;
        setModified(true);
    }



    // update associated TPpriority
    if (collTPprioritys != null)
    {
        for (int i = 0; i < collTPprioritys.size(); i++)
        {
            ((TPpriority) collTPprioritys.get(i))
                    .setPriority(v);
        }
    }

    // update associated TWorkItem
    if (collTWorkItems != null)
    {
        for (int i = 0; i < collTWorkItems.size(); i++)
        {
            ((TWorkItem) collTWorkItems.get(i))
                    .setPriorityID(v);
        }
    }

    // update associated TEscalationEntry
    if (collTEscalationEntrys != null)
    {
        for (int i = 0; i < collTEscalationEntrys.size(); i++)
        {
            ((TEscalationEntry) collTEscalationEntrys.get(i))
                    .setPriority(v);
        }
    }
}
 
Example 50
Project: FinanceAnalytics   File: CouponIborCompoundingDefinition.java   View Source Code Vote up 4 votes
@Override
public boolean equals(final Object obj) {
  if (this == obj) {
    return true;
  }
  if (!super.equals(obj)) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final CouponIborCompoundingDefinition other = (CouponIborCompoundingDefinition) obj;
  if (!Arrays.equals(_accrualEndDates, other._accrualEndDates)) {
    return false;
  }
  if (!Arrays.equals(_accrualStartDates, other._accrualStartDates)) {
    return false;
  }
  if (!Arrays.equals(_fixingDates, other._fixingDates)) {
    return false;
  }
  if (!Arrays.equals(_fixingPeriodAccrualFactors, other._fixingPeriodAccrualFactors)) {
    return false;
  }
  if (!Arrays.equals(_fixingPeriodEndDates, other._fixingPeriodEndDates)) {
    return false;
  }
  if (!Arrays.equals(_fixingPeriodStartDates, other._fixingPeriodStartDates)) {
    return false;
  }
  if (_index == null) {
    if (other._index != null) {
      return false;
    }
  } else if (!_index.equals(other._index)) {
    return false;
  }
  if (!ObjectUtils.equals(_index, other._index)) {
    return false;
  }
  if (Double.doubleToLongBits(_initialRate) != Double.doubleToLongBits(other._initialRate)) {
    return false;
  }
  return true;
}
 
Example 51
Project: Genji   File: BaseTWorkItemLock.java   View Source Code Vote up 3 votes
/**
 * Return the associated TPerson object
 * If it was not retrieved before, the object is retrieved from
 * the database using the passed connection
 *
 * @param connection the connection used to retrieve the associated object
 *        from the database, if it was not retrieved before
 * @return the associated TPerson object
 * @throws TorqueException
 */
public TPerson getTPerson(Connection connection)
    throws TorqueException
{
    if (aTPerson == null && (!ObjectUtils.equals(this.person, null)))
    {
        aTPerson = TPersonPeer.retrieveByPK(SimpleKey.keyFor(this.person), connection);
    }
    return aTPerson;
}
 
Example 52
Project: Genji   File: BaseTScreenConfig.java   View Source Code Vote up 3 votes
/**
 * Return the associated TAction object
 * If it was not retrieved before, the object is retrieved from
 * the database using the passed connection
 *
 * @param connection the connection used to retrieve the associated object
 *        from the database, if it was not retrieved before
 * @return the associated TAction object
 * @throws TorqueException
 */
public TAction getTAction(Connection connection)
    throws TorqueException
{
    if (aTAction == null && (!ObjectUtils.equals(this.action, null)))
    {
        aTAction = TActionPeer.retrieveByPK(SimpleKey.keyFor(this.action), connection);
    }
    return aTAction;
}
 
Example 53
Project: Genji   File: BaseTProjectReportRepository.java   View Source Code Vote up 3 votes
/**
 * Return the associated TProject object
 * If it was not retrieved before, the object is retrieved from
 * the database using the passed connection
 *
 * @param connection the connection used to retrieve the associated object
 *        from the database, if it was not retrieved before
 * @return the associated TProject object
 * @throws TorqueException
 */
public TProject getTProject(Connection connection)
    throws TorqueException
{
    if (aTProject == null && (!ObjectUtils.equals(this.projectID, null)))
    {
        aTProject = TProjectPeer.retrieveByPK(SimpleKey.keyFor(this.projectID), connection);
    }
    return aTProject;
}
 
Example 54
Project: report   File: ObjectUtil.java   View Source Code Vote up 2 votes
/**
 * <p>
 * Compares two objects for inequality, where either one or both objects may
 * be <code>null</code>.
 * </p>
 * 
 * <pre>
 * ObjectUtils.notEqual(null, null)                  = false
 * ObjectUtils.notEqual(null, "")                    = true
 * ObjectUtils.notEqual("", null)                    = true
 * ObjectUtils.notEqual("", "")                      = false
 * ObjectUtils.notEqual(Boolean.TRUE, null)          = true
 * ObjectUtils.notEqual(Boolean.TRUE, "true")        = true
 * ObjectUtils.notEqual(Boolean.TRUE, Boolean.TRUE)  = false
 * ObjectUtils.notEqual(Boolean.TRUE, Boolean.FALSE) = true
 * </pre>
 * 
 * @param object1
 *            the first object, may be <code>null</code>
 * @param object2
 *            the second object, may be <code>null</code>
 * @return <code>false</code> if the values of both objects are the same
 * @since 2.6
 */
public static boolean notEqual(Object object1, Object object2) {
	return ObjectUtils.equals(object1, object2) == false;
}