List of usage examples for java.lang Boolean equals
public boolean equals(Object obj)
From source file:velocitekProStartAnalyzer.MainWindow.java
private void setEndTime(String endTime) { Boolean flagTimeIsInPoints = false; Boolean startDeleting = false; if (endTime.equals(null)) { return;//from w w w. ja va 2 s . co m } JDBCPointDao jdbcPointDao = new JDBCPointDao(); jdbcPointDao.getConnection(dbName); try { jdbcPointDao.connection.setAutoCommit(false); } catch (SQLException e1) { e1.printStackTrace(); } for (PointDto pointDto : JDBCPointDao.points) { String time = pointDto.getPointDateHHmmss(); time = time.substring(0, time.length() - 3); if (time.equals(endTime)) { flagTimeIsInPoints = true; break; } } if (flagTimeIsInPoints.equals(true)) { for (PointDto pointDto : JDBCPointDao.points) { String time = pointDto.getPointDateHHmmss(); time = time.substring(0, time.length() - 3); if (time.equals(endTime)) { startDeleting = true; } if (startDeleting) { jdbcPointDao.deleteSelected(pointDto.getPointID()); } } try { jdbcPointDao.connection.commit(); } catch (SQLException e) { e.printStackTrace(); } } jdbcPointDao.closeConnection(); }
From source file:org.sakaiproject.tool.assessment.ui.listener.evaluation.TotalScoreUpdateListener.java
private boolean needUpdate(AgentResults agentResults, HashMap map, StringBuilder newScoreString) throws NumberFormatException { boolean update = true; String newComments = TextFormat.convertPlaintextToFormattedTextNoHighUnicode(log, agentResults.getComments()); agentResults.setComments(newComments); log.debug("newComments = " + newComments); double totalAutoScore = 0; if (agentResults.getTotalAutoScore() != null && !("").equals(agentResults.getTotalAutoScore())) { try {//from w w w . j a va 2s.c o m totalAutoScore = Double.valueOf(agentResults.getTotalAutoScore()).doubleValue(); } catch (NumberFormatException e) { totalAutoScore = 0; } } double totalOverrideScore = 0; Boolean newIsLate = agentResults.getIsLate(); // if the duedate were postpond, we need to adjust this // we will check if there is change of grade. if so, add up new score // else skip AssessmentGradingData old = (AssessmentGradingData) map.get(agentResults.getAssessmentGradingId()); if (old != null) { if (agentResults.getTotalOverrideScore() != null && !("").equals(agentResults.getTotalOverrideScore())) { try { totalOverrideScore = Double.valueOf(agentResults.getTotalOverrideScore()).doubleValue(); } catch (NumberFormatException e) { log.warn("Adj has wrong input type" + e); throw e; } } double newScore = totalAutoScore + totalOverrideScore; newScoreString.append(Double.valueOf(newScore)); double oldScore = 0; if (old.getFinalScore() != null) { oldScore = old.getFinalScore().doubleValue(); } Boolean oldIsLate = old.getIsLate(); String oldComments = old.getComments(); log.debug("***oldScore = " + oldScore); log.debug("***newScore = " + newScore); log.debug("***oldIsLate = " + oldIsLate); log.debug("***newIsLate = " + newIsLate); log.debug("***oldComments = " + oldComments); log.debug("***newComments = " + newComments); if (MathUtils.equalsIncludingNaN(oldScore, newScore, 0.0001) && newIsLate.equals(oldIsLate) && ((newComments != null && newComments.equals(oldComments)) || (newComments == null && oldComments == null) // following condition will happen when there is no comments (null) and user clicks on SubmissionId. // getComments() in AgentResults calls Validator.check(comments, "") so the null comment gets set to "" // there is nothing updated. update flag should be false || ((newComments != null && newComments.equals("")) && oldComments == null))) { update = false; } } else { // no assessmentGradingData exists boolean noOverrideScore = false; boolean noComment = false; String score = agentResults.getTotalOverrideScore(); if (score != null) { if (!("").equals(score.trim()) && !("-").equals(score.trim())) { try { totalOverrideScore = Double.valueOf(agentResults.getTotalOverrideScore()).doubleValue(); noOverrideScore = false; } catch (NumberFormatException e) { log.warn("Adj has wrong input type" + e); throw e; } } else { noOverrideScore = true; totalAutoScore = 0; } } else { noOverrideScore = true; totalAutoScore = 0; } double newScore = totalAutoScore + totalOverrideScore; newScoreString.append(Double.valueOf(newScore)); if ("".equals(agentResults.getComments().trim())) noComment = true; if (noOverrideScore && noComment) update = false; } return update; }
From source file:org.esupportail.bigbluebutton.domain.DomainServiceImpl.java
@Override public String createMeetingUrl(String meetingID, String meetingName, String welcome, String viewerPassword, String moderatorPassword, Integer voiceBridge, Boolean record, String username) { String base_url_create = BBBServerUrl + "api/create?"; String base_url_join = BBBServerUrl + "api/join?"; String welcome_param = ""; String checksum = ""; String attendee_password_param = "&attendeePW=" + viewerPassword; String moderator_password_param = "&moderatorPW=" + moderatorPassword; String voice_bridge_param = ""; String logoutURL_param = ""; String record_param = ""; WebUtils utils = new WebUtils(); if ((welcome != null) && !welcome.equals("")) { welcome_param = "&welcome=" + utils.urlEncode(welcome); }//from w w w. jav a2 s. c o m if ((moderatorPassword != null) && !moderatorPassword.equals("")) { moderator_password_param = "&moderatorPW=" + utils.urlEncode(moderatorPassword); } if ((viewerPassword != null) && !viewerPassword.equals("")) { attendee_password_param = "&attendeePW=" + utils.urlEncode(viewerPassword); } if ((voiceBridge != null) && !voiceBridge.equals("")) { voice_bridge_param = "&voiceBridge=" + voiceBridge; } if ((BBBLogoutUrl != null) && !BBBLogoutUrl.equals("")) { logoutURL_param = "&logoutURL=" + utils.urlEncode(BBBLogoutUrl); } if ((record != null) && !record.equals("")) { record_param = "&record=" + record.toString(); } // // Now create the URL // String create_parameters = "name=" + utils.urlEncode(meetingName) + "&meetingID=" + utils.urlEncode(meetingID) + welcome_param + attendee_password_param + moderator_password_param + voice_bridge_param + record_param + logoutURL_param; String url = base_url_create + create_parameters + "&checksum=" + utils.checksum("create" + create_parameters + BBBSecuritySalt); return url; }
From source file:org.olat.core.util.mail.manager.MailManagerImpl.java
/** * //from www . ja v a 2s .c om * @param mail * @param read cannot be null * @param identity * @return true if the read flag has been changed */ @Override public boolean setRead(DBMailLight mail, Boolean read, Identity identity) { if (mail == null || read == null || identity == null) throw new NullPointerException(); boolean changed = false; for (DBMailRecipient recipient : mail.getRecipients()) { if (recipient == null) continue; if (recipient.getRecipient() != null && recipient.getRecipient().equalsByPersistableKey(identity)) { if (!read.equals(recipient.getRead())) { recipient.setRead(read); dbInstance.updateObject(recipient); changed |= true; } } } return changed; }
From source file:integration.AbstractServerTest.java
/** * Compares the passed rendering definitions. * * @param def1/*w w w. j a v a2 s . c o m*/ * The first rendering definition to handle. * @param def2 * The second rendering definition to handle. * @throws Exception * Thrown if an error occurred. */ protected void compareRenderingDef(RenderingDef def1, RenderingDef def2) throws Exception { assertNotNull(def1); assertNotNull(def2); assertTrue(def1.getDefaultZ().getValue() == def2.getDefaultZ().getValue()); assertTrue(def1.getDefaultT().getValue() == def2.getDefaultT().getValue()); assertTrue(def1.getModel().getValue().getValue().equals(def2.getModel().getValue().getValue())); QuantumDef q1 = def1.getQuantization(); QuantumDef q2 = def2.getQuantization(); assertNotNull(q1); assertNotNull(q2); assertTrue(q1.getBitResolution().getValue() == q2.getBitResolution().getValue()); assertTrue(q1.getCdStart().getValue() == q2.getCdStart().getValue()); assertTrue(q1.getCdEnd().getValue() == q2.getCdEnd().getValue()); List<ChannelBinding> channels1 = def1.copyWaveRendering(); List<ChannelBinding> channels2 = def2.copyWaveRendering(); assertNotNull(channels1); assertNotNull(channels2); assertTrue(channels1.size() == channels2.size()); Iterator<ChannelBinding> i = channels1.iterator(); ChannelBinding c1, c2; int index = 0; while (i.hasNext()) { c1 = i.next(); c2 = channels2.get(index); assertTrue(c1.getAlpha().getValue() == c2.getAlpha().getValue()); assertTrue(c1.getRed().getValue() == c2.getRed().getValue()); assertTrue(c1.getGreen().getValue() == c2.getGreen().getValue()); assertTrue(c1.getBlue().getValue() == c2.getBlue().getValue()); assertTrue(c1.getCoefficient().getValue() == c2.getCoefficient().getValue()); assertTrue(c1.getFamily().getValue().getValue().equals(c2.getFamily().getValue().getValue())); assertTrue(c1.getInputStart().getValue() == c2.getInputStart().getValue()); assertTrue(c1.getInputEnd().getValue() == c2.getInputEnd().getValue()); Boolean b1 = Boolean.valueOf(c1.getActive().getValue()); Boolean b2 = Boolean.valueOf(c2.getActive().getValue()); assertTrue(b1.equals(b2)); b1 = Boolean.valueOf(c1.getNoiseReduction().getValue()); b2 = Boolean.valueOf(c2.getNoiseReduction().getValue()); assertTrue(b1.equals(b2)); } }
From source file:edu.ucsb.eucalyptus.transport.Axis2InOutMessageReceiver.java
public void invokeBusinessLogic(MessageContext msgContext, MessageContext newMsgContext) throws AxisFault { String methodName = this.findOperation(msgContext); Class serviceMethodArgType = this.findArgumentClass(methodName); SOAPFactory factory = this.getSOAPFactory(msgContext); OMElement msgBodyOm = msgContext.getEnvelope().getBody().getFirstElement(); String bindingName = this.findBindingName(msgBodyOm); EucalyptusMessage wrappedParam = this.bindMessage(methodName, serviceMethodArgType, msgBodyOm, bindingName); HttpRequest httprequest = (HttpRequest) msgContext.getProperty(GenericHttpDispatcher.HTTP_REQUEST); if (httprequest == null) { this.verifyUser(msgContext, wrappedParam); } else {/* w w w. ja v a 2 s . com*/ bindingName = httprequest.getBindingName(); Policy p = new Policy(); newMsgContext.setProperty(RampartMessageData.KEY_RAMPART_POLICY, p); //:: fixes the handling of certain kinds of client brain damage ::// if (httprequest.isPureClient()) { if (wrappedParam instanceof ModifyImageAttributeType) { ModifyImageAttributeType pure = ((ModifyImageAttributeType) wrappedParam); pure.setImageId(purifyImageIn(pure.getImageId())); } else if (wrappedParam instanceof DescribeImageAttributeType) { DescribeImageAttributeType pure = ((DescribeImageAttributeType) wrappedParam); pure.setImageId(purifyImageIn(pure.getImageId())); } else if (wrappedParam instanceof ResetImageAttributeType) { ResetImageAttributeType pure = ((ResetImageAttributeType) wrappedParam); pure.setImageId(purifyImageIn(pure.getImageId())); } else if (wrappedParam instanceof DescribeImagesType) { ArrayList<String> strs = Lists.newArrayList(); for (String imgId : ((DescribeImagesType) wrappedParam).getImagesSet()) { strs.add(purifyImageIn(imgId)); } ((DescribeImagesType) wrappedParam).setImagesSet(strs); } else if (wrappedParam instanceof DeregisterImageType) { DeregisterImageType pure = ((DeregisterImageType) wrappedParam); pure.setImageId(purifyImageIn(pure.getImageId())); } else if (wrappedParam instanceof RunInstancesType) { RunInstancesType pure = ((RunInstancesType) wrappedParam); pure.setImageId(purifyImageIn(pure.getImageId())); pure.setKernelId(purifyImageIn(pure.getKernelId())); pure.setRamdiskId(purifyImageIn(pure.getRamdiskId())); } } } MuleMessage message = this.invokeService(methodName, wrappedParam); if (message == null) throw new AxisFault("Received a NULL response. This is a bug -- it should NEVER happen."); this.checkException(message); if (httprequest != null) { //:: fixes the handling of certain kinds of client brain damage ::// if (httprequest.isPureClient()) { if (message.getPayload() instanceof DescribeImagesResponseType) { DescribeImagesResponseType purify = (DescribeImagesResponseType) message.getPayload(); for (ImageDetails img : purify.getImagesSet()) { img.setImageId(img.getImageId().replaceFirst("^e", "a").toLowerCase()); if (img.getKernelId() != null) img.setKernelId(img.getKernelId().replaceFirst("^e", "a").toLowerCase()); if (img.getRamdiskId() != null) img.setRamdiskId(img.getRamdiskId().replaceFirst("^e", "a").toLowerCase()); } } else if (message.getPayload() instanceof DescribeInstancesResponseType) { DescribeInstancesResponseType purify = (DescribeInstancesResponseType) message.getPayload(); for (ReservationInfoType rsvInfo : purify.getReservationSet()) { for (RunningInstancesItemType r : rsvInfo.getInstancesSet()) { r.setImageId(r.getImageId().replaceFirst("^e", "a").toLowerCase()); if (r.getKernel() != null) r.setKernel(r.getKernel().replaceFirst("^e", "a").toLowerCase()); if (r.getRamdisk() != null) r.setRamdisk(r.getRamdisk().replaceFirst("^e", "a").toLowerCase()); } } } } } if (newMsgContext != null) { SOAPEnvelope envelope = generateMessage(methodName, factory, bindingName, message.getPayload(), httprequest == null ? null : httprequest.getOriginalNamespace()); newMsgContext.setEnvelope(envelope); } newMsgContext.setProperty(Axis2HttpWorker.REAL_HTTP_REQUEST, msgContext.getProperty(Axis2HttpWorker.REAL_HTTP_REQUEST)); newMsgContext.setProperty(Axis2HttpWorker.REAL_HTTP_RESPONSE, msgContext.getProperty(Axis2HttpWorker.REAL_HTTP_RESPONSE)); LOG.info("Returning reply: " + message.getPayload()); if (message.getPayload() instanceof WalrusErrorMessageType) { WalrusErrorMessageType errorMessage = (WalrusErrorMessageType) message.getPayload(); msgContext.setProperty(Axis2HttpWorker.HTTP_STATUS, errorMessage.getHttpCode()); newMsgContext.setProperty(Axis2HttpWorker.HTTP_STATUS, errorMessage.getHttpCode()); //This selects the data formatter newMsgContext.setProperty("messageType", "application/walrus"); return; } Boolean putType = (Boolean) msgContext.getProperty(WalrusProperties.STREAMING_HTTP_PUT); Boolean getType = (Boolean) msgContext.getProperty(WalrusProperties.STREAMING_HTTP_GET); if (getType != null || putType != null) { WalrusDataResponseType reply = (WalrusDataResponseType) message.getPayload(); AxisHttpResponse response = (AxisHttpResponse) msgContext .getProperty(Axis2HttpWorker.REAL_HTTP_RESPONSE); response.addHeader(new BasicHeader("Last-Modified", reply.getLastModified())); response.addHeader(new BasicHeader("ETag", '\"' + reply.getEtag() + '\"')); if (getType != null) { newMsgContext.setProperty(WalrusProperties.STREAMING_HTTP_GET, getType); WalrusDataRequestType request = (WalrusDataRequestType) wrappedParam; Boolean isCompressed = request.getIsCompressed(); if (isCompressed == null) isCompressed = false; if (isCompressed) { newMsgContext.setProperty("GET_COMPRESSED", isCompressed); } else { Long contentLength = reply.getSize(); response.addHeader(new BasicHeader(HTTP.CONTENT_LEN, String.valueOf(contentLength))); } List<MetaDataEntry> metaData = reply.getMetaData(); for (MetaDataEntry metaDataEntry : metaData) { response.addHeader( new BasicHeader(WalrusProperties.AMZ_META_HEADER_PREFIX + metaDataEntry.getName(), metaDataEntry.getValue())); } if (getType.equals(Boolean.TRUE)) { newMsgContext.setProperty("GET_KEY", request.getBucket() + "." + request.getKey()); newMsgContext.setProperty("GET_RANDOM_KEY", request.getRandomKey()); } //This selects the data formatter newMsgContext.setProperty("messageType", "application/walrus"); } else if (putType != null) { if (reply instanceof PostObjectResponseType) { PostObjectResponseType postReply = (PostObjectResponseType) reply; String redirectUrl = postReply.getRedirectUrl(); if (redirectUrl != null) { response.addHeader(new BasicHeader("Location", redirectUrl)); msgContext.setProperty(Axis2HttpWorker.HTTP_STATUS, HttpStatus.SC_SEE_OTHER); newMsgContext.setProperty(Axis2HttpWorker.HTTP_STATUS, HttpStatus.SC_SEE_OTHER); newMsgContext.setProperty("messageType", "application/walrus"); } else { Integer successCode = postReply.getSuccessCode(); if (successCode != null) { newMsgContext.setProperty(Axis2HttpWorker.HTTP_STATUS, successCode); if (successCode == 201) { return; } else { newMsgContext.setProperty("messageType", "application/walrus"); return; } } } } response.addHeader(new BasicHeader(HTTP.CONTENT_LEN, String.valueOf(0))); } } }
From source file:org.openecomp.sdc.be.components.impl.ServiceBusinessLogic.java
private Either<Service, ResponseFormat> validateAndUpdateServiceMetadata(User user, Service currentService, Service serviceUpdate) {// ww w . j a va2 s . co m boolean hasBeenCertified = ValidationUtils.hasBeenCertified(currentService.getVersion()); Either<Boolean, ResponseFormat> response = validateAndUpdateCategory(user, currentService, serviceUpdate, hasBeenCertified, null); if (response.isRight()) { ResponseFormat errorResponse = response.right().value(); return Either.right(errorResponse); } String creatorUserIdUpdated = serviceUpdate.getCreatorUserId(); String creatorUserIdCurrent = currentService.getCreatorUserId(); if (creatorUserIdUpdated != null && !creatorUserIdCurrent.equals(creatorUserIdUpdated)) { log.info( "update srvice: recived request to update creatorUserId to {} the field is not updatable ignoring.", creatorUserIdUpdated); } String creatorFullNameUpdated = serviceUpdate.getCreatorFullName(); String creatorFullNameCurrent = currentService.getCreatorFullName(); if (creatorFullNameUpdated != null && !creatorFullNameCurrent.equals(creatorFullNameUpdated)) { log.info( "update srvice: recived request to update creatorFullName to {} the field is not updatable ignoring.", creatorFullNameUpdated); } String lastUpdaterUserIdUpdated = serviceUpdate.getLastUpdaterUserId(); String lastUpdaterUserIdCurrent = currentService.getLastUpdaterUserId(); if (lastUpdaterUserIdUpdated != null && !lastUpdaterUserIdCurrent.equals(lastUpdaterUserIdUpdated)) { log.info( "update srvice: recived request to update lastUpdaterUserId to {} the field is not updatable ignoring.", lastUpdaterUserIdUpdated); } String lastUpdaterFullNameUpdated = serviceUpdate.getLastUpdaterFullName(); String lastUpdaterFullNameCurrent = currentService.getLastUpdaterFullName(); if (lastUpdaterFullNameUpdated != null && !lastUpdaterFullNameCurrent.equals(lastUpdaterFullNameUpdated)) { log.info( "update srvice: recived request to update lastUpdaterFullName to {} the field is not updatable ignoring.", lastUpdaterFullNameUpdated); } response = validateAndUpdateServiceName(user, currentService, serviceUpdate, hasBeenCertified, null); if (response.isRight()) { ResponseFormat errorResponse = response.right().value(); return Either.right(errorResponse); } DistributionStatusEnum distributionStatusUpdated = serviceUpdate.getDistributionStatus(); DistributionStatusEnum distributionStatusCurrent = currentService.getDistributionStatus(); if (distributionStatusUpdated != null && !distributionStatusUpdated.name() .equals((distributionStatusCurrent != null ? distributionStatusCurrent.name() : null))) { log.info( "update srvice: recived request to update distributionStatus to {} the field is not updatable ignoring.", distributionStatusUpdated); } if (serviceUpdate.getProjectCode() != null) { response = validateAndUpdateProjectCode(user, currentService, serviceUpdate, null); if (response.isRight()) { ResponseFormat errorResponse = response.right().value(); return Either.right(errorResponse); } } response = validateAndUpdateIcon(user, currentService, serviceUpdate, hasBeenCertified, null); if (response.isRight()) { ResponseFormat errorResponse = response.right().value(); return Either.right(errorResponse); } Long creationDateUpdated = serviceUpdate.getCreationDate(); Long creationDateCurrent = currentService.getCreationDate(); if (creationDateUpdated != null && !creationDateCurrent.equals(creationDateUpdated)) { log.info( "update srvice: recived request to update creationDate to {} the field is not updatable ignoring.", creationDateUpdated); } String versionUpdated = serviceUpdate.getVersion(); String versionCurrent = currentService.getVersion(); if (versionUpdated != null && !versionCurrent.equals(versionUpdated)) { log.info("update srvice: recived request to update version to {} the field is not updatable ignoring.", versionUpdated); } response = validateAndUpdateDescription(user, currentService, serviceUpdate, hasBeenCertified, null); if (response.isRight()) { ResponseFormat errorResponse = response.right().value(); return Either.right(errorResponse); } response = validateAndUpdateTags(user, currentService, serviceUpdate, hasBeenCertified, null); if (response.isRight()) { ResponseFormat errorResponse = response.right().value(); return Either.right(errorResponse); } response = validateAndUpdateContactId(user, currentService, serviceUpdate, null); if (response.isRight()) { ResponseFormat errorResponse = response.right().value(); return Either.right(errorResponse); } Long lastUpdateDateUpdated = serviceUpdate.getLastUpdateDate(); Long lastUpdateDateCurrent = currentService.getLastUpdateDate(); if (lastUpdateDateUpdated != null && !lastUpdateDateCurrent.equals(lastUpdateDateUpdated)) { log.info( "update srvice: recived request to update lastUpdateDate to {} the field is not updatable ignoring.", lastUpdateDateUpdated); } LifecycleStateEnum lifecycleStateUpdated = serviceUpdate.getLifecycleState(); LifecycleStateEnum lifecycleStateCurrent = currentService.getLifecycleState(); if (lifecycleStateUpdated != null && !lifecycleStateCurrent.name().equals(lifecycleStateUpdated.name())) { log.info( "update srvice: recived request to update lifecycleState to {} the field is not updatable ignoring.", lifecycleStateUpdated); } Boolean isHighestVersionUpdated = serviceUpdate.isHighestVersion(); Boolean isHighestVersionCurrent = currentService.isHighestVersion(); if (isHighestVersionUpdated != null && !isHighestVersionCurrent.equals(isHighestVersionUpdated)) { log.info( "update srvice: recived request to update isHighestVersion to {} the field is not updatable ignoring.", isHighestVersionUpdated); } String uuidUpdated = serviceUpdate.getUUID(); String uuidCurrent = currentService.getUUID(); if (!uuidCurrent.equals(uuidUpdated)) { log.info("update srvice: recived request to update uuid to {} the field is not updatable ignoring.", uuidUpdated); } String currentInvariantUuid = currentService.getInvariantUUID(); String updatedInvariantUuid = serviceUpdate.getInvariantUUID(); if ((updatedInvariantUuid != null) && (!updatedInvariantUuid.equals(currentInvariantUuid))) { log.warn("Product invariant UUID is automatically set and cannot be updated"); serviceUpdate.setInvariantUUID(currentInvariantUuid); } return Either.left(currentService); }
From source file:org.olat.core.util.mail.manager.MailManagerImpl.java
/** * @param mail//from w ww .jav a2 s. co m * @param marked cannot be null * @param identity * @return true if the marked flag has been changed */ @Override public boolean setMarked(DBMailLight mail, Boolean marked, Identity identity) { if (mail == null || marked == null || identity == null) throw new NullPointerException(); boolean changed = false; for (DBMailRecipient recipient : mail.getRecipients()) { if (recipient == null) continue; if (recipient != null && recipient.getRecipient() != null && recipient.getRecipient().equalsByPersistableKey(identity)) { if (marked == null) { marked = Boolean.FALSE; } if (!marked.equals(recipient.getMarked())) { recipient.setMarked(marked.booleanValue()); dbInstance.updateObject(recipient); changed |= true; } } } return changed; }
From source file:com.microsoft.tfs.client.eclipse.project.ProjectRepositoryManager.java
/** * Connects the given IProject to its Team Foundation Server if and only if * it is not marked offline. This method will not reconnect offline * projects. This manager need not have any previous knowledge of this * project. This is most useful when a project was closed and is now opened. * * @param project/*from w ww . jav a 2s . c o m*/ * The IProject to attempt to connect * @return The connected repository, or null if it could not be connected. */ public TFSRepository connectIfNecessary(final IProject project) { Check.notNull(project, "project"); //$NON-NLS-1$ waitForManagerStartup(); ProjectRepositoryData projectData; synchronized (projectDataLock) { projectData = projectDataMap.get(project); if (projectData == null) { /* * We don't know about this project, it was likely just opened. */ Boolean shouldConnect = shouldConnect(project); /* * null response means that we should ignore this project * entirely */ if (shouldConnect == null) { return null; } projectData = new ProjectRepositoryData(); projectDataMap.put(project, projectData); projectClosedSet.remove(project); /* * override the online/offline state iff we have TFS-managed * projects in another state. this prevents us from reconnecting * a previously closed project when other projects are offline. */ if (shouldConnect.equals(Boolean.FALSE) && isAnyProjectOfStatus(ProjectRepositoryStatus.ONLINE)) { shouldConnect = Boolean.TRUE; } else if (shouldConnect.equals(Boolean.TRUE) && isAnyProjectOfStatus(ProjectRepositoryStatus.OFFLINE)) { shouldConnect = Boolean.FALSE; } if (shouldConnect == Boolean.FALSE) { projectData.setStatus(ProjectRepositoryStatus.OFFLINE); return null; } projectData.setStatus(ProjectRepositoryStatus.CONNECTING); } else { /* * This project already exists in our map. If it's already * connected (or offline), return the repository for the * project. */ synchronized (projectData) { if (projectData.getStatus() == ProjectRepositoryStatus.INITIALIZING) { /* Sanity check. */ return null; } else if (projectData.getStatus() != ProjectRepositoryStatus.CONNECTING) { return projectData.getRepository(); } /* * The project is being connected, fall through to join to * that job. */ } } } return connectInternal(project, true, projectData); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.coordinator.DegreeCurricularPlanManagementDispatchAction.java
public ActionForward editCurriculum(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixActionException, FenixServiceException { User userView = getUserView(request); String infoExecutionDegreeCode = getAndSetStringToRequest("infoExecutionDegreeCode", request); String infoCurricularCourseCode = getAndSetStringToRequest("infoCurricularCourseCode", request); String infoCurriculumCode = getAndSetStringToRequest("infoCurriculumCode", request); String language = request.getParameter("language"); InfoCurriculum infoCurriculum = getDataFromForm(form, language); Boolean result = Boolean.FALSE; try {// ww w.j a v a2 s . c o m result = EditCurriculumForCurricularCourse.runEditCurriculumForCurricularCourse(infoExecutionDegreeCode, infoCurriculumCode, infoCurricularCourseCode, infoCurriculum, userView.getUsername(), language); } catch (NonExistingServiceException e) { if (e.getMessage().equals("noCurricularCourse")) { addErrorMessage(request, "chosenCurricularCourse", "error.coordinator.chosenCurricularCourse"); return mapping.findForward("degreeCurricularPlanManagement"); } else if (e.getMessage().equals("noPerson")) { addErrorMessage(request, "chosenPerson", "error.coordinator.noUserView"); return mapping.findForward("degreeCurricularPlanManagement"); } } catch (FenixServiceException e) { if (e.getMessage().equals("nullCurricularCourseCode")) { addErrorMessage(request, "nullCode", "error.coordinator.noCurricularCourse"); return mapping.findForward("degreeCurricularPlanManagement"); } else if (e.getMessage().equals("nullCurriculumCode")) { addErrorMessage(request, "nullCurriculumCode", "error.coordinator.noCurriculum"); return mapping.findForward("degreeCurricularPlanManagement"); } else if (e.getMessage().equals("nullCurriculum")) { addErrorMessage(request, "nullCurriculum", "error.coordinator.noCurriculum"); return mapping.findForward("degreeCurricularPlanManagement"); } else if (e.getMessage().equals("nullUsername")) { addErrorMessage(request, "nullUsername", "error.coordinator.noUserView"); return mapping.findForward("degreeCurricularPlanManagement"); } else { throw new FenixActionException(e); } } if (result.equals(Boolean.FALSE)) { throw new FenixActionException(); } return viewActiveCurricularCourseInformation(mapping, form, request, response); }