List of usage examples for java.lang Integer equals
public boolean equals(Object obj)
From source file:com.github.dactiv.fear.service.service.account.AccountService.java
/** * ??/* w w w . jav a2 s . c om*/ * * @param parent * @param resources ? Map ? */ private void recursionResource(Map<String, Object> parent, List<Map<String, Object>> resources) { parent.put("children", Lists.newArrayList()); for (Map<String, Object> entity : resources) { Integer parentId = Casts.cast(entity.get("fkParentId"), Integer.class); if (parentId == null) { continue; } Integer id = Casts.cast(parent.get("id"), Integer.class); if (parentId.equals(id)) { recursionResource(entity, resources); List<Map<String, Object>> children = Casts.cast(parent.get("children")); if (children != null) { entity.put("parent", parent); children.add(entity); } } } }
From source file:org.kuali.coeus.s2sgen.impl.generate.S2SBaseFormGenerator.java
/** * * This method is used to get the answer for a particular Questionnaire question * question based on the question id./*from ww w. j av a 2 s.c om*/ * * @param questionSeqId * the question seq id to be passed. * @return returns the answer for a particular * question based on the question id passed. */ protected String getAnswer(Integer questionSeqId, List<? extends AnswerHeaderContract> answerHeaders) { for (AnswerHeaderContract answerHeader : answerHeaders) { if (answerHeader != null) { List<? extends AnswerContract> answerDetails = answerHeader.getAnswers(); for (AnswerContract answers : answerDetails) { if (questionSeqId.equals(getQuestionAnswerService().findQuestionById(answers.getQuestionId()) .getQuestionSeqId())) { return answers.getAnswer(); } } } } return null; }
From source file:com.aurel.track.exchange.track.exporter.TrackExportBL.java
/** * Exports the reportBeans to an xml file * @param reportBeans/*from w w w . j a v a 2s.c om*/ * @param personID * @return */ private static Document exportWorkItems(List<ReportBean> reportBeansList, Integer personID) { Document dom = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); dom = builder.newDocument(); } catch (FactoryConfigurationError e) { LOGGER.error("Creating the DOM document failed with FactoryConfigurationError:" + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return null; } catch (ParserConfigurationException e) { LOGGER.error("Creating the DOM document failed with ParserConfigurationException: " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); return null; } //create the DOM object Element root = dom.createElement(ExchangeFieldNames.TRACKPLUS_EXCHANGE); dom.appendChild(root); if (reportBeansList == null || reportBeansList.isEmpty()) { return dom; } LOGGER.info("Number of workItems exported: " + reportBeansList.size()); //load also the full history List<ReportBeanWithHistory> reportBeansWithHistoryList = ReportBeanHistoryLoader .getReportBeanWithHistoryList(reportBeansList, Locale.ENGLISH, true, false, true, null, true, true, true, true, true, personID, null, null, null, true, LONG_TEXT_TYPE.ISFULLHTML); //get the workItemIDs List<Integer> workItemIDsList = new ArrayList<Integer>(); Set<Integer> issueTypeSet = new HashSet<Integer>(); Set<Integer> projectTypeSet = new HashSet<Integer>(); Set<Integer> projectSet = new HashSet<Integer>(); for (ReportBean reportBean : reportBeansWithHistoryList) { TWorkItemBean workItemBean = reportBean.getWorkItemBean(); workItemIDsList.add(workItemBean.getObjectID()); issueTypeSet.add(workItemBean.getListTypeID()); projectSet.add(workItemBean.getProjectID()); } List<TProjectBean> projectBeans = ProjectBL.loadByProjectIDs(GeneralUtils.createListFromSet(projectSet)); if (projectBeans != null) { for (TProjectBean projectBean : projectBeans) { projectTypeSet.add(projectBean.getProjectType()); } } //load the dropdown container based on the workItemIDsList DropDownContainer dropDownContainer = HistoryDropdownContainerLoader .loadExporterDropDownContainer(GeneralUtils.createIntArrFromIntegerList(workItemIDsList)); /** * fieldType based lookup values will be gathered in the lookup map: * fieldID_parametercode keyed -> lookup objectID keyed -> attribute name to attribute string value map */ Map<Integer, ILabelBean> personBeansMap = dropDownContainer .getDataSourceMap(MergeUtil.mergeKey(SystemFields.INTEGER_PERSON, null)); Map<String, Map<Integer, Map<String, String>>> serializedLookupsMap = new HashMap<String, Map<Integer, Map<String, String>>>(); //initialize the serialized person map explicitly because it will be loaded also //from other parts (consultants/informants, budget, cost etc.) Map<Integer, Map<String, String>> serializedPersonsMap = new HashMap<Integer, Map<String, String>>(); serializedLookupsMap.put(MergeUtil.mergeKey(SystemFields.INTEGER_PERSON, null), serializedPersonsMap); /** * gather all non-fieldType based lookup values in the additionalSerializedEntitiesMap map: * accounts, costcenteres, departments, system states, projectTypes and lists */ Map<String, Map<Integer, Map<String, String>>> additionalSerializedLookupsMap = new HashMap<String, Map<Integer, Map<String, String>>>(); Map<Integer, TCostCenterBean> costCentersMap = GeneralUtils .createMapFromList(AccountBL.getAllCostcenters()); Map<Integer, TAccountBean> accountsMap = GeneralUtils.createMapFromList(AccountBL.getAllAccounts()); //get the custom fields map Map<Integer, ISerializableLabelBean> customFieldBeansMap = GeneralUtils .createMapFromList(FieldBL.loadCustom()); Set<Integer> pseudoHistoryFields = HistoryLoaderBL.getPseudoHistoryFields(); /** * add the actual attribute values */ Set<Integer> nonNullFields = new HashSet<Integer>(); //linked through parent, issueNos in descriptions/comments and later issueLinks Set<Integer> linkedWorkItemIDs = new HashSet<Integer>(); for (int n = 0; n < reportBeansWithHistoryList.size(); n++) { ReportBean reportBean = (ReportBean) reportBeansWithHistoryList.get(n); TWorkItemBean workItemBean = reportBean.getWorkItemBean(); Map<String, String> attributes = new HashMap<String, String>(); attributes.put(ExchangeFieldNames.UUID, workItemBean.getUuid()); attributes.put(ExchangeFieldNames.WORKITEMID, workItemBean.getObjectID().toString()); Element itemElement = createElementWithAttributes(ExchangeFieldNames.ITEM, null, false, attributes, dom); //system field nodes for (int i = 0; i < SystemFields.getSystemFieldsArray().length; i++) { Integer fieldID = Integer.valueOf(SystemFields.getSystemFieldsArray()[i]); if (!fieldID.equals(SystemFields.INTEGER_ISSUENO)) { //the issueNo is added directly to item element { Object workItemAttribute = workItemBean.getAttribute(fieldID, null); if (workItemAttribute != null) { IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID); if (fieldTypeRT != null) { nonNullFields.add(fieldID); gatherLinkedWorkItems(workItemAttribute, fieldTypeRT, linkedWorkItemIDs); Map<String, String> fieldAndParameterCodeAttributes = new HashMap<String, String>(); fieldAndParameterCodeAttributes.put(ExchangeFieldNames.FIELDID, fieldID.toString()); appendAttributeElement(ExchangeFieldNames.ITEM_ATTRIBUTE, itemElement, workItemAttribute, fieldTypeRT, fieldID, null, dropDownContainer, serializedLookupsMap, additionalSerializedLookupsMap, fieldAndParameterCodeAttributes, dom); } } } } //custom field nodes Map<String, Object> customAttributes = workItemBean.getCustomAttributeValues(); Integer parameterCode; if (customAttributes != null && !customAttributes.isEmpty()) { Iterator<String> iterator = customAttributes.keySet().iterator(); while (iterator.hasNext()) { String key = iterator.next(); String[] splittedKey = MergeUtil.splitKey(key); String strFieldID = splittedKey[0].substring(1); //get rid of "f" Integer fieldID = Integer.valueOf(strFieldID); String strParameterCode = null; parameterCode = null; if (splittedKey.length > 1) { //whether the workItemAttribute is a part of a composite custom field strParameterCode = splittedKey[1]; if (strParameterCode != null && !"null".equals(strParameterCode)) { try { parameterCode = Integer.valueOf(strParameterCode); } catch (Exception e) { LOGGER.error("Converting the parameterCode " + strParameterCode + " to an integer failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } //add to custom field beans addToAdditionalSerializedLookupsMap(customFieldBeansMap.get(fieldID), ExchangeFieldNames.FIELD, additionalSerializedLookupsMap); Object workItemAttribute = workItemBean.getAttribute(fieldID, parameterCode); if (workItemAttribute != null) { IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID, parameterCode); nonNullFields.add(fieldID); gatherLinkedWorkItems(workItemAttribute, fieldTypeRT, linkedWorkItemIDs); Map<String, String> fieldAndParameterCodeAttributes = new HashMap<String, String>(); if (strFieldID != null) { fieldAndParameterCodeAttributes.put(ExchangeFieldNames.FIELDID, strFieldID); } if (strParameterCode != null) { fieldAndParameterCodeAttributes.put(ExchangeFieldNames.PARAMETERCODE, strParameterCode); } appendAttributeElement(ExchangeFieldNames.ITEM_ATTRIBUTE, itemElement, workItemAttribute, fieldTypeRT, fieldID, parameterCode, dropDownContainer, serializedLookupsMap, additionalSerializedLookupsMap, fieldAndParameterCodeAttributes, dom); } } } /** * add the consulted and informed nodes */ Set<Integer> consultedList = reportBean.getConsultedList(); if (consultedList != null && !consultedList.isEmpty()) { itemElement.appendChild(createConsInfElement(ExchangeFieldNames.CONSULTANT_LIST, ExchangeFieldNames.CONSULTANT, consultedList, personBeansMap, serializedPersonsMap, dom)); } Set<Integer> informedList = reportBean.getInformedList(); if (informedList != null && !informedList.isEmpty()) { itemElement.appendChild(createConsInfElement(ExchangeFieldNames.INFORMANT_LIST, ExchangeFieldNames.INFORMANT, informedList, personBeansMap, serializedPersonsMap, dom)); } /** * add the history nodes */ ReportBeanWithHistory reportBeanWithHistory = (ReportBeanWithHistory) reportBean; Element historyElement = createHistoryElement(reportBeanWithHistory.getHistoryValuesMap(), dropDownContainer, dom, serializedLookupsMap, additionalSerializedLookupsMap, pseudoHistoryFields, linkedWorkItemIDs); if (historyElement != null) { itemElement.appendChild(historyElement); } /** * add the budget nodes */ Element budgetElement = createBudgetPlanElement(reportBeanWithHistory.getBudgetHistory(), personBeansMap, serializedPersonsMap, dom, false); if (budgetElement != null) { itemElement.appendChild(budgetElement); } Element plannedValueElement = createBudgetPlanElement(reportBeanWithHistory.getPlannedValueHistory(), personBeansMap, serializedPersonsMap, dom, true); if (plannedValueElement != null) { itemElement.appendChild(plannedValueElement); } if (budgetElement != null) { //do not add estimated remaining budget element if no budget exists Element remainingBudgetElement = createRemainingBudgetElement( reportBeanWithHistory.getActualEstimatedBudgetBean(), personBeansMap, serializedPersonsMap, dom); if (remainingBudgetElement != null) { itemElement.appendChild(remainingBudgetElement); } } /** * add the expense nodes */ Element costElement = createExpenseElement(reportBeanWithHistory.getCosts(), personBeansMap, accountsMap, costCentersMap, serializedPersonsMap, dom, additionalSerializedLookupsMap); if (costElement != null) { itemElement.appendChild(costElement); } List<TAttachmentBean> existingAttachments = AttachBL .getExistingAttachments(reportBeanWithHistory.getAttachments()); Element attachmentElement = createAttachmentElement(existingAttachments, personBeansMap, serializedPersonsMap, dom); if (attachmentElement != null) { itemElement.appendChild(attachmentElement); } root.appendChild(itemElement); } /** * load the not explicitly exported linked workItems */ linkedWorkItemIDs.removeAll(workItemIDsList); if (!linkedWorkItemIDs.isEmpty()) { List<TWorkItemBean> workItemBeanList = ItemBL .loadByWorkItemKeys(GeneralUtils.createIntArrFromSet(linkedWorkItemIDs)); if (workItemIDsList != null) { Iterator<TWorkItemBean> itrWorkItemBean = workItemBeanList.iterator(); while (itrWorkItemBean.hasNext()) { TWorkItemBean workItemBean = itrWorkItemBean.next(); Map<String, String> attributeValues = workItemBean.serializeBean(); root.appendChild(createElementWithAttributes(ExchangeFieldNames.LINKED_ITEMS, "", false, attributeValues, dom)); } } } /** * add the systemState entries to the additionalSerializedEntitiesMap */ Map<Integer, Map<String, String>> serializedProjectMap = serializedLookupsMap .get(MergeUtil.mergeKey(SystemFields.INTEGER_PROJECT, null)); Map<Integer, Map<String, String>> serializedReleaseMap = serializedLookupsMap .get(MergeUtil.mergeKey(SystemFields.RELEASE, null)); Map<Integer, Map<String, String>> serializedAccountsMap = additionalSerializedLookupsMap .get(ExchangeFieldNames.ACCOUNT); Map<Integer, TSystemStateBean> systemStateMap = GeneralUtils.createMapFromList(SystemStatusBL.loadAll()); addSystemState(serializedProjectMap, systemStateMap, additionalSerializedLookupsMap); addSystemState(serializedReleaseMap, systemStateMap, additionalSerializedLookupsMap); addSystemState(serializedAccountsMap, systemStateMap, additionalSerializedLookupsMap); /** * add each option for the list (which have at least one option set on an issue) */ Map<Integer, Map<String, String>> serializedListMap = additionalSerializedLookupsMap .get(ExchangeFieldNames.LIST); addListAdditional(serializedListMap, dropDownContainer, serializedLookupsMap, additionalSerializedLookupsMap); /** * add the project related additional entities to serializedEntitiesMap and additionalSerializedEntitiesMap */ Map<Integer, TProjectTypeBean> projetcTypesMap = GeneralUtils.createMapFromList(ProjectTypesBL.loadAll()); addProjectAdditional(serializedProjectMap, projetcTypesMap, serializedLookupsMap, additionalSerializedLookupsMap, accountsMap, costCentersMap); /** * add field related entities: the owners */ Map<Integer, Map<String, String>> serializedCustomFields = additionalSerializedLookupsMap .get(ExchangeFieldNames.FIELD); addFieldAdditional(serializedCustomFields, serializedLookupsMap); /** * add the used fieldConfigs */ List<TFieldConfigBean> fieldConfigBeans = FieldConfigBL.loadAllForFields(nonNullFields); for (Iterator<TFieldConfigBean> iterator = fieldConfigBeans.iterator(); iterator.hasNext();) { //remove the field configurations for not used issueTypes, projectTypes and projects TFieldConfigBean fieldConfigBean = iterator.next(); Integer issueTypeID = fieldConfigBean.getIssueType(); Integer projectTypeID = fieldConfigBean.getProjectType(); Integer projectID = fieldConfigBean.getProject(); if (issueTypeID != null && !issueTypeSet.contains(issueTypeID)) { iterator.remove(); continue; } if (projectTypeID != null && !projectTypeSet.contains(projectTypeID)) { iterator.remove(); continue; } if (projectID != null && !projectSet.contains(projectID)) { iterator.remove(); continue; } } //comment this and uncomment the coming block to add fewer field configs addToAdditionalSerializedLookupsMap((List) fieldConfigBeans, ExchangeFieldNames.FIELDCONFIG, additionalSerializedLookupsMap); Map<Integer, Map<String, String>> serializedFieldConfigs = additionalSerializedLookupsMap .get(ExchangeFieldNames.FIELDCONFIG); addFieldConfigsAdditional(serializedFieldConfigs, projetcTypesMap, serializedLookupsMap, additionalSerializedLookupsMap); /** * add the field settings */ List<Integer> userFieldConfigIDs = GeneralUtils.createListFromSet(serializedFieldConfigs.keySet()); //option settings List<ISerializableLabelBean> optionSettingsList = (List) OptionSettingsBL .loadByConfigList(userFieldConfigIDs); if (optionSettingsList != null) { Iterator<ISerializableLabelBean> itrOptionSettings = optionSettingsList.iterator(); while (itrOptionSettings.hasNext()) { TOptionSettingsBean optionSettingsBean = (TOptionSettingsBean) itrOptionSettings.next(); Integer listID = optionSettingsBean.getList(); if (serializedListMap == null || !serializedListMap.containsKey(listID)) { //do not export the option settings if the corresponding list is not exported //(none of the selected workItems has a value from this list) //because creating the optionSetings will fail without the listID itrOptionSettings.remove(); } } } addToAdditionalSerializedLookupsMap(optionSettingsList, ExchangeFieldNames.OPTIONSETTINGS, additionalSerializedLookupsMap); //textbox settings List<ISerializableLabelBean> textBoxSettingsList = (List) TextBoxSettingsBL .loadByConfigList(userFieldConfigIDs); addToAdditionalSerializedLookupsMap(textBoxSettingsList, ExchangeFieldNames.TEXTBOXSETTINGS, additionalSerializedLookupsMap); //general settings List<ISerializableLabelBean> generalSettingsList = (List) GeneralSettingsBL .loadByConfigList(userFieldConfigIDs); addToAdditionalSerializedLookupsMap(generalSettingsList, ExchangeFieldNames.GENERALSETTINGS, additionalSerializedLookupsMap); /** * add the person related additional entities to serializedEntitiesMap and additionalSerializedEntitiesMap */ addPersonAdditional(serializedPersonsMap, GeneralUtils.createMapFromList(DepartmentBL.getAllDepartments()), costCentersMap, serializedLookupsMap, additionalSerializedLookupsMap); /** * add the role assignments and the roles * the role assignments cannot be added to the additionalSerializedLookupsMap because they have no objectID * consequently they will be serialized directly */ List<ISerializableLabelBean> accessControlListBeanList = (List) AccessControlBL.loadByPersonsAndProjects( GeneralUtils.createIntegerListFromCollection(serializedPersonsMap.keySet()), GeneralUtils.createIntegerListFromCollection(serializedProjectMap.keySet())); if (accessControlListBeanList != null) { Map<Integer, TRoleBean> roleMap = GeneralUtils.createMapFromList(RoleBL.loadAll()); Iterator<ISerializableLabelBean> iterator = accessControlListBeanList.iterator(); while (iterator.hasNext()) { TAccessControlListBean accessControlListBean = (TAccessControlListBean) iterator.next(); //serialize the role assignment directly root.appendChild(createElementWithAttributes(ExchangeFieldNames.ACL, null, false, accessControlListBean.serializeBean(), dom)); Integer role = accessControlListBean.getRoleID(); TRoleBean roleBean = roleMap.get(role); if (roleBean != null) { //add the roles which are present in the role assignments addToAdditionalSerializedLookupsMap(roleBean, ExchangeFieldNames.ROLE, additionalSerializedLookupsMap); } } } /** * first add the additional serialized entities first because the fieldID mapping is needed by parsing the serialized entities */ Iterator<String> iterator = additionalSerializedLookupsMap.keySet().iterator(); while (iterator.hasNext()) { String entityName = iterator.next(); Map<Integer, Map<String, String>> lookupEntityMap = additionalSerializedLookupsMap.get(entityName); if (lookupEntityMap != null && !lookupEntityMap.isEmpty()) { Iterator<Integer> itrObjectID = lookupEntityMap.keySet().iterator(); while (itrObjectID.hasNext()) { Integer objectID = itrObjectID.next(); Map<String, String> attributes = lookupEntityMap.get(objectID); if (attributes != null && !attributes.isEmpty()) { root.appendChild(createElementWithAttributes(entityName, null, false, attributes, dom)); } } } } /** * add the serialized entities */ iterator = serializedLookupsMap.keySet().iterator(); while (iterator.hasNext()) { String mergedKey = iterator.next(); Integer[] parts = MergeUtil.getParts(mergedKey); Integer fieldID = parts[0]; Integer parameterCode = parts[1]; Map<Integer, Map<String, String>> lookupEntityMap = serializedLookupsMap.get(mergedKey); if (lookupEntityMap != null && !lookupEntityMap.isEmpty()) { Iterator<Integer> itrObjectID = lookupEntityMap.keySet().iterator(); while (itrObjectID.hasNext()) { Integer objectID = itrObjectID.next(); Map<String, String> attributes = lookupEntityMap.get(objectID); if (attributes != null && !attributes.isEmpty()) { if (fieldID != null) { attributes.put(ExchangeFieldNames.FIELDID, fieldID.toString()); } if (parameterCode != null) { attributes.put(ExchangeFieldNames.PARAMETERCODE, parameterCode.toString()); } root.appendChild(createElementWithAttributes(ExchangeFieldNames.DROPDOWN_ELEMENT, null, false, attributes, dom)); } } } } return dom; }
From source file:it.eng.spagobi.wapp.presentation.MenuConfigurationHTMLTreeGenerator.java
private boolean canBeMovedDown(Menu menu) { Integer parentId = (menu.getParentId() == null) ? new Integer("0") : menu.getParentId(); Integer currentProg = menu.getProg(); Iterator it = _objectsList.iterator(); while (it.hasNext()) { Menu aMenu = (Menu) it.next(); Integer parentMenuId = (aMenu.getParentId() == null) ? new Integer("0") : aMenu.getParentId(); if (parentId != null && parentId.equals(parentMenuId) && currentProg.intValue() < aMenu.getProg().intValue()) return true; }//from ww w . j a v a 2s. co m return false; }
From source file:com.aurel.track.item.ItemBL.java
/** * Whether// w w w . j av a 2 s. c o m * @param childID * @param ascendentID * @return */ public static boolean isAscendant(Integer ascendentID, Integer childID) { Integer parentID = childID; while (parentID != null) { TWorkItemBean parentWorkItem = null; try { parentWorkItem = ItemBL.loadWorkItem(parentID); } catch (ItemLoaderException e) { } if (parentWorkItem == null) { LOGGER.warn( "The parent workItem " + parentID + " for the workItem " + ascendentID + " does not exist"); return false; } else { parentID = parentWorkItem.getSuperiorworkitem(); if (parentID != null && parentID.equals(ascendentID)) { return true; } } } return false; }
From source file:com.eryansky.service.base.ResourceManager.java
/** * ResourceTreeNode/*from ww w .j a v a 2 s. co m*/ * @param repositoryResources ? * @param resource ? * @param resourceType ? * @param isCascade ?? * @return * @throws DaoException * @throws SystemException * @throws ServiceException */ private TreeNode resourceToTreeNode(List<Resource> repositoryResources, Resource resource, Integer resourceType, boolean isCascade) throws DaoException, SystemException, ServiceException { if (resource == null || !repositoryResources.contains(resource)) { return null; } if (resourceType != null) { if (!resourceType.equals(resource.getType())) { return null; } } TreeNode treeNode = new TreeNode(resource.getId().toString(), resource.getName(), resource.getIconCls()); // url Map<String, Object> attributes = Maps.newHashMap(); attributes.put("url", resource.getUrl()); attributes.put("markUrl", resource.getMarkUrl()); attributes.put("code", resource.getCode()); attributes.put("type", resource.getType()); treeNode.setAttributes(attributes); if (isCascade) { List<TreeNode> childrenTreeNodes = Lists.newArrayList(); for (Resource subResource : resource.getSubResources()) { TreeNode node = resourceToTreeNode(repositoryResources, subResource, resourceType, isCascade); if (node != null) { childrenTreeNodes.add(node); } } treeNode.setChildren(childrenTreeNodes); } return treeNode; }
From source file:io.brooklyn.ambari.server.AmbariServerImpl.java
@Override public void editAlertNotification(String name, String description, Boolean global, String notificationType, List<String> alertStates, List<String> ambariDispatchRecipients, String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth) { registeredAlertNotifications = listAlertTargets(); mailSmtpHost = mailSmtpHost.equals("default") ? (String) ((Map) getConfig(AmbariCluster.AMBARI_ALERT_NOTIFICATIONS).get("default_properties")) .get("mail.smtp.host") : mailSmtpHost;//from w w w .j a va 2 s .c o m mailSmtpPort = mailSmtpPort.equals("587") ? (Integer) ((Map) getConfig(AmbariCluster.AMBARI_ALERT_NOTIFICATIONS).get("default_properties")) .get("mail.smtp.port") : mailSmtpPort; mailSmtpFrom = mailSmtpFrom.equals("default") ? (String) ((Map) getConfig(AmbariCluster.AMBARI_ALERT_NOTIFICATIONS).get("default_properties")) .get("mail.smtp.from") : mailSmtpFrom; ImmutableMap<String, Object> alertTargetRequest = ImmutableMap.<String, Object>builder().put("name", name) .put("description", description).put("global", global).put("notification_type", notificationType) .put("alert_states", alertStates) .put("properties", ImmutableMap.of("ambari.dispatch.recipients", ambariDispatchRecipients, "mail.smtp.host", mailSmtpHost, "mail.smtp.port", mailSmtpPort, "mail.smtp.from", mailSmtpFrom, "mail.smtp.auth", mailSmtpAuth)) .build(); if (!registeredAlertNotifications.containsKey(name)) { throw new UnsupportedOperationException(String .valueOf(Strings.format("Alert with name %s doesn't exist and cannot be updated.", name))); } updateAlertTarget(registeredAlertNotifications.get(name), alertTargetRequest); }
From source file:gr.abiss.calipso.wicket.asset.AssetCustomAttributeFormPanel.java
private void addOptionsPanel(final CompoundPropertyModel model, Integer selected, boolean hide) { logger.info("addOptionsPanel, selected: " + selected + ", hide: " + hide); Object modelObject = model.getObject(); if (modelObject instanceof AssetTypeCustomAttributeSearch) { modelObject = ((AssetTypeCustomAttributeSearch) modelObject).getSearchObject(); }//from ww w . j a va2s. c o m optionsPanel = new CustomAttributeOptionsPanel("optionTranslationsPanel", (AssetTypeCustomAttribute) modelObject, getCalipso().getSupportedLanguages(), textAreaOptions); optionsPanel.setOutputMarkupId(true); //optionsPanel.setOutputMarkupId(true); if (hide == false && (selected.equals(AssetTypeCustomAttribute.FORM_TYPE_SELECT) || selected.equals(AssetTypeCustomAttribute.FORM_TYPE_MULTISELECT) || selected.equals(AssetTypeCustomAttribute.FORM_TYPE_OPTIONS_TREE))) { optionsPanel.setVisible(true); } else { optionsPanel.setVisible(false); } optionsPanelContainer = new WebMarkupContainer("optionsPanelContainer"); optionsPanelContainer.setOutputMarkupPlaceholderTag(true); optionsPanelContainer.add(optionsPanel); add(optionsPanelContainer); }
From source file:energy.usef.dso.service.business.DsoPlanboardBusinessService.java
/** * In the list of all previous prognoses for all aggregators, this method fetches the one for a given aggregator and a given ptu * index./*w w w.j ava 2 s . co m*/ * * @param lastPtuPrognoses {@link List} of previous {@link PtuPrognosis}. * @param aggregatorDomain {@link String} domain name of the aggregator. * @param ptuIndex {@link Integer} index of the PTU. * @return a {@link PtuPrognosis} or <code>null</code>. */ private PtuPrognosis fetchPreviousPtuPrognosis(List<PtuPrognosis> lastPtuPrognoses, String aggregatorDomain, Integer ptuIndex) { for (PtuPrognosis prognosis : lastPtuPrognoses) { if (aggregatorDomain.equals(prognosis.getParticipantDomain()) && ptuIndex.equals(prognosis.getPtuContainer().getPtuIndex())) { return prognosis; } } return null; }
From source file:controllers.core.ActorController.java
/** * Display the capacity of the actor with management capability if enough * perm./*from ww w . java 2 s .c o m*/ * * @param id * the actor id * @param year * the year (0 for the current) * */ @With(CheckActorExists.class) @Dynamic(IMafConstants.ACTOR_VIEW_DYNAMIC_PERMISSION) public Result capacity(Long id, Integer year) { if (year.equals(0)) { year = Calendar.getInstance().get(Calendar.YEAR); } // get the actor Actor actor = ActorDao.getActorById(id); Form<ActorCapacityFormData> capacityForm = capacityFormTemplate .fill(new ActorCapacityFormData(actor, year)); // can edit boolean canEdit = getSecurityService().dynamic(IMafConstants.ACTOR_EDIT_DYNAMIC_PERMISSION, ""); return ok(views.html.core.actor.actor_capacity.render(actor, year, capacityForm, canEdit)); }