text:
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/feature_policy/document_policy_parser.h"

#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/feature_policy/document_policy.h"
#include "third_party/blink/public/mojom/feature_policy/feature_policy_feature.mojom-blink.h"

namespace blink {
namespace {

constexpr const mojom::blink::DocumentPolicyFeature kBoolFeature =
    static_cast<mojom::blink::DocumentPolicyFeature>(1);
constexpr const mojom::blink::DocumentPolicyFeature kDoubleFeature =
    static_cast<mojom::blink::DocumentPolicyFeature>(2);

class DocumentPolicyParserTest : public ::testing::Test {
 protected:
  DocumentPolicyParserTest()
      : name_feature_map(DocumentPolicyNameFeatureMap{
            {"f-bool", kBoolFeature},
            {"f-double", kDoubleFeature},
        }),
        feature_info_map(DocumentPolicyFeatureInfoMap{
            {kBoolFeature, {"f-bool", "", PolicyValue(true)}},
            {kDoubleFeature, {"f-double", "value", PolicyValue(1.0)}},
        }) {
    available_features.insert(kBoolFeature);
    available_features.insert(kDoubleFeature);
  }

  ~DocumentPolicyParserTest() override = default;

  base::Optional<DocumentPolicy::ParsedDocumentPolicy> Parse(
      const String& policy_string,
      PolicyParserMessageBuffer& logger) {
    return DocumentPolicyParser::ParseInternal(policy_string, name_feature_map,
                                               feature_info_map,
                                               available_features, logger);
  }

  base::Optional<std::string> Serialize(
      const DocumentPolicy::FeatureState& policy) {
    return DocumentPolicy::SerializeInternal(policy, feature_info_map);
  }

 private:
  const DocumentPolicyNameFeatureMap name_feature_map;
  const DocumentPolicyFeatureInfoMap feature_info_map;
  DocumentPolicyFeatureSet available_features;

 protected:
  struct ParseTestCase {
    const char* test_name;
    const char* input_string;
    DocumentPolicy::ParsedDocumentPolicy parsed_policy;
    Vector<PolicyParserMessageBuffer::Message> messages;
  };

  // |kPolicyParseTestCases| is made as a member of
  // |DocumentPolicyParserTest| because |PolicyParserMessageBuffer::Message| has
  // a member of type WTF::String which cannot be statically allocated.
  const std::vector<ParseTestCase> kPolicyParseTestCases = {
      //
      // Parse valid policy strings.
      //
      {
          "Parse an empty policy string.",
          "",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */ {},
      },
      {
          "Parse an empty policy string.",
          " ",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */ {},
      },
      {
          "Parse bool feature with value true.",
          "f-bool",
          /* parsed_policy */
          {
              /* feature_state */ {{kBoolFeature, PolicyValue(true)}},
              /* endpoint_map */ {},
          },
          /* messages */ {},
      },
      {
          "Parse bool feature with value false.",
          "no-f-bool",
          /* parsed_policy */
          {
              /* feature_state */ {{kBoolFeature, PolicyValue(false)}},
              /* endpoint_map */ {},
          },
          /* messages */ {},
      },
      {
          "Parse double feature with value 1.0.",
          "f-double;value=1.0",
          /* parsed_policy */
          {
              /* feature_state */ {{kDoubleFeature, PolicyValue(1.0)}},
              /* endpoint_map */ {},
          },
          /* messages */ {},
      },
      {
          "Parse double feature with value literal 2.",
          "f-double;value=2",
          /* parsed_policy */
          {
              /* feature_state */ {{kDoubleFeature, PolicyValue(2.0)}},
              /* endpoint_map */ {},
          },
          /* messages */ {},
      },
      {
          "Parse double feature and bool feature.",
          "f-double;value=1,no-f-bool",
          /* parsed_policy */
          {
              /* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                   {kDoubleFeature, PolicyValue(1.0)}},
              /* endpoint_map */ {},
          },
          /* messages */ {},
      },
      {
          "Parse bool feature and double feature.",
          "no-f-bool,f-double;value=1",
          /* parsed_policy */
          {
              /* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                   {kDoubleFeature, PolicyValue(1.0)}},
              /* endpoint_map */ {},
          },
          /* messages */ {},
      },
      {
          "White-space is allowed in some positions in structured-header.",
          "no-f-bool,   f-double;value=1",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(1.0)}},
           /* endpoint_map */ {}},
          /* messages */ {},
      },
      {
          "Unrecognized parameters are ignored, but the feature entry should "
          "remain valid.",
          "no-f-bool,f-double;value=1;unknown_param=xxx",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(1.0)}},
           /* endpoint_map */ {}},
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "Unrecognized parameter name unknown_param for feature f-double."}},
      },
      {
          "Parse policy with report endpoint specified.",
          "no-f-bool,f-double;value=1;report-to=default",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(1.0)}},
           /* endpoint_map */ {{kDoubleFeature, "default"}}},
          /* messages */ {},
      },
      {
          "Parse policy with report endpoint specified.",
          "no-f-bool;report-to=default,f-double;value=1",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(1.0)}},
           /* endpoint_map */ {{kBoolFeature, "default"}}},
          /* messages */ {},
      },
      {
          "Parse policy with default report endpoint specified. 'none' "
          "keyword should overwrite default value assignment.",
          "no-f-bool;report-to=none, f-double;value=2.0, *;report-to=default",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(2.0)}},
           /* endpoint_map */ {{kDoubleFeature, "default"}}},
          /* messages */ {},
      },
      {
          "Parse policy with default report endpoint specified.",
          "no-f-bool;report-to=not_none, f-double;value=2.0, "
          "*;report-to=default",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(2.0)}},
           /* endpoint_map */ {{kBoolFeature, "not_none"},
                               {kDoubleFeature, "default"}}},
          /* messages */ {},
      },
      {
          "Parse policy with default report endpoint 'none'.",
          "no-f-bool;report-to=not_none, f-double;value=2.0, *;report-to=none",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(2.0)}},
           /* endpoint_map */ {{kBoolFeature, "not_none"}}},
          /* messages */ {},
      },
      {
          "Default endpoint can be specified anywhere in the header, not "
          "necessary at the end.",
          "no-f-bool;report-to=not_none, *;report-to=default, "
          "f-double;value=2.0",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(2.0)}},
           /* endpoint_map */ {{kBoolFeature, "not_none"},
                               {kDoubleFeature, "default"}}},
          /* messages */ {},
      },
      {
          "Default endpoint can be specified multiple times in the header. "
          "According to SH rules, last value wins.",
          "no-f-bool;report-to=not_none, f-double;value=2.0, "
          "*;report-to=default, *;report-to=none",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)},
                                {kDoubleFeature, PolicyValue(2.0)}},
           /* endpoint_map */ {{kBoolFeature, "not_none"}}},
          /* messages */ {},
      },
      {
          "Even if default endpoint is not specified, none still should be "
          "treated as a reserved keyword for endpoint names.",
          "no-f-bool;report-to=none",
          /* parsed_policy */
          {/* feature_state */ {{kBoolFeature, PolicyValue(false)}},
           /* endpoint_map */ {}},
          /* messages */ {},
      },

      //
      // Parse invalid policies.
      //
      {
          "Parse policy with unrecognized feature name.",
          "bad-feature-name",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "Unrecognized document policy feature name "
            "bad-feature-name."}},
      },
      {
          "Parse policy with unrecognized feature name.",
          "no-bad-feature-name",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "Unrecognized document policy feature name "
            "no-bad-feature-name."}},
      },
      {
          "Parse policy with wrong type of param. Expected double type but get "
          "boolean type.",
          "f-double;value=?0",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "Parameter value in feature f-double should be Double, but get "
            "Boolean."}},
      },
      {
          "Policy member should be token instead of string.",
          "\"f-bool\"",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "The item in directive should be token type."}},
      },
      {
          "Feature token should not be empty.",
          "();value=2",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "Directives must not be inner lists."}},
      },
      {
          "Too many feature tokens.",
          "(f-bool f-double);value=2",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "Directives must not be inner lists."}},
      },
      {
          "Missing mandatory parameter.",
          "f-double;report-to=default",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "Policy value parameter missing for feature f-double. Expected "
            "something like \"f-double;value=...\"."}},
      },
      {
          "\"report-to\" parameter value type should be token instead of "
          "string.",
          "f-bool;report-to=\"default\"",
          /* parsed_policy */
          {
              /* feature_state */ {},
              /* endpoint_map */ {},
          },
          /* messages */
          {{mojom::blink::ConsoleMessageLevel::kWarning,
            "\"report-to\" parameter should be a token in feature f-bool."}},
      },
  };
};

const std::pair<DocumentPolicy::FeatureState, std::string>
    kPolicySerializationTestCases[] = {
        {{{kBoolFeature, PolicyValue(false)},
          {kDoubleFeature, PolicyValue(1.0)}},
         "no-f-bool, f-double;value=1.0"},
        // Changing ordering of FeatureState element should not affect
        // serialization result.
        {{{kDoubleFeature, PolicyValue(1.0)},
          {kBoolFeature, PolicyValue(false)}},
         "no-f-bool, f-double;value=1.0"},
        // Flipping boolean-valued policy from false to true should not affect
        // result ordering of feature.
        {{{kBoolFeature, PolicyValue(true)},
          {kDoubleFeature, PolicyValue(1.0)}},
         "f-bool, f-double;value=1.0"}};

const DocumentPolicy::FeatureState kParsedPolicies[] = {
    {},  // An empty policy
    {{kBoolFeature, PolicyValue(false)}},
    {{kBoolFeature, PolicyValue(true)}},
    {{kDoubleFeature, PolicyValue(1.0)}},
    {{kBoolFeature, PolicyValue(true)}, {kDoubleFeature, PolicyValue(1.0)}}};

// Serialize and then Parse the result of serialization should cancel each
// other out, i.e. d == Parse(Serialize(d)).
// The other way s == Serialize(Parse(s)) is not always true because structured
// header allows some optional white spaces in its parsing targets and floating
// point numbers will be rounded, e.g. value=1 will be parsed to
// PolicyValue(1.0) and get serialized to value=1.0.
TEST_F(DocumentPolicyParserTest, SerializeAndParse) {
  for (const auto& policy : kParsedPolicies) {
    const base::Optional<std::string> policy_string = Serialize(policy);
    ASSERT_TRUE(policy_string.has_value());
    PolicyParserMessageBuffer logger;
    const base::Optional<DocumentPolicy::ParsedDocumentPolicy> reparsed_policy =
        Parse(policy_string.value().c_str(), logger);

    ASSERT_TRUE(reparsed_policy.has_value());
    EXPECT_EQ(reparsed_policy.value().feature_state, policy);
  }
}

TEST_F(DocumentPolicyParserTest, SerializeResultShouldMatch) {
  for (const auto& test_case : kPolicySerializationTestCases) {
    const DocumentPolicy::FeatureState& policy = test_case.first;
    const std::string& expected = test_case.second;
    const auto result = Serialize(policy);

    ASSERT_TRUE(result.has_value());
    EXPECT_EQ(result.value(), expected);
  }
}

TEST_F(DocumentPolicyParserTest, ParseResultShouldMatch) {
  for (const auto& test_case : kPolicyParseTestCases) {
    const String& test_name = test_case.test_name;

    PolicyParserMessageBuffer logger;
    const auto result = Parse(test_case.input_string, logger);

    // All tesecases should not return base::nullopt because they all comply to
    // structured header syntax.
    ASSERT_TRUE(result.has_value());

    EXPECT_EQ(result->endpoint_map, test_case.parsed_policy.endpoint_map)
        << test_name << "\n endpoint map should match";
    EXPECT_EQ(result->feature_state, test_case.parsed_policy.feature_state)
        << test_name << "\n feature state should match";
    EXPECT_EQ(logger.GetMessages().size(), test_case.messages.size())
        << test_name << "\n messages length should match";
    for (auto *it_actual = logger.GetMessages().begin(),
              *it_expected = test_case.messages.begin();
         it_actual != logger.GetMessages().end() &&
         it_expected != test_case.messages.end();
         it_actual++, it_expected++) {
      EXPECT_EQ(it_actual->level, it_expected->level)
          << test_name << "\n message level should match";
      EXPECT_EQ(it_actual->content, it_expected->content)
          << test_name << "\n message content should match";
    }
  }
}

}  // namespace
}  // namespace blink


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Interface com.google.code.linkedinapi.schema.Companies
</TITLE>

<META NAME="date" CONTENT="2011-06-10">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
com.google.code.linkedinapi.schema.Companies

Packages that use Companies

com.google.code.linkedinapi.client

com.google.code.linkedinapi.client.impl

com.google.code.linkedinapi.schema

com.google.code.linkedinapi.schema.impl

com.google.code.linkedinapi.schema.xpp

Uses of Companies in com.google.code.linkedinapi.client

Methods in com.google.code.linkedinapi.client that return Companies

 Companies
CompaniesApiClient.getCompaniesByEmailDomain(java.lang.String emailDomain)

          Gets the companies by email domain.

 Companies
CompaniesApiClient.getCompaniesByEmailDomain(java.lang.String emailDomain,
                          java.util.Set<CompanyField> companyFields)

          Gets the companies by email domain.

 Companies
CompaniesApiClient.getFollowedCompanies()

          Gets the followed companies.

 Companies
CompaniesApiClient.getFollowedCompanies(java.util.Set<CompanyField> companyFields)

          Gets the followed companies.

 Companies
CompaniesApiClient.getSuggestedCompanies()

          Gets the suggested companies.

 Companies
CompaniesApiClient.getSuggestedCompanies(java.util.Set<CompanyField> companyFields)

          Gets the suggested companies.

 Companies
CompaniesApiClient.searchCompanies()

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                int start,
                int count)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                int start,
                int count,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                int start,
                int count,
                SearchSortOrder sortOrder)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                int start,
                int count,
                SearchSortOrder sortOrder,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                SearchSortOrder sortOrder)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                SearchSortOrder sortOrder,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                int start,
                int count)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                int start,
                int count,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                int start,
                int count,
                SearchSortOrder sortOrder)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                int start,
                int count,
                SearchSortOrder sortOrder,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                SearchSortOrder sortOrder)

          Search companies.

 Companies
CompaniesApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                SearchSortOrder sortOrder,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

Uses of Companies in com.google.code.linkedinapi.client.impl

Methods in com.google.code.linkedinapi.client.impl that return Companies

 Companies
BaseLinkedInApiClient.getCompaniesByEmailDomain(java.lang.String emailDomain)

 Companies
BaseLinkedInApiClient.getCompaniesByEmailDomain(java.lang.String emailDomain,
                          java.util.Set<CompanyField> companyFields)

 Companies
BaseLinkedInApiClient.getFollowedCompanies()

 Companies
BaseLinkedInApiClient.getFollowedCompanies(java.util.Set<CompanyField> companyFields)

 Companies
BaseLinkedInApiClient.getSuggestedCompanies()

 Companies
BaseLinkedInApiClient.getSuggestedCompanies(java.util.Set<CompanyField> companyFields)

 Companies
BaseLinkedInApiClient.searchCompanies()

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                int start,
                int count)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                int start,
                int count,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                int start,
                int count,
                SearchSortOrder sortOrder)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                int start,
                int count,
                SearchSortOrder sortOrder,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                SearchSortOrder sortOrder)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                SearchSortOrder sortOrder,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                int start,
                int count)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                int start,
                int count,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                int start,
                int count,
                SearchSortOrder sortOrder)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                int start,
                int count,
                SearchSortOrder sortOrder,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                SearchSortOrder sortOrder)

          Search companies.

 Companies
BaseLinkedInApiClient.searchCompanies(java.util.Map<SearchParameter,java.lang.String> searchParameters,
                java.util.Set<CompanyField> companyFields,
                SearchSortOrder sortOrder,
                java.util.List<Parameter<FacetType,java.lang.String>> facets)

          Search companies.

Uses of Companies in com.google.code.linkedinapi.schema

Methods in com.google.code.linkedinapi.schema that return Companies

 Companies
SchemaElementFactory.createCompanies()

          Create an instance of Companies

 Companies
ObjectFactory.createCompanies()

          Create an instance of Companies

 Companies
CompanySearch.getCompanies()

          Gets the value of the companies property.

Methods in com.google.code.linkedinapi.schema with parameters of type Companies

 void
CompanySearch.setCompanies(Companies value)

          Sets the value of the companies property.

Uses of Companies in com.google.code.linkedinapi.schema.impl

Methods in com.google.code.linkedinapi.schema.impl that return Companies

 Companies
CompanySearchImpl.getCompanies()

Methods in com.google.code.linkedinapi.schema.impl with parameters of type Companies

 void
CompanySearchImpl.setCompanies(Companies value)

Uses of Companies in com.google.code.linkedinapi.schema.xpp

Classes in com.google.code.linkedinapi.schema.xpp that implement Companies

 class
CompaniesImpl

Methods in com.google.code.linkedinapi.schema.xpp that return Companies

 Companies
XppElementFactory.createCompanies()

 Companies
CompanySearchImpl.getCompanies()

Methods in com.google.code.linkedinapi.schema.xpp with parameters of type Companies

 void
CompanySearchImpl.setCompanies(Companies value)

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

redpajama_set_name: RedPajamaGithub


text:
package org.apache.isis.core.metamodel.facets.object.parseable;

import org.apache.isis.applib.adapters.Parser;
import org.apache.isis.applib.profiles.Localization;
import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
import org.apache.isis.core.commons.lang.ClassExtensions;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
import org.apache.isis.core.metamodel.facets.object.parseable.parser.ParseableFacetUsingParser;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;

public abstract class ParseableFacetAbstract extends FacetAbstract implements ParseableFacet {

    private final Class<?> parserClass;

    // to delegate to
    private final ParseableFacetUsingParser parseableFacetUsingParser;

    public ParseableFacetAbstract(final String candidateParserName, final Class<?> candidateParserClass, final FacetHolder holder, DeploymentCategory deploymentCategory, final AuthenticationSessionProvider authenticationSessionProvider, final ServicesInjector dependencyInjector, final AdapterManager adapterManager) {
        super(ParseableFacet.class, holder, Derivation.NOT_DERIVED);

        this.parserClass = ParserUtil.parserOrNull(candidateParserClass, candidateParserName);
        this.parseableFacetUsingParser = isValid()?
                createParser(holder, deploymentCategory, authenticationSessionProvider, dependencyInjector, adapterManager):null;
    }

    private ParseableFacetUsingParser createParser(final FacetHolder holder, DeploymentCategory deploymentCategory, final AuthenticationSessionProvider authenticationSessionProvider, final ServicesInjector dependencyInjector, final AdapterManager adapterManager) {
        final Parser<?> parser = (Parser<?>) ClassExtensions.newInstance(parserClass, FacetHolder.class, holder);
        return new ParseableFacetUsingParser(parser, holder, deploymentCategory, authenticationSessionProvider, dependencyInjector, adapterManager);
    }

    /**
     * Discover whether either of the candidate parser name or class is valid.
     */
    public boolean isValid() {
        return parserClass != null;
    }

    /**
     * Guaranteed to implement the {@link Parser} class, thanks to generics in
     * the applib.
     */
    public Class<?> getParserClass() {
        return parserClass;
    }

    @Override
    protected String toStringValues() {
        return parserClass.getName();
    }

    @Override
    public ObjectAdapter parseTextEntry(
            final ObjectAdapter original,
            final String entryText,
            final InteractionInitiatedBy interactionInitiatedBy, final Localization localization) {
        return parseableFacetUsingParser.parseTextEntry(original, entryText, interactionInitiatedBy, localization);
    }

    @Override
    public String parseableTitle(final ObjectAdapter existing) {
        return parseableFacetUsingParser.parseableTitle(existing);
    }
}


text:
CPUTIME
=======
A simple multi-platform CPU user-mode chronometer

Branch|Linux & OSX|Windows
---|---|---
master|[![Build Status](https://travis-ci.org/k0dai/cputime.svg?branch=master)](https://travis-ci.org/k0dai/cputime)|[![Build status](https://ci.appveyor.com/api/projects/status/vfuxoenyd0y9iidx/branch/master?svg=true)](https://ci.appveyor.com/project/gpnuma/cputime/branch/master)
dev|[![Build Status](https://travis-ci.org/k0dai/cputime.svg?branch=dev)](https://travis-ci.org/k0dai/cputime)|[![Build status](https://ci.appveyor.com/api/projects/status/vfuxoenyd0y9iidx/branch/dev?svg=true)](https://ci.appveyor.com/project/gpnuma/cputime/branch/dev)

Build
-----
To build a static and dynamic library of CPUTime on Windows, Linux or Mac OSX,

1) Download [premake 5](http://premake.github.io/) and make it available in your path

2) Run the following from the command line

```
    git clone https://github.com/k0dai/cputime.git
    cd cputime/build
    premake5 gmake
    make
```

or alternatively, on Windows for example :

```
    premake5.exe vs2017
    msbuild CPUTime.sln
```

If msbuild.exe is not available in your path, just launch Visual Studio by double clicking on CPUTime.sln and build the library inside the IDE.

Quick start
-----------
```C
#include "cputime_api.h"

cputime_chronometer chrono;
cputime_chronometer_start(&chrono);
// Do something
double lap = cputime_chronometer_lap(&chrono);
// Do something else
double elapsed = cputime_chronometer_stop(&chrono);

// At any time, if needed, it's possible to get a timeval structure containing the total elapsed usermode time
struct timeval current_total_usertime = cputime_get_current_total_usertime();
```


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v@@BUILD_VERSION@@
// 	See http://java.sun.com/xml/jaxb
// 	Any modifications to this file will be lost upon recompilation of the source schema.
// 	Generated on: 2011.03.27 um 12:23:14 MESZ
//

package biz.wolschon.fileformats.gnucash.jwsdpimpl.generated.impl.runtime;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;

import javax.xml.bind.ValidationEvent;
import javax.xml.bind.ValidationEventHandler;
import javax.xml.bind.helpers.NotIdentifiableEventImpl;
import javax.xml.bind.helpers.ValidationEventImpl;
import javax.xml.bind.helpers.ValidationEventLocatorImpl;

import org.xml.sax.SAXException;

import com.sun.xml.bind.ProxyGroup;
import com.sun.xml.bind.serializer.AbortSerializationException;
import com.sun.xml.bind.validator.Messages;

/**
 * Maintains information that needs to be stored across
 * validations of multiple objects.
 *
 * Specifically, this object is responsible for:
 *
 *

 *
detecting a cycle in a content tree by keeping track of
 *       objects that were validated.
 *
 *
keeping an instance of NamespaceContextImpl, which is
 *       shared by all MSVValidators.
 *
 *
keeping a reference to {@link ValidationErrorHandler}.
 *       MSVValidators should use this error handler to report any error.
 *

 */
class ValidationContext
{
    final DefaultJAXBContextImpl jaxbContext;
    /**
     * @param validateID
     *      if true, ID/IDREF validation will be performed.
     */
    ValidationContext( DefaultJAXBContextImpl _context, ValidationEventHandler _eventHandler, boolean validateID ) {
        this.jaxbContext = _context;
        this.eventHandler = _eventHandler;
        this.validateID = validateID;
    }

//
//
// detecting cycles.
//
//

    /** Set of all validated objects. Used to detect a cycle. */
    private final HashSet validatedObjects = new HashSet();

    /**
     * Validates the sub-tree rooted at vo and reports
     * any errors/warnings to the error handler.
     */
    public void validate( ValidatableObject vo ) throws SAXException {
        if( validatedObjects.add(ProxyGroup.unwrap(vo)) ) {
            // setup a new validator for this object and validate it.
            MSVValidator.validate(jaxbContext,this,vo);
        } else {
            // this object has already been validated once.
            reportEvent( vo, Messages.format( Messages.CYCLE_DETECTED ) );
        }
    }

//
//
// Keeping track of namespace bindings.
//
//

    /** namespace context. */
    private final NamespaceContextImpl nsContext = new NamespaceContextImpl(null);

    public NamespaceContextImpl getNamespaceContext() { return nsContext; }

//
//
// ID/IDREF validation
//
//
    /** ID/IDREF validation is done only when this flag is true. */
    private final boolean validateID;

    private final HashSet IDs = new HashSet();
    private final HashMap IDREFs = new HashMap();

    public String onID( XMLSerializable owner, String value ) throws SAXException {

        if(!validateID) return value;

        if(!IDs.add(value)) {
            // this ID value has already been used.
            //reportEvent(Util.toValidatableObject(owner),
            //    Messages.format(Messages.DUPLICATE_ID,value));
            reportEvent(jaxbContext.getGrammarInfo().castToValidatableObject(owner),
                Messages.format(Messages.DUPLICATE_ID,value));
        }

        return value;
    }
    public String onIDREF( XMLSerializable referer, String value ) throws SAXException {
        if(!validateID) return value;

        if(IDs.contains(value))
            return value; // this IDREF has the corresponding ID.

        // remember the value to check the value later.
        IDREFs.put(value,referer);

        return value;
    }
    /** Tests if all IDREFs have corresponding IDs. */
    protected void reconcileIDs() throws SAXException {
        if(!validateID) return;

        for (Iterator itr = IDREFs.entrySet().iterator(); itr.hasNext();) {
            Map.Entry e = (Map.Entry) itr.next();

            if(IDs.contains(e.getKey()))
                continue;   // OK.

            // ID was not found.
            ValidatableObject source = (ValidatableObject)e.getValue();
            reportEvent(
                source,
                new NotIdentifiableEventImpl(
                    ValidationEvent.ERROR,
                    Messages.format( Messages.ID_NOT_FOUND, e.getKey() ),
                    new ValidationEventLocatorImpl( source ) ) );
        }

        IDREFs.clear();
    }

//
//
// Keeping track of ValidationErrorHandler
//
//
    private final ValidationEventHandler eventHandler;

    /**
     * Reports an error to the application.
     */
    public void reportEvent(ValidatableObject source, String formattedMessage) throws AbortSerializationException {
        reportEvent(
            source,
            new ValidationEventImpl( ValidationEvent.ERROR,
                                     formattedMessage,
                                     new ValidationEventLocatorImpl(source) ) );
    }

    /**
     * Reports an error to the client.
     * This version should be used when an exception is thrown from sub-modules.
     */
    public void reportEvent(ValidatableObject source, Exception nestedException ) throws AbortSerializationException {
        reportEvent(
            source,
            new ValidationEventImpl( ValidationEvent.ERROR,
                                     nestedException.toString(),
                                     new ValidationEventLocatorImpl(source),
                                     nestedException ) );
    }

    public void reportEvent( ValidatableObject source, ValidationEvent event ) throws AbortSerializationException {
        boolean r;

        try {
            r = eventHandler.handleEvent( event );
        } catch( RuntimeException re ) {
            // if the client event handler causes a RuntimeException, then
            // we have to return false.
            r = false;
        }

        if(!r) {
            // throw an exception to abort validation
            throw new AbortSerializationException( event.getMessage() );
        }
    }

}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Tests</title>

    <button onclick="change(-10000)">◐</button>
    <button onclick="change(-1)">←</button>
    <button onclick="change(1)">→</button>
    <button onclick="change(10000)">◑</button>


text:
package com.scipionyx.butterflyeffect.plugin.ui.view;

import com.scipionyx.butterflyeffect.frontend.model.Title;
import com.scipionyx.butterflyeffect.frontend.ui.view.common.AbstractView;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.UIScope;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.VerticalLayout;

/**
 *
 *
 *
 * @version 0.1.0
 * @author Renato Mendes
 *
 */
@SpringComponent("pluginView")
@UIScope()
public class PluginView extends AbstractView {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	/**
	 *
	 */
	@Override
	public void doEnter(ViewChangeEvent event) {
	}

	/**
	 *
	 */
	@Override
	public void doBuild() {
		// getTitlePanel().setTitle("Welcome - Plugin View - doBuild");
	}

	@Override
	public void doBuildLeftMenu(VerticalLayout leftMenuPanel) {
	}

	@Override
	public void doBuildWorkArea(VerticalLayout workAreaPanel, Title tile) {
	}

	@Override
	public void doBuildBottomArea(HorizontalLayout buttomAreaPanel) {
	}

}


text:
#include "condor_common.h"
#include "condor_attributes.h"
#include "condor_debug.h"
#include "condor_string.h"	// for strnewp and friends
#include "condor_daemon_core.h"
#include "condor_config.h"

#include "gridmanager.h"
#include "infnbatchjob.h"

// GridManager job states
#define GM_INIT					0
#define GM_REGISTER				1
#define GM_STDIO_UPDATE			2
#define GM_UNSUBMITTED			3
#define GM_SUBMIT				4
#define GM_SUBMIT_SAVE			5
#define GM_SUBMITTED			6
#define GM_DONE_SAVE			7
#define GM_DONE_COMMIT			8
#define GM_CANCEL				9
#define GM_FAILED				10
#define GM_DELETE				11
#define GM_CLEAR_REQUEST		12
#define GM_HOLD					13
#define GM_PROXY_EXPIRED		14
#define GM_REFRESH_PROXY		15
#define GM_START				16
#define GM_POLL_ACTIVE			17

static const char *GMStateNames[] = {
	"GM_INIT",
	"GM_REGISTER",
	"GM_STDIO_UPDATE",
	"GM_UNSUBMITTED",
	"GM_SUBMIT",
	"GM_SUBMIT_SAVE",
	"GM_SUBMITTED",
	"GM_DONE_SAVE",
	"GM_DONE_COMMIT",
	"GM_CANCEL",
	"GM_FAILED",
	"GM_DELETE",
	"GM_CLEAR_REQUEST",
	"GM_HOLD",
	"GM_PROXY_EXPIRED",
	"GM_REFRESH_PROXY",
	"GM_START",
	"GM_POLL_ACTIVE"
};

#define JOB_STATE_UNKNOWN				-1
#define JOB_STATE_UNSUBMITTED			0

// TODO: Let the maximum submit attempts be set in the job ad or, better yet,
// evalute PeriodicHold expression in job ad.
#define MAX_SUBMIT_ATTEMPTS	1

#define LOG_GLOBUS_ERROR(func,error) \
    dprintf(D_ALWAYS, \
		"(%d.%d) gmState %s, remoteState %d: %s returned error %d\n", \
        procID.cluster,procID.proc,GMStateNames[gmState],remoteState, \
        func,error)

void INFNBatchJobInit()
{
}

void INFNBatchJobReconfig()
{
	int tmp_int;

	tmp_int = param_integer( "INFN_JOB_POLL_INTERVAL", 5 * 60 );
	INFNBatchJob::setPollInterval( tmp_int );

	tmp_int = param_integer( "GRIDMANAGER_GAHP_CALL_TIMEOUT", 5 * 60 );
	INFNBatchJob::setGahpCallTimeout( tmp_int );

	tmp_int = param_integer("GRIDMANAGER_CONNECT_FAILURE_RETRY_COUNT",3);
	INFNBatchJob::setConnectFailureRetry( tmp_int );
}

bool INFNBatchJobAdMatch( const ClassAd *job_ad ) {
	int universe;
	std::string resource;
		// CRUFT: grid-type 'blah' is deprecated. Now, the specific batch
		//   system names should be used (pbs, lsf). Glite are the only
		//   people who care about the old value. This changed happend in
		//   Condor 6.7.12.
	if ( job_ad->LookupInteger( ATTR_JOB_UNIVERSE, universe ) &&
		 universe == CONDOR_UNIVERSE_GRID &&
		 job_ad->LookupString( ATTR_GRID_RESOURCE, resource ) &&
		 ( strncasecmp( resource.c_str(), "blah", 4 ) == 0 ||
		   strncasecmp( resource.c_str(), "batch", 5 ) == 0 ||
		   strncasecmp( resource.c_str(), "pbs", 3 ) == 0 ||
		   strncasecmp( resource.c_str(), "lsf", 3 ) == 0 ||
		   strncasecmp( resource.c_str(), "nqs", 3 ) == 0 ||
		   strncasecmp( resource.c_str(), "sge", 3 ) == 0 ||
		   strncasecmp( resource.c_str(), "naregi", 6 ) == 0 ) ) {

		return true;
	}
	return false;
}

BaseJob *INFNBatchJobCreate( ClassAd *jobad )
{
	return (BaseJob *)new INFNBatchJob( jobad );
}

int INFNBatchJob::pollInterval = 300;			// default value
int INFNBatchJob::submitInterval = 300;			// default value
int INFNBatchJob::gahpCallTimeout = 300;		// default value
int INFNBatchJob::maxConnectFailures = 3;		// default value

INFNBatchJob::INFNBatchJob( ClassAd *classad )
	: BaseJob( classad )
{
	std::string buff;
	std::string error_string = "";
	char *gahp_path;
	ArgList gahp_args;

	gahpAd = NULL;
	gmState = GM_INIT;
	remoteState = JOB_STATE_UNKNOWN;
	enteredCurrentGmState = time(NULL);
	enteredCurrentRemoteState = time(NULL);
	lastSubmitAttempt = 0;
	numSubmitAttempts = 0;
	remoteJobId = NULL;
	lastPollTime = 0;
	pollNow = false;
	myResource = NULL;
	gahp = NULL;
	jobProxy = NULL;
	remoteProxyExpireTime = 0;

	// In GM_HOLD, we assume HoldReason to be set only if we set it, so make
	// sure it's unset when we start.
	if ( jobAd->LookupString( ATTR_HOLD_REASON, NULL, 0 ) != 0 ) {
		jobAd->AssignExpr( ATTR_HOLD_REASON, "Undefined" );
	}

	buff = "";
	jobAd->LookupString( ATTR_GRID_RESOURCE, buff );
	if ( buff != "" ) {
		const char *token;
		Tokenize( buff );

		token = GetNextToken( " ", false );
		if ( !strcmp( "batch", token ) ) {
			token = GetNextToken( " ", false );
		}
		batchType = strdup( token );

		while ( (token = GetNextToken( " ", false )) ) {
			gahp_args.AppendArg( token );
		}
	} else {
		sprintf( error_string, "%s is not set in the job ad",
							  ATTR_GRID_RESOURCE );
		goto error_exit;
	}

	buff = "";
	jobAd->LookupString( ATTR_GRID_JOB_ID, buff );
	if ( buff != "" ) {
		SetRemoteJobId( strchr( buff.c_str(), ' ' ) + 1 );
	} else {
		remoteState = JOB_STATE_UNSUBMITTED;
	}

	strupr( batchType );

	if ( gahp_args.Count() > 0 ) {
		gahp_path = param( "REMOTE_GAHP" );
		if ( gahp_path == NULL ) {
			sprintf( error_string, "REMOTE_GAHP not defined" );
			goto error_exit;
		}
	} else {
		sprintf( buff, "%s_GAHP", batchType );
		gahp_path = param(buff.c_str());
		if ( gahp_path == NULL ) {
			gahp_path = param( "BATCH_GAHP" );
			if ( gahp_path == NULL ) {
				sprintf( error_string, "Neither %s nor %s defined", buff.c_str(),
						 "BATCH_GAHP" );
				goto error_exit;
			}
		}
	}

	buff = batchType;
	if ( gahp_args.Count() > 0 ) {
		sprintf_cat( buff, "/%s", gahp_args.GetArg( 0 ) );
	}
	gahp = new GahpClient( buff.c_str(), gahp_path, &gahp_args );
	free( gahp_path );

	myResource = INFNBatchResource::FindOrCreateResource( batchType,
														  gahp_args.GetArg(0) );
	myResource->RegisterJob( this );
	if ( remoteJobId ) {
		myResource->AlreadySubmitted( this );
	}

		// Does this have to be lower-case for SetRemoteJobId()?

	strlwr( batchType );

	ASSERT( gahp != NULL );
	gahp->setNotificationTimerId( evaluateStateTid );
	gahp->setMode( GahpClient::normal );
	gahp->setTimeout( gahpCallTimeout );

	jobProxy = AcquireProxy( jobAd, error_string,
							 (TimerHandlercpp)&BaseJob::SetEvaluateState, this );
	if ( jobProxy == NULL && error_string != "" ) {
		goto error_exit;
	}

	return;

 error_exit:
		// We must ensure that the code-path from GM_HOLD doesn't depend
		// on any initialization that's been skipped.
	gmState = GM_HOLD;
	if ( !error_string.empty() ) {
		jobAd->Assign( ATTR_HOLD_REASON, error_string.c_str() );
	}
	return;
}

INFNBatchJob::~INFNBatchJob()
{
	if ( jobProxy != NULL ) {
		ReleaseProxy( jobProxy, (TimerHandlercpp)&BaseJob::SetEvaluateState, this );
	}
	if ( myResource ) {
		myResource->UnregisterJob( this );
	}
	if ( batchType != NULL ) {
		free( batchType );
	}
	if ( remoteJobId != NULL ) {
		free( remoteJobId );
	}
	if ( gahpAd ) {
		delete gahpAd;
	}
	if ( gahp != NULL ) {
		delete gahp;
	}
}

void INFNBatchJob::Reconfig()
{
	BaseJob::Reconfig();
	gahp->setTimeout( gahpCallTimeout );
}

void INFNBatchJob::doEvaluateState()
{
	int old_gm_state;
	int old_remote_state;
	bool reevaluate_state = true;
	time_t now = time(NULL);

	bool attr_exists;
	bool attr_dirty;
	int rc;

	daemonCore->Reset_Timer( evaluateStateTid, TIMER_NEVER );

    dprintf(D_ALWAYS,
			"(%d.%d) doEvaluateState called: gmState %s, remoteState %d\n",
			procID.cluster,procID.proc,GMStateNames[gmState],remoteState);

	if ( gahp ) {
		gahp->setMode( GahpClient::normal );
	}

	do {
		reevaluate_state = false;
		old_gm_state = gmState;
		old_remote_state = remoteState;

		ASSERT ( gahp != NULL || gmState == GM_HOLD || gmState == GM_DELETE );

		switch ( gmState ) {
		case GM_INIT: {
			// This is the state all jobs start in when the GlobusJob object
			// is first created. Here, we do things that we didn't want to
			// do in the constructor because they could block (the
			// constructor is called while we're connected to the schedd).
			if ( gahp->Startup() == false ) {
				dprintf( D_ALWAYS, "(%d.%d) Error starting GAHP\n",
						 procID.cluster, procID.proc );

				jobAd->Assign( ATTR_HOLD_REASON, "Failed to start GAHP" );
				gmState = GM_HOLD;
				break;
			}
			if ( jobProxy ) {
				if ( gahp->Initialize( jobProxy ) == false ) {
					dprintf( D_ALWAYS, "(%d.%d) Error initializing GAHP\n",
							 procID.cluster, procID.proc );

					jobAd->Assign( ATTR_HOLD_REASON,
								   "Failed to initialize GAHP" );
					gmState = GM_HOLD;
					break;
				}

				gahp->setDelegProxy( jobProxy );
			}

			gmState = GM_START;
			} break;
		case GM_START: {
			// This state is the real start of the state machine, after
			// one-time initialization has been taken care of.
			// If we think there's a running jobmanager
			// out there, we try to register for callbacks (in GM_REGISTER).
			// The one way jobs can end up back in this state is if we
			// attempt a restart of a jobmanager only to be told that the
			// old jobmanager process is still alive.
			errorString = "";
			if ( condorState == COMPLETED ) {
				gmState = GM_DONE_COMMIT;
			} else if ( remoteJobId == NULL ) {
				gmState = GM_CLEAR_REQUEST;
			} else {
				gmState = GM_SUBMITTED;
			}
			} break;
		case GM_UNSUBMITTED: {
			// There are no outstanding remote submissions for this job (if
			// there is one, we've given up on it).
			if ( condorState == REMOVED ) {
				gmState = GM_DELETE;
			} else if ( condorState == HELD ) {
				gmState = GM_DELETE;
				break;
			} else if ( condorState == COMPLETED ) {
				gmState = GM_DELETE;
			} else {
				gmState = GM_SUBMIT;
			}
			} break;
		case GM_SUBMIT: {
			// Start a new remote submission for this job.

			// Can't break in the middle of a submit, because the job will
			// end up running if the submit succeeds
			/*
			if ( condorState == REMOVED || condorState == HELD ) {
				gmState = GM_UNSUBMITTED;
				break;
			}
			*/
			if ( numSubmitAttempts >= MAX_SUBMIT_ATTEMPTS ) {
				jobAd->Assign( ATTR_HOLD_REASON,
							   "Attempts to submit failed" );
				gmState = GM_HOLD;
				break;
			}
			// After a submit, wait at least submitInterval before trying
			// another one.
			if ( now >= lastSubmitAttempt + submitInterval ) {
				char *job_id_string = NULL;

				// Once RequestSubmit() is called at least once, you must
				// CancelRequest() once you're done with the request call
				if ( myResource->RequestSubmit( this ) == false ) {
					break;
				}

				if ( gahpAd == NULL ) {
					gahpAd = buildSubmitAd();
				}
				if ( gahpAd == NULL ) {
					gmState = GM_HOLD;
					break;
				}

				rc = gahp->blah_job_submit( gahpAd, &job_id_string );
				if ( rc == GAHPCLIENT_COMMAND_NOT_SUBMITTED ||
					 rc == GAHPCLIENT_COMMAND_PENDING ) {
					break;
				}
				lastSubmitAttempt = time(NULL);
				numSubmitAttempts++;
				if ( rc == GLOBUS_SUCCESS ) {
					SetRemoteJobId( job_id_string );
					if(jobProxy) {
						remoteProxyExpireTime = jobProxy->expiration_time;
					}
					WriteGridSubmitEventToUserLog( jobAd );
					gmState = GM_SUBMIT_SAVE;
				} else {
					// unhandled error
					dprintf( D_ALWAYS,
							 "(%d.%d) blah_job_submit() failed: %s\n",
							 procID.cluster, procID.proc,
							 gahp->getErrorString() );
					errorString = gahp->getErrorString();
					myResource->CancelSubmit( this );
					gmState = GM_UNSUBMITTED;
					reevaluate_state = true;
				}
				if ( job_id_string != NULL ) {
					free( job_id_string );
				}
			} else if ( condorState == REMOVED || condorState == HELD ) {
				gmState = GM_UNSUBMITTED;
			} else {
				unsigned int delay = 0;
				if ( (lastSubmitAttempt + submitInterval) > now ) {
					delay = (lastSubmitAttempt + submitInterval) - now;
				}
				daemonCore->Reset_Timer( evaluateStateTid, delay );
			}
			} break;
		case GM_SUBMIT_SAVE: {
			// Save the job id for a new remote submission.
			if ( condorState == REMOVED || condorState == HELD ) {
				gmState = GM_CANCEL;
			} else {
				jobAd->GetDirtyFlag( ATTR_GRID_JOB_ID, &attr_exists, &attr_dirty );
				if ( attr_exists && attr_dirty ) {
					requestScheddUpdate( this, true );
					break;
				}
				gmState = GM_SUBMITTED;
			}
			} break;
		case GM_SUBMITTED: {
			// The job has been submitted. Wait for completion or failure,
			// and poll the remote schedd occassionally to let it know
			// we're still alive.
			// The resetting of the evaluateStateTid timer should be the
			// last thing we do, after checking everything of interest.
			if ( condorState == REMOVED || condorState == HELD ) {
				gmState = GM_CANCEL;
			} else if ( remoteState == COMPLETED ) {
				gmState = GM_DONE_SAVE;
			} else if ( remoteState == REMOVED ) {
				errorString = "Job removed from batch queue manually";
				SetRemoteJobId( NULL );
				gmState = GM_HOLD;
			} else if ( jobProxy && remoteProxyExpireTime < jobProxy->expiration_time ) {
					gmState = GM_REFRESH_PROXY;
			} else {
				if ( lastPollTime < enteredCurrentGmState ) {
					lastPollTime = enteredCurrentGmState;
				}
				if ( pollNow ) {
					lastPollTime = 0;
					pollNow = false;
				}
				if ( now >= lastPollTime + pollInterval ) {
					gmState = GM_POLL_ACTIVE;
					break;
				}
				unsigned int delay = 0;
				if ( (lastPollTime + pollInterval) > now ) {
					delay = (lastPollTime + pollInterval) - now;
				}
				daemonCore->Reset_Timer( evaluateStateTid, delay );
			}
			} break;
		case GM_POLL_ACTIVE: {
			ClassAd *status_ad = NULL;
			rc = gahp->blah_job_status( remoteJobId, &status_ad );
			if ( rc == GAHPCLIENT_COMMAND_NOT_SUBMITTED ||
				 rc == GAHPCLIENT_COMMAND_PENDING ) {
				break;
			}
			if ( rc != GLOBUS_SUCCESS ) {
				// unhandled error
				dprintf( D_ALWAYS,
						 "(%d.%d) blah_job_status() failed: %s\n",
						 procID.cluster, procID.proc, gahp->getErrorString() );
				errorString = gahp->getErrorString();
				gmState = GM_CANCEL;
				break;
			}
			ProcessRemoteAd( status_ad );
			delete status_ad;
			lastPollTime = time(NULL);
			gmState = GM_SUBMITTED;
			} break;
		case GM_REFRESH_PROXY: {
			if ( condorState == REMOVED || condorState == HELD ) {
				gmState = GM_SUBMITTED;
			} else {
				// We should never end up here if we don't have a
				// proxy already!
				if( ! jobProxy ) {
					EXCEPT( "(%d.%d) Requested to refresh proxy, but no proxy present. ", procID.cluster,procID.proc);
				}

				rc = gahp->blah_job_refresh_proxy( remoteJobId,
												   jobProxy->proxy_filename );
				if ( rc == GAHPCLIENT_COMMAND_NOT_SUBMITTED ||
					 rc == GAHPCLIENT_COMMAND_PENDING ) {
					break;
				}
				if ( rc != GLOBUS_SUCCESS ) {
					// unhandled error
					dprintf( D_ALWAYS,
							 "(%d.%d) blah_job_refresh_proxy() failed: %s\n",
							 procID.cluster, procID.proc, gahp->getErrorString() );
					errorString = gahp->getErrorString();
					gmState = GM_CANCEL;
					break;
				}
				remoteProxyExpireTime = jobProxy->expiration_time;
				gmState = GM_SUBMITTED;
			}
		} break;
		case GM_DONE_SAVE: {
			// Report job completion to the schedd.
			JobTerminated();
			if ( condorState == COMPLETED ) {
				jobAd->GetDirtyFlag( ATTR_JOB_STATUS, &attr_exists, &attr_dirty );
				if ( attr_exists && attr_dirty ) {
					requestScheddUpdate( this, true );
					break;
				}
			}
			gmState = GM_DONE_COMMIT;
			} break;
		case GM_DONE_COMMIT: {
			// Tell the remote schedd it can remove the job from the queue.

			// Nothing to do for this job type
			if ( condorState == COMPLETED || condorState == REMOVED ) {
				gmState = GM_DELETE;
			} else {
				// Clear the contact string here because it may not get
				// cleared in GM_CLEAR_REQUEST (it might go to GM_HOLD first).
				SetRemoteJobId( NULL );
				requestScheddUpdate( this, false );
				myResource->CancelSubmit( this );
				gmState = GM_CLEAR_REQUEST;
			}
			} break;
		case GM_CANCEL: {
			// We need to cancel the job submission.

			// Should this if-stmt be here? Even if the job is completed,
			// we may still want to remove it (say if we have trouble
			// fetching the output files).
			if ( remoteState != COMPLETED ) {
				rc = gahp->blah_job_cancel( remoteJobId );
				if ( rc == GAHPCLIENT_COMMAND_NOT_SUBMITTED ||
					 rc == GAHPCLIENT_COMMAND_PENDING ) {
					break;
				}
				if ( rc != GLOBUS_SUCCESS ) {
					// unhandled error
					dprintf( D_ALWAYS,
							 "(%d.%d) blah_job_cancel() failed: %s\n",
							 procID.cluster, procID.proc, gahp->getErrorString() );
					errorString = gahp->getErrorString();
					gmState = GM_CLEAR_REQUEST;
					break;
				}
				SetRemoteJobId( NULL );
				myResource->CancelSubmit( this );
			}
			if ( condorState == REMOVED ) {
				gmState = GM_DELETE;
			} else {
				gmState = GM_CLEAR_REQUEST;
			}
			} break;
		case GM_DELETE: {
			// We are done with the job. Propagate any remaining updates
			// to the schedd, then delete this object.
			DoneWithJob();
			// This object will be deleted when the update occurs
			} break;
		case GM_CLEAR_REQUEST: {
			// Remove all knowledge of any previous or present job
			// submission, in both the gridmanager and the schedd.

			// For now, put problem jobs on hold instead of
			// forgetting about current submission and trying again.
			// TODO: Let our action here be dictated by the user preference
			// expressed in the job ad.
			if ( remoteJobId != NULL && condorState != REMOVED ) {
				gmState = GM_HOLD;
				break;
			}
			errorString = "";
			SetRemoteJobId( NULL );
			myResource->CancelSubmit( this );
			JobIdle();
			if ( submitLogged ) {
				JobEvicted();
			}

			// If there are no updates to be done when we first enter this
			// state, requestScheddUpdate will return done immediately
			// and not waste time with a needless connection to the
			// schedd. If updates need to be made, they won't show up in
			// schedd_actions after the first pass through this state
			// because we modified our local variables the first time
			// through. However, since we registered update events the
			// first time, requestScheddUpdate won't return done until
			// they've been committed to the schedd.
			const char *name;
			ExprTree *expr;
			jobAd->ResetExpr();
			if ( jobAd->NextDirtyExpr(name, expr) ) {
				requestScheddUpdate( this, true );
				break;
			}
			remoteProxyExpireTime = 0;
			submitLogged = false;
			executeLogged = false;
			submitFailedLogged = false;
			terminateLogged = false;
			abortLogged = false;
			evictLogged = false;
			gmState = GM_UNSUBMITTED;
			remoteState = JOB_STATE_UNSUBMITTED;
			SetRemoteJobStatus( NULL );
			} break;
		case GM_HOLD: {
			// Put the job on hold in the schedd.
			// TODO: what happens if we learn here that the job is removed?

			// If the condor state is already HELD, then someone already
			// HELD it, so don't update anything else.
			if ( condorState != HELD ) {

				// Set the hold reason as best we can
				// TODO: set the hold reason in a more robust way.
				char holdReason[1024];
				holdReason[0] = '\0';
				holdReason[sizeof(holdReason)-1] = '\0';
				jobAd->LookupString( ATTR_HOLD_REASON, holdReason,
									 sizeof(holdReason) - 1 );
				if ( holdReason[0] == '\0' && errorString != "" ) {
					strncpy( holdReason, errorString.c_str(),
							 sizeof(holdReason) - 1 );
				}
				if ( holdReason[0] == '\0' ) {
					strncpy( holdReason, "Unspecified gridmanager error",
							 sizeof(holdReason) - 1 );
				}

				JobHeld( holdReason );
			}
			gmState = GM_DELETE;
			} break;
		default:
			EXCEPT( "(%d.%d) Unknown gmState %d!", procID.cluster,procID.proc,
					gmState );
		}

		if ( gmState != old_gm_state || remoteState != old_remote_state ) {
			reevaluate_state = true;
		}
		if ( remoteState != old_remote_state ) {
//			dprintf(D_FULLDEBUG, "(%d.%d) remote state change: %s -> %s\n",
//					procID.cluster, procID.proc,
//					JobStatusNames(old_remote_state),
//					JobStatusNames(remoteState));
			enteredCurrentRemoteState = time(NULL);
		}
		if ( gmState != old_gm_state ) {
			dprintf(D_FULLDEBUG, "(%d.%d) gm state change: %s -> %s\n",
					procID.cluster, procID.proc, GMStateNames[old_gm_state],
					GMStateNames[gmState]);
			enteredCurrentGmState = time(NULL);
			// If we were waiting for a pending gahp call, we're not
			// anymore so purge it.
			if ( gahp ) {
				gahp->purgePendingRequests();
			}
			// If we were calling a gahp func that used gahpAd, we're done
			// with it now, so free it.
			if ( gahpAd ) {
				delete gahpAd;
				gahpAd = NULL;
			}
		}

	} while ( reevaluate_state );
}

void INFNBatchJob::SetRemoteJobId( const char *job_id )
{
	free( remoteJobId );
	if ( job_id ) {
		remoteJobId = strdup( job_id );
	} else {
		remoteJobId = NULL;
	}

	std::string full_job_id;
	if ( job_id ) {
		sprintf( full_job_id, "%s %s", batchType, job_id );
	}
	BaseJob::SetRemoteJobId( full_job_id.c_str() );
}

void INFNBatchJob::ProcessRemoteAd( ClassAd *remote_ad )
{
	int new_remote_state;
	ExprTree *new_expr, *old_expr;

	int index;
	const char *attrs_to_copy[] = {
		ATTR_BYTES_SENT,
		ATTR_BYTES_RECVD,
		ATTR_COMPLETION_DATE,
		ATTR_JOB_RUN_COUNT,
		ATTR_JOB_START_DATE,
		ATTR_ON_EXIT_BY_SIGNAL,
		ATTR_ON_EXIT_SIGNAL,
		ATTR_ON_EXIT_CODE,
		ATTR_EXIT_REASON,
		ATTR_JOB_CURRENT_START_DATE,
		ATTR_JOB_LOCAL_SYS_CPU,
		ATTR_JOB_LOCAL_USER_CPU,
		ATTR_JOB_REMOTE_SYS_CPU,
		ATTR_JOB_REMOTE_USER_CPU,
		ATTR_NUM_CKPTS,
		ATTR_NUM_GLOBUS_SUBMITS,
		ATTR_NUM_MATCHES,
		ATTR_NUM_RESTARTS,
		ATTR_JOB_REMOTE_WALL_CLOCK,
		ATTR_JOB_CORE_DUMPED,
		ATTR_EXECUTABLE_SIZE,
		ATTR_IMAGE_SIZE,
		NULL };		// list must end with a NULL

	if ( remote_ad == NULL ) {
		return;
	}

	dprintf( D_FULLDEBUG, "(%d.%d) ***ProcessRemoteAd\n",
			 procID.cluster, procID.proc );

	remote_ad->LookupInteger( ATTR_JOB_STATUS, new_remote_state );

	if ( new_remote_state == IDLE ) {
		JobIdle();
	}
	if ( new_remote_state == RUNNING ) {
		JobRunning();
	}
	// If the job has been removed locally, don't propagate a hold from
	// the remote schedd.
	// If HELD is the first job status we get from the remote schedd,
	// assume that it's an old hold that was also reflected in the local
	// schedd and has since been released locally (and should be released
	// remotely as well). This won't always be true, but releasing the
	// remote job anyway shouldn't cause any major trouble.
	if ( new_remote_state == HELD && condorState != REMOVED &&
		 remoteState != JOB_STATE_UNKNOWN ) {
		char *reason = NULL;
		int code = 0;
		int subcode = 0;
		if ( remote_ad->LookupString( ATTR_HOLD_REASON, &reason ) ) {
			remote_ad->LookupInteger( ATTR_HOLD_REASON_CODE, code );
			remote_ad->LookupInteger( ATTR_HOLD_REASON_SUBCODE, subcode );
			JobHeld( reason, code, subcode );
			free( reason );
		} else {
			JobHeld( "held remotely with no hold reason" );
		}
	}
	remoteState = new_remote_state;
	SetRemoteJobStatus( getJobStatusString( remoteState ) );

	index = -1;
	while ( attrs_to_copy[++index] != NULL ) {
		old_expr = jobAd->LookupExpr( attrs_to_copy[index] );
		new_expr = remote_ad->LookupExpr( attrs_to_copy[index] );

		if ( new_expr != NULL && ( old_expr == NULL || !(*old_expr == *new_expr) ) ) {
			jobAd->Insert( attrs_to_copy[index], new_expr->Copy() );
		}
	}

	requestScheddUpdate( this, false );

	return;
}

BaseResource *INFNBatchJob::GetResource()
{
	return (BaseResource *)myResource;
}

ClassAd *INFNBatchJob::buildSubmitAd()
{
	MyString expr;
	ClassAd *submit_ad;
	ExprTree *next_expr;
	bool use_new_args_env = false;

		// Older versions of the blahp don't know about the new
		// Arguments and Environment job attributes. Newer version
		// put "new_esc_format" in their version string to indicate
		// that they understand these new attributes. If we're
		// talking to an old blahp, convert to the old Args and Env
		// attributes.
	if ( strstr( gahp->getVersion(), "new_esc_format" ) ) {
		use_new_args_env = true;
	} else {
		use_new_args_env = false;
	}

	int index;
	const char *attrs_to_copy[] = {
//		ATTR_JOB_CMD,
		ATTR_JOB_ARGUMENTS1,
		ATTR_JOB_ARGUMENTS2,
		ATTR_JOB_ENVIRONMENT1,
		ATTR_JOB_ENVIRONMENT1_DELIM,
		ATTR_JOB_ENVIRONMENT2,
		ATTR_JOB_INPUT,
		ATTR_JOB_OUTPUT,
		ATTR_JOB_ERROR,
		ATTR_TRANSFER_INPUT_FILES,
		ATTR_TRANSFER_OUTPUT_FILES,
		ATTR_TRANSFER_OUTPUT_REMAPS,
//		ATTR_REQUIREMENTS,
//		ATTR_RANK,
//		ATTR_OWNER,
//		ATTR_DISK_USAGE,
//		ATTR_IMAGE_SIZE,
//		ATTR_EXECUTABLE_SIZE,
//		ATTR_MAX_HOSTS,
//		ATTR_MIN_HOSTS,
//		ATTR_JOB_PRIO,
		ATTR_JOB_IWD,
		ATTR_X509_USER_PROXY,
		ATTR_GRID_RESOURCE,
		NULL };		// list must end with a NULL

	submit_ad = new ClassAd;

	index = -1;
	while ( attrs_to_copy[++index] != NULL ) {
		if ( ( next_expr = jobAd->LookupExpr( attrs_to_copy[index] ) ) != NULL ) {
			submit_ad->Insert( attrs_to_copy[index], next_expr->Copy() );
		}
	}

	expr = "";
	jobAd->LookupString( ATTR_JOB_REMOTE_IWD, expr );
	if ( !expr.IsEmpty() ) {
		submit_ad->Assign( ATTR_JOB_IWD, expr );
	}

	// The blahp expects the Cmd attribute to contain the full pathname
	// of the job executable.
	jobAd->LookupString( ATTR_JOB_CMD, expr );
	if ( expr.FindChar( '/' ) < 0 ) {
		std::string fullpath;
		submit_ad->LookupString( ATTR_JOB_IWD, fullpath );
		sprintf_cat( fullpath, "/%s", expr.Value() );
		submit_ad->Assign( ATTR_JOB_CMD, fullpath );
	} else {
		submit_ad->Assign( ATTR_JOB_CMD, expr );
	}

		// CRUFT: In the current glite code, jobs have a grid-type of 'blah'
		//   and the blahp looks at the attribute "gridtype" for 'pbs' or
		//   'lsf'. Until the blahp changes to look at GridResource, set
		//   'gridtype' for non-glite users.
	if ( strcmp( batchType, "blah" ) != 0 ) {
		submit_ad->Assign( "gridtype", batchType );
	}

	if ( !use_new_args_env ) {
		MyString error_str;
		MyString value_str;
		ArgList args;
		Env env;

		submit_ad->Delete( ATTR_JOB_ARGUMENTS2 );
		submit_ad->Delete( ATTR_JOB_ENVIRONMENT1_DELIM );
		submit_ad->Delete( ATTR_JOB_ENVIRONMENT2 );

		if ( !args.AppendArgsFromClassAd( jobAd, &error_str ) ||
			 !args.GetArgsStringV1Raw( &value_str, &error_str ) ) {
			errorString = error_str.Value();
			delete submit_ad;
			return NULL;
		}
		submit_ad->Assign( ATTR_JOB_ARGUMENTS1, value_str.Value() );

		value_str = "";
		if ( !env.MergeFrom( jobAd, &error_str ) ||
			 !env.getDelimitedStringV1Raw( &value_str, &error_str ) ) {
			errorString = error_str.Value();
			delete submit_ad;
			return NULL;
		}
		submit_ad->Assign( ATTR_JOB_ENVIRONMENT1, value_str.Value() );
	}

//	submit_ad->Assign( ATTR_JOB_STATUS, IDLE );
//submit_ad->Assign( ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_VANILLA );

//	submit_ad->Assign( ATTR_Q_DATE, now );
//	submit_ad->Assign( ATTR_CURRENT_HOSTS, 0 );
//	submit_ad->Assign( ATTR_COMPLETION_DATE, 0 );
//	submit_ad->Assign( ATTR_JOB_REMOTE_WALL_CLOCK, (float)0.0 );
//	submit_ad->Assign( ATTR_JOB_LOCAL_USER_CPU, (float)0.0 );
//	submit_ad->Assign( ATTR_JOB_LOCAL_SYS_CPU, (float)0.0 );
//	submit_ad->Assign( ATTR_JOB_REMOTE_USER_CPU, (float)0.0 );
//	submit_ad->Assign( ATTR_JOB_REMOTE_SYS_CPU, (float)0.0 );
//	submit_ad->Assign( ATTR_JOB_EXIT_STATUS, 0 );
//	submit_ad->Assign( ATTR_NUM_CKPTS, 0 );
//	submit_ad->Assign( ATTR_NUM_RESTARTS, 0 );
//	submit_ad->Assign( ATTR_NUM_SYSTEM_HOLDS, 0 );
//	submit_ad->Assign( ATTR_JOB_COMMITTED_TIME, 0 );
//	submit_ad->Assign( ATTR_COMMITTED_SLOT_TIME, 0 );
//	submit_ad->Assign( ATTR_CUMULATIVE_SLOT_TIME, 0 );
//	submit_ad->Assign( ATTR_TOTAL_SUSPENSIONS, 0 );
//	submit_ad->Assign( ATTR_LAST_SUSPENSION_TIME, 0 );
//	submit_ad->Assign( ATTR_CUMULATIVE_SUSPENSION_TIME, 0 );
//	submit_ad->Assign( ATTR_ON_EXIT_BY_SIGNAL, false );
//	submit_ad->Assign( ATTR_CURRENT_HOSTS, 0 );
//	submit_ad->Assign( ATTR_ENTERED_CURRENT_STATUS, now  );
//	submit_ad->Assign( ATTR_JOB_NOTIFICATION, NOTIFY_NEVER );
//	submit_ad->Assign( ATTR_JOB_LEAVE_IN_QUEUE, true );
//	submit_ad->Assign( ATTR_SHOULD_TRANSFER_FILES, false );

//	expr.sprintf( "%s = (%s >= %s) =!= True && time() > %s + %d",
//				  ATTR_PERIODIC_REMOVE_CHECK, ATTR_STAGE_IN_FINISH,
//				  ATTR_STAGE_IN_START, ATTR_Q_DATE, 1800 );
//	submit_ad->Insert( expr.Value() );

	bool cleared_environment = false;
	bool cleared_arguments = false;

		// Remove all remote_* attributes from the new ad before
		// translating remote_* attributes from the original ad.
		// See gittrac #376 for why we have two loops here.
	const char *next_name;
	submit_ad->ResetName();
	while ( (next_name = submit_ad->NextNameOriginal()) != NULL ) {
		if ( strncasecmp( next_name, "REMOTE_", 7 ) == 0 &&
			 strlen( next_name ) > 7 ) {

			submit_ad->Delete( next_name );
		}
	}

	jobAd->ResetExpr();
	while ( jobAd->NextExpr(next_name, next_expr) ) {
		if ( strncasecmp( next_name, "REMOTE_", 7 ) == 0 &&
			 strlen( next_name ) > 7 ) {

			char const *attr_name = &(next_name[7]);

			if(strcasecmp(attr_name,ATTR_JOB_ENVIRONMENT1) == 0 ||
			   strcasecmp(attr_name,ATTR_JOB_ENVIRONMENT1_DELIM) == 0 ||
			   strcasecmp(attr_name,ATTR_JOB_ENVIRONMENT2) == 0)
			{
				//Any remote environment settings indicate that we
				//should clear whatever environment was already copied
				//over from the non-remote settings, so the non-remote
				//settings can never trump the remote settings.
				if(!cleared_environment) {
					cleared_environment = true;
					submit_ad->Delete(ATTR_JOB_ENVIRONMENT1);
					submit_ad->Delete(ATTR_JOB_ENVIRONMENT1_DELIM);
					submit_ad->Delete(ATTR_JOB_ENVIRONMENT2);
				}
			}

			if(strcasecmp(attr_name,ATTR_JOB_ARGUMENTS1) == 0 ||
			   strcasecmp(attr_name,ATTR_JOB_ARGUMENTS2) == 0)
			{
				//Any remote arguments settings indicate that we
				//should clear whatever arguments was already copied
				//over from the non-remote settings, so the non-remote
				//settings can never trump the remote settings.
				if(!cleared_arguments) {
					cleared_arguments = true;
					submit_ad->Delete(ATTR_JOB_ARGUMENTS1);
					submit_ad->Delete(ATTR_JOB_ARGUMENTS2);
				}
			}

			submit_ad->Insert( attr_name, next_expr->Copy() );
		}
	}

		// worry about ATTR_JOB_[OUTPUT|ERROR]_ORIG

	return submit_ad;
}


text:
using Lucene.Net.Support;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace Lucene.Net.Search
{

    using AtomicReaderContext = Lucene.Net.Index.AtomicReaderContext;
    using IBits = Lucene.Net.Util.IBits;
    using IndexReader = Lucene.Net.Index.IndexReader;
    using Term = Lucene.Net.Index.Term;
    using ToStringUtils = Lucene.Net.Util.ToStringUtils;

    /// <summary>
    /// A query that wraps another query or a filter and simply returns a constant score equal to the
    /// query boost for every document that matches the filter or query.
    /// For queries it therefore simply strips of all scores and returns a constant one.
    /// </summary>
    public class ConstantScoreQuery : Query
    {
        protected readonly Filter m_filter;
        protected readonly Query m_query;

        /// <summary>
        /// Strips off scores from the passed in <see cref="Search.Query"/>. The hits will get a constant score
        /// dependent on the boost factor of this query.
        /// </summary>
        public ConstantScoreQuery(Query query)
        {
            this.m_filter = null;
            this.m_query = query ?? throw new NullReferenceException("Query may not be null");
        }

        /// <summary>
        /// Wraps a <see cref="Search.Filter"/> as a <see cref="Search.Query"/>. The hits will get a constant score
        /// dependent on the boost factor of this query.
        /// If you simply want to strip off scores from a <see cref="Search.Query"/>, no longer use
        /// <c>new ConstantScoreQuery(new QueryWrapperFilter(query))</c>, instead
        /// use <see cref="ConstantScoreQuery(Query)"/>!
        /// </summary>
        public ConstantScoreQuery(Filter filter)
        {
            this.m_filter = filter ?? throw new NullReferenceException("Filter may not be null");
            this.m_query = null;
        }

        /// <summary>
        /// Returns the encapsulated filter, returns <c>null</c> if a query is wrapped. </summary>
        public virtual Filter Filter => m_filter;

        /// <summary>
        /// Returns the encapsulated query, returns <c>null</c> if a filter is wrapped. </summary>
        public virtual Query Query => m_query;

        public override Query Rewrite(IndexReader reader)
        {
            if (m_query != null)
            {
                Query rewritten = m_query.Rewrite(reader);
                if (rewritten != m_query)
                {
                    rewritten = new ConstantScoreQuery(rewritten);
                    rewritten.Boost = this.Boost;
                    return rewritten;
                }
            }
            else
            {
                Debug.Assert(m_filter != null);
                // Fix outdated usage pattern from Lucene 2.x/early-3.x:
                // because ConstantScoreQuery only accepted filters,
                // QueryWrapperFilter was used to wrap queries.
                if (m_filter is QueryWrapperFilter)
                {
                    QueryWrapperFilter qwf = (QueryWrapperFilter)m_filter;
                    Query rewritten = new ConstantScoreQuery(qwf.Query.Rewrite(reader));
                    rewritten.Boost = this.Boost;
                    return rewritten;
                }
            }
            return this;
        }

        public override void ExtractTerms(ISet<Term> terms)
        {
            // TODO: OK to not add any terms when wrapped a filter
            // and used with MultiSearcher, but may not be OK for
            // highlighting.
            // If a query was wrapped, we delegate to query.
            if (m_query != null)
            {
                m_query.ExtractTerms(terms);
            }
        }

        protected class ConstantWeight : Weight
        {
            private readonly ConstantScoreQuery outerInstance;

            private readonly Weight innerWeight;
            private float queryNorm;
            private float queryWeight;

            public ConstantWeight(ConstantScoreQuery outerInstance, IndexSearcher searcher)
            {
                this.outerInstance = outerInstance;
                this.innerWeight = (outerInstance.m_query == null) ? null : outerInstance.m_query.CreateWeight(searcher);
            }

            public override Query Query => outerInstance;

            public override float GetValueForNormalization()
            {
                // we calculate sumOfSquaredWeights of the inner weight, but ignore it (just to initialize everything)
                if (innerWeight != null)
                {
                    innerWeight.GetValueForNormalization();
                }
                queryWeight = outerInstance.Boost;
                return queryWeight * queryWeight;
            }

            public override void Normalize(float norm, float topLevelBoost)
            {
                this.queryNorm = norm * topLevelBoost;
                queryWeight *= this.queryNorm;
                // we normalize the inner weight, but ignore it (just to initialize everything)
                if (innerWeight != null)
                {
                    innerWeight.Normalize(norm, topLevelBoost);
                }
            }

            public override BulkScorer GetBulkScorer(AtomicReaderContext context, bool scoreDocsInOrder, IBits acceptDocs)
            {
                //DocIdSetIterator disi;
                if (outerInstance.m_filter != null)
                {
                    Debug.Assert(outerInstance.m_query == null);
                    return base.GetBulkScorer(context, scoreDocsInOrder, acceptDocs);
                }
                else
                {
                    Debug.Assert(outerInstance.m_query != null && innerWeight != null);
                    BulkScorer bulkScorer = innerWeight.GetBulkScorer(context, scoreDocsInOrder, acceptDocs);
                    if (bulkScorer == null)
                    {
                        return null;
                    }
                    return new ConstantBulkScorer(outerInstance, bulkScorer, this, queryWeight);
                }
            }

            public override Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs)
            {
                DocIdSetIterator disi;
                if (outerInstance.m_filter != null)
                {
                    Debug.Assert(outerInstance.m_query == null);
                    DocIdSet dis = outerInstance.m_filter.GetDocIdSet(context, acceptDocs);
                    if (dis == null)
                    {
                        return null;
                    }
                    disi = dis.GetIterator();
                }
                else
                {
                    Debug.Assert(outerInstance.m_query != null && innerWeight != null);
                    disi = innerWeight.GetScorer(context, acceptDocs);
                }

                if (disi == null)
                {
                    return null;
                }
                return new ConstantScorer(outerInstance, disi, this, queryWeight);
            }

            public override bool ScoresDocsOutOfOrder => (innerWeight != null) ? innerWeight.ScoresDocsOutOfOrder : false;

            public override Explanation Explain(AtomicReaderContext context, int doc)
            {
                Scorer cs = GetScorer(context, (context.AtomicReader).LiveDocs);
                bool exists = (cs != null && cs.Advance(doc) == doc);

                ComplexExplanation result = new ComplexExplanation();
                if (exists)
                {
                    result.Description = outerInstance.ToString() + ", product of:";
                    result.Value = queryWeight;
                    result.Match = true;
                    result.AddDetail(new Explanation(outerInstance.Boost, "boost"));
                    result.AddDetail(new Explanation(queryNorm, "queryNorm"));
                }
                else
                {
                    result.Description = outerInstance.ToString() + " doesn't match id " + doc;
                    result.Value = 0;
                    result.Match = false;
                }
                return result;
            }
        }

        /// <summary>
        /// We return this as our <see cref="BulkScorer"/> so that if the CSQ
        /// wraps a query with its own optimized top-level
        /// scorer (e.g. <see cref="BooleanScorer"/>) we can use that
        /// top-level scorer.
        /// </summary>
        protected class ConstantBulkScorer : BulkScorer
        {
            private readonly ConstantScoreQuery outerInstance;

            internal readonly BulkScorer bulkScorer;
            internal readonly Weight weight;
            internal readonly float theScore;

            public ConstantBulkScorer(ConstantScoreQuery outerInstance, BulkScorer bulkScorer, Weight weight, float theScore)
            {
                this.outerInstance = outerInstance;
                this.bulkScorer = bulkScorer;
                this.weight = weight;
                this.theScore = theScore;
            }

            public override bool Score(ICollector collector, int max)
            {
                return bulkScorer.Score(WrapCollector(collector), max);
            }

            private ICollector WrapCollector(ICollector collector)
            {
                return new CollectorAnonymousInnerClassHelper(this, collector);
            }

            private class CollectorAnonymousInnerClassHelper : ICollector
            {
                private readonly ConstantBulkScorer outerInstance;

                private ICollector collector;

                public CollectorAnonymousInnerClassHelper(ConstantBulkScorer outerInstance, Lucene.Net.Search.ICollector collector)
                {
                    this.outerInstance = outerInstance;
                    this.collector = collector;
                }

                public virtual void SetScorer(Scorer scorer)
                {
                    // we must wrap again here, but using the value passed in as parameter:
                    collector.SetScorer(new ConstantScorer(outerInstance.outerInstance, scorer, outerInstance.weight, outerInstance.theScore));
                }

                public virtual void Collect(int doc)
                {
                    collector.Collect(doc);
                }

                public virtual void SetNextReader(AtomicReaderContext context)
                {
                    collector.SetNextReader(context);
                }

                public virtual bool AcceptsDocsOutOfOrder => collector.AcceptsDocsOutOfOrder;
            }
        }

        // LUCENENET NOTE: Marked internal for testing
        protected internal class ConstantScorer : Scorer
        {
            private readonly ConstantScoreQuery outerInstance;

            internal readonly DocIdSetIterator docIdSetIterator;
            internal readonly float theScore;

            public ConstantScorer(ConstantScoreQuery outerInstance, DocIdSetIterator docIdSetIterator, Weight w, float theScore)
                : base(w)
            {
                this.outerInstance = outerInstance;
                this.theScore = theScore;
                this.docIdSetIterator = docIdSetIterator;
            }

            public override int NextDoc()
            {
                return docIdSetIterator.NextDoc();
            }

            public override int DocID => docIdSetIterator.DocID;

            public override float GetScore()
            {
                Debug.Assert(docIdSetIterator.DocID != NO_MORE_DOCS);
                return theScore;
            }

            public override int Freq => 1;

            public override int Advance(int target)
            {
                return docIdSetIterator.Advance(target);
            }

            public override long GetCost()
            {
                return docIdSetIterator.GetCost();
            }

            public override ICollection<ChildScorer> GetChildren()
            {
                if (outerInstance.m_query != null)
                {
                    return new[] { new ChildScorer((Scorer)docIdSetIterator, "constant") };
                }
                else
                {
                    return Collections.EmptyList<ChildScorer>();
                }
            }
        }

        public override Weight CreateWeight(IndexSearcher searcher)
        {
            return new ConstantScoreQuery.ConstantWeight(this, searcher);
        }

        public override string ToString(string field)
        {
            return (new StringBuilder("ConstantScore(")).Append((m_query == null) ? m_filter.ToString() : m_query.ToString(field)).Append(')').Append(ToStringUtils.Boost(Boost)).ToString();
        }

        public override bool Equals(object o)
        {
            if (this == o)
            {
                return true;
            }
            if (!base.Equals(o))
            {
                return false;
            }
            if (o is ConstantScoreQuery)
            {
                ConstantScoreQuery other = (ConstantScoreQuery)o;
                return ((this.m_filter == null) ? other.m_filter == null : this.m_filter.Equals(other.m_filter)) && ((this.m_query == null) ? other.m_query == null : this.m_query.Equals(other.m_query));
            }
            return false;
        }

        public override int GetHashCode()
        {
            return 31 * base.GetHashCode() + ((m_query == null) ? (object)m_filter : m_query).GetHashCode();
        }
    }
}


text:
from flask import Flask, request, render_template, redirect
from flask import send_from_directory

from mongoengine import Document, StringField, DateTimeField, connect

import os
import datetime

app = Flask(__name__)
app.debug = True

class Entry(Document):
    author = StringField()
    message = StringField()
    timestamp = DateTimeField()

@app.route("/", methods=["GET", ])
def index():
    """List all the guestbook entries."""
    all_entries = Entry.objects
    return render_template("index.html", entries=all_entries)

@app.route("/sign", methods=["GET", "POST", ])
def sign():
    """Allow guests to *sign* the guestbook."""
    if request.method == "GET":
        return render_template("sign.html")
    else:
        the_author = request.form["the_author"]
        the_message = request.form["the_message"]
        current_time = datetime.datetime.now()

        entry = Entry(
            author=the_author,
            message=the_message,
            timestamp=current_time
        )
        entry.save()
        return redirect("/")  # Redirect after POST is Good Behavor!

@app.route("/styles/<path:filename>")
def styles(filename):
    """Allow Flask to server our CSS files."""
    return send_from_directory("styles", filename)

if __name__ == "__main__":
    host = "localhost"
    port = int(os.getenv("PORT", 5000))
    if port != 5000:
        host = "0.0.0.0"
    else:
        connect("tcguestbook")  # A MongoDB connection
    app.run(port=port, host=host)


text:
package com.shinemo.openapi.client.aes.domain;

import com.shinemo.openapi.client.aes.AesKey;

/**
 * Created by ohun on 2017/4/14.
 *
 * @author ohun@live.cn (夜色)
 */
public final class AesKeyEntity implements AesKey {
    private Integer id;
    private String key;
    private transient String orgId; //组织id
    private transient Long gmtCreate;  //创建时间

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Long getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Long gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    @Override
    public Integer getId() {
        return this.id;
    }

    @Override
    public String getKey() {
        return this.key;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AesKeyEntity that = (AesKeyEntity) o;

        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public String toString() {
        return "AesKeyEntity{" +
                "id=" + id +
                ", key='" + key + '\'' +
                ", orgId='" + orgId + '\'' +
                ", gmtCreate=" + gmtCreate +
                '}';
    }
}


text:
"""
    Kubernetes

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

    OpenAPI spec version: v1.7.4

    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from pprint import pformat
from six import iteritems
import re

class ExtensionsV1beta1DeploymentStatus(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, available_replicas=None, collision_count=None, conditions=None, observed_generation=None, ready_replicas=None, replicas=None, unavailable_replicas=None, updated_replicas=None):
        """
        ExtensionsV1beta1DeploymentStatus - a model defined in Swagger

        :param dict swaggerTypes: The key is attribute name
                                  and the value is attribute type.
        :param dict attributeMap: The key is attribute name
                                  and the value is json key in definition.
        """
        self.swagger_types = {
            'available_replicas': 'int',
            'collision_count': 'int',
            'conditions': 'list[ExtensionsV1beta1DeploymentCondition]',
            'observed_generation': 'int',
            'ready_replicas': 'int',
            'replicas': 'int',
            'unavailable_replicas': 'int',
            'updated_replicas': 'int'
        }

        self.attribute_map = {
            'available_replicas': 'availableReplicas',
            'collision_count': 'collisionCount',
            'conditions': 'conditions',
            'observed_generation': 'observedGeneration',
            'ready_replicas': 'readyReplicas',
            'replicas': 'replicas',
            'unavailable_replicas': 'unavailableReplicas',
            'updated_replicas': 'updatedReplicas'
        }

        self._available_replicas = available_replicas
        self._collision_count = collision_count
        self._conditions = conditions
        self._observed_generation = observed_generation
        self._ready_replicas = ready_replicas
        self._replicas = replicas
        self._unavailable_replicas = unavailable_replicas
        self._updated_replicas = updated_replicas

    @property
    def available_replicas(self):
        """
        Gets the available_replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.

        :return: The available_replicas of this ExtensionsV1beta1DeploymentStatus.
        :rtype: int
        """
        return self._available_replicas

    @available_replicas.setter
    def available_replicas(self, available_replicas):
        """
        Sets the available_replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.

        :param available_replicas: The available_replicas of this ExtensionsV1beta1DeploymentStatus.
        :type: int
        """

        self._available_replicas = available_replicas

    @property
    def collision_count(self):
        """
        Gets the collision_count of this ExtensionsV1beta1DeploymentStatus.
        Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.

        :return: The collision_count of this ExtensionsV1beta1DeploymentStatus.
        :rtype: int
        """
        return self._collision_count

    @collision_count.setter
    def collision_count(self, collision_count):
        """
        Sets the collision_count of this ExtensionsV1beta1DeploymentStatus.
        Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.

        :param collision_count: The collision_count of this ExtensionsV1beta1DeploymentStatus.
        :type: int
        """

        self._collision_count = collision_count

    @property
    def conditions(self):
        """
        Gets the conditions of this ExtensionsV1beta1DeploymentStatus.
        Represents the latest available observations of a deployment's current state.

        :return: The conditions of this ExtensionsV1beta1DeploymentStatus.
        :rtype: list[ExtensionsV1beta1DeploymentCondition]
        """
        return self._conditions

    @conditions.setter
    def conditions(self, conditions):
        """
        Sets the conditions of this ExtensionsV1beta1DeploymentStatus.
        Represents the latest available observations of a deployment's current state.

        :param conditions: The conditions of this ExtensionsV1beta1DeploymentStatus.
        :type: list[ExtensionsV1beta1DeploymentCondition]
        """

        self._conditions = conditions

    @property
    def observed_generation(self):
        """
        Gets the observed_generation of this ExtensionsV1beta1DeploymentStatus.
        The generation observed by the deployment controller.

        :return: The observed_generation of this ExtensionsV1beta1DeploymentStatus.
        :rtype: int
        """
        return self._observed_generation

    @observed_generation.setter
    def observed_generation(self, observed_generation):
        """
        Sets the observed_generation of this ExtensionsV1beta1DeploymentStatus.
        The generation observed by the deployment controller.

        :param observed_generation: The observed_generation of this ExtensionsV1beta1DeploymentStatus.
        :type: int
        """

        self._observed_generation = observed_generation

    @property
    def ready_replicas(self):
        """
        Gets the ready_replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of ready pods targeted by this deployment.

        :return: The ready_replicas of this ExtensionsV1beta1DeploymentStatus.
        :rtype: int
        """
        return self._ready_replicas

    @ready_replicas.setter
    def ready_replicas(self, ready_replicas):
        """
        Sets the ready_replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of ready pods targeted by this deployment.

        :param ready_replicas: The ready_replicas of this ExtensionsV1beta1DeploymentStatus.
        :type: int
        """

        self._ready_replicas = ready_replicas

    @property
    def replicas(self):
        """
        Gets the replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of non-terminated pods targeted by this deployment (their labels match the selector).

        :return: The replicas of this ExtensionsV1beta1DeploymentStatus.
        :rtype: int
        """
        return self._replicas

    @replicas.setter
    def replicas(self, replicas):
        """
        Sets the replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of non-terminated pods targeted by this deployment (their labels match the selector).

        :param replicas: The replicas of this ExtensionsV1beta1DeploymentStatus.
        :type: int
        """

        self._replicas = replicas

    @property
    def unavailable_replicas(self):
        """
        Gets the unavailable_replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of unavailable pods targeted by this deployment.

        :return: The unavailable_replicas of this ExtensionsV1beta1DeploymentStatus.
        :rtype: int
        """
        return self._unavailable_replicas

    @unavailable_replicas.setter
    def unavailable_replicas(self, unavailable_replicas):
        """
        Sets the unavailable_replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of unavailable pods targeted by this deployment.

        :param unavailable_replicas: The unavailable_replicas of this ExtensionsV1beta1DeploymentStatus.
        :type: int
        """

        self._unavailable_replicas = unavailable_replicas

    @property
    def updated_replicas(self):
        """
        Gets the updated_replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of non-terminated pods targeted by this deployment that have the desired template spec.

        :return: The updated_replicas of this ExtensionsV1beta1DeploymentStatus.
        :rtype: int
        """
        return self._updated_replicas

    @updated_replicas.setter
    def updated_replicas(self, updated_replicas):
        """
        Sets the updated_replicas of this ExtensionsV1beta1DeploymentStatus.
        Total number of non-terminated pods targeted by this deployment that have the desired template spec.

        :param updated_replicas: The updated_replicas of this ExtensionsV1beta1DeploymentStatus.
        :type: int
        """

        self._updated_replicas = updated_replicas

    def to_dict(self):
        """
        Returns the model properties as a dict
        """
        result = {}

        for attr, _ in iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return pformat(self.to_dict())

    def __repr__(self):
        """
        For `print` and `pprint`
        """
        return self.to_str()

    def __eq__(self, other):
        """
        Returns true if both objects are equal
        """
        if not isinstance(other, ExtensionsV1beta1DeploymentStatus):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """
        Returns true if both objects are not equal
        """
        return not self == other


text:
package ardom.vika.ui.lists.view_models;

import ardom.common.ui.recycler_view.view_models.ViewModelBase;
import ardom.vika.data.models.WorkScheduleInfo;

/**
 * Created by tsadoklf on 08/01/2017.
 */
public class WorkScheduleInfoViewModel extends ViewModelBase<WorkScheduleInfo> {

    private String mStatusMessage = "";

    public WorkScheduleInfoViewModel(WorkScheduleInfo workScheduleInfo) {
        super(workScheduleInfo.getCode(), workScheduleInfo);
    }
    //
    // getCode
    //
    public String getCode(){
        return getKey();
    }
    //
    // getStartEndTimeAsString
    //

    public String getStatusMessage() {
        return mStatusMessage;
    }

    public void setStatusMessage(String statusMessage) {
        mStatusMessage = statusMessage;
    }
}