Example usage for java.lang Integer equals

List of usage examples for java.lang Integer equals

Introduction

In this page you can find the example usage for java.lang Integer equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:de.iteratec.iteraplan.businesslogic.exchange.nettoExport.SpreadsheetReportColumnStructure.java

private String resolveAttributeValue(Object resolvedObject) {
    if (resolvedObject instanceof Iterable<?>) {
        List<String> valuesList = Lists.newArrayList();
        for (Object avaObj : (Iterable<?>) resolvedObject) {
            if (avaObj instanceof AttributeValueAssignment) {
                AttributeValueAssignment ava = (AttributeValueAssignment) avaObj;
                try {
                    AttributeValue attributeValue = ava.getAttributeValue();
                    AttributeType attributeType = attributeValue.getAbstractAttributeType();
                    TypeOfAttribute typeOfAttribute = attributeType.getTypeOfAttribute();
                    Integer atIdEntity = attributeType.getId();
                    Integer atIdCol = Integer.valueOf((columnEntry.getField()));
                    if (atIdCol.equals(atIdEntity)) {
                        switch (typeOfAttribute) {
                        case DATE:
                            if (attributeValue instanceof DateAV) {
                                Object valueObj = ((DateAV) attributeValue).getValue();
                                valuesList.add(getDateFormat().format(valueObj));
                            } else {
                                valuesList.add(String.valueOf(attributeValue.getValue()));
                            }//  ww w.j  a  v a 2 s  . c o  m
                            break;
                        case RESPONSIBILITY:
                            if (attributeValue instanceof ResponsibilityAV) {
                                valuesList.add(((ResponsibilityAV) attributeValue).getName());
                            } else {
                                valuesList.add(String.valueOf(attributeValue.getValue()));
                            }
                            break;
                        default:
                            valuesList.add(String.valueOf(attributeValue.getValue()));
                            break;
                        }
                    }
                } catch (Exception e) {
                    // nothing
                }
            }
        }
        if (valuesList.size() > 0) {
            return Joiner.on(MULTIVALUE_SEPARATOR).join(valuesList);
        }
    }
    return NOT_FOUND;
}

From source file:net.firejack.platform.service.registry.broker.install.PerformPackageArchiveBroker.java

@Override
protected ServiceResponse perform(ServiceRequest<NamedValues> request) throws Exception {
    String uploadedFilename = (String) request.getData().get("uploadedFilename");
    String versionName = (String) request.getData().get("versionName");
    Boolean doAsCurrent = (Boolean) request.getData().get("doAsCurrent");
    Boolean doArchive = (Boolean) request.getData().get("doArchive");

    Integer version = VersionUtils.convertToNumber(versionName);

    InputStream stream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE,
            PackageFileType.PACKAGE_XML.getOfrFileName() + "." + uploadedFilename, helper.getTemp());
    PackageModel packageRN;//from  www.  ja v a  2 s  . co m
    IPackageDescriptor patchProcessor;
    if (StringUtils.isBlank(uploadedFilename) || stream == null) {
        throw new BusinessFunctionException(null, "file.is.not.exist", PackageFileType.PACKAGE_XML.name());
    } else {
        patchProcessor = packageInstallationService.getPackageDescriptor(stream);
        IOUtils.closeQuietly(stream);
        String packageLookup = patchProcessor.getPath() + "." + StringUtils.normalize(patchProcessor.getName());
        packageRN = packageStore.findByLookup(packageLookup);
        if (packageRN == null) {
            throw new BusinessFunctionException(null, "package.not.found.by.lookup", packageLookup);
        }
    }

    try {
        InputStream resourceStream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE,
                PackageFileType.RESOURCE_ZIP.getOfrFileName() + "." + uploadedFilename, helper.getTemp());
        InputStream warStream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE,
                PackageFileType.APP_WAR.getOfrFileName() + "." + uploadedFilename, helper.getTemp());

        String packageXmlFile = packageRN.getName() + PackageFileType.PACKAGE_XML.getDotExtension();

        if (doArchive) {
            IPackageDescriptor descriptor = packageExporter.exportPackageDescriptor(packageRN.getId());
            PackageExportResult result = packageExporter.exportPackageDescriptor(descriptor);
            packageVersionHelper.archiveVersion(packageRN, packageRN.getVersion(), result.getPackageXml());
        }

        Integer packageXmlVersion = VersionUtils.convertToNumber(patchProcessor.getVersion());
        if (!packageXmlVersion.equals(version)) {
            stream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE,
                    PackageFileType.PACKAGE_XML.getOfrFileName() + "." + uploadedFilename, helper.getTemp());
            InputStream inputStream = packageVersionHelper.changeVersionNumber(stream, version);
            OPFEngine.FileStoreService.upload(OpenFlame.FILESTORE_BASE,
                    PackageFileType.PACKAGE_XML.name() + uploadedFilename, inputStream, helper.getTemp());
            IOUtils.closeQuietly(stream);
            IOUtils.closeQuietly(inputStream);
        }

        stream = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE,
                PackageFileType.PACKAGE_XML.getOfrFileName() + "." + uploadedFilename, helper.getTemp());
        OPFEngine.FileStoreService.upload(OpenFlame.FILESTORE_BASE, packageXmlFile, stream, helper.getVersion(),
                String.valueOf(packageRN.getId()), version.toString());
        IOUtils.closeQuietly(stream);

        String resourceZipFile = packageRN.getName() + PackageFileType.RESOURCE_ZIP.getDotExtension();
        if (resourceStream != null) {
            OPFEngine.FileStoreService.upload(OpenFlame.FILESTORE_BASE, resourceZipFile, resourceStream,
                    helper.getVersion(), String.valueOf(packageRN.getId()), version.toString());
            IOUtils.closeQuietly(resourceStream);
        }

        if (warStream != null) {
            String war = packageRN.getName() + PackageFileType.APP_WAR.getDotExtension();
            OPFEngine.FileStoreService.upload(OpenFlame.FILESTORE_BASE, war, warStream, helper.getVersion(),
                    String.valueOf(packageRN.getId()), version.toString());
            IOUtils.closeQuietly(warStream);
        }

        if (doAsCurrent) {
            InputStream packageXml = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE,
                    packageXmlFile, helper.getVersion(), String.valueOf(packageRN.getId()), version.toString());
            InputStream resourceZip = OPFEngine.FileStoreService.download(OpenFlame.FILESTORE_BASE,
                    resourceZipFile, helper.getVersion(), String.valueOf(packageRN.getId()),
                    version.toString());
            StatusProviderTranslationResult result = packageInstallationService.activatePackage(packageXml,
                    resourceZip);
            IOUtils.closeQuietly(packageXml);
            IOUtils.closeQuietly(resourceZip);
            if (result.getResult()) {
                packageRN = packageStore.updatePackageVersion(packageRN.getId(), version);
            }
        }
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }

    return new ServiceResponse("Activate successfully", true);
}

From source file:org.kuali.coeus.s2sgen.impl.generate.support.CommonSF424BaseGenerator.java

/**
  * This method returns a map containing the answers related to EOState REview for a given proposal
  */*  w  w  w . j  a  va 2s .  co  m*/
  * @param pdDoc Proposal Development Document.
  * @return Map&lt;String, String&gt; map containing the answers related to EOState Review for a given proposal.
  */
public Map<String, String> getEOStateReview(ProposalDevelopmentDocumentContract pdDoc) {
    Map<String, String> stateReview = new HashMap<>();
    List<? extends AnswerHeaderContract> answerHeaders = propDevQuestionAnswerService
            .getQuestionnaireAnswerHeaders(pdDoc.getDevelopmentProposal().getProposalNumber());
    if (!answerHeaders.isEmpty()) {
        for (AnswerContract answers : answerHeaders.get(0).getAnswers()) {
            Integer questionSeqId = getQuestionAnswerService().findQuestionById(answers.getQuestionId())
                    .getQuestionSeqId();
            if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_129)) {
                stateReview.putIfAbsent(YNQ_ANSWER, answers.getAnswer());
            }
            if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_130)) {
                stateReview.putIfAbsent(YNQ_REVIEW_DATE, answers.getAnswer());
            }
            if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_131)) {
                stateReview.putIfAbsent(YNQ_STATE_REVIEW_DATA, answers.getAnswer());
            }
        }
    }
    // If question is not answered or question is inactive
    if (stateReview.size() == 0) {
        stateReview.put(YNQ_ANSWER, YNQ_NOT_REVIEWED);
        stateReview.put(YNQ_REVIEW_DATE, null);
    }
    return stateReview;
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.manager.executionCourseManagement.SeperateExecutionCourse.java

boolean contains(Integer[] integerArray, Integer integer) {
    for (Integer element : integerArray) {
        if (integer.equals(element)) {
            return true;
        }/*from w w  w . j  av a2s  .  c  o  m*/
    }

    return false;
}

From source file:com.linuxbox.enkive.statistics.removal.RemovalJob.java

/**
 * this method takes an identifier that determines a date range and a type
 * of grainualarity and deletes all the objects found in a query over these
 * //from   w  ww  . j  a v  a2 s  .co  m
 * @param interval
 *            - the identifier that determines how the date is to be made
 * @param grainType
 *            - the type of grainularity to delete
 */
private void cleaner(int interval, int grainType) {
    setDate(interval);
    StatsQuery query = new MongoStatsDateQuery(new Date(0L), dateFilter);
    query.grainType = grainType;
    Set<Map<String, Object>> data = client.queryStatistics(query);
    Set<Object> deletionSet = createSetOfObjs();

    for (Map<String, Object> map : data) {
        Integer gType = (Integer) map.get(CONSOLIDATION_TYPE);
        if (gType != null) {
            if (gType.equals(grainType)) {
                deletionSet.add(map.get("_id"));
            }
        } else if (grainType == 0) {
            deletionSet.add(map.get("_id"));
        }
    }
    client.remove(deletionSet);
}

From source file:com.aurel.track.fieldType.runtime.matchers.run.CompositeSelectMatcherRT.java

private boolean containsValue(Integer intValue, Object[] intArr) {
    for (int i = 0; i < intArr.length; i++) {
        if (intValue.equals(intArr[i])) {
            return true;
        }// w w  w.  j ava  2  s  .  co m
    }
    return false;
}

From source file:de.forsthaus.backend.dao.impl.SecRightDAOImpl.java

@SuppressWarnings("unchecked")
@Override//from   w w  w . jav  a2 s.  co m
public List<SecRight> getRightsLikeRightNameAndTypes(String aRightName, List<Integer> listOfRightTyps) {

    final DetachedCriteria criteria = DetachedCriteria.forClass(SecRight.class);
    criteria.addOrder(Order.asc("rigName"));

    List<SecRight> result = null; // init

    String hqlFrom = "";
    String hqlWhere = "";
    String hqlAdd = "";

    // check if value is '-1'. it means 'all', no filtering
    // only if value is empty
    for (final Integer integer : listOfRightTyps) {
        if (integer.equals(new Integer(-1))) {
            if (aRightName.isEmpty()) {
                return getAllRights(integer.intValue());
            } else if (!aRightName.isEmpty()) {

                hqlFrom = " from SecRight as secRight where ";
                hqlWhere = " secRight.rigName like '%" + aRightName + "%'";
                final String hqlQuery = hqlFrom + hqlWhere;

                // System.out.println(hqlQuery);

                return getHibernateTemplate().find(hqlQuery);
            }
        }
    }

    // check if only 1 type and value is empty
    if (listOfRightTyps.size() == 1) {
        final int i = listOfRightTyps.get(0).intValue();
        if (aRightName.isEmpty()) {
            return getAllRights(i);
        }
    }

    // if more than one type than construct the hql query
    hqlFrom = " from SecRight as secRight where ";
    // get the first value
    hqlWhere = " secRight.rigType = " + listOfRightTyps.get(0);

    for (int i = 1; i < listOfRightTyps.size(); i++) {
        hqlWhere = hqlWhere + " or secRight.rigType = " + listOfRightTyps.get(i);
    }

    String hqlQuery = hqlFrom + hqlWhere;

    if (!aRightName.isEmpty()) {
        // add the right name
        hqlAdd = " and secRight.rigName like '%" + aRightName + "%'";
        hqlQuery = hqlQuery + hqlAdd;
    }

    // System.out.println(hqlQuery);

    result = getHibernateTemplate().find(hqlQuery);

    return result;
}

From source file:com.aurel.track.fieldType.runtime.system.select.SystemPersonBaseRT.java

/**
 * Loads the matcher for the field /*from ww  w.  j a v  a2 s. c  o m*/
 * @param fieldID 
 */
@Override
public IMatcherRT getMatcherRT(Integer fieldID, int relation, Object matchValue,
        MatcherContext matcherContext) {
    IMatcherRT matcherRT = new SystemSelectMatcherRT(fieldID, relation, matchValue, matcherContext);
    //replace the symbolic value with the actual value
    Integer[] matchValueArr;
    if (matchValue != null) {
        try {
            matchValueArr = (Integer[]) matchValue;
            if (matchValueArr != null) {
                for (int i = 0; i < matchValueArr.length; i++) {
                    Integer intMatchValue = matchValueArr[i];
                    if (intMatchValue != null && intMatchValue.equals(MatcherContext.LOGGED_USER_SYMBOLIC)) {
                        Map<Integer, Integer> loggedUserReplacement = (Map<Integer, Integer>) (matcherContext
                                .getContextMap().get(MatcherContext.LOGGED_USER));
                        if (loggedUserReplacement != null
                                && loggedUserReplacement.get(MatcherContext.LOGGED_USER_SYMBOLIC) != null) {
                            matchValueArr[i] = loggedUserReplacement.get(MatcherContext.LOGGED_USER_SYMBOLIC);
                            break;
                        }
                    }
                }
            }
        } catch (Exception e) {
            LOGGER.warn("Converting the match value to Integer[] failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
        }
    }
    return matcherRT;
}

From source file:com.sshtools.appframework.api.ui.ActionBuilder.java

protected void rebuildMenuBar(Collection<AppAction> enabledActions) {
    menuBar.invalidate();//  w ww  .  j a v  a2 s.c  o  m

    // Build the menu bar action list
    menuBar.removeAll();
    List<AppAction> menuBarActions = new ArrayList<AppAction>();
    for (AppAction action : enabledActions) {
        if (Boolean.TRUE.equals(action.getValue(AppAction.ON_MENUBAR))) {
            menuBarActions.add(action);
        }
    }
    log.debug("There are " + menuBarActions.size() + " on the menubar");

    // Build the menu bar
    List<ActionMenu> menus = new ArrayList<ActionMenu>(listActionMenus());
    Collections.sort(menus);
    Map<String, List<AppAction>> map = new HashMap<String, List<AppAction>>();
    for (AppAction z : menuBarActions) {
        String menuName = (String) z.getValue(AppAction.MENU_NAME);
        if (menuName == null) {
        } else {
            ;
            String m = (String) z.getValue(AppAction.MENU_NAME);
            ActionMenu menu = getActionMenu(menus.iterator(), m);
            if (menu != null) {
                List<AppAction> x = map.get(menu.getName());
                if (x == null) {
                    x = new ArrayList<AppAction>();
                    map.put(menu.getName(), x);
                }
                x.add(z);
            }
        }
    }

    // Create the menu components
    for (ActionMenu m : menus) {
        List<AppAction> x = map.get(m.getName());
        if (x != null) {
            Collections.sort(x, new MenuItemActionComparator());
            JMenu menu = new JMenu(m.getDisplayName());
            menu.setMnemonic(m.getWeight());
            Integer grp = null;
            for (AppAction a : x) {
                Integer g = (Integer) a.getValue(AppAction.MENU_ITEM_GROUP);
                if ((grp != null) && !g.equals(grp)) {
                    menu.addSeparator();
                }
                grp = g;
                if (a instanceof MenuAction) {
                    JMenu mnu = (JMenu) a.getValue(MenuAction.MENU);
                    menu.add(mnu);
                } else {
                    if (Boolean.TRUE.equals(a.getValue(AppAction.IS_TOGGLE_BUTTON))) {
                        menu.add(new ActionJCheckboxMenuItem(a));
                    } else {
                        JMenuItem item = new JMenuItem(a);
                        menu.add(item);
                    }
                }
            }
            menuBar.add(menu);
        }
    }
    menuBar.validate();
    menuBar.repaint();
}

From source file:com.heliumv.factory.impl.ZeiterfassungCall.java

private void modifyKommtGehtToNow(ZeitdatenDto zDto) throws RemoteException, NamingException, EJBExceptionLP {
    Integer taetigkeitId = zDto.getTaetigkeitIId();
    if (taetigkeitId == null)
        return;/*from  www. j  a v  a 2 s  . c o  m*/

    if (taetigkeitId.equals(getCachedTaetigkeitId(ZeiterfassungFac.TAETIGKEIT_KOMMT))
            || taetigkeitId.equals(getCachedTaetigkeitId(ZeiterfassungFac.TAETIGKEIT_GEHT))
            || taetigkeitId.equals(getCachedTaetigkeitId(ZeiterfassungFac.TAETIGKEIT_UNTER))) {

        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(System.currentTimeMillis());
        c.set(Calendar.MILLISECOND, 0);
        c.set(Calendar.SECOND, 0);
        zDto.setTZeit(new Timestamp(c.getTimeInMillis()));
    }
}