text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using NClap.Metadata;
using NClap.Types;
using NClap.Utilities;

namespace NClap.Parser
{
    /// <summary>
    /// Encapsulates the state of an in-progress parse operation.
    /// </summary>
    internal class ArgumentParser
    {
        // Constants
        private static readonly ConsoleColor? ErrorForegroundColor = ConsoleColor.Yellow;

        /// <summary>
        /// Constructs a new stateful parser for the given argument.
        /// </summary>
        /// <param name="argSet">The argument set containing the argument to be parsed.</param>
        /// <param name="arg">The definition of the argument.</param>
        /// <param name="options">General options for parsing this argument set.</param>
        /// <param name="destination">The destination object into which the parsed result should go,
        /// if so desired; null otherwise to parse without saving results.</param>
        public ArgumentParser(ArgumentSetDefinition argSet, ArgumentDefinition arg, CommandLineParserOptions options,
            object destination = null)
        {
            ArgumentSet = argSet ?? throw new ArgumentNullException(nameof(argSet));
            Argument = arg ?? throw new ArgumentNullException(nameof(arg));
            Reporter = options?.Reporter ?? (s => { });
            DestinationObject = arg.FixedDestination ?? destination;
            ParseContext = CreateParseContext(Argument, ArgumentSet.Attribute, options, DestinationObject);

            if (Argument.IsCollection)
            {
                CollectionValues = GenericCollectionFactory.CreateList(Argument.CollectionArgumentType.ElementType.Type);
            }
        }

        /// <summary>
        /// Argument set containing the definition of the argument to be parsed.
        /// </summary>
        public ArgumentSetDefinition ArgumentSet { get; }

        /// <summary>
        /// Argument to be parsed.
        /// </summary>
        public ArgumentDefinition Argument { get; }

        /// <summary>
        /// Context for parsing.
        /// </summary>
        public ArgumentParseContext ParseContext { get; }

        /// <summary>
        /// Object to use to report errors.
        /// </summary>
        public ErrorReporter Reporter { get; }

        /// <summary>
        /// For collections, stores the in-progress list of values seen.
        /// </summary>
        public IList CollectionValues { get; }

        /// <summary>
        /// Destination object into which parsed and finalized result should be
        /// stored. May not be present.
        /// </summary>
        public object DestinationObject { get; }

        /// <summary>
        /// State variable indicating whether this argument has been seen in
        /// the currently-being-parsed command line.
        /// </summary>
        public bool SeenValue { get; set; }

        /// <summary>
        /// Finalizes parsing of the argument, reporting any errors from policy
        /// violations (e.g. missing required arguments).
        /// </summary>
        /// <param name="fileSystemReader">File system reader to use.</param>
        /// <returns>True indicates that finalization completed successfully;
        /// false indicates that a failure occurred.</returns>
        public bool TryFinalize(IFileSystemReader fileSystemReader)
        {
            // If we haven't seen a value for this argument, then fill in the default.
            if (!SeenValue && Argument.HasDefaultValue)
            {
                if (!TryValidateValue(Argument.DefaultValue, new ArgumentValidationContext(fileSystemReader)))
                {
                    return false;
                }

                if (DestinationObject != null && !TrySetValue(DestinationObject, Argument.DefaultValue))
                {
                    return false;
                }
            }

            // If this is a collection, then create the collection.
            if (Argument.IsCollection && (SeenValue || !Argument.TakesRestOfLine) && (DestinationObject != null))
            {
                if (!TryCreateCollection(Argument.CollectionArgumentType, CollectionValues, out object collection))
                {
                    return false;
                }

                if (!TrySetValue(DestinationObject, collection))
                {
                    return false;
                }
            }

            if (Argument.IsRequired && !SeenValue)
            {
                ReportMissingRequiredArgument();
                return false;
            }

            return true;
        }

        /// <summary>
        /// Parses the provided value string using this object's value type.
        /// </summary>
        /// <param name="setParseState">Current parse state for containing arg set.</param>
        /// <param name="value">The string to parse.</param>
        /// <param name="parsedValue">On success, receives the parsed value.
        /// </param>
        /// <returns>True on success; false otherwise.</returns>
        public bool TryParseAndStore(ArgumentSetParser setParseState, string value, out object parsedValue)
        {
            // Check for disallowed duplicate arguments.
            if (SeenValue && !Argument.AllowMultiple)
            {
                ReportDuplicateArgumentValue(value);

                parsedValue = null;
                return false;
            }

            // Check for conflicting arguments that have already been specified.
            bool conflictsDetected = false;
            foreach (var arg in Argument.ConflictingArgs.Where(setParseState.HasSeenValueFor))
            {
                ReportConflictingArgument(value, arg);
                conflictsDetected = true;
            }

            if (conflictsDetected)
            {
                parsedValue = null;
                return false;
            }

            // Note that we've now seen a value for this argument so we can
            // catch disallowed duplicates later.
            SeenValue = true;

            // Parse the string version of the value.
            if (!ParseValue(value, out object newValue))
            {
                parsedValue = null;
                return false;
            }

            if (!TryValidateValue(newValue, new ArgumentValidationContext(ParseContext.FileSystemReader)))
            {
                parsedValue = null;
                return false;
            }

            if (Argument.IsCollection)
            {
                var newValues = Argument.CollectionArgumentType.ToEnumerable(newValue).Cast<object>();

                // Check for disallowed duplicate values in this argument. Note that the
                // duplication could either be between existing values and the new values,
                // or within the new value collection itself.
                if (Argument.Unique)
                {
                    var allValues = newValues.Concat(CollectionValues.Cast<object>()).ToList();

                    // TODO: Allow providing alternate notion of equality for uniqueness.
                    if (allValues.Count != allValues.Distinct().Count())
                    {
                        ReportDuplicateArgumentValue(value);

                        parsedValue = null;
                        return false;
                    }
                }

                // Add the value to the collection.
                foreach (var newValueItem in newValues)
                {
                    CollectionValues.Add(newValueItem);
                }
            }
            else if (IsObjectPresent(DestinationObject))
            {
                if (!TrySetValue(DestinationObject, newValue, value))
                {
                    parsedValue = null;
                    return false;
                }
            }

            parsedValue = newValue;
            return true;
        }

        /// <summary>
        /// Fills out this argument with the remainder of the provided command
        /// line.
        /// </summary>
        /// <param name="restOfLine">Remainder of the command-line tokens.</param>
        /// <returns>true on success; false otherwise.</returns>
        public bool TrySetRestOfLine(IEnumerable<string> restOfLine)
        {
            Debug.Assert(restOfLine != null);
            Debug.Assert(!SeenValue);

            SeenValue = true;

            if (Argument.IsCollection)
            {
                foreach (var arg in restOfLine)
                {
                    CollectionValues.Add(arg);
                }
            }
            else if (IsObjectPresent(DestinationObject))
            {
                var restOfLineAsList = restOfLine.ToList();
                if (!TrySetValue(DestinationObject,
                    CreateCommandLine(restOfLineAsList),
                    string.Join(" ", restOfLineAsList)))
                {
                    return false;
                }
            }

            return true;
        }

        /// <summary>
        /// Generate possible completions of this argument that start with the
        /// provided string prefix.
        /// </summary>
        /// <param name="tokens">The set of tokens in the input being completed.
        /// </param>
        /// <param name="indexOfTokenToComplete">The 0-based index of the token
        /// to complete.</param>
        /// <param name="valueToComplete">The prefix string.</param>
        /// <param name="inProgressParsedObject">Optionally, the object
        /// resulting from parsing and processing the tokens before the one
        /// being completed.</param>
        /// <returns>Possible completions.</returns>
        public IEnumerable<string> GetCompletions(IReadOnlyList<string> tokens, int indexOfTokenToComplete, string valueToComplete, object inProgressParsedObject)
        {
            var context = new ArgumentCompletionContext
            {
                ParseContext = ParseContext,
                Tokens = tokens,
                TokenIndex = indexOfTokenToComplete,
                InProgressParsedObject = inProgressParsedObject,
                CaseSensitive = ArgumentSet.Attribute.CaseSensitive
            };

            return Argument.ArgumentType.GetCompletions(context, valueToComplete);
        }

        /// <summary>
        /// Attempts to validate the given value in the provided context.
        /// </summary>
        /// <param name="value">Value to validate.</param>
        /// <param name="validationContext">Context for validation.</param>
        /// <param name="reportInvalidValue">Whether or not invalid values should
        /// be reported.</param>
        /// <returns>true if the value passed validation; false otherwise.</returns>
        public bool TryValidateValue(object value, ArgumentValidationContext validationContext, bool reportInvalidValue = true) =>
            Argument.ValidationAttributes.All(attrib =>
            {
                if (attrib.TryValidate(validationContext, value, out string reason))
                {
                    return true;
                }

                if (reportInvalidValue)
                {
                    ReportBadArgumentValue(Argument.ValueType.Format(value), reason);
                }

                return false;
            });

        private bool TrySetValue(object containingObject, object value, string valueString = null)
        {
            //
            // Try to set the value.  If the member is a property, it's
            // possible that there's a non-default implementation of its
            // 'set' method that further validates values.  Watch out for
            // that and surface any reported errors.
            //

            try
            {
                if (Argument.FixedDestination != null)
                {
                    containingObject = Argument.FixedDestination;
                }

                Argument.Member.SetValue(containingObject, value);
                return true;
            }
            catch (ArgumentException ex)
            {
                ReportBadArgumentValue(valueString ?? value.ToString(), ex);
                return false;
            }
        }

        private bool TryCreateCollection(ICollectionArgumentType argType, IList values, out object collection)
        {
            try
            {
                collection = argType.ToCollection(values);
                return true;
            }
            catch (ArgumentException ex)
            {
                var convertedValues = new List<string>();
                foreach (var v in values)
                {
                    convertedValues.Add(v.ToString());
                }

                ReportBadArgumentValue(string.Join(", ", convertedValues), ex);

                collection = null;
                return false;
            }
        }

        private bool ParseValue(string stringData, out object value)
        {
            if (Argument.ArgumentType.TryParse(ParseContext, stringData, out value))
            {
                return true;
            }

            ReportBadArgumentValue(stringData);

            value = null;
            return false;
        }

        private void ReportMissingRequiredArgument()
        {
            if (Argument.IsPositional)
            {
                ReportLine(Strings.MissingRequiredPositionalArgument, Argument.LongName);
            }
            else
            {
                ReportLine(
                    Strings.MissingRequiredNamedArgument,
                    ArgumentSet.Attribute.NamedArgumentPrefixes.FirstOrDefault() ?? string.Empty,
                    Argument.LongName);
            }
        }

        private void ReportDuplicateArgumentValue(string value) =>
            ReportLine(Strings.DuplicateArgument, Argument.LongName, value);

        private void ReportConflictingArgument(string value, ArgumentDefinition conflictingArg) =>
            ReportLine(Strings.ConflictingArgument, value, Argument.LongName, conflictingArg.LongName);

        private void ReportBadArgumentValue(string value, ArgumentException exception) =>
            ReportBadArgumentValue(value, exception.Message);

        private void ReportBadArgumentValue(string value, string message = null)
        {
            if (message != null)
            {
                ReportLine(Strings.BadArgumentValueWithReason, value, Argument.LongName, message);
            }
            else
            {
                ReportLine(Strings.BadArgumentValue, value, Argument.LongName);
            }

            var values = Argument.ValueType.GetCompletions(new ArgumentCompletionContext { ParseContext = ParseContext }, string.Empty)
                .ToList();

            if (values.Count > 0)
            {
                ReportLine(
                    "  " + Strings.PossibleArgumentValues,
                    string.Join(", ", values.Select(a => "'" + a + "'")));
            }
        }

        private void ReportLine(string message, params object[] args)
        {
            Reporter.Invoke(new ColoredMultistring(
                new[]
                {
                    new ColoredString(
                        string.Format(
                            CultureInfo.CurrentCulture,
                            message + Environment.NewLine,
                            args),
                        ErrorForegroundColor)
                }));
        }

        private static ArgumentParseContext CreateParseContext(ArgumentDefinition argument, ArgumentSetAttribute setAttribute, CommandLineParserOptions options, object containingObject) =>
            new ArgumentParseContext
            {
                NumberOptions = argument.Attribute.NumberOptions,
                ElementSeparators = argument.Attribute.ElementSeparators,
                AllowEmpty = argument.Attribute.AllowEmpty,
                FileSystemReader = options.FileSystemReader,
                ParserContext = options.Context,
                ServiceConfigurer = options.ServiceConfigurer,
                CaseSensitive = setAttribute.CaseSensitive,
                ContainingObject = containingObject
            };

        private static bool IsObjectPresent<T>(T value) =>
            typeof(T).GetTypeInfo().IsValueType ||
            (object)value != null;

        private static string CreateCommandLine(IEnumerable<string> arguments) =>
            string.Join(" ", arguments.Select(a => StringUtilities.QuoteIfNeeded(a, '\"')));
    }
}


text:
cask :v1 => 'spark' do
  version :latest
  sha256 :no_check

  url 'http://www.shadowlab.org/softwares/Spark/Spark.dmg'
  homepage 'http://www.shadowlab.org/softwares/spark.php'
  license :unknown

  app 'Spark.app'
  zap :delete => '~/Library/Application Support/Spark'
end

redpajama_set_name: RedPajamaGithub


text:
import unittest
import shutil
import os

from mc_commands.management.commands.helpers._update_changelog import generate_assets
from mc_commands.management.commands.helpers._generate_debugger import generate_debugger

class GenerateDebuggerTest(unittest.TestCase):
    def setUp(self):
        self.BASE_DIR = os.path.dirname(__file__)
        if os.path.exists(os.path.join(self.BASE_DIR, 'assets')):
            shutil.rmtree(os.path.join(self.BASE_DIR, 'assets'))
        generate_assets(self.BASE_DIR, 'test-app')

    def test_debugger(self):
        generate_debugger(self.BASE_DIR, 'Password1')
        self.assertTrue(os.path.exists(os.path.join(self.BASE_DIR, 'assets', 'app', 'config', 'logger.js')))
        self.assertTrue(os.path.exists(os.path.join(self.BASE_DIR, 'docs', 'logging.md')))

    def tearDown(self):
        shutil.rmtree(os.path.join(self.BASE_DIR, 'assets'))


text:
[![Build status](https://img.shields.io/appveyor/ci/Picturepark/picturepark-sdk-dotnet.svg?label=build)](https://ci.appveyor.com/project/Picturepark/picturepark-sdk-dotnet)
[![NuGet Version](https://img.shields.io/nuget/v/Picturepark.SDK.V1.svg)](https://www.nuget.org/packages?q=Picturepark)
[![Build status](https://img.shields.io/appveyor/ci/Picturepark/picturepark-sdk-dotnet-7lqi5/master.svg?label=CI+build)](https://ci.appveyor.com/project/Picturepark/picturepark-sdk-dotnet-7lqi5)
[![MyGet CI](https://img.shields.io/myget/picturepark-sdk-dotnet-ci/vpre/Picturepark.SDK.V1.svg?label=CI+nuget)](https://www.myget.org/gallery/picturepark-sdk-dotnet-ci)

Links:
- [Picturepark Website](https://picturepark.com/)
- [SDK Documentation](https://picturepark.github.io/Picturepark.SDK.DotNet/sdk/site/index.html)
- [API Documentation](https://picturepark.github.io/Picturepark.SDK.DotNet/api/index.html)
- [Getting started](docs/README.md)

## NuGet Packages

**Public APIs**:

- **[Picturepark.SDK.V1](https://www.nuget.org/packages/Picturepark.SDK.V1) (.NET Standard 1.3+ & .NET 4.5+):**
    - Client implementations to access the Picturepark server
    - [Getting started](docs/README.md)
    - [SDK Documentation](https://picturepark.github.io/Picturepark.SDK.DotNet/sdk/site/api/Picturepark.SDK.V1.html)
- **[Picturepark.SDK.V1.Contract](https://www.nuget.org/packages/Picturepark.SDK.V1.Contract) (.NET Standard 1.3+ & .NET 4.5+):**
    - DTO classes and client interfaces
    - [SDK Documentation](https://picturepark.github.io/Picturepark.SDK.DotNet/sdk/site/api/Picturepark.SDK.V1.Contract.html)
- **[Picturepark.SDK.V1.Localization](https://www.nuget.org/packages/Picturepark.SDK.V1.Localization) (.NET Standard 1.3+ & .NET 4.5+):**
    - Utilities to translate server messages
    - [SDK Documentation](https://picturepark.github.io/Picturepark.SDK.DotNet/sdk/site/api/Picturepark.SDK.V1.Localization.html)

**Management APIs**:

- **[Picturepark.SDK.V1.CloudManager](https://www.nuget.org/packages/Picturepark.SDK.V1.CloudManager) (.NET Standard 1.3+ & .NET 4.5+)**
    - [SDK Documentation](https://picturepark.github.io/Picturepark.SDK.DotNet/sdk/site/api/Picturepark.SDK.V1.CloudManager.html)
- **[Picturepark.SDK.V1.ServiceProvider](https://www.nuget.org/packages/Picturepark.SDK.V1.ServiceProvider) (.NET Standard 2.0+ & .NET 4.6.1+)**
    - [SDK Documentation](https://picturepark.github.io/Picturepark.SDK.DotNet/sdk/site/api/Picturepark.SDK.V1.ServiceProvider.html)

## Compatibility matrix

| SDK version | Picturepark CP version |
|-------------|------------------------|
| `11.0.x`    | `11.0.x`               |
| `11.1.x`    | `11.1.x`               |
| `11.2.x`    | `11.2.x`               |
| `11.3.x`    | `11.3.x`               |
| `11.4.x`    | `11.4.x`               |
| `11.5.x`    | `11.5.x`               |

## SDK Development

Links:

- [Build scripts](SCRIPTS.md)
- [Sources](src/)

### Client generation

Run the following commands to regenerate the clients based on the Swagger specifications in `/swagger`:

    npm install
	npm run nswag

### CI Builds

Branch: master

- NuGet CI Feed: https://www.myget.org/gallery/picturepark-sdk-dotnet-ci
- AppVeyor CI Build: https://ci.appveyor.com/project/Picturepark/picturepark-sdk-dotnet-7lqi5

### Release Builds

Branch: release

- NuGet Feed: https://www.nuget.org/packages?q=Picturepark
- AppVeyor Build: https://ci.appveyor.com/project/Picturepark/picturepark-sdk-dotnet


text:
package me.kafeitu.activiti.chapter15.leave.ws;

import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

/**
 * 请假WebService接口
 * @author: Henry Yan
 */
@WebService
public interface LeaveWebService {

    /**
     * 是否需要总经理审批
     * @param startDate 请假开始时间
     * @param endDate   请假结束时间
     * @return  true|false
     */
    @WebResult(name="needed")
    boolean generalManagerAudit(@WebParam(name = "startDate") String startDate, @WebParam(name = "endDate") String endDate);

}


text:
'use strict';

/**
 * Background music player
 * @class Music
 */
var Music = function() {
    var self=this;

    /**
     * True when the music is enabled.
     * @name Music#enabled
     * @type object
    */
    this.enabled=true;

    /**
     * Audio API
     * @name Music#audio
     * @type object
    */
    this.audio=new Audio('music/intro.mp3');

    /**
     * Loop the track
    */
    this.audio.addEventListener('ended', function() {
        this.currentTime = 0;
        this.play();
    }, false);
};

/**
 * Play
 */
Music.prototype.play = function() {
    if (!this.enabled) return;
    this.audio.play();
};

/**
 * Pause
 */
Music.prototype.pause = function() {
    this.audio.pause();
};

/**
 * Mute
 */
Music.prototype.mute = function() {
    this.enabled = false;
    this.pause();
};

/**
 * Unmute
 */
Music.prototype.unmute = function() {
    this.enabled = true;
    this.play();
};

/**
 * Toggle
 */
Music.prototype.toggle = function() {
    if (this.enabled) this.mute();
    else this.unmute();
};


text:
typedef unsigned int size_t;
#endif

#ifndef _HAVE_TIME_T
#define _HAVE_TIME_T
typedef unsigned int time_t;
#endif

#ifndef true
#define true 		(1==1)
#endif

#ifndef false
#define false 		(1==0)
#endif

typedef unsigned long long uint64_t;
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;

typedef long long int64_t;
typedef int int32_t;
typedef short int16_t;
typedef char int8_t;

typedef int32_t  intptr_t;
typedef uint32_t uintptr_t;

#endif


text:
package com.daeliin.components.cms.mail;

import com.daeliin.components.core.mail.Mail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;

import javax.inject.Inject;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.util.Date;
import java.util.Map;

/**
 * Processes and sends mails.
 */
@Profile("mail")
@Component
public class Mailing {

    private static final Logger LOGGER = LoggerFactory.getLogger(Mailing.class);

    @Value("${daeliin.mail.domain.name}")
    private String domainName;

    @Value("${daeliin.mail.domain.url}")
    private String domainUrl;

    private final TemplateEngine templateEngine;
    private final JavaMailSenderImpl mailSender;

    @Inject
    public Mailing(final TemplateEngine templateEngine, final JavaMailSenderImpl mailSender) {
        this.templateEngine = templateEngine;
        this.mailSender = mailSender;
    }

    public void send(Mail mail) {
        MimeMessage message = this.mailSender.createMimeMessage();

        try {
            MimeMessageHelper helper = new MimeMessageHelper(message, true);
            helper.setTo(mail.to());
            helper.setSentDate(new Date());
            helper.setFrom(mail.from());
            helper.setSubject(mail.subject());
            helper.setText(processBody(mail.parameters(), mail.templateName()), true);

            this.mailSender.send(message);
        } catch (MessagingException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }

    private String processBody(Map<String, Object> parameters, final String templateName) {
        Context context = new Context();

        addGlobalParameters(parameters);
        parameters.forEach(context::setVariable);

        return this.templateEngine.process(templateName, context);
    }

    private void addGlobalParameters(Map<String, Object> parameters) {
        parameters.put("domainName", domainName);
        parameters.put("domainUrl", domainUrl);
    }
}


text:
@implementation INRootViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

	if ([self parentSlidingViewController]) {
		UIImage * sidebarIcon = [[UIImage imageNamed: @"icon_sidebar.png"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
		UIBarButtonItem * sidebar = [[UIBarButtonItem alloc] initWithImage:sidebarIcon style:UIBarButtonItemStyleBordered target:self action:@selector(sidebarTapped:)];
		[sidebar setTintColor: [UIColor darkGrayColor]];
		[self.navigationItem setLeftBarButtonItem: sidebar];
	}
}

- (void)viewDidAppear:(BOOL)animated
{
}

- (void)viewWillDisappear:(BOOL)animated
{
}

- (JSSlidingViewController*)parentSlidingViewController
{
    JSSlidingViewController * js = (JSSlidingViewController *)[self parentViewController];
    if ([js isKindOfClass: [JSSlidingViewController class]] == NO)
        js = (JSSlidingViewController *)[js parentViewController];
    return js;
}

- (IBAction)sidebarTapped:(id)sender
{
	JSSlidingViewController * js = [self parentSlidingViewController];
    if ([js isOpen])
        [js closeSlider:YES completion:nil];
    else
        [js openSlider:YES completion:nil];
}

- (void)smartPushViewController:(UIViewController*)vc animated:(BOOL)animated
{
	if (self.navigationController)
		[self.navigationController pushViewController:vc animated:animated];
	else {
		if ([self.parentViewController isKindOfClass: [INSplitViewController class]]){
			INSplitViewController * split = (INSplitViewController*)self.parentViewController;
			if ([[split paneViewControllers] count] == 3) {
				[split popPane: NO];
				[split pushViewController: vc animated: NO];
			} else {
				[split pushViewController: vc animated: animated];
			}
		}
	}
}

- (void)smartPresentViewController:(UIViewController*)vc animated:(BOOL)animated
{
	[self presentViewController:vc animated:animated completion:NULL];
}

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>Case</members>
        <members>Product2</members>
        <members>Vehicle__c</members>
        <members>Work_Part__c</members>
        <name>CustomObject</name>
    </types>
    <version>38.0</version>
</Package>


text:
package com.cooldatasoft.currency.resource;

import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

import com.cooldatasoft.currency.service.CurrencyService;

/**
 * Created by fmucar on 04/02/15.
 */
@Named
public class CurrencyResource {

    @Inject
    private CurrencyService currencyService;

    @GET
    @Path("/{fromCurrency}/{toCurrency}")
    public Response getCurrencyExhangeRate(String from, String to) {
        return Response.ok(currencyService.getCurrencyExhangeRate(from, to)).build();
    }

}


text:
class TreeBuilderSections < TreeBuilder
  has_kids_for Hash, [:x_get_tree_hash_kids]

  def initialize(name, type, sandbox, build, data, controller_name, current_tenant)
    @data = data
    @controller_name = controller_name
    @current_tenant = current_tenant
    @sandbox = sandbox
    super(name, type, sandbox, build)
  end

  private

  def tree_init_options(_tree_name)
    {:full_ids => true, :add_root => false, :lazy => false}
  end

  def set_locals_for_render
    locals = super
    locals.merge!(:checkboxes   => true,
                  :three_checks => true,
                  :onselect     => "miqOnCheckSections",
                  :check_url    => "/#{@controller_name}/sections_field_changed/")
  end

  def root_options
    []
  end

  def x_get_tree_roots(count_only = false, _options)
    nodes = []
    group = nil
    @data.master_list.each_slice(3) do |section, _records, _fields|
      if group.blank? || section[:group] != group
        group = section[:group]
        nodes.push(:id          => "group_#{section[:group]}",
                   :text        => section[:group] == "Categories" ? "#{@current_tenant} Tags" : section[:group],
                   :tip         => section[:group],
                   :image       => false,
                   :select      => true,
                   :cfmeNoClick => true,
                   :children    => [section])
      else
        nodes.last[:children].push(section)
      end
    end
    nodes.each do |node|
      checked = node[:children].count { |kid| @data.include[kid[:name]][:checked] } # number of checked kids
      if checked == 0
        node[:select] = false
      elsif checked < node[:children].size
        node[:select] = 'undefined'
      else
        node[:select] = true
      end
    end
    count_only_or_objects(count_only, nodes)
  end

  def x_get_tree_hash_kids(parent, count_only)
    nodes = parent[:children].map do |kid|
      {:id          => "group_#{kid[:group]}:#{kid[:name]}",
       :text        => kid[:header],
       :tip         => kid[:header],
       :image       => false,
       :select      => @data.include[kid[:name]][:checked],
       :cfmeNoClick => true,
       :children    => []
      }
    end
    count_only_or_objects(count_only, nodes)
  end
end


text:
package org.kuali.rice.kns.service.impl;

import org.apache.commons.collections.CollectionUtils;
import org.kuali.rice.kns.datadictionary.MaintainableSectionDefinition;
import org.kuali.rice.kns.util.documentserlializer.MaintenanceDocumentPropertySerializibilityEvaluator;
import org.kuali.rice.krad.datadictionary.MaintenanceDocumentEntry;
import org.kuali.rice.krad.util.documentserializer.AlwaysTruePropertySerializibilityEvaluator;
import org.kuali.rice.krad.util.documentserializer.PropertySerializabilityEvaluator;

import java.util.List;

/**
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class BusinessObjectSerializerServiceImpl extends org.kuali.rice.krad.service.impl.BusinessObjectSerializerServiceImpl {

    @Override
    public PropertySerializabilityEvaluator getPropertySerizabilityEvaluator(Object businessObject) {
        PropertySerializabilityEvaluator evaluator = null;

        String docTypeName = getDocumentDictionaryService().getMaintenanceDocumentTypeName(businessObject.getClass());
        MaintenanceDocumentEntry maintenanceDocumentEntry =
                getDocumentDictionaryService().getMaintenanceDocumentEntry(docTypeName);

        if (maintenanceDocumentEntry instanceof org.kuali.rice.kns.datadictionary.MaintenanceDocumentEntry) {
            List<MaintainableSectionDefinition> maintainableSectionDefinitions =
                    ((org.kuali.rice.kns.datadictionary.MaintenanceDocumentEntry) maintenanceDocumentEntry).getMaintainableSections();
            if (CollectionUtils.isEmpty(maintainableSectionDefinitions)) {
                evaluator = new AlwaysTruePropertySerializibilityEvaluator();
            } else {
                evaluator = new MaintenanceDocumentPropertySerializibilityEvaluator();
                evaluator.initializeEvaluatorForDataObject(businessObject);
            }
        }
        else {
           evaluator = new AlwaysTruePropertySerializibilityEvaluator();
        }

        return evaluator;
    }
}