List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:gov.nih.nci.cabig.caaers.web.admin.MandatoryFieldsController.java
/** * Populates the fields, the key of the map will be qualified name of the parent. Display name * of the field will be display name of the node. In case if the node does not have a display * name, the display name of the parent will be used instead. *///from w w w. ja va 2s .c o m //protected void populateFieldMap(MandatoryFieldsCommand command, Map<String, InputFieldGroup> map, TreeNode node) { protected void populateFieldMap(MandatoryFieldsCommand command, Map<String, InputFieldGroup> map, TreeNode node) { // only add leaf nodes in the filed map. (others are just sections) if (node.isLeaf()) { String key = node.getParent().getQualifiedDisplayName(); InputFieldGroup group = map.get(key); if (group == null) { group = new DefaultInputFieldGroup(key); map.put(key, group); } List<InputField> fields = group.getFields(); String displayName = node.getDisplayName(); String path = node.getPropertyPath(); if (StringUtils.isEmpty(path)) return; Integer pathIndex = command.getMandatoryFieldMap().get(path); if (pathIndex == null) return; int index = pathIndex.intValue(); if (StringUtils.isEmpty(displayName)) displayName = node.getParent().getDisplayName(); fields.add(InputFieldFactory.createSelectField("mandatoryFields[" + index + "].mandatory", displayName, false, WebUtils.collectOptions(Arrays.asList(Mandatory.values()), "name", "displayName"))); } else { // add children of this node in the map for (TreeNode n : node.getChildren()) populateFieldMap(command, map, n); } }
From source file:com.adobe.acs.commons.util.impl.ReflectionUtilTest.java
@Test public void test_inheritanceValueMap() { InheritanceValueMap inheritanceValueMap = new HierarchyNodeInheritanceValueMap(valueMap); Integer myInheritedIntegerField = ReflectionUtil.convertValueMapValue(inheritanceValueMap, "myIntegerField", Integer.class); assertEquals(22, myInheritedIntegerField.intValue()); }
From source file:es.emergya.bbdd.dao.RolHome.java
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true, rollbackFor = Throwable.class) public Integer getTotal() { Integer res = new Integer(-1); Session currentSession = getSession(); currentSession.clear();// ww w. j a va 2 s.c om Criteria criteria = currentSession.createCriteria(Rol.class).setProjection(Projections.rowCount()); Integer count = (Integer) criteria.uniqueResult(); res = count.intValue(); return res; }
From source file:org.springmodules.validation.bean.conf.loader.xml.handler.LengthRuleElementHandler.java
protected AbstractValidationRule createValidationRule(Element element) { String minText = element.getAttribute(MIN_ATTR); String maxText = element.getAttribute(MAX_ATTR); Integer min = (StringUtils.hasText(minText)) ? new Integer(minText) : null; Integer max = (StringUtils.hasText(maxText)) ? new Integer(maxText) : null; if (min != null && max != null) { return new LengthValidationRule(min.intValue(), max.intValue()); }// w w w. jav a 2 s .co m if (min != null) { return new MinLengthValidationRule(min.intValue()); } if (max != null) { return new MaxLengthValidationRule(max.intValue()); } throw new ValidationConfigurationException( "Element '" + ELEMENT_NAME + "' must have either 'min' attribute, 'max' attribute, or both"); }
From source file:com.adito.util.Utils.java
/** * Given a string containing entity escapes, returns a string * containing the actual Unicode characters corresponding to the * escapes./*from ww w . j a v a 2 s .c o m*/ * * Note: nasty bug fixed by Helge Tesgaard (and, in parallel, by * Alex, but Helge deserves major props for emailing me the fix). * 15-Feb-2002 Another bug fixed by Sean Brown <sean@boohai.com> * * @see #htmlescape(String) **/ public static String htmlunescape(String s1) { StringBuffer buf = new StringBuffer(); int i; for (i = 0; i < s1.length(); ++i) { char ch = s1.charAt(i); if (ch == '&') { int semi = s1.indexOf(';', i + 1); if (semi == -1) { buf.append(ch); continue; } String entity = s1.substring(i + 1, semi); Integer iso; if (entity.charAt(0) == '#') { iso = new Integer(entity.substring(1)); } else { iso = (Integer) e2i.get(entity); } if (iso == null) { buf.append("&" + entity + ";"); } else { buf.append((char) (iso.intValue())); } i = semi; } else { buf.append(ch); } } return buf.toString(); }
From source file:com.aurel.track.item.link.ItemLinkBL.java
/** * Merge the predecessor and successor links for a workItem * @return/*from w ww .ja v a2 s. c om*/ */ static List<TWorkItemLinkBean> getLinks(Collection<TWorkItemLinkBean> successorsForMeAsPredecessor, Collection<TWorkItemLinkBean> predecessorsForMeAsSuccessor) { Map<Integer, TLinkTypeBean> linkTypeMap = GeneralUtils.createMapFromList(LinkTypeBL.loadAll()); List<TWorkItemLinkBean> workItemLinkList = new LinkedList<TWorkItemLinkBean>(); //links from me as predecessor to successors if (successorsForMeAsPredecessor != null && !successorsForMeAsPredecessor.isEmpty()) { for (TWorkItemLinkBean workItemLinkBean : successorsForMeAsPredecessor) { Integer linkType = workItemLinkBean.getLinkType(); TLinkTypeBean linkTypeBean = linkTypeMap.get(linkType); Integer linkTypeDirection = linkTypeBean.getLinkDirection(); if (linkTypeBean == null || linkTypeDirection == null || linkTypeDirection.intValue() == LINK_DIRECTION.RIGHT_TO_LEFT) { //remove the links of type "right to left". Bidirectional and "left to right" (pred to succ) relations remain //for right to left link types the links are visible only from successor item continue; } workItemLinkList.add(workItemLinkBean); } } //links from me as successor to predecessors if (predecessorsForMeAsSuccessor != null && !predecessorsForMeAsSuccessor.isEmpty()) { for (TWorkItemLinkBean workItemLinkBean : predecessorsForMeAsSuccessor) { Integer linkType = workItemLinkBean.getLinkType(); TLinkTypeBean linkTypeBean = linkTypeMap.get(linkType); Integer linkTypeDirection = linkTypeBean.getLinkDirection(); if (linkTypeBean == null || linkTypeDirection == null || linkTypeDirection.intValue() == LINK_DIRECTION.LEFT_TO_RIGHT) { //remove the links of type "left to right". Bidirectional and "right to left" (pred to succ) relations remain //for left to right link types the links are visible only from predecessor item continue; } workItemLinkList.add(workItemLinkBean); } } Collections.sort(workItemLinkList); return workItemLinkList; }
From source file:ded.model.Inheritance.java
/** Return the value to which 'this' is mapped in 'inheritanceToInteger'. */ public int toJSONRef(HashMap<Inheritance, Integer> inheritanceToInteger) { Integer index = inheritanceToInteger.get(this); if (index == null) { throw new RuntimeException("internal error: inheritanceToInteger mapping not found"); }/*w w w . j a va 2s . c o m*/ return index.intValue(); }
From source file:net.sourceforge.fenixedu.util.tests.ResponseProcessing.java
private String getActionString(Integer actionCode) { if (actionCode.intValue() == SET) { return SET_STRING; } else if (actionCode.intValue() == ADD) { return ADD_STRING; } else if (actionCode.intValue() == SUBTRACT) { return SUBTRACT_STRING; } else if (actionCode.intValue() == MULTIPLY) { return MULTIPLY_STRING; } else if (actionCode.intValue() == DIVIDE) { return DIVIDE_STRING; }/* w w w. j a v a 2s . c o m*/ return null; }
From source file:net.geco.model.iojson.JacksonSerializer.java
@Override public JSONSerializer optField(String key, Integer nullableValue) throws IOException { if (nullableValue != null) { gen.writeNumberField(key, nullableValue.intValue()); }/*from w ww .j a va2 s. co m*/ return this; }
From source file:com.aurel.track.item.link.ItemLinkBL.java
/** * Gets the links for a workItem/*w w w . ja v a 2 s . c o m*/ * @param itemID * @return */ static Set<Integer> getLinkedItemIDs(Integer itemID) { List<TWorkItemLinkBean> successorsForMeAsPredecessorMap = getSuccessorsForMeAsPredecessor(itemID); List<TWorkItemLinkBean> predecessorsForMeAsSuccessorMap = getPredecessorsForMeAsSuccessor(itemID); Map<Integer, TLinkTypeBean> linkTypeMap = GeneralUtils.createMapFromList(LinkTypeBL.loadAll()); Set<Integer> linkedItemIDs = new HashSet<Integer>(); //links from me as predecessor to successors if (successorsForMeAsPredecessorMap != null && !successorsForMeAsPredecessorMap.isEmpty()) { for (TWorkItemLinkBean workItemLinkBean : successorsForMeAsPredecessorMap) { Integer linkType = workItemLinkBean.getLinkType(); TLinkTypeBean linkTypeBean = linkTypeMap.get(linkType); Integer linkTypeDirection = linkTypeBean.getLinkDirection(); if (linkTypeBean == null || linkTypeDirection == null || linkTypeDirection.intValue() == LINK_DIRECTION.RIGHT_TO_LEFT) { //remove the links of type "right to left". Bidirectional and "left to right" (pred to succ) relations remain //for right to left link types the links are visible only from successor item continue; } Integer succesorItemID = workItemLinkBean.getLinkSucc(); linkedItemIDs.add(succesorItemID); } } //links from me as successor to predecessors if (predecessorsForMeAsSuccessorMap != null && !predecessorsForMeAsSuccessorMap.isEmpty()) { for (TWorkItemLinkBean workItemLinkBean : predecessorsForMeAsSuccessorMap) { Integer linkType = workItemLinkBean.getLinkType(); TLinkTypeBean linkTypeBean = linkTypeMap.get(linkType); Integer linkTypeDirection = linkTypeBean.getLinkDirection(); if (linkTypeBean == null || linkTypeDirection == null || linkTypeDirection.intValue() == LINK_DIRECTION.LEFT_TO_RIGHT) { //remove the links of type "left to right". Bidirectional and "right to left" (pred to succ) relations remain //for left to right link types the links are visible only from predecessor item continue; } Integer predecessorItemID = workItemLinkBean.getLinkPred(); linkedItemIDs.add(predecessorItemID); } } return linkedItemIDs; }