List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:com.aurel.track.admin.customize.category.filter.parameters.FilterSelectsParametersUtil.java
/** * Whether the saved filter contains parameter or not * @return/* w w w . j av a 2s . c om*/ */ public static boolean savedFilterContainsParameter(Integer filterID, TPersonBean personBean, Locale locale) { TQueryRepositoryBean queryRepositoryBean = (TQueryRepositoryBean) TreeFilterFacade.getInstance() .getByKey(filterID); boolean containsParameter = false; if (queryRepositoryBean != null) { Integer queryType = queryRepositoryBean.getQueryType(); if (queryType != null && queryType.intValue() == QUERY_PURPOSE.TREE_FILTER) { QNode extendedRootNode = FilterBL.loadNode(queryRepositoryBean); FilterUpperTO filterUpperTO = FilterUpperFromQNodeTransformer .getFilterSelectsFromTree(extendedRootNode, true, true, personBean, locale, true); QNode rootNode = TreeFilterLoaderBL.getOriginalTree(extendedRootNode); if (containsParameter(filterUpperTO) || QNodeParametersUtil.containsParameter(rootNode)) { containsParameter = true; } } } return containsParameter; }
From source file:edu.umd.cs.submitServer.servlets.UploadSubmission.java
public static Submission uploadSubmission(Project project, StudentRegistration studentRegistration, byte[] zipOutput, HttpServletRequest request, Timestamp submissionTimestamp, String clientTool, String clientVersion, String cvsTimestamp, SubmitServerDatabaseProperties db, Logger log) throws ServletException, IOException { Connection conn;/*ww w . j a va 2 s . c om*/ try { conn = db.getConnection(); } catch (SQLException e) { throw new ServletException(e); } Submission submission = null; boolean transactionSuccess = false; try { Integer baselinePK = project.getArchivePK(); int testSetupPK = project.getTestSetupPK(); byte baseLineSubmission[] = null; if (baselinePK != null && baselinePK.intValue() != 0) { baseLineSubmission = project.getBaselineZip(conn); } else if (testSetupPK != 0) { baseLineSubmission = Submission.lookupCanonicalSubmissionArchive(project.getProjectPK(), conn); } zipOutput = FixZip.adjustZipNames(baseLineSubmission, zipOutput); int archivePK = Submission.uploadSubmissionArchive(zipOutput, conn); synchronized (UPLOAD_LOCK) { final int NUMBER_OF_ATTEMPTS = 2; int attempt = 1; while (true) { try { conn.setAutoCommit(false); conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); submission = Submission.submit(archivePK, studentRegistration, project, cvsTimestamp, clientTool, clientVersion, submissionTimestamp, conn); conn.commit(); transactionSuccess = true; break; } catch (SQLException e) { conn.rollback(); if (attempt++ >= NUMBER_OF_ATTEMPTS) { Submission.deleteAbortedSubmissionArchive(archivePK, conn); throw e; } } } } } catch (SQLException e) { throw new ServletException(e); } finally { rollbackIfUnsuccessfulAndAlwaysReleaseConnection(transactionSuccess, request, conn, db, log); } logSubmission(studentRegistration, zipOutput, submission); if (submission.getBuildStatus() == Submission.BuildStatus.NEW) WaitingBuildServer.offerSubmission(project, submission); return submission; }
From source file:it.cnr.icar.eric.client.ui.swing.SwingWorker.java
/** * Activate the capabilities of glasspane, only if this is the 1st running * call for 'aComp'//from w w w . ja v a 2s . com * * @return GlassPane for aComponent's top level component. */ private static synchronized void deactivateGlassPaneSynch(GlassPane aPane) { if (aPane != null) { Integer iCount = countPerGlassPane.get(aPane); if (iCount == null) { // no GlassPane active for it, error?, return return; } else { int count = iCount.intValue(); if (count == 1) { // only one activateGlassPane call for aPane, reset count countPerGlassPane.remove(aPane); // Stop UI interception aPane.setVisible(false); } else { // More than one call, just decrease count int newCount = count - 1; countPerGlassPane.put(aPane, new Integer(newCount)); } } } }
From source file:com.aurel.track.fieldType.runtime.bl.AttributeValueBL.java
/** * Prepares a map of attributeValueBeans for a workItem: * - key: fieldID_parameterCode//from w w w .ja v a2 s .c om * - value: attributeValueBean or list of attributeValueBeans * (custom and system selects because they might be multiple) * attributeValueBeanList contains attributeValueBeans for the same workItem * @param attributeValueBeanList list of attributeValueBeans * @return */ private static Map<String, Object> prepareAttributeValueMapForWorkItem( List<TAttributeValueBean> attributeValueBeanList) { Map<String, Object> attributeValueBeanMap = new HashMap<String, Object>(); //load the custom attributes to workItemBeans for (TAttributeValueBean attributeValueBean : attributeValueBeanList) { String mergeKey = MergeUtil.mergeKey(attributeValueBean.getField(), attributeValueBean.getParameterCode()); Integer valueType = attributeValueBean.getValidValue(); if (valueType == null || (valueType.intValue() != ValueType.CUSTOMOPTION && valueType.intValue() != ValueType.SYSTEMOPTION)) { //direct value (not a select) if (!attributeValueBeanMap.containsKey(mergeKey)) { attributeValueBeanMap.put(mergeKey, attributeValueBean); } else { //somehow (race condition?) there are more entries in db. delete them silently deleteByObjectID(attributeValueBean.getObjectID()); } } else { //select value (custom or system): there might be more entries for the same mergeKey (when multiple=true). //each fieldType should know whether it should get the value from //the map as attributeValueBean or as list of attributeValueBeans List<TAttributeValueBean> selectAttributeList = (List<TAttributeValueBean>) attributeValueBeanMap .get(mergeKey); if (selectAttributeList == null) { selectAttributeList = new ArrayList<TAttributeValueBean>(); attributeValueBeanMap.put(mergeKey, selectAttributeList); } selectAttributeList.add(attributeValueBean); } } return attributeValueBeanMap; }
From source file:de.iteratec.iteraplan.businesslogic.exchange.common.informationflow.InformationFlowGeneralHelper.java
/** * retrieves the caption for the legend//from ww w . j a va 2 s .co m * * @param lineCaptionSelected * which type of element / attribute to be used for the caption * @param lineCaptionAttributeId * the id of the attribute * @param informationFlowOptions * the info flow options bean * @param locale * the currently used locale * @return See method description. */ public static String getDescriptionTypeName(AttributeTypeService attributeTypeService, int[] lineCaptionSelected, Integer lineCaptionAttributeId, IInformationFlowOptions informationFlowOptions, Locale locale) { List<String> descriptionTypeNames = Lists.newArrayList(); for (int lineCaption : lineCaptionSelected) { switch (lineCaption) { case InformationFlowOptionsBean.LINE_DESCR_ATTRIBUTES: if (GraphicalExportBaseOptions.NOTHING_SELECTED != lineCaptionAttributeId.intValue()) { AttributeType attrType = attributeTypeService.loadObjectById(lineCaptionAttributeId); descriptionTypeNames.add(attrType.getName()); } else { descriptionTypeNames.add("n.a."); } break; case InformationFlowOptionsBean.LINE_DESCR_TECHNICAL_COMPONENTS: descriptionTypeNames .add(MessageAccess.getStringOrNull(Constants.BB_TECHNICALCOMPONENTRELEASE_PLURAL, locale)); break; case InformationFlowOptionsBean.LINE_DESCR_DESCRIPTION: descriptionTypeNames.add(MessageAccess.getStringOrNull(Constants.ATTRIBUTE_DESCRIPTION, locale)); break; case InformationFlowOptionsBean.LINE_DESCR_NAME: descriptionTypeNames.add(MessageAccess.getStringOrNull(Constants.ATTRIBUTE_NAME, locale)); break; default: // Business Objects are displayed at the end } } if (ArrayUtils.contains(lineCaptionSelected, InformationFlowOptionsBean.LINE_DESCR_BUSINESS_OBJECTS)) { descriptionTypeNames.add(MessageAccess.getStringOrNull(Constants.BB_BUSINESSOBJECT_PLURAL, locale)); } return StringUtils.join(descriptionTypeNames, "; "); }
From source file:gate.termraider.util.Utilities.java
/** * Forces the ultimate value to be Integer. *//*from w w w .ja v a2s.com*/ public static void incrementScoreTermValue(Map<ScoreType, Map<Term, Number>> map, ScoreType type, Term term, Integer increment) { Map<Term, Number> submap; if (map.containsKey(type)) { submap = map.get(type); } else { submap = new HashMap<Term, Number>(); } int count; if (submap.containsKey(term)) { count = submap.get(term).intValue(); } else { count = 0; } count += increment.intValue(); submap.put(term, count); map.put(type, submap); }
From source file:de.schaeuffelhut.android.openvpn.Preferences.java
public final static void setDns1(Context context, File configFile, Integer dnsChange, String dns) { Editor edit = PreferenceManager.getDefaultSharedPreferences(context).edit(); edit.putInt(Preferences.KEY_CONFIG_DNSCHANGE(configFile), dnsChange == null ? -1 : dnsChange.intValue()); edit.putString(Preferences.KEY_CONFIG_DNS1(configFile), dns); edit.commit();//w w w. j a v a2s . c o m }
From source file:uk.org.funcube.fcdw.server.processor.DataProcessor.java
private static String calculateDigest(final String hexString, final String authCode, final Integer utf) throws NoSuchAlgorithmException { String digest = null;/*from ww w .ja v a 2 s. c o m*/ final MessageDigest md5 = MessageDigest.getInstance("MD5"); if (utf == null) { md5.update(hexString.getBytes()); md5.update(":".getBytes()); digest = convertToHex(md5.digest(authCode.getBytes())); } else if (utf.intValue() == 8) { md5.update(hexString.getBytes(Charset.forName("UTF8"))); md5.update(":".getBytes(Charset.forName("UTF8"))); digest = convertToHex(md5.digest(authCode.getBytes(Charset.forName("UTF8")))); } else { md5.update(hexString.getBytes(Charset.forName("UTF16"))); md5.update(":".getBytes(Charset.forName("UTF16"))); digest = convertToHex(md5.digest(authCode.getBytes(Charset.forName("UTF16")))); } return digest; }
From source file:com.aurel.track.item.PrintItemDetailsBL.java
private static Integer getConfigByName(Properties properties, String configString, int defaultValue) { Integer configValue = null; try {//from w ww . j av a 2 s . c o m configValue = Integer.valueOf(properties.getProperty(configString).trim()); } catch (Exception e) { LOGGER.warn("Loading the " + configString + " failed with " + e.getMessage()); } if (configValue == null || configValue.intValue() <= 0) { return Integer.valueOf(defaultValue); } else { return configValue; } }
From source file:gridool.sqlet.catalog.PartitioningConf.java
private static int[] toFieldIndexes(@Nullable Map<String, Integer> map) { if (map == null) { return new int[] { 0, 1, 2, 3, 4, 5 }; } else {/*from w ww . j a v a 2s .c o m*/ Integer c0 = map.get("NODE"); Integer c1 = map.get("MASTER"); Integer c2 = map.get("DBURL"); Integer c3 = map.get("USER"); Integer c4 = map.get("PASSWORD"); Integer c5 = map.get("MAPOUTPUT"); Preconditions.checkNotNull(c0, c1, c2, c3, c4, c5); final int[] indexes = new int[6]; indexes[0] = c0.intValue(); indexes[1] = c1.intValue(); indexes[2] = c2.intValue(); indexes[3] = c3.intValue(); indexes[4] = c4.intValue(); indexes[5] = c5.intValue(); return indexes; } }