List of usage examples for java.lang Long compareTo
public int compareTo(Long anotherLong)
From source file:gate.annotation.AnnotationSetImpl.java
/** * Propagate document content changes to this AnnotationSet. * /*w w w. j a v a 2 s . com*/ * This method is called for all annotation sets of a document from * DocumentImpl.edit to adapt the annotations to the text changes made through * the edit. The behaviour of this method is influenced by the configuration * setting {@link gate.GateConstants#DOCEDIT_INSERT_PREPEND GateConstants.DOCEDIT_INSERT_PREPEND }: * annotations immediately * ending before or starting after the point of insertion will either become * part of the inserted text or not. Currently it works like this: * <ul> * <li>PREPEND=true: annotation before will become part, annotation after not * <li>PREPEND=false: annotation before will not become part, annotation after * will become part * </UL> * NOTE 1 (JP): There is another setting * {@link gate.GateConstants#DOCEDIT_INSERT_APPEND GateConstants.DOCEDIT_INSERT_APPEND } * but * this setting does currently not influence the behaviour of this method. * The behaviour of this method may change in the future so that * DOCEDIT_INSERT_APPEND is considered separately and in addition to * DOCEDIT_INSERT_PREPEND so that it can be controlled independently if * the annotation before and/or after an insertion point gets expanded or not. * <p> * NOTE 2: This method has, unfortunately, to be * public, to allow DocumentImpls to get at it. Oh for a "friend" declaration. * Doesn't throw InvalidOffsetException as DocumentImpl is the only client, * and that checks the offsets before calling this method. */ public void edit(Long start, Long end, DocumentContent replacement) { // make sure we have the indices computed indexByStartOffset(); if (end.compareTo(start) > 0) { // get the nodes that need to be processed (the nodes internal to // the // removed section plus the marginal ones List<Node> affectedNodes = new ArrayList<Node>( nodesByOffset.subMap(start, new Long(end.longValue() + 1)).values()); // if we have more than 1 node we need to delete all apart from // the first // and move the annotations so that they refer to the one we keep // (the // first) NodeImpl firstNode = null; if (!affectedNodes.isEmpty()) { firstNode = (NodeImpl) affectedNodes.get(0); List<Annotation> startingAnnotations = new ArrayList<Annotation>(); List<Annotation> endingAnnotations = new ArrayList<Annotation>(); // now we need to find all the annotations // ending in the zone List<Node> beforeNodes = new ArrayList<Node>( nodesByOffset.subMap(new Long(0), new Long(end.longValue() + 1)).values()); Iterator<Node> beforeNodesIter = beforeNodes.iterator(); while (beforeNodesIter.hasNext()) { Node currentNode = beforeNodesIter.next(); Collection<Annotation> annotations = getAnnotsByStartNode(currentNode.getId()); if (annotations == null) continue; // iterates on the annotations in this set Iterator<Annotation> localIterator = annotations.iterator(); while (localIterator.hasNext()) { Annotation annotation = localIterator.next(); long offsetEndAnnotation = annotation.getEndNode().getOffset().longValue(); // we are interested only in the annotations ending // inside the zone if (offsetEndAnnotation >= start.longValue() && offsetEndAnnotation <= end.longValue()) endingAnnotations.add(annotation); } } for (int i = 1; i < affectedNodes.size(); i++) { Node aNode = affectedNodes.get(i); Collection<Annotation> annSet = getAnnotsByStartNode(aNode.getId()); if (annSet != null) { startingAnnotations.addAll(annSet); } // remove the node // nodesByOffset.remove(aNode.getOffset()); // annotsByStartNode.remove(aNode); } // modify the annotations so they point to the saved node Iterator<Annotation> annIter = startingAnnotations.iterator(); while (annIter.hasNext()) { AnnotationImpl anAnnot = (AnnotationImpl) annIter.next(); anAnnot.start = firstNode; // remove the modified annotation if it has just become // zero-length if (anAnnot.start == anAnnot.end) { remove(anAnnot); } else { addToStartOffsetIndex(anAnnot); } } annIter = endingAnnotations.iterator(); while (annIter.hasNext()) { AnnotationImpl anAnnot = (AnnotationImpl) annIter.next(); anAnnot.end = firstNode; // remove the modified annotation if it has just become // zero-length if (anAnnot.start == anAnnot.end) { remove(anAnnot); } } // remove the unused nodes inside the area for (int i = 1; i < affectedNodes.size(); i++) { Node aNode = affectedNodes.get(i); nodesByOffset.remove(aNode.getOffset()); annotsByStartNode.remove(aNode.getId()); } // repair the first node // remove from offset index nodesByOffset.remove(firstNode.getOffset()); // change the offset for the saved node firstNode.setOffset(start); // add back to the offset index nodesByOffset.put(firstNode.getOffset(), firstNode); } } // now handle the insert and/or update the rest of the nodes' // position // get the user selected behaviour (defaults to append) boolean shouldPrepend = Gate.getUserConfig().getBoolean(GateConstants.DOCEDIT_INSERT_PREPEND) .booleanValue(); long s = start.longValue(), e = end.longValue(); long rlen = // length of the replacement value ((replacement == null) ? 0 : replacement.size().longValue()); // update the offsets and the index by offset for the rest of the // nodes List<Node> nodesAfterReplacement = new ArrayList<Node>(nodesByOffset.tailMap(start).values()); // remove from the index by offset Iterator<Node> nodesAfterReplacementIter = nodesAfterReplacement.iterator(); while (nodesAfterReplacementIter.hasNext()) { NodeImpl n = (NodeImpl) nodesAfterReplacementIter.next(); nodesByOffset.remove(n.getOffset()); } // change the offsets nodesAfterReplacementIter = nodesAfterReplacement.iterator(); while (nodesAfterReplacementIter.hasNext()) { NodeImpl n = (NodeImpl) nodesAfterReplacementIter.next(); long oldOffset = n.getOffset().longValue(); // by default we move all nodes back long newOffset = oldOffset - (e - s) + rlen; // for the first node we need behave differently if (oldOffset == s) { // the first offset never moves back if (newOffset < s) newOffset = s; // if we're prepending we don't move forward if (shouldPrepend) newOffset = s; } n.setOffset(new Long(newOffset)); } // add back to the index by offset with the new offsets nodesAfterReplacementIter = nodesAfterReplacement.iterator(); while (nodesAfterReplacementIter.hasNext()) { NodeImpl n = (NodeImpl) nodesAfterReplacementIter.next(); nodesByOffset.put(n.getOffset(), n); } // //rebuild the indices with the new offsets // nodesByOffset = null; // annotsByStartNode = null; // annotsByEndNode = null; // indexByStartOffset(); // indexByEndOffset(); }
From source file:org.alfresco.repo.version.Version2ServiceImpl.java
/** * Check if versions are marked with invalid version label, if true > apply default serial version label (e.g. "1.0", "1.1") * /* www.ja v a 2 s .c om*/ * @param versionHistory a version histore node reference * @param nodeRef a node reference */ private void checkForCorruptedVersions(NodeRef versionHistory, NodeRef nodeRef) { // get the current version label in live store String versionLabel = (String) this.nodeService.getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL); if (versionLabel != null && versionLabel.equals("0")) { // need to correct version labels List<Version> versions = getAllVersions(versionHistory); // sort versions by node id Collections.sort(versions, new Comparator<Version>() { public int compare(Version v1, Version v2) { int result = v1.getFrozenModifiedDate().compareTo(v2.getFrozenModifiedDate()); if (result == 0) { Long dbid1 = (Long) nodeService.getProperty(v1.getFrozenStateNodeRef(), ContentModel.PROP_NODE_DBID); Long dbid2 = (Long) nodeService.getProperty(v2.getFrozenStateNodeRef(), ContentModel.PROP_NODE_DBID); if (dbid1 != null && dbid2 != null) { result = dbid1.compareTo(dbid2); } else { result = 0; if (logger.isWarnEnabled()) { logger.warn("node-dbid property is missing for versions: " + v1.toString() + " or " + v2.toString()); } } } return result; } }); SerialVersionLabelPolicy serialVersionLabelPolicy = new SerialVersionLabelPolicy(); QName classRef = this.nodeService.getType(nodeRef); Version preceedingVersion = null; for (Version version : versions) { // re-calculate version label versionLabel = serialVersionLabelPolicy.calculateVersionLabel(classRef, preceedingVersion, 0, version.getVersionProperties()); // update version with new version label NodeRef versionNodeRef = new NodeRef(StoreRef.PROTOCOL_WORKSPACE, version.getFrozenStateNodeRef().getStoreRef().getIdentifier(), version.getFrozenStateNodeRef().getId()); this.dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_VERSION_LABEL, versionLabel); version.getVersionProperties().put(VersionBaseModel.PROP_VERSION_LABEL, versionLabel); // remember preceding version preceedingVersion = version; } // update current version label in live store this.nodeService.setProperty(nodeRef, ContentModel.PROP_VERSION_LABEL, versionLabel); } }
From source file:com.flyhz.avengers.framework.application.FetchApplication.java
private void fetch() { LOG.info("initFetch first ......"); HConnection hConnection = null;//from w w w.j a v a2 s. c o m HBaseAdmin hbaseAdmin = null; // HTable hVersion = null; HTable hPage = null; HTable hDomain = null; try { hConnection = HConnectionManager.createConnection(hbaseConf); hbaseAdmin = new HBaseAdmin(hConnection); Configuration configuration = HBaseConfiguration.create(hbaseConf); configuration.setLong("hbase.rpc.timeout", 1200000); // Scan configuration.setLong("hbase.client.scanner.caching", 1000); hPage = new HTable(hbaseConf, AVTable.av_page.name()); Scan hPageScan = new Scan(); hPageScan.addColumn(Bytes.toBytes(AVFamily.i.name()), Bytes.toBytes(AVColumn.bid.name())); ResultScanner hPageRs = hPage.getScanner(hPageScan); if (hPageRs != null) { Long startKey = 0L; Long endKey = 0L; for (Result result : hPageRs) { Long id = Bytes.toLong(result.getRow()); Long batchId = Bytes.toLong( result.getValue(Bytes.toBytes(AVFamily.i.name()), Bytes.toBytes(AVColumn.bid.name()))); if (this.batchId == batchId) { LOG.info("rowkey -> {},batchId ->{}", id, batchId); startKey = id; break; } } hDomain = new HTable(hbaseConf, AVTable.av_domain.name()); Scan hDomainScan = new Scan(); hDomainScan.addColumn(Bytes.toBytes(AVFamily.i.name()), Bytes.toBytes(AVColumn.maxid.name())); ResultScanner hDomainRs = hDomain.getScanner(hDomainScan); if (hDomainRs == null) { return; } for (Result result : hDomainRs) { Long value = Bytes.toLong(result.getValue(Bytes.toBytes(AVFamily.i.name()), Bytes.toBytes(AVColumn.maxid.name()))); if (endKey.compareTo(value) < 0) { endKey = value; } } endKey = endKey + 1; LOG.info("startKey > {},endKey > {}", startKey, endKey); numTotalContainers = (Integer) XConfiguration.getAvengersContext() .get(XConfiguration.NUM_FETCH_CONTAINERS); Long size = (endKey - startKey + 1) / numTotalContainers; for (int i = 0; i < numTotalContainers; i++) { Long sk = startKey + size * i; Long ek = startKey + size * (i + 1); LOG.info("start > {} end > {}", sk, ek); XPairDto<Long, Long> pair = new XPairDto<Long, Long>(sk, ek); pairs.add(pair); ContainerRequest containerAsk = setupContainerAskForRM(); amRMClient.addContainerRequest(containerAsk); } for (int i = 0; i < numTotalContainers; i++) { // ContainerRequest containerAsk = setupContainerAskForRM(); // amRMClient.addContainerRequest(containerAsk); } numRequestedContainers.set(numTotalContainers); while (!done && (numCompletedContainers.get() != numTotalContainers)) { try { Thread.sleep(200); } catch (InterruptedException ex) { } } } } catch (IOException e) { LOG.error("fetch", e); } catch (Throwable e) { LOG.error("fetch", e); } finally { if (hPage != null) { try { hPage.close(); } catch (IOException e) { LOG.error("", e); } } if (hbaseAdmin != null) { try { hbaseAdmin.close(); } catch (IOException e) { LOG.error("", e); } } if (hConnection != null) { try { hConnection.close(); } catch (IOException e) { LOG.error("", e); } } } }
From source file:org.oscarehr.casemgmt.service.CaseManagementManager.java
public boolean roleInAccess(Long roleId, ProgramAccess pa) { boolean rt = false; Set roleset = pa.getRoles();// w w w . j av a 2 s. com Iterator itr = roleset.iterator(); while (itr.hasNext()) { Secrole rl = (Secrole) itr.next(); if (roleId.compareTo(rl.getId()) == 0) return true; } return rt; }
From source file:org.wso2.carbon.governance.api.common.GovernanceArtifactManager.java
@Paginate("getPaginatedGovernanceArtifacts") public List<String> getPaginatedGovernanceArtifacts() throws GovernanceException { List<String> paths = Arrays.asList(GovernanceUtils.getResultPaths(registry, mediaType)); Collections.sort(paths, new Comparator<String>() { public int compare(String o1, String o2) { Long l1 = -1l;/*from w w w. ja va2 s . c o m*/ Long l2 = -1l; String temp1 = RegistryUtils.getParentPath(o1); String temp2 = RegistryUtils.getParentPath(o2); try { l1 = Long.parseLong(RegistryUtils.getResourceName(temp1)); l2 = Long.parseLong(RegistryUtils.getResourceName(temp2)); } catch (NumberFormatException ignore) { } // First order by name int result = RegistryUtils.getResourceName(temp1) .compareToIgnoreCase(RegistryUtils.getResourceName(temp2)); if (result != 0) { return result; } // Then order by namespace result = temp1.compareToIgnoreCase(temp2); if (result != 0) { return result; } // Finally by version return l2.compareTo(l1); } }); return paths; }
From source file:jp.co.opentone.bsol.linkbinder.service.correspon.impl.CorresponWorkflowServiceImpl.java
/** * ?.//from ww w . ja va 2 s . c om * @param correspon ? * @param workflows * @throws ServiceAbortException */ private void updateWorkflow(Correspon correspon, List<Workflow> workflows, List<Workflow> workflowDb) throws ServiceAbortException { // ??(???) // ??????????? serviceHelper.updateCorrespon(correspon); Long corresponId = correspon.getId(); // ???Checker?????Checker/Approver?? if (isWorkflowPattern1(correspon) && helper.isWorkflowChecker(workflows, getCurrentUser()) && !workflowDb.isEmpty()) { Long selfWorkflowNo = getProcessingWorkflowNo(workflows); // Draft??/? if (correspon.getWorkflowStatus() == WorkflowStatus.DRAFT) { selfWorkflowNo = 0L; } // ?? deleteByCorresponIdWorkflowNo(corresponId, selfWorkflowNo); for (Workflow wf : workflows) { // ?? if (selfWorkflowNo.compareTo(wf.getWorkflowNo()) < 0) { insertWorkflow(wf); } } } else if (isKeyPattern2AndWorkflowProcessStatus(correspon, workflowDb)) { // Approver? Workflow approver = workflows.get(workflows.size() - 1); // Approver???? deleteByCorresponIdWorkflowNo(corresponId, approver.getWorkflowNo() - 1); insertWorkflow(approver); } else { // ?? deleteByCorresponId(corresponId); for (Workflow wf : workflows) { // ?? insertWorkflow(wf); } } }
From source file:com.marand.thinkmed.medications.business.impl.DefaultMedicationsBo.java
Set<MentalHealthTherapyDto> filterMentalHealthTherapyList( final List<MentalHealthTherapyDto> mentalHealthTherapyDtos) { final Set<MentalHealthTherapyDto> removedDuplicates = new TreeSet<>((o1, o2) -> { final int statusCompare = o1.getTherapyStatusEnum().compareTo(o2.getTherapyStatusEnum()); if (statusCompare == 0) { final Long o1Id = o1.getMentalHealthMedicationDto().getId(); final Long o2Id = o2.getMentalHealthMedicationDto().getId(); final int idCompare = o1Id.compareTo(o2Id); final Long o1RouteId = o1.getMentalHealthMedicationDto().getRoute().getId(); final Long o2RouteId = o2.getMentalHealthMedicationDto().getRoute().getId(); return idCompare == 0 ? o1RouteId.compareTo(o2RouteId) : idCompare; } else {/* ww w.j a v a 2 s .c o m*/ return statusCompare; } }); removedDuplicates.addAll(mentalHealthTherapyDtos); return removedDuplicates; }
From source file:org.gbif.harvest.tapir.TapirMetadataHandler.java
/** * Construct a new BioDatasource, or update an existing one. * Uniqueness is based on the name and uddi key. * Return the created/updated BioDatasource's id - later used in * updating its target count// w w w. ja va2s .com * * @param name of Biodatasource * @param url access point URL * @param resourceName resource name * @param uddiKey registry service UUID * @param params map of Biodatasource params * @param contentNamespace contentNamespace * @param mappingFile name * @param protocol name * @param settings settings * @param supportsTitle boolean * @param parentDirectoryName parent directory name * * @return id of Biodatasource * * @throws HarvesterException thrown if method fails */ private Long createOrUpdateBioDatasource(String name, String url, String resourceName, String uddiKey, Map<String, Object> params, String contentNamespace, String mappingFile, String protocol, Map<String, String> settings, String supportsTitle, String parentDirectoryName) throws HarvesterException { // Whether we're creating/updating, we always need to update params: params.put("url", url); params.put("resource_name", resourceName); params.put("contentNamespace", contentNamespace); params.put("mappingFile", mappingFile); params.put("protocol", protocol); params.put("supportsTitle", supportsTitle); params.put("harvesterFactory", Constants.TAPIR_HARVESTER_FACTORY); // construct BioDatasource's name String newName = BioDatasourceUtils.constructBioDatasourceName(name, resourceName); params.put("name", newName); // construct the new, validated directory name String newValidDirectoryName = BioDatasourceUtils.constructBioDatasourceOperatorDirectoryName(resourceName, parentDirectoryName); params.put("directory", newValidDirectoryName); // get country name String country = null; if (params.containsKey("country")) { country = (String) params.get("country"); // "country":null is converted to "country":"\"null\"" if (StringUtils.equalsIgnoreCase(country, "\"null\"")) { country = null; } } // get provider name String dataProviderName = null; if (params.containsKey("providerName")) { dataProviderName = params.get("providerName").toString(); } // add the settings info to params if (settings.containsKey("minQueryTermLength")) { params.put("minQueryTermLength", settings.get("minQueryTermLength")); } else { params.put("minQueryTermLength", "0"); } if (settings.containsKey("maxResponseSize")) { params.put("maxResponseSize", settings.get("maxResponseSize")); } else { params.put("maxResponseSize", "0"); } // add synchroniserFactories list to params synchroniserFactories = getSynchroniserFactories(); List<String> factories = new LinkedList<String>(); Iterator<AbstractSynchroniserFactory> iter = synchroniserFactories.iterator(); while (iter.hasNext()) { Class cls = (iter.next().getClass()); String clsName = cls.getName(); factories.add(clsName); } params.put("synchroniserFactories", factories); // check if the retrieved entity has already been saved as a bioDatasource Long id = -1L; // get resource uuid String resourceUuid = null; if (params.containsKey("resourceUuid")) { resourceUuid = params.get("resourceUuid").toString(); } // if it belongs to a resource, check using resourceKey in case resource name has changed if (StringUtils.isNotBlank(resourceUuid)) { id = bioDatasourceManager.checkIfBioDatasourceExists(resourceUuid, uddiKey, Constants.TAPIR_HARVESTER_FACTORY); } else { id = bioDatasourceManager.checkIfBioDatasourceExists(newName, uddiKey); } int defaultCount = 0; try { // if this is a new BioDatasource if (id.compareTo(-1L) == 0) { // update params Map<String, Object> newParams = new HashMap<String, Object>(); newParams.putAll(params); // newParams.put("directory", newValidDirectoryName); newParams.put("uddiKey", uddiKey); newParams.put("targetCount", defaultCount); String parametersAsJson = JSONUtils.jsonFromMap(newParams); // create new BioDatasource BioDatasource datasource = new BioDatasource(newName, dataProviderName, Constants.TAPIR_HARVESTER_FACTORY, parametersAsJson, uddiKey, country, url); BioDatasource bioDatasource = bioDatasourceManager.save(datasource); log.info("createBioDatasource", newName); return bioDatasource.getId(); } else { BioDatasource bioDatasource = bioDatasourceManager.get(id); // update params Map<String, Object> oldParams = JSONUtils.mapFromJSON(bioDatasource.getParametersAsJSON()); oldParams.putAll(params); bioDatasource.setParametersAsJSON(JSONUtils.jsonFromMap(oldParams)); // in case the name got changed bioDatasource.setName(BioDatasourceUtils.prepareStringForUI(newName)); // in case the url has changed bioDatasource.setUrl(BioDatasourceUtils.prepareStringForUI(url)); // in case the country has changed bioDatasource.setCountry(BioDatasourceUtils.prepareStringForUI(country)); // in case the provider name has changed bioDatasource.setProviderName(BioDatasourceUtils.prepareStringForUI(dataProviderName)); bioDatasourceManager.save(bioDatasource); log.info("createBioDatasource.exists", bioDatasource.getName()); } } catch (Exception e) { log.error("error.createBioDatasource", e.getMessage(), e); throw new HarvesterException(e.getMessage(), e); } return id; }
From source file:org.kuali.kfs.module.bc.document.web.struts.BudgetConstructionAction.java
/** * @see org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#refresh(org.apache.struts.action.ActionMapping, * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//*w w w . j a va2 s .co m*/ @Override public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BudgetConstructionForm budgetConstructionForm = (BudgetConstructionForm) form; budgetConstructionForm.setDerivedValuesOnForm(request); // Do specific refresh stuff here based on refreshCaller parameter // typical refresh callers would be monthlyBudget or salarySetting or lookupable String refreshCaller = request.getParameter(KFSConstants.REFRESH_CALLER); if (refreshCaller != null && refreshCaller.endsWith(BCConstants.MONTHLY_BUDGET_REFRESH_CALLER)) { // monthly process applies any changes to the DB and the form session object // including any override to the request amount which also changes the request total // it also sets up calc monthly benefits if the line is involved in benefits BudgetDocumentService budgetDocumentService = SpringContext.getBean(BudgetDocumentService.class); budgetDocumentService.calculateBenefitsIfNeeded(budgetConstructionForm.getBudgetConstructionDocument()); } if (refreshCaller != null && refreshCaller.endsWith(BCConstants.QUICK_SALARY_SETTING_REFRESH_CALLER)) { BudgetDocumentService budgetDocumentService = SpringContext.getBean(BudgetDocumentService.class); // if editing - reload expenditure and check for changes to detail salary lines and 2plg request amount boolean diffFound = false; if (budgetConstructionForm.isEditAllowed() && !budgetConstructionForm.isSystemViewOnly()) { BudgetConstructionDocument currentBCDoc = budgetConstructionForm.getBudgetConstructionDocument(); // get the current set of salary setting related rows from DB and compare against preSalarySettingRows List<PendingBudgetConstructionGeneralLedger> dbSalarySettingRows = budgetDocumentService .getPBGLSalarySettingRows(currentBCDoc); for (PendingBudgetConstructionGeneralLedger dbSalarySettingRow : dbSalarySettingRows) { if (budgetConstructionForm.getPreSalarySettingRows() .containsKey(dbSalarySettingRow.getFinancialObjectCode() + dbSalarySettingRow.getFinancialSubObjectCode())) { // update the existing row if a difference is found KualiInteger dbReqAmount = dbSalarySettingRow.getAccountLineAnnualBalanceAmount(); KualiInteger preReqAmount = budgetConstructionForm.getPreSalarySettingRows() .get(dbSalarySettingRow.getFinancialObjectCode() + dbSalarySettingRow.getFinancialSubObjectCode()) .getAccountLineAnnualBalanceAmount(); Long dbVersionNumber = dbSalarySettingRow.getVersionNumber(); Long preReqVersionNumber = budgetConstructionForm.getPreSalarySettingRows() .get(dbSalarySettingRow.getFinancialObjectCode() + dbSalarySettingRow.getFinancialSubObjectCode()) .getVersionNumber(); if ((dbVersionNumber.compareTo(preReqVersionNumber) != 0) || (dbReqAmount.compareTo(preReqAmount) != 0)) { budgetDocumentService.addOrUpdatePBGLRow(currentBCDoc, dbSalarySettingRow, Boolean.FALSE); // only flag for existing line diff when the request amount changes // changes in versionNumber implies offsetting updates of some sort if (dbReqAmount.compareTo(preReqAmount) != 0) { diffFound = true; } } } else { // update the req amount and version or add the new row to the current doc as needed // insert the new DB row to the set in memory budgetDocumentService.addOrUpdatePBGLRow(currentBCDoc, dbSalarySettingRow, Boolean.FALSE); diffFound = true; } } if (diffFound) { this.adjustForSalarySettingChanges(budgetConstructionForm); } } } if (refreshCaller != null && refreshCaller.endsWith(KFSConstants.LOOKUPABLE_SUFFIX)) { this.checkAndFixReturnedLookupValues(budgetConstructionForm.getNewRevenueLine(), budgetConstructionForm.getBudgetConstructionDocument()); this.checkAndFixReturnedLookupValues(budgetConstructionForm.getNewExpenditureLine(), budgetConstructionForm.getBudgetConstructionDocument()); final List REFRESH_FIELDS = Collections .unmodifiableList(Arrays.asList(new String[] { "financialObject", "financialSubObject" })); SpringContext.getBean(PersistenceService.class) .retrieveReferenceObjects(budgetConstructionForm.getNewRevenueLine(), REFRESH_FIELDS); SpringContext.getBean(PersistenceService.class) .retrieveReferenceObjects(budgetConstructionForm.getNewExpenditureLine(), REFRESH_FIELDS); } // balance inquiry anchor is set before doing a balance inquiry if (budgetConstructionForm.getBalanceInquiryReturnAnchor() != null) { budgetConstructionForm.setAnchor(budgetConstructionForm.getBalanceInquiryReturnAnchor()); budgetConstructionForm.setBalanceInquiryReturnAnchor(null); } return mapping.findForward(KFSConstants.MAPPING_BASIC); }
From source file:org.sakaiproject.contentreview.turnitin.TurnitinReviewServiceImpl.java
public String getIconUrlforScore(Long score) { String urlBase = "/library/content-review/score_"; String suffix = ".gif"; if (score.equals(Long.valueOf(0))) { return urlBase + "blue" + suffix; } else if (score.compareTo(Long.valueOf(25)) < 0) { return urlBase + "green" + suffix; } else if (score.compareTo(Long.valueOf(50)) < 0) { return urlBase + "yellow" + suffix; } else if (score.compareTo(Long.valueOf(75)) < 0) { return urlBase + "orange" + suffix; } else {//ww w . j a v a2s . co m return urlBase + "red" + suffix; } }