text:
Status: Internal-Only
Author: Author;
CreateDate: 2015-12-16
ModifyDate: 2015-12-16

# Community Care Contracting Network

## Sections:
* [Client Details](#client-details)
* [Overview](#overview)
* [Inbound Data Sources](#inbound-data-sources)
* [Outbound Data Sources](#outbound-data-sources)
* [Custom Procedures and Tables](#custom-procedures-and-tables)
* [External Links](#external-links)
* [Out of Scope](#out-of-scope)

##Client Details
####Client Name
Community Care Contracting Network

####Client Density Area
Northwest

####Client Acronym
CCCN

####Client Contract IDs
Client Contacts

##Overview

###Description
####CCCN is comprised of five separate community health centers in WA:

![Report Generation](../img/cccn_map.jpg)

CEOs from each CHC are members of the CCCN Board and enter into contracts together, but CCCN is not an operational organization.Tactically, we manage each organization and its stakeholders on an individual basis.

###CCCN Sites

| CHC       | CBHA                                                                                | CVCH                                                                                | ICHS                                                                                | Sea Mar                                                                                | YVFWC                                                                                |
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| LOCATIONS | 3                                                                                | 7                                                                                | 7 (4 main)                                                                                | 50+                                                                                | 29                                                                                |
| PROVIDERS | 38                                                                                | 47                                                                                | 62                                                                                | (many!)                                                                                | 192                                                                                |
| PATIENTS  | 29,366+                                                                                | 25,957+                                                                                | 21,000+                                                                                | 224,519+                                                                                | 139,369+                                                                                |
| SERVICES  | Medical, Dental, Pharmacy, Vision, Lab + X-Ray, WIC, Maternity, Patient Education, Behavioral Health, Infant Toddler Early Intervention | FamilyMedicine, Behavioral Health, Behavioral Medicine, Dental, Diabetes Care, Immunization, Lab + X-Ray, Midwifery, Pediatrics, Pharmacy, Prenatal, WIC | Medical,Dental, Behavioral Health, Pharmacy, Chinese Traditional Medicine, Lab, WIC, Interpreter Services | Medical, Dental, BehavioralHealth –incl. Child and Family Services wraparound program, Preventative Health, Assisted Living, Home Care/Senior Services, Nursing Home, Pharmacy, Nurse Line, etc. | Family, Internal,OB/GYN, Pediatrics, Dental, Behavioral Health, Nutrition, Pharmacy, Lab, Radiology, Employment, Home Visits, New Hope HIV/Aids, Case Management, etc. |
| WEBSITE   | www.cbha.org                                                                                | www.cvch.org                                                                                | www.ichs.com                                                                                | www.seamar.org                                                                                | www.yvfwc.org                                                                                |

###Front-end URLs
* [QA Front-End](https://CCCNwebtst01.arcadiahosted.local/)
* [UAT Front-End](https://CCCNtest.arcadiaanalytics.com/)
* [PROD Front-End](https://CCCN.arcadiaanalytics.com/)

###Contacts

##Inbound Data Sources

###Claims
* [CHPW-Claims - CHPWCLM](../Implementations/Sources/CHPWCLM/index.html) **To be implemented Feb 2016**
* [Community Health Plan of Washington (CHPW)](./Sources/CHPW.md)   **To be decommissioned Feb 2016**
* [Coordinated Care (CCW)](./Sources/CCW.md)
* [Family Care](./Sources/FAMCAR.md)
* [Willamette Valley Claims - WVP](../Implementations/Sources/WVP/index.html) - Willamette Valley Community Health. See note on source page on name ambiguity.

###Clinical

* [Columbia Basin Health Association - CBHA](../Implementations/Sources/CBHA/index.html)
* [Columbia Valley Community Health Center - CVCH](../Implementations/Sources/CVCH/index.html)
* [Columbia Valley CHC - CVCHA](../Implementations/Sources/CVCHA/index.html)
* [International Community Health Services - ICHS](../Implementations/Sources/ICHS/index.html)
* [Yakima Valley Farm Workers Clinic - YVFWC](../Implementations/Sources/YVFWC/index.html)   - *deprecated; new Epic Connector comming*
* [Yakima Valley Farm Workers Clinic (Epic) - YVFWCE](../Implementations/Sources/YVFWCE/index.html)

##Outbound Data Sources

###Contract Dashboard
* [CCCN Contract Dashboard - CCCNDASH](./Sources/CCCNDASH.md)

##Outbound Data Sources

###Contract Dashboard
* [CCCN Contract Dashboard - CCCNDASH](./~Sources/CCCNDASH.md)

###Custom Reports

* R1 – Patient-Member Misalignment
* R2 – Enrollment Gaps and Recertification
* R3 – Capitation Accuracy Reconciliation

#####Database
* R1 – rpt.uspReportMemberPatientMisalignment
* R2 – rpt.uspReportEnrollmentGapRecertificaiton
* R3 – rpt.uspReportPremiumAccuracyReconcicialition

#####GITHUB:
* R1 – rpt.MemberPatientMisalignment
* R2 – rpt.EnrollmentGapRecertificaiton
* R3 – rpt.PremiumAccuracyReconciliation

##Out of Scope
Out of scope

##Product Configuration

###Periods Processed
As of January 2016, all non default measures have been disabled. By default the product will dynamically run the  periods for the current week, month, quarter, trailing year and year.

Periods **must** be manually enabled to run for the last 12 months, 12 weeks, 12 quarters and 4 years each time new historical data is loaded or new periods/initiatives are enabled.

###Enabled Measures
* HEDIS
* HEDIS 2016
* P4P 2015
* P4P 2014
* CCO - **enable for YVFWC only**

###Enabled Reports
* Utilization
	* ED Detail
	* ED Frequent Flyer Report
	* Utilization Detail
* Patients
	* High Cost
	* High Risk
	* Non-Engaging (18 Months)
	* Past Visit
	* Patient Registry
	* Significant Event
	* Upcoming Visit
	* Two Year Old Immunization Registry
	* Thirteen Year Old Immunization Registry
* Operations
	* Visit History
	* Order Management
	* Medications and Prescriptions
	* Charge Capture
	* Member Roster
	* Medication Management
	* Readmission Report
	* Attribution Mismatch Detail
	* Discharge Readmission Report

##Customization
###Patient Lists
[Details Under Development] Member site attribution list- Implemented using the 4.9 feature to sort on custom lists to provide CCCN with the ability to segment members on their plan sourced site attribution.

#### Report Generation & CCW File Delivery Process

![Report Generation](../img/CCW_Prod_File_Delivery_Process.jpg)

###MPI Customization
In addition to the core MPI logic, the following customization is enabled in CCCN:

**Match Criteria 1**: Normalized First Name, Normalized Last Name, Normalized DOB, and Normalized Gender, and one of the following: SSN, Medicare ID, Zip Code, or City.
**Match Criteria 2**: First 5 characters of last name, first 3 characters of first name, Normalized DOB, Normalized Gender, and Normalized City.
**Match Criteria 3**: First 5 characters of last name, First 3 characters of first name, Medicaid ID, Normalized DOB, and Normalized Gender.

The custom logic can be found in the following procedure:

**dbo.uspFilter\_FuzzyResults\_CCCN.sql** [View on GitHub](https://github.com/arcadia/qdw-cccn/blob/master/Database/MasterPatientIndex/Scripts/uspFilter_FuzzyResults_CCCN.sql)

##Custom Procedures and Tables

#### Warehouse

##### Stored Procedures
* dbo.uspDeletePlanMemberReceipt.sql [View on GitHub](https://github.com/arcadia/qdw-cccn/blob/master/Database/Warehouse/Schema%20Objects/Schemas/dbo/Programmability/uspDeletePlanMemberReceipt.sql)

Procedure to delete data from **dbo.plan\_member_receipt** table. Is executed by the Informatica task flow job. Is currently needed since the premium data gets loaded directly into the warehouse and is a new historical extract. The procedure can take a source parameter to delete only data for a specific source, if left null CCW is selected by default.

* rpt.Bad\_Provider\_Patient_list.sql
* rpt.CCCN\_MCL_Counts.sql
* rpt.CCW\_analysis_encounters.sql
* rpt.Not\_active\_in_chc.sql
* rpt.Not\_known\_to_chc.sql
* rpt.Provider\_Patient_list.sql
* rpt.ReportEnrollmentGapRecertificationReport.sql
* rpt.ReportInternalBilling.sql
* rpt.ReportMemberPatientMisalignment.sql
* rpt.ReportQualityBonusPerfomance_New.sql
* rpt.ReportQualityBonusPerformance.sql
* rpt.ReportQualityBonusPerformance_New.sql
* rpt.uspMonthlyInvoicePopulationByMCO.sql
* rpt.uspPopulateMemberClinicalSource.sql
* rpt.uspReportCBHAFutureOpportunities.sql
* rpt.uspReportPremiumAccuracy.sql
* rpt.uspUpdateCommonMemberFields.sql
* rpt.uspUpdateCommonPatientFields_custom.sql
* rpt.uspUpdateCustomReportFields.sql

#### Tables
**Tabled for Managed Care Tables**

* dbo.plan\_member_receipt.sql  [View on GitHub](https://github.com/arcadia/qdw-cccn/blob/master/Database/Warehouse/Schema%20Objects/Schemas/dbo/Tables/plan_member_receipt.sql)

Custom CCCN table to hold premium data. No corresponding staging table exists and it gets populated directly by the Informatica task flow. Before new data gets loaded, old data gets deleted by dbo.uspDeletePlanMemberReceipt

* dbo.capitation_codes.sql [View on GitHub](https://github.com/arcadia/qdw-cccn/blob/7e90d30871cfacad7bad4b2317f30c10c9c83368/Database/Warehouse/Schema%20Objects/Schemas/lookup/Tables/capitation_codes.sql)

| source\_id | type  | value | fund      |
|-----------|-------|-------|-----------|
| 1001\*/ALL | CPT** | 98812 | fund type |

*source\_id can either be "ALL" or the source_id from dbo.plan_source which corresponds with a plan source like CCW or CHPW
**could be other items outside of CPT code if needed in the future

Populated by post-deploy script: CapitationCodes.sql [View on GitHub](https://github.com/arcadia/qdw-cccn/blob/d4172883e54ca465919b2d7510b833bf1487f130/Database/Warehouse/Scripts/Post-Deployment/CapitationCodes.sql)

**Tables for R1-R4 reports:**

* rpt.CommonMemberFields.sql
* rpt.CommonPatientFields_custom.sql
* rpt.EnrollmentGapRecertification.sql
* rpt.MemberClinicalSource.sql
* rpt.MemberPatientMisalignment.sql
* rpt.PremiumAccuracy.sql

###Staging

####Stored Procedures
* usp\_implicit\_del\_plan\_member\_assignment_ccw.sql [View on GitHub](https://github.com/arcadia/qdw-cccn/blob/master/Database/Warehouse/Schema%20Objects/Schemas/staging/Programmability/Stored%20Procedures/usp_implicit_del_plan_member_assignment_ccw.sql)
* usp\_implicit\_del\_plan\_member\_elig_ccw.sql [View on GitHub](https://github.com/arcadia/qdw-cccn/blob/master/Database/Warehouse/Schema%20Objects/Schemas/staging/Programmability/Stored%20Procedures/usp_implicit_del_plan_member_elig_ccw.sql)

**NOTE please do not run historical extracts for assignment and eligibility.** Run only extract for one month which will have historical data. If a historical extract was done for these two tables, run another extract to only pull in the data from the latest load into prestaging. This is due the custom procedures below which deal with source data issues

The above two procedures get run as part of the nightly job as part of the core implicit delete functionality. This functionality is not used by any other current 4.x implementation but is still currently supported in the product. The procedures will be registered as implicit deletes using uspConfigureImplicitDelete and runs as part of the nightly job before the scrubbing step. The procedures are run before the warehouse load step and when data is present in staging brings in all of the CCW sourced warehouse records in plan member assignment and eligibility into staging as deleted. The intended outcome is to set all CCW records as deleted that were previously in the warehouse but no longer included in the most recent extracts. This is needed because the current CCW extracts are historical but sometimes exclude records that are no longer active or have been deleted at the source.

####Views
* staging.plan\_member_receipt [View on GitHub](https://github.com/arcadia/qdw-cccn/blob/master/Database/Staging/Schema%20Objects/Schemas/staging/Synonyms/plan_member_receipt.synonym.sql)

Synonym for the warehouse table **dbo.plan\_member_receipt** Is used to leverage the existing Informatica connection to staging, while populating the warehouse table directly.

##External Links
###Jira Issues
* [Client-Reported Open Issues ](https://jira.arcadiasolutions.com/issues/?jql=%22Impacted%20Data%20Sources%22%20IN%20(CCCN)%20AND%20%22Client%20Reported%20Indicator%22%20%3D%20Yes%20AND%20status%20NOT%20IN%20(Closed))
* [Known Issues](https://jira.arcadiasolutions.com/issues/?jql=%22Impacted%20Data%20Sources%22%20IN%20(CCCN)%20AND%20resolution%20IN%20(%22Known%20Issue%22))
* [Priority Open Issues](https://jira.arcadiasolutions.com/issues/?jql=%22Impacted%20Data%20Sources%22%20IN%20(CCCN)%20AND%20%22Calculated%20Priority%22%20%3C%205%20AND%20status%20NOT%20IN%20(Closed))
* [Unresolved Issues](https://jira.arcadiasolutions.com/issues/?jql=%22Impacted%20Data%20Sources%22%20IN%20(CCCN)%20AND%20status%20NOT%20IN%20(Resolved%2C%20Complete%2C%20%22Deploy%20to%20DEV%22%2C%20%22Deploy%20to%20QA%22%2C%20%22Deploy%20to%20UAT%22%2C%20%22Deploy%20to%20PROD%22%2C%20%22Validate%20in%20DEV%22%2C%20%22Validate%20in%20QA%22%2C%20%22Validate%20in%20QA%22%2C%20%22Validate%20in%20UAT%22%2C%20%22Validate%20in%20PROD%22%2C%20Closed))
* [Resolved Issues Awaiting Deployment](https://jira.arcadiasolutions.com/issues/?jql=%22Impacted%20Data%20Sources%22%20IN%20(CCCN)%20AND%20status%20IN%20(Resolved%2C%20Complete%2C%20%22Deploy%20to%20DEV%22%2C%20%22Deploy%20to%20QA%22%2C%20%22Deploy%20to%20UAT%22%2C%20%22Deploy%20to%20PROD%22%2C%20%22Validate%20in%20DEV%22%2C%20%22Validate%20in%20QA%22%2C%20%22Validate%20in%20QA%22%2C%20%22Validate%20in%20UAT%22%2C%20%22Validate%20in%20PROD%22))
* [Open Issues](https://jira.arcadiasolutions.com/issues/?jql=%22Impacted%20Data%20Sources%22%20IN%20(CCCN)%20AND%20status%20NOT%20IN%20(Closed))
* [On Hold Issues](https://jira.arcadiasolutions.com/issues/?jql=%22Impacted%20Data%20Sources%22%20IN%20(CCCN)%20AND%20status%20IN%20(%22On%20Hold%22%2C%20%22On%20Hold-External%22%2C%20%22On%20Hold-Internal%22))
* [Repo on Github](https://github.com/arcadia/qdw-CCCN)
* [BOX - SoW](https://arcadia.app.box.com/files/0/f/1570839907/CCCN)
* [Deployment History](https://labs.arcadiaanalytics.com/monitoring_framework/#vhistory)

##Attachments
* Put Relevant Attachments Here


text:
package org.rest.client.task;

/**
 * The primary interface a caller must implement to receive a response from a
 * {@link LoadTask}.
 *
 *

 * If an task is successful, then {@link #onSuccess()} is called, otherwise
 * {@link #onFailure()} is called.
 *

 *
 *

 * Note: {@link #onInnerTaskFinished()} should be called at least once. If
 * {@link LoadTask} has more than one inner task this should be call after each
 * inner task finish it's job.
 *

 *

 * A call with a typical use of TasksCallback might look like this:
 *
 *

 * task.run(new TasksCallback() {
 * 	public void onSuccess() {
 * 		TasksLoader.processNext();
 * 	}
 *
 * 	public void onFailure(int finished) {
 * 		if (tryOnFailure) {
 * 			TasksLoader.tryAgainOrDie();
 * 		} else {
 * 			taskFinished += task.getTasksCount() - finished;
 * 			TasksLoader.notifyUIabautTaskFinish();
 * 		}
 * 	}
 *
 * 	public void onInnerTaskFinished() {
 * 		// increase loader only
 * 		TasksLoader.notifyUIabautTaskFinish();
 * 	}
 *
 * });
 *

 *
 *

 *
 * @author jarrod
 *
 */
public interface TasksCallback {
	/**
	 * Called when an task call fails to complete normally.
	 *

	 * {@link TasksLoader} should than try to run task one more time. If task
	 * fails to complete again than {@link TasksLoader} remove task from tasks
	 * que and continue.
	 *

	 *
	 */
	void onFailure(int tasksExecutedCount);

	/**
	 * Should be called when task is unable to complete it's work and this is
	 * fatal error.
	 *

	 * Application can't run without this task and should display error message
	 * only.
	 *

	 *
	 * @param message
	 *            Message to display to user.
	 */
	void onFatalError(String message);

	/**
	 * Called when an task call completes successfully.
	 *

	 * After this call {@link TasksLoader} remove task from tasks que and
	 * continue with next task.
	 *

	 *

	 * There is no way (yet) to implement fatal error about task. You can't
	 * notify user about something go wrong. If that widgets should handle
	 * errors by themselfs.
	 *

	 */
	void onSuccess();

	/**
	 * Called when each inner task is finished. If task has only one inner task its
	 * should be executed before {@link #onSuccess()} is called.
	 * @param taskFinished number of task finished.
	 */
	void onInnerTaskFinished(int taskFinished);
}

redpajama_set_name: RedPajamaGithub


text:
require 'erb'
require 'delegate'
require './lib/enumerable_method'

class ProblemGenerator < SimpleDelegator
  def to_s
    ERB.new(File.read(template)).result(binding).chomp
  end

  def template
    "./lib/templates/problem.erb"
  end

  def write
    File.open("./lib/generator/#{name}_problem.rb", 'wb') do |file|
      file.write to_s
    end
    system("cp -r ./lib/templates/method ./lib/templates/#{name}")
  end
end


text:
package org.apache.camel.component.http;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

import org.apache.camel.Endpoint;
import org.apache.camel.ResolveEndpointFailedException;
import org.apache.camel.http.common.HttpBinding;
import org.apache.camel.http.common.HttpCommonComponent;
import org.apache.camel.http.common.HttpConfiguration;
import org.apache.camel.http.common.UrlRewrite;
import org.apache.camel.spi.HeaderFilterStrategy;
import org.apache.camel.util.CollectionHelper;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.URISupport;
import org.apache.camel.util.UnsafeUriCharactersEncoder;
import org.apache.commons.httpclient.HttpConnectionManager;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;

/**
 * The HTTP Component
 *
 * @version
 */
public class HttpComponent extends HttpCommonComponent {
    protected HttpClientConfigurer httpClientConfigurer;
    protected HttpConnectionManager httpConnectionManager;

    public HttpComponent() {
        super(HttpEndpoint.class);
    }

    public HttpComponent(Class<? extends HttpEndpoint> endpointClass) {
        super(endpointClass);
    }

    /**
     * Creates the HttpClientConfigurer based on the given parameters
     *
     * @param parameters the map of parameters
     * @return the configurer
     */
    protected HttpClientConfigurer createHttpClientConfigurer(Map<String, Object> parameters, Set<AuthMethod> authMethods) {
        // prefer to use endpoint configured over component configured
        // TODO cmueller: remove the "httpClientConfigurerRef" look up in Camel 3.0
        HttpClientConfigurer configurer = resolveAndRemoveReferenceParameter(parameters, "httpClientConfigurerRef", HttpClientConfigurer.class);
        if (configurer == null) {
            // try without ref
            configurer = resolveAndRemoveReferenceParameter(parameters, "httpClientConfigurer", HttpClientConfigurer.class);
        }
        if (configurer == null) {
            // fallback to component configured
            configurer = getHttpClientConfigurer();
        }

        // authentication can be endpoint configured
        String authUsername = getAndRemoveParameter(parameters, "authUsername", String.class);
        String authMethod = getAndRemoveParameter(parameters, "authMethod", String.class);
        // validate that if auth username is given then the auth method is also provided
        if (authUsername != null && authMethod == null) {
            throw new IllegalArgumentException("Option authMethod must be provided to use authentication");
        }
        if (authMethod != null) {
            String authPassword = getAndRemoveParameter(parameters, "authPassword", String.class);
            String authDomain = getAndRemoveParameter(parameters, "authDomain", String.class);
            String authHost = getAndRemoveParameter(parameters, "authHost", String.class);
            configurer = configureAuth(configurer, authMethod, authUsername, authPassword, authDomain, authHost, authMethods);
        } else if (httpConfiguration != null) {
            // or fallback to use component configuration
            configurer = configureAuth(configurer, httpConfiguration.getAuthMethod(), httpConfiguration.getAuthUsername(),
                    httpConfiguration.getAuthPassword(), httpConfiguration.getAuthDomain(), httpConfiguration.getAuthHost(), authMethods);
        }

        // proxy authentication can be endpoint configured
        String proxyAuthUsername = getAndRemoveParameter(parameters, "proxyAuthUsername", String.class);
        String proxyAuthMethod = getAndRemoveParameter(parameters, "proxyAuthMethod", String.class);
        // validate that if proxy auth username is given then the proxy auth method is also provided
        if (proxyAuthUsername != null && proxyAuthMethod == null) {
            throw new IllegalArgumentException("Option proxyAuthMethod must be provided to use proxy authentication");
        }
        if (proxyAuthMethod != null) {
            String proxyAuthPassword = getAndRemoveParameter(parameters, "proxyAuthPassword", String.class);
            String proxyAuthDomain = getAndRemoveParameter(parameters, "proxyAuthDomain", String.class);
            String proxyAuthHost = getAndRemoveParameter(parameters, "proxyAuthHost", String.class);
            configurer = configureProxyAuth(configurer, proxyAuthMethod, proxyAuthUsername, proxyAuthPassword, proxyAuthDomain, proxyAuthHost, authMethods);
        } else if (httpConfiguration != null) {
            // or fallback to use component configuration
            configurer = configureProxyAuth(configurer, httpConfiguration.getProxyAuthMethod(), httpConfiguration.getProxyAuthUsername(),
                    httpConfiguration.getProxyAuthPassword(), httpConfiguration.getProxyAuthDomain(), httpConfiguration.getProxyAuthHost(), authMethods);
        }

        return configurer;
    }

    /**
     * Configures the authentication method to be used
     *
     * @return configurer to used
     */
    protected HttpClientConfigurer configureAuth(HttpClientConfigurer configurer, String authMethod, String username,
                                                 String password, String domain, String host, Set<AuthMethod> authMethods) {

        // no auth is in use
        if (username == null && authMethod == null) {
            return configurer;
        }

        // validate mandatory options given
        if (username != null && authMethod == null) {
            throw new IllegalArgumentException("Option authMethod must be provided to use authentication");
        }
        ObjectHelper.notNull(authMethod, "authMethod");
        ObjectHelper.notNull(username, "authUsername");
        ObjectHelper.notNull(password, "authPassword");

        AuthMethod auth = getCamelContext().getTypeConverter().convertTo(AuthMethod.class, authMethod);

        // add it as a auth method used
        authMethods.add(auth);

        if (auth == AuthMethod.Basic || auth == AuthMethod.Digest) {
            return CompositeHttpConfigurer.combineConfigurers(configurer,
                    new BasicAuthenticationHttpClientConfigurer(false, username, password));
        } else if (auth == AuthMethod.NTLM) {
            // domain is mandatory for NTLM
            ObjectHelper.notNull(domain, "authDomain");
            return CompositeHttpConfigurer.combineConfigurers(configurer,
                    new NTLMAuthenticationHttpClientConfigurer(false, username, password, domain, host));
        }

        throw new IllegalArgumentException("Unknown authMethod " + authMethod);
    }

    /**
     * Configures the proxy authentication method to be used
     *
     * @return configurer to used
     */
    protected HttpClientConfigurer configureProxyAuth(HttpClientConfigurer configurer, String authMethod, String username,
                                                      String password, String domain, String host, Set<AuthMethod> authMethods) {
        // no proxy auth is in use
        if (username == null && authMethod == null) {
            return configurer;
        }

        // validate mandatory options given
        if (username != null && authMethod == null) {
            throw new IllegalArgumentException("Option proxyAuthMethod must be provided to use proxy authentication");
        }
        ObjectHelper.notNull(authMethod, "proxyAuthMethod");
        ObjectHelper.notNull(username, "proxyAuthUsername");
        ObjectHelper.notNull(password, "proxyAuthPassword");

        AuthMethod auth = getCamelContext().getTypeConverter().convertTo(AuthMethod.class, authMethod);

        // add it as a auth method used
        authMethods.add(auth);

        if (auth == AuthMethod.Basic || auth == AuthMethod.Digest) {
            return CompositeHttpConfigurer.combineConfigurers(configurer,
                    new BasicAuthenticationHttpClientConfigurer(true, username, password));
        } else if (auth == AuthMethod.NTLM) {
            // domain is mandatory for NTML
            ObjectHelper.notNull(domain, "proxyAuthDomain");
            return CompositeHttpConfigurer.combineConfigurers(configurer,
                    new NTLMAuthenticationHttpClientConfigurer(true, username, password, domain, host));
        }

        throw new IllegalArgumentException("Unknown proxyAuthMethod " + authMethod);
    }

    @Override
    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
        String addressUri = "http://" + remaining;
        if (uri.startsWith("https:")) {
            addressUri = "https://" + remaining;
        }
        Map<String, Object> httpClientParameters = new HashMap<String, Object>(parameters);
        // must extract well known parameters before we create the endpoint
        // TODO cmueller: remove the "httpBindingRef" look up in Camel 3.0
        HttpBinding binding = resolveAndRemoveReferenceParameter(parameters, "httpBindingRef", HttpBinding.class);
        if (binding == null) {
            // try without ref
            binding = resolveAndRemoveReferenceParameter(parameters, "httpBinding", HttpBinding.class);
        }
        String proxyHost = getAndRemoveParameter(parameters, "proxyHost", String.class);
        Integer proxyPort = getAndRemoveParameter(parameters, "proxyPort", Integer.class);
        String authMethodPriority = getAndRemoveParameter(parameters, "authMethodPriority", String.class);
        HeaderFilterStrategy headerFilterStrategy = resolveAndRemoveReferenceParameter(parameters, "headerFilterStrategy", HeaderFilterStrategy.class);
        UrlRewrite urlRewrite = resolveAndRemoveReferenceParameter(parameters, "urlRewrite", UrlRewrite.class);
        // http client can be configured from URI options
        HttpClientParams clientParams = new HttpClientParams();
        IntrospectionSupport.setProperties(clientParams, parameters, "httpClient.");
        // validate that we could resolve all httpClient. parameters as this component is lenient
        validateParameters(uri, parameters, "httpClient.");
        // http client can be configured from URI options
        HttpConnectionManagerParams connectionManagerParams = new HttpConnectionManagerParams();
        // setup the httpConnectionManagerParams
        IntrospectionSupport.setProperties(connectionManagerParams, parameters, "httpConnectionManager.");
        validateParameters(uri, parameters, "httpConnectionManager.");
        // make sure the component httpConnectionManager is take effect
        HttpConnectionManager thisHttpConnectionManager = httpConnectionManager;
        if (thisHttpConnectionManager == null) {
            // only set the params on the new created http connection manager
            thisHttpConnectionManager = new MultiThreadedHttpConnectionManager();
            thisHttpConnectionManager.setParams(connectionManagerParams);
        }
        // create the configurer to use for this endpoint (authMethods contains the used methods created by the configurer)
        final Set<AuthMethod> authMethods = new LinkedHashSet<AuthMethod>();
        HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, authMethods);
        addressUri = UnsafeUriCharactersEncoder.encodeHttpURI(addressUri);
        URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), httpClientParameters);

        // create the endpoint and connectionManagerParams already be set
        HttpEndpoint endpoint = createHttpEndpoint(endpointUri.toString(), this, clientParams, thisHttpConnectionManager, configurer);

        if (headerFilterStrategy != null) {
            endpoint.setHeaderFilterStrategy(headerFilterStrategy);
        } else {
            setEndpointHeaderFilterStrategy(endpoint);
        }
        if (urlRewrite != null) {
            // let CamelContext deal with the lifecycle of the url rewrite
            // this ensures its being shutdown when Camel shutdown etc.
            getCamelContext().addService(urlRewrite);
            endpoint.setUrlRewrite(urlRewrite);
        }

        // prefer to use endpoint configured over component configured
        if (binding == null) {
            // fallback to component configured
            binding = getHttpBinding();
        }
        if (binding != null) {
            endpoint.setBinding(binding);
        }
        if (proxyHost != null) {
            endpoint.setProxyHost(proxyHost);
            endpoint.setProxyPort(proxyPort);
        } else if (httpConfiguration != null) {
            endpoint.setProxyHost(httpConfiguration.getProxyHost());
            endpoint.setProxyPort(httpConfiguration.getProxyPort());
        }
        if (authMethodPriority != null) {
            endpoint.setAuthMethodPriority(authMethodPriority);
        } else if (httpConfiguration != null && httpConfiguration.getAuthMethodPriority() != null) {
            endpoint.setAuthMethodPriority(httpConfiguration.getAuthMethodPriority());
        } else {
            // no explicit auth method priority configured, so use convention over configuration
            // and set priority based on auth method
            if (!authMethods.isEmpty()) {
                authMethodPriority = CollectionHelper.collectionAsCommaDelimitedString(authMethods);
                endpoint.setAuthMethodPriority(authMethodPriority);
            }
        }
        setProperties(endpoint, parameters);
        // restructure uri to be based on the parameters left as we dont want to include the Camel internal options
        URI httpUri = URISupport.createRemainingURI(new URI(addressUri), parameters);

        // validate http uri that end-user did not duplicate the http part that can be a common error
        String part = httpUri.getSchemeSpecificPart();
        if (part != null) {
            part = part.toLowerCase();
            if (part.startsWith("//http//") || part.startsWith("//https//") || part.startsWith("//http://") || part.startsWith("//https://")) {
                throw new ResolveEndpointFailedException(uri,
                        "The uri part is not configured correctly. You have duplicated the http(s) protocol.");
            }
        }
        endpoint.setHttpUri(httpUri);
        return endpoint;
    }

    protected HttpEndpoint createHttpEndpoint(String uri, HttpComponent component, HttpClientParams clientParams,
                                              HttpConnectionManager connectionManager, HttpClientConfigurer configurer) throws URISyntaxException {
        return new HttpEndpoint(uri, component, clientParams, connectionManager, configurer);
    }

    public HttpClientConfigurer getHttpClientConfigurer() {
        return httpClientConfigurer;
    }

    /**
     * To use the custom HttpClientConfigurer to perform configuration of the HttpClient that will be used.
     */
    public void setHttpClientConfigurer(HttpClientConfigurer httpClientConfigurer) {
        this.httpClientConfigurer = httpClientConfigurer;
    }

    public HttpConnectionManager getHttpConnectionManager() {
        return httpConnectionManager;
    }

    /**
     * To use a custom HttpConnectionManager to manage connections
     */
    public void setHttpConnectionManager(HttpConnectionManager httpConnectionManager) {
        this.httpConnectionManager = httpConnectionManager;
    }

    /**
     * To use a custom HttpBinding to control the mapping between Camel message and HttpClient.
     */
    @Override
    public void setHttpBinding(HttpBinding httpBinding) {
        // need to override and call super for component docs
        super.setHttpBinding(httpBinding);
    }

    /**
     * To use the shared HttpConfiguration as base configuration.
     */
    @Override
    public void setHttpConfiguration(HttpConfiguration httpConfiguration) {
        // need to override and call super for component docs
        super.setHttpConfiguration(httpConfiguration);
    }
}


text:
        $expected = <?= $this->getAttribute('valueHelper')->invoke($function->getReturn()->getType(), $function->getReturn()->getCustomType()) ?>;

        $property = (new \ReflectionClass($this-><?= lcfirst($function->getParentNode()->getName()) ?>))
            ->getProperty('<?= $getterAnnotation->getProperty() ?>');
        $property->setAccessible(true);
<?php if ($function->isStatic()) { ?>
        $property->setValue(null, $expected);

        $this->assertSame($expected, <?= $function->getParentNode()->getName() ?>::<?= $function->getName() ?>());
<?php } else { ?>
        $property->setValue($this-><?= lcfirst($function->getParentNode()->getName()) ?>, $expected);

        $this->assertSame($expected, $this-><?= lcfirst($function->getParentNode()->getName()) ?>-><?= $function->getName() ?>());
<?php } ?>


text:
{{ partial "header.html" . }}

Uh oh!

The page you're looking for isn't here.

{{ partial "footer.html" . }}


text:
   //Obs.: Algumas funções estão sendo chamadas inline via HTML.

function verificaDia(verificardisciplina, dia) { //Retorna o dia de acordo com o valor especificado

  switch(verificardisciplina["horarios"][dia]["semana"]) {

    case 0:
    return "Domingo ";
    break;
    case 1:
    return "Segunda-feira ";
    break;
    case 2:
    return "Terça-feira ";
    break;
    case 3:
    return "Quarta-feira ";
    break;
    case 4:
    return "Quinta-feira ";
    break;
    case 5:
    return "Sexta-feira ";
    break;
    case 6:
    return "Sábado ";

  }

}

function converteDia(valor) { //Retorna o dia de acordo com o valor especificado

  switch(valor) {

    case 0:
    return "Domingo ";
    break;
    case 1:
    return "Segunda-feira ";
    break;
    case 2:
    return "Terça-feira ";
    break;
    case 3:
    return "Quarta-feira ";
    break;
    case 4:
    return "Quinta-feira ";
    break;
    case 5:
    return "Sexta-feira ";
    break;
    case 6:
    return "Sábado ";

  }

}

function verificaHora(verificardisciplina, dia) { //Função que verifica o horário da disciplina, de acordo com o dia informado

  var tamanhohoras = verificardisciplina["horarios"][dia]["horas"].length;

  return "das " + verificardisciplina["horarios"][dia]["horas"][0] + " às " + verificardisciplina["horarios"][dia]["horas"][tamanhohoras-1];

}

function verificaPeriodicidade(verificardisciplina, dia) { //Função que verifica o horário da disciplina, de acordo com o dia informado

  return verificardisciplina["horarios"][dia]["periodicidade_extenso"];

}

   function clicar() { //Função que mostrao calendário na tela

   		if($('div#calendario')[0].style.cssText == "display: none;") {

  		$('div#calendario')[0].style.cssText = "display: block;";
      $('div#disciplinaspegas')[0].style.cssText = "display: block;";

  	}

  	else{

  		$('div#calendario')[0].style.cssText = "display: none;";
      $('div#disciplinaspegas')[0].style.cssText = "display: none";

  	}

   }

   //Execução da função quinzenal, ao se clicar no botão
   //"Visualização quinzenal" => atualmente desativado.
/*
   function quinzenal() {

   	if($('tbody#segundo')[0].style.cssText == "display: none;"){
   		$('tbody#segundo')[0].style.cssText = "";
   		$('#mudarcalendario')[0].innerText = "Alterar para visualização semanal";
      $('tbody#terceiro')[0].style.cssText = "";
      $('tbody#primeiro')[0].style.cssText = "display: none;";
      $('#calendario1quinzenal')[0].style.cssText = "float: left;";
      $('#calendario2quinzenal')[0].style.cssText = "float: right;";
   	}

   	else if($('tbody#segundo')[0].style.cssText == "") {
   		$('tbody#segundo')[0].style.cssText = "display: none;";
   		$('#mudarcalendario')[0].innerText = "Alterar para visualização quinzenal";
      $('tbody#terceiro')[0].style.cssText = "display: none;";
      $('tbody#primeiro')[0].style.cssText = "";
   	}
   }
   */

        // document.getElementById("dias").innerHTML = (todasDisciplinas[i].horarios[1].horas + "");

function retornaHorario(valor) { //Retorna o horário baseado no valor inserido

switch(valor) {

  case 0:
  return "08:00";

  case 1:
  return "08:30";

  case 2:
  return "09:00";

  case 3:
  return "09:30";

  case 4:
  return "10:00";

  case 5:
  return "10:30";

  case 6:
  return "11:00";

  case 7:
  return "11:30";

  case 8:
  return "12:00";

  case 9:
  return "12:30";

  case 10:
  return "13:00";

  case 11:
  return "13:30";

  case 12:
  return "14:00";

  case 13:
  return "14:30";

  case 14:
  return "15:00";

  case 15:
  return "15:30";

  case 16:
  return "16:00";

  case 17:
  return "16:30";

  case 18:
  return "17:00";

  case 19:
  return "17:30";

  case 20:
  return "18:00";

  case 21:
  return "18:30";

  case 22:
  return "19:00";

  case 23:
  return "19:30";

  case 24:
  return "20:00";

  case 25:
  return "20:30";

  case 26:
  return "21:00";

  case 27:
  return "21:30";

  case 28:
  return "22:00";

  case 29:
  return "22:30";

  case 30:
  return "23:00";

}
}

function quantosDias(disciplina) //Retorna a quantidade de dias na semana em que a disciplina é ministrada
{

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina
  return todasDisciplinas[numerodisciplina]['horarios'].length; //Pega a quantidade de dias da semana em que a disciplina é ministrada

}

function periodicidadeDisciplina(disciplina, dia) //Retorna a periodicidade
{ //Verifica se é semanal ou quinzenal

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina
  return todasDisciplinas[numerodisciplina]['horarios'][dia]['periodicidade_extenso'];

}

function disciplinaConflitanteSemanal(disciplina, qualdia) //Verifica se a disciplina semanal possui conflito

{

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina

  var dia = todasDisciplinas[numerodisciplina]["horarios"][qualdia]["semana"]; //Pega o dia não-convertido em que a disciplina é ministrada

          var tamanhohorarios = todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'].length;

          x=0; //variável de controle
          var horariosarray = [];

  while(x<tamanhohorarios-1)
  {

            horariosarray[x] =  todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][0] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][1] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][3] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][4];
            x = x+1;

  }

          x=0;

  while(x<tamanhohorarios-1)

  {

      var seletor = "." + "quinzenaum_" + dia + "_" + horariosarray[x];
      var seletor2 = "." + "quinzenadois_" + dia + "_" + horariosarray[x];

    if($(seletor)[0].style.backgroundColor == "rgb(0, 100, 0)"  || $(seletor2)[0].style.backgroundColor == "rgb(0, 100, 0)" || $(seletor)[0].style.backgroundColor == "rgb(29, 40, 163)" || $(seletor2)[0].style.backgroundColor == "rgb(29, 40, 163)" )
    {

    break;

    }

    else
    {

    return false;

    }

  x = x+1;

  }

}

function pintarCalendarioSemanal(disciplina, qualdia) //Pinta o calendário para disciplinas quinzenais

{

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina

  var dia = todasDisciplinas[numerodisciplina]["horarios"][qualdia]["semana"]; //Pega o dia não-convertido em que a disciplina é ministrada

        var tamanhohorarios = todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'].length;

        x=0; //variável de controle
        var horariosarray = [];

  while(x<tamanhohorarios-1)
  {

            horariosarray[x] =  todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][0] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][1] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][3] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][4];
            x = x+1;

  }
  x=0; //reinicializa a variável de controle

  while(x<horariosarray.length)
  {

            var seletor = "." + "quinzenaum_" + dia + "_" + horariosarray[x];
            var seletor2 = "." + "quinzenadois_" + dia + "_" + horariosarray[x];

            if(todasDisciplinas[numerodisciplina].nome_campus == "Campus Santo André")
            {
              $(seletor)[0].style.backgroundColor = "rgb(0, 100, 0)";
            }
            else
            {
              $(seletor)[0].style.backgroundColor = "rgb(29, 40, 163)";
            }

            $(seletor)[0].classList.add(numerodisciplina);
            if(todasDisciplinas[numerodisciplina].codigo.length > 7)
            {
              var codigodisciplina = todasDisciplinas[numerodisciplina].codigo[0] + todasDisciplinas[numerodisciplina].codigo[1] + todasDisciplinas[numerodisciplina].codigo[2] + todasDisciplinas[numerodisciplina].codigo[3] + todasDisciplinas[numerodisciplina].codigo[4] + todasDisciplinas[numerodisciplina].codigo[5] + todasDisciplinas[numerodisciplina].codigo[6];
            }
            else
            {
              var codigodisciplina = todasDisciplinas[numerodisciplina].codigo;
            }
            $(seletor)[0].innerHTML = codigodisciplina;

           // $(seletor)[0].innerHTML = todasDisciplinas[numerodisciplina].codigo;

            if(todasDisciplinas[numerodisciplina].nome_campus == "Campus Santo André")
            {
              $(seletor2)[0].style.backgroundColor = "rgb(0, 100, 0)";
            }
            else
            {
              $(seletor2)[0].style.backgroundColor = "rgb(29, 40, 163)";
            }
            $(seletor2)[0].classList.add(numerodisciplina);

            if(todasDisciplinas[numerodisciplina].codigo.length > 7)
            {
              var codigodisciplina = todasDisciplinas[numerodisciplina].codigo[0] + todasDisciplinas[numerodisciplina].codigo[1] + todasDisciplinas[numerodisciplina].codigo[2] + todasDisciplinas[numerodisciplina].codigo[3] + todasDisciplinas[numerodisciplina].codigo[4] + todasDisciplinas[numerodisciplina].codigo[5] + todasDisciplinas[numerodisciplina].codigo[6];
            }
            else
            {
              var codigodisciplina = todasDisciplinas[numerodisciplina].codigo;
            }

            $(seletor2)[0].innerHTML = codigodisciplina;

            x++;

  }

}

function alertaCalendario(disciplina) //Emite o alerta informando que houve conflito e desmarca a disciplina
{

  $('.conflito')[0].style.display = "block";
  var numerodisciplina = disciplina['value']; //Pega o número da disciplina
  var normalizador = "input[value=" + numerodisciplina + "]";
  $(normalizador)[0].checked = false;
  $('div#fundopreto')[0].style.display = "block";

}

function limpacorCalendarioSemanal(disciplina, qualdia) //Limpa o calendário quando desmarca disciplina
{

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina

  var dia = todasDisciplinas[numerodisciplina]["horarios"][qualdia]["semana"]; //Pega o dia não-convertido em que a disciplina é ministrada

        var tamanhohorarios = todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'].length;

        x=0; //variável de controle
        var horariosarray = [];

  while(x<tamanhohorarios-1)
  {

            horariosarray[x] =  todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][0] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][1] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][3] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][4];
            x = x+1;

  }
  x=0; //reinicializa a variável de controle

  while(x<horariosarray.length)
  {

            var seletor = "." + "quinzenaum_" + dia + "_" + horariosarray[x];
            var seletor2 = "." + "quinzenadois_" + dia + "_" + horariosarray[x];

            $(seletor)[0].style.backgroundColor = "";
            $(seletor)[0].classList.remove(numerodisciplina);
            $(seletor)[0].innerHTML = "";

            $(seletor2)[0].style.backgroundColor = "";
            $(seletor2)[0].classList.remove(numerodisciplina);
            $(seletor2)[0].innerHTML = "";

            x++;

  }

}

function verificaDisciplinaSelecionada(disciplina, qualdia) { //Verifica se é disciplina repetida

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina

  var dia = todasDisciplinas[numerodisciplina]["horarios"][qualdia]["semana"]; //Pega o dia não-convertido em que a disciplina é ministrada

        var tamanhohorarios = todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'].length;

        x=0; //variável de controle
        var horariosarray = [];

  while(x<tamanhohorarios-1)
  {

            horariosarray[x] =  todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][0] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][1] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][3] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][4];
            x = x+1;

  }
  x=0; //reinicializa a variável de controle

    var seletor = "." + "quinzenaum_" + dia + "_" + horariosarray[0];
    var seletor2 = "." + "quinzenadois_" + dia + "_" + horariosarray[0];

    if($(seletor)[0].classList.contains(numerodisciplina) || $(seletor2)[0].classList.contains(numerodisciplina))
    {

      return true;

    }

    else {
      return false;
    }

}

function fecharalerta() { //Função que fecha a janela de erro

  $('.conflito')[0].style.display = "none";
  $('div#fundopreto')[0].style.display = "none";

}

function pintarCalendarioQuinzenal(disciplina, qualdia, quinzena) //Pinta o calendário quinzenal
{

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina

  var dia = todasDisciplinas[numerodisciplina]["horarios"][qualdia]["semana"]; //Pega o dia não-convertido em que a disciplina é ministrada

        var tamanhohorarios = todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'].length;

        x=0; //variável de controle
        var horariosarray = [];

  while(x<tamanhohorarios-1)
  {

            horariosarray[x] =  todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][0] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][1] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][3] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][4];
            x = x+1;

  }
  x=0; //reinicializa a variável de controle

  while(x<horariosarray.length)
  {

      if(quinzena == 1) {

        var seletor = "." + "quinzenaum_" + dia + "_" + horariosarray[x];
        if(todasDisciplinas[numerodisciplina].nome_campus == "Campus Santo André")
            {
              $(seletor)[0].style.backgroundColor = "rgb(0, 100, 0)";
            }
            else
            {
              $(seletor)[0].style.backgroundColor = "rgb(29, 40, 163)";
            }
        $(seletor)[0].classList.add(numerodisciplina);
        $(seletor)[0].innerHTML = todasDisciplinas[numerodisciplina].codigo;
      }

      else if(quinzena == 2) {

        var seletor = "." + "quinzenadois_" + dia + "_" + horariosarray[x];
        if(todasDisciplinas[numerodisciplina].nome_campus == "Campus Santo André")
            {
              $(seletor)[0].style.backgroundColor = "rgb(0, 100, 0)";
            }
            else
            {
              $(seletor)[0].style.backgroundColor = "rgb(29, 40, 163)";
            }
        $(seletor)[0].classList.add(numerodisciplina);
        if(todasDisciplinas[numerodisciplina].codigo.length > 7)
        {
          var codigodisciplina = todasDisciplinas[numerodisciplina].codigo[0] + todasDisciplinas[numerodisciplina].codigo[1] + todasDisciplinas[numerodisciplina].codigo[2] + todasDisciplinas[numerodisciplina].codigo[3] + todasDisciplinas[numerodisciplina].codigo[4] + todasDisciplinas[numerodisciplina].codigo[5] + todasDisciplinas[numerodisciplina].codigo[6];
        }
        else
        {
          var codigodisciplina = todasDisciplinas[numerodisciplina].codigo;
        }

            $(seletor)[0].innerHTML = codigodisciplina;
        //$(seletor)[0].innerHTML = todasDisciplinas[numerodisciplina].codigo;

      }

            x++;

  }

}

function limpacorCalendarioQuinzenal(disciplina, qualdia, quinzena) //Limpa o calendário quinzenal
{

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina

  var dia = todasDisciplinas[numerodisciplina]["horarios"][qualdia]["semana"]; //Pega o dia não-convertido em que a disciplina é ministrada

        var tamanhohorarios = todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'].length;

        x=0; //variável de controle
        var horariosarray = [];

  while(x<tamanhohorarios-1)
  {

            horariosarray[x] =  todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][0] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][1] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][3] + todasDisciplinas[numerodisciplina]['horarios']

[qualdia]['horas'][x][4];
            x = x+1;

  }
  x=0; //reinicializa a variável de controle

  while(x<horariosarray.length)
  {
    if(quinzena == 1){

      var seletor = "." + "quinzenaum_" + dia + "_" + horariosarray[x];
      $(seletor)[0].style.backgroundColor = "";
      $(seletor)[0].classList.remove(numerodisciplina);
      $(seletor)[0].innerHTML = "";
    }

    else if(quinzena == 2) {

      var seletor = "." + "quinzenadois_" + dia + "_" + horariosarray[x];
      $(seletor)[0].style.backgroundColor = "";
      $(seletor)[0].classList.remove(numerodisciplina);
      $(seletor)[0].innerHTML = "";

    }

    x++;

  }

}

function disciplinaConflitanteQuinzenal(disciplina, qualdia, quinzena) //Verifica se há conflito quinzenal
{

  var numerodisciplina = ($(disciplina)[0]['id']); //Pega o número da disciplina

  var dia = todasDisciplinas[numerodisciplina]["horarios"][qualdia]["semana"]; //Pega o dia não-convertido em que a disciplina é ministrada

          var tamanhohorarios = todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'].length;

          x=0; //variável de controle
          var horariosarray = [];

  while(x<tamanhohorarios-1)
  {

            horariosarray[x] =  todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][0] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][1] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][3] + todasDisciplinas[numerodisciplina]['horarios'][qualdia]['horas'][x][4];
            x = x+1;

  }

          x=0;

  while(x<tamanhohorarios-1)
  {

    if(quinzena == 1)
{//1
      var seletor = "." + "quinzenaum_" + dia + "_" + horariosarray[x];
      if($(seletor)[0].style.backgroundColor == "rgb(0, 100, 0)" || $(seletor)[0].style.backgroundColor == "rgb(29, 40, 163)")
    {//2

    break;

    }//2

    else
    {//3

    return false;

    }//3
}//1

    if(quinzena == 2)
    {//4
      var seletor = "." + "quinzenadois_" + dia + "_" + horariosarray[x];
      if($(seletor)[0].style.backgroundColor == "rgb(0, 100, 0)" || $(seletor)[0].style.backgroundColor == "rgb(29, 40, 163)")
      {//5

      break;

      }//5

      else
      {//6

      return false;

      }//6

    }//4
  x = x+1;

  }
}

function buscaNome() //Função do filtro por busca de nome
{

var valorbusca = $('input#busca')[0].value;
var valorbuscaconvertido = valorbusca.toUpperCase();

x=0//Variável de controle
qtddisciplinas = $('#tabeladisciplinas > tr > td:nth-child(2)').length;

while(x < qtddisciplinas)
{
  var valorbuscado = $('#tabeladisciplinas > tr > td:nth-child(3)')[x].innerHTML.toUpperCase().indexOf(valorbuscaconvertido);

  if(valorbuscado != -1)
  {

  $('#tabeladisciplinas > tr')[x].style.display = "";

  }

  else
  {
  $('#tabeladisciplinas > tr')[x].style.display = "none";

  }

x++;

}

}

function buscaCampus(campus) //Função do filtro de busca por campus
{
	var start = new Date().getTime();
	x=0; //Variável de controle

 console.log('chamou essa funcao');

qtddisciplinas = $('#tabeladisciplinas > tr > td:nth-child(2)').length;

  while(x < qtddisciplinas)
  {

    if(campus == "sa")
    {
      var comparativo = "Santo André";
      if($('#tabeladisciplinas > tr > td:nth-child(3)')[x].innerHTML.indexOf(comparativo) != -1)
      {
        //Não fazer nada se a disciplina for de Santo André
      }
      else
      {
        $('#tabeladisciplinas > tr')[x].style.display = "none"; //Esconder se for de São Bernardo
      }
    }

    else if(campus == "sbc")
    {
      var comparativo = "São Bernardo";
      if($('#tabeladisciplinas > tr > td:nth-child(3)')[x].innerHTML.indexOf(comparativo) != -1)
      {
        //Não fazer nada se a disciplina for de São Bernardo
      }
      else
      {
        $('#tabeladisciplinas > tr')[x].style.display = "none"; //Esconder se for de Santo André
      }
    }

    x++;

  }
  var end = new Date().getTime();
  var time = end - start;
  console.log(time);
}

function buscaVagas() //Filtra as disciplinas que possuem mais vagas do que requisições
{
x=0; //Variável de controle

qtddisciplinas = $('#tabeladisciplinas > tr > td:nth-child(2)').length;

  while(x < qtddisciplinas)
  {

      var normalizadorvagas = "input[id=" + x + "]"; //Pega o número do todasDisciplinas
      var selecionadisciplina = $(normalizadorvagas)[0].value; //Pega o id
      var montarqtdvagas = "tr[value=" + selecionadisciplina + "]" + ">td[value=" + selecionadisciplina + "]";
      var qtdvagas = $(montarqtdvagas)[0].innerHTML;
      var qtdrequisicoes = $(montarqtdvagas)[1].innerHTML;

      if(qtdvagas > qtdrequisicoes)
      {
        //Não fazer nada
      }
      else
      {
        var identificatr = "tr[value=" + selecionadisciplina + "]";
        $(identificatr)[0].style.display = "none"; //Esconder
      }
   x++;

  }

}

//Não está sendo utilizada
/*
function mostrarfiltros()
{

  if($('#filtros')[0].style.display == "")
  {

    $('#filtros')[0].style.display = "block";
    $('#mostrarfiltros')[0].innerHTML = "Esconder filtros";
    $("#mostrarfiltros")[0].classList.remove("btn-success");
    $("#mostrarfiltros")[0].classList.add("btn-danger");

  }
else {

  $('#filtros')[0].style.display = "";
  $('#mostrarfiltros')[0].innerHTML = "Mostrar filtros";
  $("#mostrarfiltros")[0].classList.add("btn-success");
  $("#mostrarfiltros")[0].classList.remove("btn-danger");

}

}
*/

function organizaDisciplinas() //Organiza as disciplinas de acordo com o curso selecionado
{

  $('select')[0].disabled = false;

  //TODO arrumar essa porquice
  $('table#tabeladisciplinas')[0].innerHTML = '';
  $('table#tabeladisciplinas')[0].innerHTML = '<th style="width:20px">Selecionar</th><th style="width:100px">Código</th><th>Discipina (Campus)</th><th style="width: 30px">Vagas</th><th style="width:30px;">Requisições</th><th style="width:100px;">T-P-I</th><th style="width: 350px;">Horário</th>';
  $('table#tabeladisciplinas')[1].innerHTML = '';
  $('table#tabeladisciplinas')[1].innerHTML = '<th style="width:20px">Selecionar</th><th style="width:100px">Código</th><th>Discipina (Campus)</th><th style="width: 30px">Vagas</th><th style="width:30px;">Requisições</th><th style="width:100px;">T-P-I</th><th style="width: 350px;">Horário</th>';
  $('table#tabeladisciplinas')[2].innerHTML = '';
  $('table#tabeladisciplinas')[2].innerHTML = '<th style="width:20px">Selecionar</th><th style="width:100px">Código</th><th>Discipina (Campus)</th><th style="width: 30px">Vagas</th><th style="width:30px;">Requisições</th><th style="width:100px;">T-P-I</th><th style="width: 350px;">Horário</th>';

  //Início do código

var i=0;  //variável de controle

/*

Tarefa 1 => Listar as disciplinas

Enquanto a variável de controle for menor do que a quantidade total de
disciplinas ofertadas, será executada a função abaixo:

*/

while(i < todasDisciplinas.length){

var tr = document.createElement("tr"); //Cria linha da tabela
tr.setAttribute("value", todasDisciplinas[i].id); //Atribui id à linha

//Novo código
var p=0;

while(p<todasDisciplinas[i]['horarios'].length) //Quantidade de dias da disciplina
{
var cc = 0;
var codigodisciplina = "";
while(cc<todasDisciplinas[i].codigo.length)
{
  if(todasDisciplinas[i].codigo[cc] != "-")
  {
    codigodisciplina = codigodisciplina + todasDisciplinas[i].codigo[cc];
  }
  cc++;
}

  if(todasDisciplinas[i]['horarios'][p]['periodicidade_extenso'] == " - semanal")
  {
     var u = 0; //Variável de controle

    while(u<(todasDisciplinas[i]['horarios'][p]['horas'].length-1))
    {

        tr.className = tr.className + "quinzenaum" + todasDisciplinas[i]['horarios'][p]['semana'] + "_" + todasDisciplinas[i]['horarios'][p]['horas'][u][0] + todasDisciplinas[i]['horarios'][p]['horas'][u][1] + todasDisciplinas[i]['horarios'][p]['horas'][u][3] + todasDisciplinas[i]['horarios'][p]['horas'][u][4] + " quinzenadois" + todasDisciplinas[i]['horarios'][p]['semana'] + "_" + todasDisciplinas[i]['horarios'][p]['horas'][u][0] + todasDisciplinas[i]['horarios'][p]['horas'][u][1] + todasDisciplinas[i]['horarios'][p]['horas'][u][3] + todasDisciplinas[i]['horarios'][p]['horas'][u][4] + " ";
        u++;
      }

      tr.className = tr.className + codigodisciplina + " ";

  }

  else if(todasDisciplinas[i]['horarios'][p]['periodicidade_extenso'] == " - quinzenal (I)")
  {
     var u = 0; //Variável de controle

    while(u<todasDisciplinas[i]['horarios'][p]['horas'].length-1)
    {

        tr.className = tr.className + "quinzenaum" + todasDisciplinas[i]['horarios'][p]['semana'] + "_" + todasDisciplinas[i]['horarios'][p]['horas'][u][0] + todasDisciplinas[i]['horarios'][p]['horas'][u][1] + todasDisciplinas[i]['horarios'][p]['horas'][u][3] + todasDisciplinas[i]['horarios'][p]['horas'][u][4] + " ";
        u++;
    }

    tr.className = tr.className + codigodisciplina;

  }

  else if(todasDisciplinas[i]['horarios'][p]['periodicidade_extenso'] == " - quinzenal (II)")
  {
     var u = 0; //Variável de controle

    while(u<todasDisciplinas[i]['horarios'][p]['horas'].length-1)
    {

        tr.className = tr.className + "quinzenadois" + todasDisciplinas[i]['horarios'][p]['semana'] + "_" + todasDisciplinas[i]['horarios'][p]['horas'][u][0] + todasDisciplinas[i]['horarios'][p]['horas'][u][1] + todasDisciplinas[i]['horarios'][p]['horas'][u][3] + todasDisciplinas[i]['horarios'][p]['horas'][u][4] + " ";
        u++;
    }

    tr.className = tr.className + codigodisciplina;

  }

  p++;

}

//Fim do novo código

var td = []; //Cria array para as tags td

var li = document.createElement("li"); //Cria linha

var w = 0 //Variável de controle

//Cria 7 tags td e as vincula à array td

while(w<7) {

  td[w] = document.createElement("td");
  w++;

}

//Vincula o elemento lista ao primeiro elemento da array td

td[0].appendChild(li);
td[3].setAttribute("value", todasDisciplinas[i].id);
td[4].setAttribute("value", todasDisciplinas[i].id);

var w = 0; //Reinicializa a variável de controle

td[0].firstChild.innerHTML = '<input type="checkbox"' + ' value="' + todasDisciplinas[i].id + '"' + ' id="' + i + '"' + " onchange='verificacao(this)'" + " name='disciplina_ids[]'" + ">";
td[1].textContent = todasDisciplinas[i].codigo; //Vincula o código da disciplina
//td[2].textContent = todasDisciplinas[i].nome; //Vincula o nome da disciplina e campus

var span = document.createElement('span');
span.textContent = todasDisciplinas[i].nome;

if(todasDisciplinas[i].campus == 1) {
span.className = "sa";
}
else {
  span.className = "sbc";
}
td[2].appendChild(span);
 td[3].textContent = todasDisciplinas[i].vagas;

if((periodoMatricula || periodoSegundoQuadrimestre) && todasDisciplinas[i].vagas_ingressantes != null)
{

   if(alunoIngressante)
   {

    td[3].textContent = todasDisciplinas[i].vagas_ingressantes;

   }
   else
   {

    td[3].textContent = todasDisciplinas[i].vagas - todasDisciplinas[i].vagas_ingressantes;

   }

}

if((periodoMatricula || periodoSegundoQuadrimestre) && todasDisciplinas[i].vagas_ingressantes != null)
{

  if(alunoIngressante)
   {

    if(contagemMatriculasIngressantes[todasDisciplinas[i].id] == undefined)
    {

    td[4].textContent = 0;
     }
    else
    {
    td[4].textContent = contagemMatriculasIngressantes[todasDisciplinas[i].id];
    }

    //td[4].textContent = todasDisciplinas[i].vagas_ingressantes;

   }
   else
   {

    //td[4].textContent = contagemMatriculas[todasDisciplinas[i].id] - contagemMatriculasIngressantes[todasDisciplinas[i].id];
    td[4].textContent = contagemMatriculas[todasDisciplinas[i].id];

    //td[4].textContent = todasDisciplinas[i].vagas - todasDisciplinas[i].vagas_ingressantes;

   }

  /*if(contagemMatriculasIngressantes[todasDisciplinas[i].id] == undefined)
  {

    td[4].textContent = 0;
  }
  else
  {
    td[4].textContent = contagemMatriculasIngressantes[todasDisciplinas[i].id];
  }
*/

}

else
{
  if(contagemMatriculas[todasDisciplinas[i].id] == undefined)
  {

    td[4].textContent = 0;
  }

  else
  {

    td[4].textContent = contagemMatriculas[todasDisciplinas[i].id];

  }

}

td[5].textContent = "(" + todasDisciplinas[i].tpi[0]+"-"+todasDisciplinas[i].tpi[1]+"-"+todasDisciplinas[i].tpi[2] + ")"; //Vincula o T-P-I

/* Vincula os dias da semana e horários das disciplinas */

/* Verifica, inicialmente, qual é a quantidade total de dias da disciplina,
após isso, identifica quais são os dias em que a disciplina é ministrada.

*/

//var horariofinal = organizaHorarios(todasDisciplinas[i]);

if(todasDisciplinas[i]["horarios"].length == 1) {

  var dia1 = verificaDia(todasDisciplinas[i], 0);
  var horario1 = verificaHora(todasDisciplinas[i], 0);
  var periodicidade1 = verificaPeriodicidade(todasDisciplinas[i], 0);
  var horariofechado1 = dia1 + horario1 + periodicidade1;
  var horariofinal = horariofechado1;

}

else if(todasDisciplinas[i]["horarios"].length == 2) {

  var dia1 = verificaDia(todasDisciplinas[i], 0);
  var horario1 = verificaHora(todasDisciplinas[i], 0);
  var periodicidade1 = verificaPeriodicidade(todasDisciplinas[i], 0);
  var horariofechado1 = dia1 + horario1 + periodicidade1;

  var dia2 = verificaDia(todasDisciplinas[i], 1);
  var horario2 = verificaHora(todasDisciplinas[i], 1);
  var periodicidade2 = verificaPeriodicidade(todasDisciplinas[i], 1);

  var horariofechado2 = dia2 + horario2 + periodicidade2;

  var horariofinal = horariofechado1 + "<br>" + horariofechado2;

  }

else if(todasDisciplinas[i]["horarios"].length == 3) {

  var dia1 = verificaDia(todasDisciplinas[i], 0);
  var horario1 = verificaHora(todasDisciplinas[i], 0);
  var periodicidade1 = verificaPeriodicidade(todasDisciplinas[i], 0);
  var horariofechado1 = dia1 + horario1 + periodicidade1;

  var dia2 = verificaDia(todasDisciplinas[i], 1);
  var horario2 = verificaHora(todasDisciplinas[i], 1);
  var periodicidade2 = verificaPeriodicidade(todasDisciplinas[i], 1);
  var horariofechado2 = dia2 + horario2 + periodicidade2;

  var dia3 = verificaDia(todasDisciplinas[i], 2);
  var horario3 = verificaHora(todasDisciplinas[i], 2);
  var periodicidade3 = verificaPeriodicidade(todasDisciplinas[i], 2);
  var horariofechado3 = dia3 + horario3 + periodicidade3;

  var horariofinal = horariofechado1 + "<br>" + horariofechado2 + "<br>" + horariofechado3;

}

else if(todasDisciplinas[i]["horarios"].length == 4)
{

  var dia1 = verificaDia(todasDisciplinas[i], 0);
  var horario1 = verificaHora(todasDisciplinas[i], 0);
  var periodicidade1 = verificaPeriodicidade(todasDisciplinas[i], 0);
  var horariofechado1 = dia1 + horario1 + periodicidade1;

  var dia2 = verificaDia(todasDisciplinas[i], 1);
  var horario2 = verificaHora(todasDisciplinas[i], 1);
  var periodicidade2 = verificaPeriodicidade(todasDisciplinas[i], 1);
  var horariofechado2 = dia2 + horario2 + periodicidade2;

  var dia3 = verificaDia(todasDisciplinas[i], 2);
  var horario3 = verificaHora(todasDisciplinas[i], 2);
  var periodicidade3 = verificaPeriodicidade(todasDisciplinas[i], 2);
  var horariofechado3 = dia3 + horario3 + periodicidade3;

  var dia4 = verificaDia(todasDisciplinas[i], 3);
  var horario4 = verificaHora(todasDisciplinas[i], 3);
  var periodicidade4 = verificaPeriodicidade(todasDisciplinas[i], 3);
  var horariofechado4 = dia4 + horario4 + periodicidade4;

  var horariofinal = horariofechado1 + "<br>" + horariofechado2 + "<br>" + horariofechado3 + "<br>" + horariofechado4;

}

else if(todasDisciplinas[i]["horarios"].length == 5)
{

  var dia1 = verificaDia(todasDisciplinas[i], 0);
  var horario1 = verificaHora(todasDisciplinas[i], 0);
  var periodicidade1 = verificaPeriodicidade(todasDisciplinas[i], 0);
  var horariofechado1 = dia1 + horario1 + periodicidade1;

  var dia2 = verificaDia(todasDisciplinas[i], 1);
  var horario2 = verificaHora(todasDisciplinas[i], 1);
  var periodicidade2 = verificaPeriodicidade(todasDisciplinas[i], 1);
  var horariofechado2 = dia2 + horario2 + periodicidade2;

  var dia3 = verificaDia(todasDisciplinas[i], 2);
  var horario3 = verificaHora(todasDisciplinas[i], 2);
  var periodicidade3 = verificaPeriodicidade(todasDisciplinas[i], 2);
  var horariofechado3 = dia3 + horario3 + periodicidade3;

  var dia4 = verificaDia(todasDisciplinas[i], 3);
  var horario4 = verificaHora(todasDisciplinas[i], 3);
  var periodicidade4 = verificaPeriodicidade(todasDisciplinas[i], 3);
  var horariofechado4 = dia4 + horario4 + periodicidade4;

  var dia5 = verificaDia(todasDisciplinas[i], 4);
  var horario5 = verificaHora(todasDisciplinas[i], 4);
  var periodicidade5 = verificaPeriodicidade(todasDisciplinas[i], 4);
  var horariofechado5 = dia5 + horario5 + periodicidade5;

  var horariofinal = horariofechado1 + "<br>" + horariofechado2 + "<br>" + horariofechado3 + "<br>" + horariofechado4 + "<br>" + horariofechado5;

}

td[6].innerHTML = horariofinal; //Vincula o horário à última td

//Vincula as sete td's à tr

while(w<7) {

tr.appendChild(td[w]);
w++;

}

//Insere as informações na tabela de disciplinas.

var cursoselecionado = $('#curso')[0].value;
var obrigatoriedades = todasDisciplinas[i].obrigatoriedades.length;
var x = 0 //Variável de controle
//var encontrada = false;

if(obrigatoriedades == 0)
{
$('div#disciplinaslivres>table')[0].appendChild(tr);
}
else if(obrigatoriedades >= 1)
{

while(x<obrigatoriedades){
  if (todasDisciplinas[i].obrigatoriedades[x].curso_id == cursoselecionado && todasDisciplinas[i].obrigatoriedades[x].obrigatoriedade == "obrigatoria")
  {

    $('div#disciplinasobrigatorias>table')[0].appendChild(tr);
    break;

  }

  else if(todasDisciplinas[i].obrigatoriedades[x].curso_id == cursoselecionado && todasDisciplinas[i].obrigatoriedades[x].obrigatoriedade == "limitada")
  {

     $('div#disciplinaslimitadas>table')[0].appendChild(tr);
      break;

  }

  else if(x == (obrigatoriedades-1))
  {

       $('div#disciplinaslivres>table')[0].appendChild(tr);

  }

  x++;
}
}

i++; //incrementa para puxar a próxima disciplina

}
repreencherDisciplinas();
var x = 0;
while(x<disciplinas.length)
{

      var input = "input[value=" + disciplinas[x] + "]"; //Alterado
      var normalizador = $(input)[0];
      validaLinha(normalizador);
      x++;

}

mesmaDisciplina();
controlaMesmoCodigo();

}

function insereDisciplina(iddisciplina) //Insere disciplina no array disciplinas e insere a classe mesmadisciplina das linhas da tabela
{

  disciplinas.push(iddisciplina);
  x=0;
  /*while(x<disciplinas.length)
  {

    var normalizador = "tr[id=" + $(disciplinas)[x] + "]";
    var valorseletor = $(normalizador)[0];
    valorseletor.classList.add("mesmadisciplina");
    x++;

  }*/
  mesmaDisciplina(); //Insere a classe nas disciplinas selecionadas.

}

function insereCodigo(codigo)
{

  codigosdisciplinas.push(codigo);

}

function removeCodigo(codigo) //Remove disciplina do array disciplinas e remove a classe mesmadisciplina das linhas da tabela
{

  var index = codigosdisciplinas.indexOf(codigo);
  if (index > -1)
  {
    codigosdisciplinas.splice(index, 1);
  }
  var normalizador = "tr." + codigo;
  var valorseletor = $(normalizador)[0];
  valorseletor.classList.remove("mesmocodigo");

}

function mesmaDisciplina() //Insere a classe mesmadisciplina
{

  x=0;
  while(x<disciplinas.length)
  {
    var normalizador = "tr[value=" + $(disciplinas)[x] + "]";
    var valorseletor = $(normalizador)[0];
    valorseletor.classList.add("mesmadisciplina");

    x++;
  }

}

function removeDisciplina(iddisciplina) //Remove disciplina do array disciplinas e remove a classe mesmadisciplina das linhas da tabela
{

  var index = disciplinas.indexOf(iddisciplina);
  if (index > -1)
  {
    disciplinas.splice(index, 1);
  }
  var normalizador = "tr[value=" + iddisciplina + "]";
  var valorseletor = $(normalizador)[0];
  valorseletor.classList.remove("mesmadisciplina");

}

function repreencherDisciplinas() //Pega as disciplinas da array disciplinas e preenche os campos
{

  var i = 0 //Variável de controle
  while(i<disciplinas.length)
  {
    var preencher = disciplinas[i];
    var arrumando = "input[value=" + preencher + "]";
    $(arrumando)[0].checked = true;

    i++;
  }

}

function validaLinha(elem) //Adiciona e remove os conflitos entre as linhas da tabela
{

  var iddisciplina = elem.value;
  var normalizador = "tr[value=" + iddisciplina + "]";
  var tamanhoarrayclasses = $(normalizador)[0].classList.length;

  i=0; //Variável de controle
  w=0; //Variável de controle

  if(elem.checked == true) //Se o input estiver marcado
  {

    while(i<disciplinas.length) //Varre todas as disciplinas da lista
    {

        while(w<tamanhoarrayclasses) //Enquanto for menor do que a quantidade de classes da tr
        {
          if(($(normalizador)[0].classList[w] != "mesmadisciplina") && ($(normalizador)[0].classList[w] != "disciplinaconflito"))
            {
              var nomedaclasse = "." + $(normalizador)[0].classList[w];

              $(nomedaclasse).each(function(){

              this.classList.add("disciplinaconflito");

              });

            }

           w++;
        }

      i++;

    }

  }

  if(elem.checked == false) //Se o input estiver desmarcado
  {

    while(i<disciplinas.length) //Varre todas as disciplinas da lista
    {

        while(w<tamanhoarrayclasses) //Enquanto for menor do que a quantidade de classes da tr
        {
          if(($(normalizador)[0].classList[w] != "mesmadisciplina") && ($(normalizador)[0].classList[w] != "disciplinaconflito"))
            {
              var nomedaclasse = "." + $(normalizador)[0].classList[w];
              $(nomedaclasse).each(function(){

              this.classList.remove("disciplinaconflito");

              });

            }

           w++;
        }

      i++;

    }

  }

}

function organizaHorarios(disciplina) //Monta os horários das disciplinas e os organiza
{

var qtddias = disciplina["horarios"].length;
var o = 0; //Variável de controle
var dias = [];
var horarios = [];
var periodicidades = [];
var horariofechado = [];

while(o<qtddias)
{

dias.push(verificaDia(disciplina, o));
horarios.push(verificaHora(disciplina, o));
periodicidades.push(verificaPeriodicidade(disciplina, 0));
//horariofechado[o] = dias[o] + horarios[o] + periodicidades[o];

o++;

}

p=0;
var retorno = "";
if(dias.length == 1)
{

  return dias[0] + horarios[0] + periodicidades[0]

}

else
{

  while(p<dias.length)
  {

    var retorno = retorno + dias[p] + horarios[p] + periodicidades[p] + "<br>";
    p++;

  }
  return retorno;
}

}

function removeClasses()
{

  var resultadomesmadisciplina = $(".mesmadisciplina");
  resultadomesmadisciplina.each(function x(){this.classList.remove('mesmadisciplina')});

  var resultadoconflito = $(".disciplinaconflito");
  resultadoconflito.each(function x(){this.classList.remove('disciplinaconflito')});

  var resultadocodigo = $(".mesmocodigo");
  resultadocodigo.each(function x(){this.classList.remove('mesmocodigo')});

}

function controlaMesmoCodigo()
{

  var ow = 0;
  while(ow<codigosdisciplinas.length)
  {
    var controle = "." + codigosdisciplinas[ow];
    var controlaresposta = $(controle);
    controlaresposta.each(function x(){this.classList.add("mesmocodigo")});

    ow++;

  }

}

/*function insereTPI(elem)
{

  var id = elem.id;
  creditospegos = creditospegos + todasDisciplinas[id].tpi[0] + todasDisciplinas[id].tpi[1];

}

function removeTPI(elem)
{

  var id = elem.id;
  creditospegos = creditospegos - todasDisciplinas[id].tpi[0] - todasDisciplinas[id].tpi[1];

}

function atualizaTPI()
{
  $("#atualiza").innerHTML = creditospegos;

}
*/

function atualizaTPI()
{

  var controle = 0;
  var creditos = 0;
  while(controle<disciplinas.length)
  {

    var iddisciplina = disciplinas[controle];
    var normalizador = "input[value=" + iddisciplina + "]";
    var valortddis = $(normalizador)[0].id;
    creditos = creditos + todasDisciplinas[valortddis]["tpi"][0] + todasDisciplinas[valortddis]["tpi"][1];

    controle++;

  }

  $("#atualiza")[0].innerHTML = creditos;

}

function buscaTurno(turno) //Função do filtro de busca por turno
{
x=0; //Variável de controle

qtddisciplinas = $('#tabeladisciplinas > tr > td:nth-child(2)').length;

  while(x < qtddisciplinas)
  {

    if(turno == "matutino")
    {
      var comparativo = "Matutino";
      if($('#tabeladisciplinas > tr > td:nth-child(3)')[x].innerHTML.indexOf(comparativo) != -1)
      {
        //Não fazer nada se o valor selecionado for matutino
      }
      else
      {
        $('#tabeladisciplinas > tr')[x].style.display = "none"; //Esconder se for noturno
      }
    }

    else if(turno == "noturno")
    {
      var comparativo = "Noturno";
      if($('#tabeladisciplinas > tr > td:nth-child(3)')[x].innerHTML.indexOf(comparativo) != -1)
      {
        //Não fazer nada se o valor selecionado for noturno
      }
      else
      {
        $('#tabeladisciplinas > tr')[x].style.display = "none"; //Esconder se for diurno
      }
    }

    x++;

  }
}


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>Angular l10n Specification</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	      <link rel="stylesheet" href="../styles/style.css">

            Angular l10n Specification
            <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>

<input type="text" placeholder="Type to search">
            <compodoc-menu></compodoc-menu>

                   <compodoc-menu mode="normal"></compodoc-menu>

Modules

L10nRoutingModule

        Info

        Source

File

            projects/angular-l10n/src/lib/modules/l10n-routing.module.ts

        Methods

                            Static
                            forRoot

                    forRoot(token: L10nRoutingToken)

Defined in projects/angular-l10n/src/lib/modules/l10n-routing.module.ts:11

                        Parameters :

                                    Name
                                    Type
                                    Optional
                                    Default value

                                    token

                                                L10nRoutingToken

                                        No

                                        {}

                        Returns :     ModuleWithProviders<L10nRoutingModule>

import { NgModule, ModuleWithProviders } from '@angular/core';

import { L10nRoutingToken } from '../models/l10n-config';
import { L10nRoutingService } from '../services/l10n-routing.service';
import { L10nLoader, L10nRoutingLoader } from '../services/l10n-loader';
import { L10nLocation, L10nDefaultLocation } from '../services/l10n-location';

@NgModule({})
export class L10nRoutingModule {

    public static forRoot(token: L10nRoutingToken = {}): ModuleWithProviders<L10nRoutingModule> {
        return {
            ngModule: L10nRoutingModule,
            providers: [
                L10nRoutingService,
                { provide: L10nLocation, useClass: token.location || L10nDefaultLocation },
                { provide: L10nLoader, useClass: L10nRoutingLoader }
            ]
        };
    }

}

 result-matching ""

No results matching ""


text:
class MessagesController < ApplicationController
  def new
  end

  def create
    body = params[:message][:body]
    conversation_id = params[:message][:conversation].to_i
    friendship_id = params[:message][:friendship].to_i

    message = Message.new(body: body, user_id: current_user.id, conversation_id: conversation_id)

    if message.save
      render "messages/_show_messages", locals: {message: message}, layout: false
    else
      flash[:error] = "Message was not sent"
      redirect_to friendship_path(friendship_id)
    end
  end
end


text:
require 'rack/domain/version'

# This Rack middleware allows to intercept requests and route them to different
# apps based on the domain (full, with subdomains and the TLD).
#
# @example Using a regexp
#   # Match the 'lobster' subdomain.
#   use Rack::Domain, /^lobster\./, run: Rack::Lobster.new
# @example Using a string
#   # Match only if the current domain is github.com:
#   use Rack::Domain, 'github.com', run: MyGitHubClone
# @example Using an array of strings and regexps
#   use Rack::Domain, ['lobst.er', /^lobster\./], run: Rack::Lobster.new
# @example Using an on-the-fly app build with a `Rack::Builder` block:
#   use Rack::Domain, /^api/ do
#     use Rack::Logger
#     run MyApi
#   end
class Rack::Domain
  # Create a new instance of this middleware.
  # **Note** that this method is the method called by `Rack::Builder#use`.
  #
  # @param [#call] next_app The next app on the stack, filled automatically by
  #   Rack when building the middlware chain.
  #
  # @param [String, Regexp, Array<String, Regexp>] filter The filter used to,
  #   well, filter the domain. If `filter` is a `String`, it will be matched as the
  #   entire domain; if it's a regexp, it will be matched as a regexp. If it's
  #   an array of strings and regexps, it will match if any of the elements of
  #   the array matches the domain as specified above.
  #
  # @param [Hash] opts An hash of options.
  # @option opts [#call, nil] :run The Rack app to run if the domain matches the
  #   filter. If you don't want to pass a ready application, you can pass a
  #   block with `Rack::Builder` syntax which will create a Rack app on-the-fly.
  #
  # @raise [ArgumentError] if both a building block and an app to run were
  #   passed to this function.
  def initialize(next_app, filter, opts = {}, &block)
    if opts[:run] && block_given?
      fail ArgumentError, 'Pass either an app to run or a block, not both'
    end

    @next_app = next_app
    @filter = filter
    @app_to_run = opts[:run]
    @dsl_block = block
  end

  # The `call` method as per the Rack middleware specification.
  # @param [Hash] env The environment passed around in the middlware chain.
  def call(env)
    @domain = Rack::Request.new(env).host
    app = domain_matches? ? app_or_dsl_block : @next_app
    app.call(env)
  end

  private

  # Return the app that was specified to be run if the domain matches or, if the
  # app was specified on-the-fly with a builder block, return a new app created
  # with that block (and `Rack::Builder`).
  # @return [#call]
  def app_or_dsl_block
    @app_to_run || Rack::Builder.new(&@dsl_block)
  end

  # Return `true` if the domain of the current request matches the given
  # `@filter`, `false` otherwise.
  # @raise [ArgumentError] if the filter or array of filters aren't regexps or
  #   strings.
  # @return [Boolean]
  def domain_matches?
    # Force the filter to be an array.
    @filter = [@filter] unless @filter.is_a?(Array)

    # Check if any of the elements of the `@filter` array matches the domain.
    # The matching test is done based on the element's type.
    @filter.any? do |flt|
      if flt.is_a?(Regexp)
        flt =~ @domain
      elsif flt.is_a?(String)
        flt == @domain
      else
        fail ArgumentError, 'The filters must be strings or regexps'
      end
    end
  end
end


text:
module Catalog::Service
  #noinspection ALL
  class GetCapabilitiesHandler < CswRequestHandler
    def handle
      super
      b = Builder::XmlMarkup.new
      root_args = {'xmlns' => 'http://www.opengis.net/ows/1.1',
                   'xmlns:ows' => 'http://www.opengis.net/ows/1.1',
                   'xmlns:xlink' => 'http://www.w3.org/2001/XMLSchema-instance',
                   'xmlns:xsi' => 'http://www.w3.org/1999/xlink',
                   'xmlns:ogc' => 'http://www.opengis.net/ogc',
                   'xmlns:gml' => 'http://www.opengis.net/gml',
                   'xsi:schemaLocation' => 'http://www.opengis.net/ows/1.1 ows.xsd',
                   'version' => '1.2.0'}

      b.Capabilities root_args do
        add_service_identification b
        add_service_provider b
        add_operations_metadata b
        add_filter_capabilities b
      end
    end

    private
    def add_service_identification(b)
      b.ServiceIdentification do
        b.Title 'TIG', 'xml:lang' => 'en'
        b.Abstract 'CS-W 2.0.2/AP ISO19115/19139 for service, datasets and applications'
        b.Keywords do
          b.Keyword 'TIG'
          b.Keyword 'ISO-19115'
          b.Keyword 'ISO-19119'
        end
        b.ServiceType 'OGC:CSW'
        b.ServiceTypeVersion '2.0.2'
        b.Fees 'None'
        b.AccessConstraints 'None'
      end
    end

    def add_service_provider(b)
      b.ServiceProvider do
        b.ProviderName 'TIG'
        b.ServiceContact do
          b.IndividualName 'Victor Savkin, Software Developer'
          b.PositionName 'Computer Scienctiest'
          b.ContactInfo do
            b.ElectronicMailAddress 'avix1000@gmail.com'
          end
        end
      end
    end

    def add_operations_metadata(b)
      b.OperationsMetadata do
        add_operation b, 'GetCapabilities'
        add_operation b, 'DescribeRecord'
        add_operation b, 'GetRecords'
      end
    end

    def add_operation(b, op_name)
      url = 'http://localhost:3000/csw/endpoint?'
      b.Operation :name => op_name do
        b.DCP do
          b.HTTP do
            b.Get 'xlink:href' => url
          end
        end
        b.Parameter :name => 'Format' do
          b.Value 'text/xml'
        end
      end
    end

    def add_filter_capabilities(b)
      b.ogc :Filter_Capabilities do
        b.ogc :Spatial_Capabilities do

          b.ogc :GeometryOperands do
            b.ogc :GeometryOperand, 'gml:Envelope'
          end

          b.ogc :SpatialOperators do
            b.ogc :SpatialOperator, :name => 'BBOX'
          end
        end

        b.ogc :Scalar_Capabilities do
          b.ogc :LogicalOperators
          b.ogc :ComparisonOperators do
            b.ogc :ComparisonOperator, 'EqualTo'
            b.ogc :ComparisonOperator, 'NotEqualTo'
            b.ogc :ComparisonOperator, 'GreaterThan'
            b.ogc :ComparisonOperator, 'GreaterThanEqualTo'
            b.ogc :ComparisonOperator, 'LessThan'
            b.ogc :ComparisonOperator, 'LessThanEqualTo'
            b.ogc :ComparisonOperator, 'Like'

#              b.ogc :ComparisonOperator, 'NullCheck'
#              b.ogc :ComparisonOperator, 'Between'
          end
        end
      end
    end
  end
end


text:
public class Main {
    static public void main(String[] args) throws Exception {
        int millis = 1000;

        if (args.length > 1) {
            millis = Integer.parseInt(args[1]);
        }

        System.out.println("Sleeping " + millis + " msec...");

        long start = System.currentTimeMillis();
        Thread.sleep(millis);
        long elapsed = System.currentTimeMillis() - start;
        long offBy = Math.abs(elapsed - millis);

        System.out.println("Done sleeping");

        if (offBy > 250) {
            System.out.println("Actually slept about " + elapsed + " msec...");
        }
    }
}


text:
require_relative '../cloudburrito'
require 'rspec'
require 'rack/test'

RSpec.describe 'The CloudBurrito app' do
  include Rack::Test::Methods

  def app
    CloudBurrito
  end

  before(:each) do
    Package.delete_all
    Patron.delete_all
  end

  def token
    CloudBurrito.slack_veri_token
  end

  context 'GET /' do
    it 'returns text/plain' do
      header 'Accept', 'text/plain'
      get '/'
      expect(last_response).to be_ok
      expect(last_response.body).to eq('Welcome to Cloud Burrito!')
    end

    it 'returns text/html' do
      get '/'
      expect(last_response).to be_ok
      expect(last_response.body).not_to eq('Welcome to Cloud Burrito!')
    end
  end

  context 'GET /notaburrito' do
    it 'returns 404 with text/plain' do
      header 'Accept', 'text/plain'
      get '/notaburrito'
      expect(last_response.status).to eq(404)
      expect(last_response.body).to eq('404: Burrito Not Found!')
    end

    it 'returns 404 with text/html' do
      get '/notaburrito'
      expect(last_response.status).to eq(404)
      expect(last_response.body).not_to eq('404: Burrito Not Found!')
    end
  end

  context 'GET /stats' do
    it 'returns text/html' do
      get '/stats'
      expect(last_response).to be_ok
    end

    it 'returns application/json' do
      header 'Accept', 'application/json'
      get '/stats'
      expect(last_response).to be_ok
      x = JSON.parse last_response.body
      expect(x['ok']).to be true
    end
  end

  context 'GET /rules' do
    it 'returns text/html' do
      get '/rules'
      expect(last_response).to be_ok
    end
  end

  context 'GET /cbtp' do
    it 'returns text/html' do
      get '/cbtp'
      expect(last_response).to be_ok
    end
  end

  context 'GET /slack' do
    it 'requires user_id' do
      get '/slack'
      expect(last_response.status).to eq(401)
    end

    it 'requires token' do
      get '/slack', user_id: 1
      expect(last_response.status).to eq(401)
    end

    it 'returns 404' do
      get '/slack', token: token, user_id: 1
      expect(last_response.status).to eq(404)
    end
  end

  context 'POST /slack' do
    it 'requires user_id' do
      post '/slack'
      expect(last_response.status).to eq(401)
    end

    it 'requires token' do
      post '/slack', user_id: '1'
      expect(last_response.status).to eq(401)
      expect(last_response.body).to eq('401: Burrito Unauthorized!')
    end

    context 'new user' do
      it 'users automatically added' do
        post '/slack', token: token, user_id: '1', text: ''
        expect(Patron.count).to eq(1)
      end

      it 'gets welcome page' do
        post '/slack', token: token, user_id: '1', text: ''
        expect(last_response).to be_ok
        expect(last_response.body).to eq("Welcome to the Cloud Burrito, where all your delicious dreams come true!
Now that you're here, you'll need to know how this works.
To join the Cloud Burrito type:
>/cloudburrito join
Once you are in the Cloud Burrito you will need to wait an hour before you can request a burrito, which you can do by typing in the following:
>/cloudburrito feed
A random person in the Cloud Burrito pool party will be selected to bring you a burrito, once you have received the burrito, you must acknowledge by typing in the following:
>/cloudburrito full
If you receive a request to bring someone a burrito you will need to acknowledge by typing:
>/cloudburrito serving
If you need a reminder of these commands, just type in:
>/cloudburrito
And that's it! Have fun!

Check out https://cloudburrito.jacksonargo.com/ for current stats!\n")
      end
    end

    context 'help' do
      it 'returns help by default' do
        create(:patron, slack_user_id: '1')
        post '/slack', token: token, user_id: '1'
        expect(last_response).to be_ok
        expect(last_response.body).to eq("Welcome to Cloud Burrito!
Version: #{`git describe`}

You can use these commands to do things:
>*join*: Join the burrito pool party.
>*leave*: Leave the burrito pool party.
>*pool*: Change your pool party.
>*feed*: Download a burrito from the cloud.
>*full*: ACK receipt of burrito.
>*status*: Where is my burrito at?
>*serving*: ACK a delivery request.
>*reject*: Reject a delivery request.
>*stats*: View your burrito stats.

Bugs? Issues? Features? Please see the link below.
https://github.com/jacksonargo/cloudburrito/issues/new
")
      end
    end

    context 'passes to slack controller' do
      let(:patron) { create(:slack_patron) }
      let(:params) { { token: token, user_id: patron.slack_user_id } }
      after(:each) do
        post '/slack', params
        expect(last_response).to be_ok
        expect(last_response.body).not_to match(/Cloud Burrito/)
      end

      it('join')    { params['text'] = 'join' }
      it('leave')   { params['text'] = 'leave' }
      it('feed')    { params['text'] = 'feed' }
      it('full')    { params['text'] = 'full' }
      it('status')  { params['text'] = 'status' }
      it('serving') { params['text'] = 'serving' }
      it('stats')   { params['text'] = 'stats' }
    end
  end

  context 'GET /user' do
    let(:patron) { create(:slack_patron) }
    it 'returns 401 without id' do
      get '/user'
      expect(last_response.status).to eq(401)
    end

    it 'returns 401 without token' do
      get '/user', id: patron._id
      expect(last_response.status).to eq(401)
    end

    it 'Can access user pages' do
      get '/user', token: patron.user_token, id: patron._id
      expect(last_response).to be_ok
    end
  end
end


text:
package com.lothrazar.cyclic.data;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftResultInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;

public interface IContainerCraftingAction {

  ItemStack transferStack(PlayerEntity playerIn, int index);

  CraftingInventory getCraftMatrix();

  CraftResultInventory getCraftResult();
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.altkom.desktop;

/**
 *
 * @author student
 */
public class Main {

}


text:
from __future__ import print_function

import pygion
from pygion import task, RW
import numpy

@task(privileges=[RW])
def hello(R):
    print(R.x)

# Define the main task. This task is called first.
@task
def main():
    R = pygion.Region([0, 0], {'x': pygion.float64})
    pygion.fill(R, 'x', 3.14)

    hello(R)

if __name__ == '__main__':
    main()


text:
FOUNDATION_EXPORT double Pods_BXLoadMoreControl_ExampleVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_BXLoadMoreControl_ExampleVersionString[];


text:
planet.js
=========

Don't ask me why invent another wheel. :-(

### Requirements

* Node.js >= v4.0.0

### Installation

```
sudo npm install -g planet.js
```

### Usage

1. Initialize working directory `planet i`
2. Edit `config.yml` for your needs
3. Add `planet /path/to/your/config.yml` to cronjob
4. Point your webserver root to `/path/to/your/public/directory`

### License

MIT