text:
package com.evolveum.midpoint.web.component.wizard.resource;

import com.evolveum.midpoint.model.api.ModelService;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.data.paging.NavigatorPanel;
import com.evolveum.midpoint.web.component.form.multivalue.MultiValueAutoCompleteTextPanel;
import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel;
import com.evolveum.midpoint.web.component.input.ThreeStateBooleanPanel;
import com.evolveum.midpoint.web.component.util.ListDataProvider;
import com.evolveum.midpoint.web.component.util.LoadableModel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.component.wizard.WizardStep;
import com.evolveum.midpoint.web.component.wizard.resource.component.synchronization.ConditionalSearchFilterEditor;
import com.evolveum.midpoint.web.component.wizard.resource.component.synchronization.SynchronizationExpressionEditor;
import com.evolveum.midpoint.web.component.wizard.resource.component.synchronization.SynchronizationReactionEditor;
import com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectSynchronizationTypeDto;
import com.evolveum.midpoint.web.component.wizard.resource.dto.ResourceSynchronizationDto;
import com.evolveum.midpoint.web.page.PageBase;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.web.util.WebModelUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.*;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.validation.IValidator;

import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author lazyman
 * @author shood
 */
public class SynchronizationStep extends WizardStep {

    private static final Trace LOGGER = TraceManager.getTrace(SynchronizationStep.class);

    private static final String DOT_CLASS = SynchronizationStep.class.getName() + ".";
    private static final String OPERATION_SAVE_SYNC = DOT_CLASS + "saveResourceSynchronization";
    private static final String OPERATION_LOAD_OBJECT_TEMPLATE_LIST = "loadObjectTemplateList";

    private static final String ID_TABLE_ROWS = "tableRows";
    private static final String ID_OBJECT_SYNC_ROW = "objectSyncRow";
    private static final String ID_OBJECT_SYNC_LINK = "objectSyncLink";
    private static final String ID_OBJECT_SYNC_LABEL = "objectSyncName";
    private static final String ID_OBJECT_SYNC_DELETE = "objectSyncDelete";
    private static final String ID_PAGING = "objectSyncPaging";
    private static final String ID_OBJECT_SYNC_ADD = "objectSyncAddButton";
    private static final String ID_OBJECT_SYNC_EDITOR = "objectSyncConfig";
    private static final String ID_THIRD_ROW_CONTAINER = "thirdRowContainer";

    private static final String ID_EDITOR_LABEL = "editorLabel";
    private static final String ID_EDITOR_NAME = "editorName";
    private static final String ID_EDITOR_DESCRIPTION = "editorDescription";
    private static final String ID_EDITOR_KIND = "editorKind";
    private static final String ID_EDITOR_INTENT = "editorIntent";
    private static final String ID_EDITOR_FOCUS = "editorFocus";
    private static final String ID_EDITOR_ENABLED = "editorEnabled";
    private static final String ID_EDITOR_BUTTON_CONDITION = "editorConditionButton";
    private static final String ID_EDITOR_BUTTON_CONFIRMATION = "editorConfirmationButton";
    private static final String ID_EDITOR_OBJECT_TEMPLATE = "editorObjectTemplate";
    private static final String ID_EDITOR_RECONCILE = "editorReconcile";
    private static final String ID_EDITOR_OPPORTUNISTIC = "editorOpportunistic";
    private static final String ID_EDITOR_OBJECT_CLASS = "editorObjectClass";
    private static final String ID_EDITOR_EDITOR_CORRELATION = "editorCorrelation";
    private static final String ID_EDITOR_REACTION = "editorReaction";
    private static final String ID_T_KIND = "kindTooltip";
    private static final String ID_T_INTENT = "intentTooltip";
    private static final String ID_T_OBJ_CLASS = "objectClassTooltip";
    private static final String ID_T_FOCUS = "focusTooltip";
    private static final String ID_T_ENABLED = "enabledTooltip";
    private static final String ID_T_CONDITION = "conditionTooltip";
    private static final String ID_T_CONFIRMATION = "confirmationTooltip";
    private static final String ID_T_OBJ_TEMPLATE = "objectTemplateTooltip";
    private static final String ID_T_RECONCILE = "reconcileTooltip";
    private static final String ID_T_OPPORTUNISTIC = "opportunisticTooltip";
    private static final String ID_T_CORRELATION = "correlationTooltip";
    private static final String ID_T_REACTION = "reactionTooltip";

    private IModel<PrismObject<ResourceType>> resourceModel;
    private IModel<ResourceSynchronizationDto> model;

    public SynchronizationStep(IModel<PrismObject<ResourceType>> resourceModel, PageBase pageBase) {
        super(pageBase);
        this.resourceModel = resourceModel;

        model = new LoadableModel<ResourceSynchronizationDto>(false) {
            @Override
            protected ResourceSynchronizationDto load() {
                return loadResourceSynchronization();
            }
        };

        initLayout();
    }

    private ResourceSynchronizationDto loadResourceSynchronization(){
        ResourceSynchronizationDto dto = new ResourceSynchronizationDto();
        List<ObjectSynchronizationTypeDto> list = new ArrayList<>();

        if(resourceModel != null && resourceModel.getObject() != null &&
                resourceModel.getObject().asObjectable() != null){

            if(resourceModel.getObject().asObjectable().getSynchronization() == null){
                resourceModel.getObject().asObjectable().setSynchronization(new SynchronizationType());
            }

            SynchronizationType sync = resourceModel.getObject().asObjectable().getSynchronization();

            ObjectSynchronizationTypeDto obj;
            if(sync != null && sync.getObjectSynchronization() != null){
                for(ObjectSynchronizationType syncObject: sync.getObjectSynchronization()){
                    obj = new ObjectSynchronizationTypeDto(syncObject);
                    list.add(obj);
                }
            }
        }

        dto.setSelected(createPlaceholderObjectType());
        dto.setObjectSyncList(list);
        dto.setObjectClassList(loadResourceObjectClassList(resourceModel, LOGGER, getString("SynchronizationStep.message.errorLoadingObjectSyncList")));
        return dto;
    }

    private ObjectSynchronizationType createPlaceholderObjectType(){
        return new ObjectSynchronizationType();
    }

    private boolean isAnySelected(){
        for(ObjectSynchronizationTypeDto dto: model.getObject().getObjectSyncList()){
            if(dto.isSelected()){
                return true;
            }
        }

        return false;
    }

    private void initLayout(){
        final ListDataProvider<ObjectSynchronizationTypeDto> syncProvider = new ListDataProvider<>(this,
                new PropertyModel<List<ObjectSynchronizationTypeDto>>(model, ResourceSynchronizationDto.F_OBJECT_SYNC_LIST));

        //first row - object sync list
        WebMarkupContainer tableBody = new WebMarkupContainer(ID_TABLE_ROWS);
        tableBody.setOutputMarkupId(true);
        add(tableBody);

        //second row - ObjectSynchronizationType editor
        WebMarkupContainer objectSyncEditor = new WebMarkupContainer(ID_OBJECT_SYNC_EDITOR);
        objectSyncEditor.setOutputMarkupId(true);
        objectSyncEditor.add(new VisibleEnableBehaviour(){

            @Override
            public boolean isEnabled(){
                return isAnySelected();
            }

        });
        add(objectSyncEditor);

        //third row - container for more specific editors
        WebMarkupContainer thirdRowContainer = new WebMarkupContainer(ID_THIRD_ROW_CONTAINER);
        thirdRowContainer.setOutputMarkupId(true);
        add(thirdRowContainer);

        DataView<ObjectSynchronizationTypeDto> syncDataView = new DataView<ObjectSynchronizationTypeDto>(ID_OBJECT_SYNC_ROW,
                syncProvider, UserProfileStorage.DEFAULT_PAGING_SIZE) {

            @Override
            protected void populateItem(Item<ObjectSynchronizationTypeDto> item) {
                final ObjectSynchronizationTypeDto syncObject = item.getModelObject();

                AjaxSubmitLink link = new AjaxSubmitLink(ID_OBJECT_SYNC_LINK) {

                    @Override
                    protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                        editSyncObjectPerformed(target, syncObject);
                    }
                };
                item.add(link);

                Label label = new Label(ID_OBJECT_SYNC_LABEL, createObjectSyncTypeDisplayModel(syncObject));
                label.setOutputMarkupId(true);
                link.add(label);

                AjaxLink delete = new AjaxLink(ID_OBJECT_SYNC_DELETE){

                    @Override
                    public void onClick(AjaxRequestTarget target){
                        deleteSyncObjectPerformed(target, syncObject);
                    }
                };
                link.add(delete);

                item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {

                    @Override
                    public String getObject() {
                        if(syncObject.isSelected()){
                            return "success";
                        }

                        return null;
                    }
                }));

            }
        };
        tableBody.add(syncDataView);

        NavigatorPanel navigator = new NavigatorPanel(ID_PAGING, syncDataView, true);
        navigator.setOutputMarkupId(true);
        navigator.setOutputMarkupPlaceholderTag(true);
        add(navigator);

        AjaxLink add = new AjaxLink(ID_OBJECT_SYNC_ADD) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                addSyncObjectPerformed(target);
            }
        };
        add(add);

        initObjectSyncEditor(objectSyncEditor);
    }

    private void initObjectSyncEditor(WebMarkupContainer editor){
        Label editorLabel = new Label(ID_EDITOR_LABEL, new LoadableModel<String>() {

            @Override
            protected String load() {
                if(isAnySelected()){
                    String name = model.getObject().getSelected().getName() != null ? model.getObject().getSelected().getName() : "-";
                    return getString("SynchronizationStep.label.editSyncObject", name);
                } else {
                    return getString("SynchronizationStep.label.emptyDisplayName");
                }
            }
        });
        editor.add(editorLabel);

        TextField editorName = new TextField<>(ID_EDITOR_NAME, new PropertyModel<String>(model,
                ResourceSynchronizationDto.F_SELECTED + ".name"));
        editor.add(editorName);

        TextArea editorDescription = new TextArea<>(ID_EDITOR_DESCRIPTION, new PropertyModel<String>(model,
                ResourceSynchronizationDto.F_SELECTED + ".description"));
        editor.add(editorDescription);

        DropDownChoice editorKind = new DropDownChoice<>(ID_EDITOR_KIND,
                new PropertyModel<ShadowKindType>(model, ResourceSynchronizationDto.F_SELECTED + ".kind"),
                WebMiscUtil.createReadonlyModelFromEnum(ShadowKindType.class),
                new EnumChoiceRenderer<ShadowKindType>(this));
        editorKind.setNullValid(true);
        editor.add(editorKind);

        TextField editorIntent = new TextField<>(ID_EDITOR_INTENT, new PropertyModel<String>(model,
                ResourceSynchronizationDto.F_SELECTED + ".intent"));
        editor.add(editorIntent);

        MultiValueAutoCompleteTextPanel<QName> editorObjectClass = new MultiValueAutoCompleteTextPanel<QName>(ID_EDITOR_OBJECT_CLASS,
                new PropertyModel<List<QName>>(model, ResourceSynchronizationDto.F_SELECTED + ".objectClass"), true){

            @Override
            protected IModel<String> createTextModel(final IModel<QName> model) {
                return new PropertyModel<>(model, "localPart");
            }

            @Override
            protected QName createNewEmptyItem() {
                return new QName("");
            }

            @Override
            protected boolean buttonsDisabled() {
                return !isAnySelected();
            }

            @Override
            protected List<QName> createObjectList() {
                return model.getObject().getObjectClassList();
            }

            @Override
            protected String createAutoCompleteObjectLabel(QName object) {
                return object.getLocalPart();
            }

            @Override
            protected IValidator<String> createAutoCompleteValidator(){
                return createObjectClassValidator(new LoadableModel<List<QName>>(false) {

                    @Override
                    protected List<QName> load() {
                        return model.getObject().getObjectClassList();
                    }
                });
            }
        };
        editor.add(editorObjectClass);

        DropDownChoice editorFocus = new DropDownChoice<>(ID_EDITOR_FOCUS, new PropertyModel<QName>(model,
                ResourceSynchronizationDto.F_SELECTED + ".focusType"),
                new AbstractReadOnlyModel<List<QName>>() {

                    @Override
                    public List<QName> getObject() {
                        return createFocusTypeList();
                    }
                }, new IChoiceRenderer<QName>() {

            @Override
            public Object getDisplayValue(QName object) {
                return object.getLocalPart();
            }

            @Override
            public String getIdValue(QName object, int index) {
                return Integer.toString(index);
            }
        });
        editorFocus.setNullValid(true);
        editor.add(editorFocus);

        CheckBox editorEnabled = new CheckBox(ID_EDITOR_ENABLED, new PropertyModel<Boolean>(model,
                ResourceSynchronizationDto.F_SELECTED + ".enabled"));
        editor.add(editorEnabled);

        AjaxSubmitLink editorCondition = new AjaxSubmitLink(ID_EDITOR_BUTTON_CONDITION){

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                conditionEditPerformed(target);
            }
        };
        addDisableClassModifier(editorCondition);
        editor.add(editorCondition);

        AjaxSubmitLink editorConfirmation = new AjaxSubmitLink(ID_EDITOR_BUTTON_CONFIRMATION){

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                confirmationEditPerformed(target);
            }
        };
        addDisableClassModifier(editorConfirmation);
        editor.add(editorConfirmation);

        DropDownChoice editorObjectTemplate = new DropDownChoice<>(ID_EDITOR_OBJECT_TEMPLATE,
                new PropertyModel<ObjectReferenceType>(model, ResourceSynchronizationDto.F_SELECTED + ".objectTemplateRef"),
                new AbstractReadOnlyModel<List<ObjectReferenceType>>() {

                    @Override
                    public List<ObjectReferenceType> getObject() {
                        return createObjectTemplateList();
                    }
                }, new IChoiceRenderer<ObjectReferenceType>() {

            @Override
            public Object getDisplayValue(ObjectReferenceType object) {
                return model.getObject().getObjectTemplateMap().get(object.getOid());
            }

            @Override
            public String getIdValue(ObjectReferenceType object, int index) {
                return Integer.toString(index);
            }
        });
        editorObjectTemplate.setNullValid(true);
        editor.add(editorObjectTemplate);

        CheckBox editorReconcile = new CheckBox(ID_EDITOR_RECONCILE, new PropertyModel<Boolean>(model,
                ResourceSynchronizationDto.F_SELECTED + ".reconcile"));
        editor.add(editorReconcile);

        ThreeStateBooleanPanel opportunistic = new ThreeStateBooleanPanel(ID_EDITOR_OPPORTUNISTIC,
                new PropertyModel<Boolean>(model, ResourceSynchronizationDto.F_SELECTED + ".opportunistic"));
        editor.add(opportunistic);

        MultiValueTextEditPanel editorCorrelation = new MultiValueTextEditPanel<ConditionalSearchFilterType>(ID_EDITOR_EDITOR_CORRELATION,
                new PropertyModel<List<ConditionalSearchFilterType>>(model, ObjectSynchronizationTypeDto.F_SELECTED + ".correlation"), false){

            @Override
            protected IModel<String> createTextModel(final IModel<ConditionalSearchFilterType> model) {
                return new Model<String>() {

                    @Override
                    public String getObject() {
                        StringBuilder sb = new StringBuilder();

                        ConditionalSearchFilterType searchFilter = model.getObject();
                        if(searchFilter != null && searchFilter.getDescription() != null){
                            sb.append(searchFilter.getDescription());
                        }

                        if(sb.toString().isEmpty()){
                            sb.append(getString("SynchronizationStep.label.notSpecified"));
                        }

                        return sb.toString();
                    }
                };
            }

            @Override
            protected ConditionalSearchFilterType createNewEmptyItem(){
                return new ConditionalSearchFilterType();
            }

            @Override
            protected void editPerformed(AjaxRequestTarget target, ConditionalSearchFilterType object){
                correlationEditPerformed(target, object);
            }

            @Override
            protected boolean buttonsDisabled(){
                return !isAnySelected();
            }
        };
        editor.add(editorCorrelation);

        MultiValueTextEditPanel editorReaction = new MultiValueTextEditPanel<SynchronizationReactionType>(ID_EDITOR_REACTION,
                new PropertyModel<List<SynchronizationReactionType>>(model, ObjectSynchronizationTypeDto.F_SELECTED + ".reaction"), false){

            @Override
            protected IModel<String> createTextModel(final IModel<SynchronizationReactionType> model) {
                return new Model<String>() {

                    @Override
                    public String getObject() {
                        StringBuilder sb = new StringBuilder();

                        if(model.getObject() != null){
                            SynchronizationReactionType reaction = model.getObject();

                            sb.append(reaction.getName() != null ? reaction.getName() : "- ");

                            if(reaction.getSituation() != null){
                                sb.append(" (");
                                sb.append(reaction.getSituation());
                                sb.append(")");
                            }
                        }

                        return sb.toString();
                    }
                };
            }

            @Override
            protected SynchronizationReactionType createNewEmptyItem(){
                return new SynchronizationReactionType();
            }

            @Override
            protected void editPerformed(AjaxRequestTarget target, SynchronizationReactionType object){
                reactionEditPerformed(target, object);
            }

            @Override
            protected boolean buttonsDisabled(){
                return !isAnySelected();
            }
        };
        editor.add(editorReaction);

        Label kindTooltip = new Label(ID_T_KIND);
        kindTooltip.add(new InfoTooltipBehavior());
        editor.add(kindTooltip);

        Label intentTooltip = new Label(ID_T_INTENT);
        intentTooltip.add(new InfoTooltipBehavior());
        editor.add(intentTooltip);

        Label objClassTooltip = new Label(ID_T_OBJ_CLASS);
        objClassTooltip.add(new InfoTooltipBehavior());
        editor.add(objClassTooltip);

        Label focusTooltip = new Label(ID_T_FOCUS);
        focusTooltip.add(new InfoTooltipBehavior());
        editor.add(focusTooltip);

        Label enabledTooltip = new Label(ID_T_ENABLED);
        enabledTooltip.add(new InfoTooltipBehavior());
        editor.add(enabledTooltip);

        Label conditionTooltip = new Label(ID_T_CONDITION);
        conditionTooltip.add(new InfoTooltipBehavior());
        editor.add(conditionTooltip);

        Label confirmationTooltip = new Label(ID_T_CONFIRMATION);
        confirmationTooltip.add(new InfoTooltipBehavior());
        editor.add(confirmationTooltip);

        Label objTemplateTooltip = new Label(ID_T_OBJ_TEMPLATE);
        objTemplateTooltip.add(new InfoTooltipBehavior());
        editor.add(objTemplateTooltip);

        Label reconcileTooltip = new Label(ID_T_RECONCILE);
        reconcileTooltip.add(new InfoTooltipBehavior());
        editor.add(reconcileTooltip);

        Label opportunisticTooltip = new Label(ID_T_OPPORTUNISTIC);
        opportunisticTooltip.add(new InfoTooltipBehavior());
        editor.add(opportunisticTooltip);

        Label correlationTooltip = new Label(ID_T_CORRELATION);
        correlationTooltip.add(new InfoTooltipBehavior());
        editor.add(correlationTooltip);

        Label reactionTooltip = new Label(ID_T_REACTION);
        reactionTooltip.add(new InfoTooltipBehavior());
        editor.add(reactionTooltip);
    }

    private IModel<String> createObjectSyncTypeDisplayModel(final ObjectSynchronizationTypeDto syncObject){
        return new AbstractReadOnlyModel<String>() {

            @Override
            public String getObject() {
                StringBuilder sb = new StringBuilder();

                if(syncObject != null && syncObject.getSyncType() != null){
                    ObjectSynchronizationType object = syncObject.getSyncType();
                    sb.append(object.getName() != null ? object.getName() : "(name not specified) ");

                    if(object.getKind() != null || object.getIntent() != null){
                        sb.append("(");
                        sb.append(object.getKind() != null ? object.getKind() : " - ");
                        sb.append(", ");
                        sb.append(object.getIntent() != null ? object.getIntent() : "- ");
                        sb.append(")");
                    }
                }

                return sb.toString();
            }
        };
    }

    private List<ObjectReferenceType> createObjectTemplateList(){
        model.getObject().getObjectTemplateMap().clear();
        OperationResult result = new OperationResult(OPERATION_LOAD_OBJECT_TEMPLATE_LIST);
        Task task = getPageBase().createSimpleTask(OPERATION_LOAD_OBJECT_TEMPLATE_LIST);
        List<PrismObject<ObjectTemplateType>> templates = null;
        List<ObjectReferenceType> references = new ArrayList<>();

        try {
            templates = getPageBase().getModelService().searchObjects(ObjectTemplateType.class, new ObjectQuery(), null, task, result);
            result.recomputeStatus();

        } catch (Exception e){
            result.recordFatalError(getString("SynchronizationStep.message.errorLoadingObjectTemplates"), e);
            LoggingUtils.logException(LOGGER, "Couldn't load object templates from repository.", e);
        }

        // TODO - show error somehow
        // if(!result.isSuccess()){
        //    getPageBase().showResult(result);
        // }

        if(templates != null){
            ObjectReferenceType ref;

            for(PrismObject<ObjectTemplateType> template: templates){
                if(model.getObject() != null){
                    model.getObject().getObjectTemplateMap().put(template.getOid(), WebMiscUtil.getName(template));
                }

                ref = new ObjectReferenceType();
                ref.setType(ObjectTemplateType.COMPLEX_TYPE);
                ref.setOid(template.getOid());
                references.add(ref);
            }
        }

        return references;
    }

    //TODO - add more FocusType items if needed
    private List<QName> createFocusTypeList(){
        List<QName> focusTypeList = new ArrayList<>();

        focusTypeList.add(UserType.COMPLEX_TYPE);
        focusTypeList.add(OrgType.COMPLEX_TYPE);
        focusTypeList.add(RoleType.COMPLEX_TYPE);

        return focusTypeList;
    }

    private void addDisableClassModifier(Component component){
        component.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

            @Override
            public String getObject() {
                if(!isAnySelected()){
                    return " disabled";
                }

                return null;
            }
        }));
    }

    private void resetSelected(){
        for(ObjectSynchronizationTypeDto dto: model.getObject().getObjectSyncList()){
            dto.setSelected(false);
        }
    }

    private Component getSyncObjectTable(){
        return get(ID_TABLE_ROWS);
    }

    private Component getNavigator(){
        return get(ID_PAGING);
    }

    private Component getSyncObjectEditor(){
        return get(ID_OBJECT_SYNC_EDITOR);
    }

    private Component getThirdRowContainer(){
        return get(ID_THIRD_ROW_CONTAINER);
    }

    private void insertEmptyThirdRow(){
        getThirdRowContainer().replaceWith(new WebMarkupContainer(ID_THIRD_ROW_CONTAINER));
    }

    private void conditionEditPerformed(AjaxRequestTarget target){
        WebMarkupContainer newContainer = new SynchronizationExpressionEditor(ID_THIRD_ROW_CONTAINER,
                new PropertyModel<ExpressionType>(model, ResourceSynchronizationDto.F_SELECTED + ".condition")){

            @Override
            public String getLabel(){
                return "SynchronizationExpressionEditor.label.condition";
            }
        };
        getThirdRowContainer().replaceWith(newContainer);

        target.add(getThirdRowContainer(), get(ID_OBJECT_SYNC_EDITOR), getPageBase().getFeedbackPanel());
    }

    private void confirmationEditPerformed(AjaxRequestTarget target){
        WebMarkupContainer newContainer = new SynchronizationExpressionEditor(ID_THIRD_ROW_CONTAINER,
                new PropertyModel<ExpressionType>(model, ResourceSynchronizationDto.F_SELECTED + ".confirmation")){

            @Override
            public String getLabel(){
                return "SynchronizationExpressionEditor.label.confirmation";
            }
        };
        getThirdRowContainer().replaceWith(newContainer);

        target.add(getThirdRowContainer(), get(ID_OBJECT_SYNC_EDITOR), getPageBase().getFeedbackPanel());
    }

    private void correlationEditPerformed(AjaxRequestTarget target, ConditionalSearchFilterType condition){
        WebMarkupContainer newContainer = new ConditionalSearchFilterEditor(ID_THIRD_ROW_CONTAINER,
                new Model<>(condition));
        getThirdRowContainer().replaceWith(newContainer);

        target.add(getThirdRowContainer(), get(ID_OBJECT_SYNC_EDITOR), getPageBase().getFeedbackPanel());
    }

    private void reactionEditPerformed(AjaxRequestTarget target, SynchronizationReactionType reaction){
        WebMarkupContainer newContainer = new SynchronizationReactionEditor(ID_THIRD_ROW_CONTAINER,
                new Model<>(reaction));
        getThirdRowContainer().replaceWith(newContainer);

        for(SynchronizationActionType action: reaction.getAction()){
            if(action.getRef() != null){
                warn(getString("SynchronizationStep.message.unsupportedActionFormat"));
                break;
            }
        }

        target.add(getThirdRowContainer(), get(ID_OBJECT_SYNC_EDITOR), getPageBase().getFeedbackPanel());
    }

    @Override
    public void applyState(){
        savePerformed();
    }

    private void savePerformed(){
        PrismObject<ResourceType> oldResource;
        PrismObject<ResourceType> newResource = resourceModel.getObject();
        OperationResult result = new OperationResult(OPERATION_SAVE_SYNC);
        ModelService modelService = getPageBase().getModelService();
        ObjectDelta delta;

        prepareResourceToSave(newResource.asObjectable());

        try{
            oldResource = WebModelUtils.loadObject(ResourceType.class, newResource.getOid(), result, getPageBase());
            if(oldResource != null){
                delta = oldResource.diff(newResource);

                if(LOGGER.isTraceEnabled()){
                    LOGGER.trace(delta.debugDump());
                }

                Collection<ObjectDelta<? extends ObjectType>> deltas = WebMiscUtil.createDeltaCollection(delta);
                modelService.executeChanges(deltas, null, getPageBase().createSimpleTask(OPERATION_SAVE_SYNC), result);
            }

        } catch (Exception e){
            LoggingUtils.logException(LOGGER, "Couldn't save resource synchronization.", e);
            result.recordFatalError(getString("SynchronizationStep.message.cantSave", e));
        } finally {
            result.computeStatusIfUnknown();
            setResult(result);
        }

        if(WebMiscUtil.showResultInPage(result)){
            getPageBase().showResult(result);
        }
    }

    private void prepareResourceToSave(ResourceType resource){
        if(resource.getSynchronization() == null){
            return;
        }

        if(model == null || model.getObject() == null){
            return;
        }

        ResourceSynchronizationDto dto = model.getObject();

        SynchronizationType sync = resource.getSynchronization();
        for(ObjectSynchronizationType syncObject: sync.getObjectSynchronization()){
            List<QName> newObjectClassList = new ArrayList<>();

            for(QName objectClass: syncObject.getObjectClass()){
                for(QName objClazz: dto.getObjectClassList()){
                    if(objClazz.getLocalPart().equals(objectClass.getLocalPart())){
                        QName newObjectClass = new QName(objClazz.getNamespaceURI(), objClazz.getLocalPart());
                        newObjectClassList.add(newObjectClass);
                    }
                }
            }

            syncObject.getObjectClass().clear();
            syncObject.getObjectClass().addAll(newObjectClassList);
        }
    }

    private void editSyncObjectPerformed(AjaxRequestTarget target, ObjectSynchronizationTypeDto syncObject){
        resetSelected();
        syncObject.setSelected(true);
        model.getObject().setSelected(syncObject.getSyncType());

        insertEmptyThirdRow();
        target.add(getSyncObjectTable(), getNavigator(), getSyncObjectEditor(), getThirdRowContainer());
    }

    private void deleteSyncObjectPerformed(AjaxRequestTarget target, ObjectSynchronizationTypeDto syncObject){
        ArrayList<ObjectSynchronizationTypeDto> list = (ArrayList<ObjectSynchronizationTypeDto>) model.getObject().getObjectSyncList();

        list.remove(syncObject);

        if(syncObject.isSelected()){
            insertEmptyThirdRow();
            target.add(getThirdRowContainer());
        }

        if(list.isEmpty()){
            insertEmptyThirdRow();
            target.add(getThirdRowContainer());
        }

        target.add(getSyncObjectEditor(), getSyncObjectTable(), getNavigator());
    }

    private void addSyncObjectPerformed(AjaxRequestTarget target){
        ObjectSynchronizationType syncObject = new ObjectSynchronizationType();
        syncObject.setName(getString("SynchronizationStep.label.newObjectType"));

        ObjectSynchronizationTypeDto dto = new ObjectSynchronizationTypeDto(syncObject);

        resetSelected();
        dto.setSelected(true);
        model.getObject().setSelected(dto.getSyncType());
        model.getObject().getObjectSyncList().add(dto);
        resourceModel.getObject().asObjectable().getSynchronization().getObjectSynchronization().add(syncObject);
        insertEmptyThirdRow();
        target.add(getSyncObjectTable(), getNavigator(), getSyncObjectEditor(), getThirdRowContainer());
    }
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.textocat.textokit.core</groupId>
		<artifactId>textokit-parent</artifactId>
		<version>0.1-SNAPSHOT</version>
		<relativePath>../Textokit.Parent/pom.xml</relativePath>
	</parent>
	<artifactId>textokit-sentence-splitter-heuristic</artifactId>
	<name>Textokit.SentenceSplitter.Heuristic</name>
	<description>Textokit's rule-based sentence splitter</description>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>com.textocat.textokit.core</groupId>
			<artifactId>textokit-commons</artifactId>
		</dependency>
		<dependency>
			<groupId>com.textocat.textokit.core</groupId>
			<artifactId>textokit-sentence-splitter-api</artifactId>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>
		<dependency>
			<groupId>com.textocat.textokit.core</groupId>
			<artifactId>textokit-tokenizer-simple</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>

redpajama_set_name: RedPajamaGithub


text:
package com.twitter.finagle.memcached.protocol.text.client

import com.twitter.finagle.memcached.protocol.ServerError
import com.twitter.finagle.memcached.protocol.text._
import com.twitter.finagle.memcached.util.ChannelBufferUtils._
import com.twitter.finagle.memcached.util.ParserUtils
import com.twitter.finagle.netty3.ChannelBufferBuf
import com.twitter.util.StateMachine
import org.jboss.netty.buffer.ChannelBuffer
import org.jboss.netty.channel._

object Decoder {
  private val END   = "END": ChannelBuffer
  private val ITEM  = "ITEM": ChannelBuffer
  private val STAT  = "STAT": ChannelBuffer
  private val VALUE = "VALUE": ChannelBuffer

  private val EmptyValueLines = ValueLines(Seq.empty)

  private val NeedMoreData: Decoding = null
}

class Decoder extends AbstractDecoder with StateMachine {
  import Decoder._

  case object AwaitingResponse extends State
  case class AwaitingResponseOrEnd(valuesSoFar: Seq[TokensWithData]) extends State
  case class AwaitingStatsOrEnd(valuesSoFar: Seq[Tokens]) extends State
  case class AwaitingData(
      valuesSoFar: Seq[TokensWithData],
      tokens: Seq[ChannelBuffer],
      bytesNeeded: Int)
    extends State

  final protected[memcached] def start() {
    state = AwaitingResponse
  }

  private[this] val awaitingResponseContinue: Seq[ChannelBuffer] => Decoding = { tokens =>
    if (isEnd(tokens)) {
      EmptyValueLines
    } else if (isStats(tokens)) {
      awaitStatsOrEnd(Seq(Tokens(tokens.map(ChannelBufferBuf.Owned(_)))))
      NeedMoreData
    } else {
      Tokens(tokens.map(ChannelBufferBuf.Owned(_)))
    }
  }

  def decode(ctx: ChannelHandlerContext, channel: Channel, buffer: ChannelBuffer): Decoding = {
    state match {
      case AwaitingResponse =>
        decodeLine(buffer, needsData)(awaitingResponseContinue)

      case AwaitingStatsOrEnd(linesSoFar) =>
        decodeLine(buffer, needsData) { tokens =>
          if (isEnd(tokens)) {
            StatLines(linesSoFar)
          } else if (isStats(tokens)) {
            awaitStatsOrEnd(linesSoFar :+ Tokens(tokens.map(ChannelBufferBuf.Owned(_))))
            NeedMoreData
          } else {
            throw new ServerError("Invalid reply from STATS command")
          }
        }
      case AwaitingData(valuesSoFar, tokens, bytesNeeded) =>
        decodeData(bytesNeeded, buffer) { data =>
          awaitResponseOrEnd(
            valuesSoFar :+
              TokensWithData(tokens.map(ChannelBufferBuf.Owned(_)), ChannelBufferBuf.Owned(data))
          )
          NeedMoreData
        }
      case AwaitingResponseOrEnd(valuesSoFar) =>
        decodeLine(buffer, needsData) { tokens =>
          if (isEnd(tokens)) {
            ValueLines(valuesSoFar)
          } else NeedMoreData
        }
    }
  }

  final protected[memcached] def awaitData(tokens: Seq[ChannelBuffer], bytesNeeded: Int): Unit = {
    state match {
      case AwaitingResponse =>
        awaitData(Nil, tokens, bytesNeeded)
      case AwaitingResponseOrEnd(valuesSoFar) =>
        awaitData(valuesSoFar, tokens, bytesNeeded)
    }
  }

  private[this] def awaitData(
    valuesSoFar: Seq[TokensWithData],
    tokens: Seq[ChannelBuffer],
    bytesNeeded: Int
  ): Unit = {
    state = AwaitingData(valuesSoFar, tokens, bytesNeeded)
  }

  private[this] def awaitResponseOrEnd(valuesSoFar: Seq[TokensWithData]): Unit = {
    state = AwaitingResponseOrEnd(valuesSoFar)
  }

  private[this] def awaitStatsOrEnd(valuesSoFar: Seq[Tokens]): Unit = {
    state = AwaitingStatsOrEnd(valuesSoFar)
  }

  private[this] def isEnd(tokens: Seq[ChannelBuffer]) =
    tokens.length == 1 && tokens.head == END

  private[this] def isStats(tokens: Seq[ChannelBuffer]) =
    tokens.nonEmpty && (tokens.head == STAT || tokens.head == ITEM)

  private[this] val needsData: Seq[ChannelBuffer] => Int = { tokens =>
    val responseName = tokens.head
    if (responseName == VALUE) {
      validateValueResponse(tokens)
      tokens(3).toInt
    } else -1
  }

  private[this] def validateValueResponse(args: Seq[ChannelBuffer]) {
    if (args.length < 4) throw new ServerError("Too few arguments")
    if (args.length > 5) throw new ServerError("Too many arguments")
    if (args.length == 5 && !ParserUtils.isDigits(args(4))) throw new ServerError("CAS must be a number")
    if (!ParserUtils.isDigits(args(3))) throw new ServerError("Bytes must be number")
  }
}


text:
import {initialiseData} from "../../../common";

import template from "./inline-measurable-rating-panel.html";
import {CORE_API} from "../../../common/services/core-api-utils";

const bindings = {
    parentEntityRef: "<",
    measurableCategoryRef: "<",
};

const initialState = {
    categories: [],
    measurableCategory: {},
    ratings: [],
    ratingSchemesById: {},
    measurables: []
};

function controller($q, serviceBroker) {
    const vm = initialiseData(this, initialState);

    const loadData = () => {
        serviceBroker
            .loadAppData(CORE_API.MeasurableStore.findAll)
            .then(r => vm.measurables = _
                .filter(r.data, d => d.categoryId === vm.measurableCategoryRef.id));

        serviceBroker
            .loadViewData(CORE_API.MeasurableRatingStore.findForEntityReference,
                [vm.parentEntityRef],
                {force: true})
            .then(r => vm.ratings = r.data);

        serviceBroker.loadViewData(CORE_API.RatingSchemeStore.findRatingsForEntityAndMeasurableCategory,
            [vm.parentEntityRef, vm.measurableCategoryRef.id])
            .then(r => vm.ratingSchemeItems = r.data);
    };

    vm.$onChanges = (changes) => {
        if(vm.parentEntityRef && vm.measurableCategoryRef){
            loadData();
        }
    };
}

controller.$inject = [
    "$q",
    "ServiceBroker"
];

const component = {
    template,
    bindings,
    controller
};

export default {
    component,
    id: "waltzInlineMeasurableRatingPanel"
};


text:
title: Consultation sur la simplification de la procédure d'autorisation environnementale
link: http://www.consultations-publiques.developpement-durable.gouv.fr/decret-relatif-a-la-simplification-de-la-procedure-a1941.html
opendata:
description: Ministère de la Transition Écologique et Solidaire
organisateur : Ministère de la Transition Écologique et Solidaire
outil:
- Autre
methodes:
- Les consultations en ligne
screenshot: min-agri.png
date: 2019-04-16 09:29:08 +0000
in_progress: false
note-citoyenne: 5
note-decidee: 4
---

Organisé par le Ministère de la Transition Écologique et Solidaire. Type de consultation : Appel à commentaires.
Date de fin : 6 mai 2019

La procédure d'autorisation environnementale, qui concerne pour l'essentiel les installations classées pour la protection de l'environnement et les installations, ouvrages, activités et travaux au titre de la loi sur l'eau soumis à autorisation, est constituée de trois phases principales :

une phase d'examen, lors de laquelle le service instructeur mène différentes consultations administratives pour le compte du préfet, essentiellement au sein de l'Etat mais aussi auprès de commissions spécialisées ;
une phase d'enquête publique ;
une phase de décision avec la délivrance de l'autorisation assortie de prescriptions, ou d'un refus.

Cette procédure a été mise en place en 2017 pour intégrer dans la même décision administrative, après l'instruction d'un dossier rassemblant tous les éléments, des aspects précédemment traités de manière séparée (espèces protégées, défrichement, etc.).

Quatre axes sont traités par le projet de décret :

La dématérialisation de la procédure
La possibilité de mieux proportionner les consultations
Le lancement plus rapide de l'enquête publique
La fluidification de la fin de la procédure


text:
package org.kaaproject.kaa.server.admin.client.mvp.activity;

import org.kaaproject.kaa.common.dto.logs.LogAppenderDto;
import org.kaaproject.kaa.server.admin.client.KaaAdmin;
import org.kaaproject.kaa.server.admin.client.mvp.ClientFactory;
import org.kaaproject.kaa.server.admin.client.mvp.activity.grid.AbstractDataProvider;
import org.kaaproject.kaa.server.admin.client.mvp.data.AppendersDataProvider;
import org.kaaproject.kaa.server.admin.client.mvp.place.LogAppenderPlace;
import org.kaaproject.kaa.server.admin.client.mvp.place.LogAppendersPlace;
import org.kaaproject.kaa.server.admin.client.mvp.view.BaseListView;

import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.view.client.MultiSelectionModel;

public class LogAppendersActivity extends AbstractListActivity<LogAppenderDto, LogAppendersPlace> {

    private String applicationId;

    public LogAppendersActivity(LogAppendersPlace place, ClientFactory clientFactory) {
        super(place, LogAppenderDto.class, clientFactory);
        this.applicationId = place.getApplicationId();
    }

    @Override
    protected BaseListView<LogAppenderDto> getView() {
        return clientFactory.getAppendersView();
    }

    @Override
    protected AbstractDataProvider<LogAppenderDto> getDataProvider(MultiSelectionModel<LogAppenderDto> selectionModel) {
        return new AppendersDataProvider(selectionModel, listView, applicationId);
    }

    @Override
    protected Place newEntityPlace() {
        return new LogAppenderPlace(applicationId, "");
    }

    @Override
    protected Place existingEntityPlace(String id) {
        return new LogAppenderPlace(applicationId, id);
    }

    @Override
    protected void deleteEntity(String id, AsyncCallback<Void> callback) {
        KaaAdmin.getDataSource().removeLogAppender(id, callback);
    }

}


text:
URI: reverse_proxy.html.en
Content-Language: en
Content-type: text/html; charset=ISO-8859-1

URI: reverse_proxy.html.es
Content-Language: es
Content-type: text/html; charset=ISO-8859-1


text:
class ContainerDefinition < ApplicationRecord
  # :name, :image, :image_pull_policy, :memory, :cpu
  belongs_to :container_group
  belongs_to :ext_management_system, :foreign_key => :ems_id
  has_many :container_port_configs, :dependent => :destroy
  has_many :container_env_vars,     :dependent => :destroy
  has_one :container,               :dependent => :destroy
  has_one :security_context,        :as => :resource, :dependent => :destroy
  has_one :container_image,         :through => :container

  def disconnect_inv
    _log.info "Disconnecting Container definition [#{name}] id [#{id}]"
    self.container.try(:disconnect_inv)
    self.deleted_on = Time.now.utc
    self.container_group = nil
    self.old_ems_id = self.ems_id
    self.ems_id = nil
    save
  end
end


text:
'use strict'

const t = require('tap')
const test = t.test

const { Hooks } = require('../../lib/hooks')
const noop = () => {}

test('hooks should have 4 array with the registered hooks', t => {
  const hooks = new Hooks()
  t.is(typeof hooks, 'object')
  t.ok(Array.isArray(hooks.onRequest))
  t.ok(Array.isArray(hooks.onSend))
  t.ok(Array.isArray(hooks.preParsing))
  t.ok(Array.isArray(hooks.preValidation))
  t.ok(Array.isArray(hooks.preHandler))
  t.ok(Array.isArray(hooks.onResponse))
  t.ok(Array.isArray(hooks.onError))
  t.end()
})

test('hooks.add should add a hook to the given hook', t => {
  const hooks = new Hooks()
  hooks.add('onRequest', noop)
  t.is(hooks.onRequest.length, 1)
  t.is(typeof hooks.onRequest[0], 'function')

  hooks.add('preParsing', noop)
  t.is(hooks.preParsing.length, 1)
  t.is(typeof hooks.preParsing[0], 'function')

  hooks.add('preValidation', noop)
  t.is(hooks.preValidation.length, 1)
  t.is(typeof hooks.preValidation[0], 'function')

  hooks.add('preHandler', noop)
  t.is(hooks.preHandler.length, 1)
  t.is(typeof hooks.preHandler[0], 'function')

  hooks.add('onResponse', noop)
  t.is(hooks.onResponse.length, 1)
  t.is(typeof hooks.onResponse[0], 'function')

  hooks.add('onSend', noop)
  t.is(hooks.onSend.length, 1)
  t.is(typeof hooks.onSend[0], 'function')

  hooks.add('onError', noop)
  t.is(hooks.onError.length, 1)
  t.is(typeof hooks.onError[0], 'function')
  t.end()
})

test('hooks should throw on unexisting handler', t => {
  t.plan(1)
  const hooks = new Hooks()
  try {
    hooks.add('onUnexistingHook', noop)
    t.fail()
  } catch (e) {
    t.pass()
  }
})

test('should throw on wrong parameters', t => {
  const hooks = new Hooks()
  t.plan(4)
  try {
    hooks.add(null, noop)
    t.fail()
  } catch (e) {
    t.is(e.code, 'FST_ERR_HOOK_INVALID_TYPE')
    t.is(e.message, 'The hook name must be a string')
  }

  try {
    hooks.add('', null)
    t.fail()
  } catch (e) {
    t.is(e.code, 'FST_ERR_HOOK_INVALID_HANDLER')
    t.is(e.message, 'The hook callback must be a function')
  }
})


text: tinymce.PluginManager.add("example_dependency",function(){},["example"]);


text:
var FamousEngine = require('famous/core/FamousEngine');
var DOMElement = require('famous/dom-renderables/DOMElement');

var Size = require('famous/components/Size');
var Position = require('famous/components/Position');

var Rotation = require('famous/components/Rotation');
var Position = require('famous/components/Position');

var MenuPanel = require('./menuPanel.js');
var LayoutManager = require('./layoutManager.js');
var MainDisplayPanel = require('./mainDisplayPanel.js');
var CatMenuDisplayPanel = require('./catMenuDisplayPanel.js');

function App(scene) {

    LayoutManager.calcAppDimensions();

    var APP_WIDTH  = LayoutManager.getAppDimensionWidth();
    var APP_HEIGHT = LayoutManager.getAppDimensionHeight();;
    var APP_DEPTH = 100;

    var that = this;

    this.rootNode = scene.addChild();
    this.rootNode.selElement = null;

    this.rootNode.setProportionalSize(1,1,1)
        .setAlign(0,0);

    this.rootWidth = APP_WIDTH ;
    this.rootHeight = APP_HEIGHT;

    this.context = {
      appscene : scene,
      approot  : this
    }

    //Create the background Node and Div for the Signage
    this.backgroundNode = this.rootNode.addChild();
    this.backgroundDIV = new DOMElement(this.backgroundNode, {
       //content : "Famous Collaboration",
       properties:{
         'background-color':'rgb(218, 214, 214)',

       }
    });

    this.rootNode.headerNode = this.rootNode.addChild();
    this.rootNode.headerNode.setProportionalSize(1,0.1).setPosition(0,0,100);

    this.headerDIV = new DOMElement(this.rootNode.headerNode, {
       content : "JobRiver",
       properties:{
         /*'background-color':'rgb(96, 87, 212)',*/
         'background': '-webkit-linear-gradient(left, rgb(36, 48, 151), rgb(142, 142, 217))',
         'color' : 'white',
         'font-size' : '8vh',
         'font-style': 'italic'
       }
    });

    this.rootNode.menuPanel = new MenuPanel(this.rootNode.addChild(),this.context);
    this.rootNode.mainDisplayPanel = new MainDisplayPanel(this.rootNode.addChild(),this.context);

    this.rootNode.catSelPanel = new CatMenuDisplayPanel(this.rootNode.addChild(),this.context);

    //Add size change component to RootNode

    this.rootNode.addComponent({
        id : null,
        node : null,
        onMount: function (node) {
            this.id = node.addComponent(this);
            node.requestUpdate(this.id);
            this.node = node;
        },
        onSizeChange: function(sizew,sizeh){
          console.log(sizew,sizeh);

          LayoutManager.calcAppDimensions();
          console.log("LayoutManager width " + LayoutManager.getAppDimensionWidth());

          APP_WIDTH  = window.innerWidth;
          APP_HEIGHT = window.innerHeight;

          //this.node.menuPanel.getParentNode().setPosition(0, LayoutManager.getAppHeaderHeight());
          //this.node.mainDisplayPanel.getParentNode().setPosition(0, LayoutManager.getAppHeaderHeight() + LayoutManager.getAppMenuHeight());

        }
    });

    this.backgroundNode.onReceive = function(event,payload){

      if(event==='click'){
          that.context.appscene.emit("deselect");
      }

    }

    this.rootNode.onReceive = function(event,payload){

      console.log(event,payload);
      if(event==='menuchange'){
        if(payload == 1){
          that.activateCatMenu();
        } else if (payload == 0){
          that.activateMainDisplay();
          that.rootNode.menuPanel.changeCaption("All Categories");
        }
      } else if(event==='triggercat') {
        that.activateCatDisplay(payload);
        that.rootNode.menuPanel.changeCaption(payload);

      } else if(event==='jobdetails') {
        that.activateJobDetailsDisplay(payload);

      } else if(event==='removeoverlay') {
        that.deactivateJobDetailsDisplay();
      }

    }

}

App.prototype.activateCatMenu = function(){

  this.rootNode.mainDisplayPanel.halt();
  this.rootNode.catSelPanel.show();

}

App.prototype.activateMainDisplay = function(){

  this.rootNode.mainDisplayPanel.activateMainDisplay();

}

App.prototype.activateCatDisplay = function(catname){

  this.rootNode.mainDisplayPanel.activateCatDisplay(catname);
  this.rootNode.catSelPanel.hide();
}

App.prototype.activateJobDetailsDisplay = function(jobcode){

  for(var i = 0; i < jobList.jobs.length;i++){

    if(jobList.jobs[i]['Code'] == jobcode){

        this.rootNode.mainDisplayPanel.activateJobDetailsDisplay(jobList.jobs[i]);
        this.rootNode.menuPanel.setOverlayMode(jobcode);
        break;
    }

  }

}

App.prototype.deactivateJobDetailsDisplay = function(){

  this.rootNode.mainDisplayPanel.deactivateJobDetailsDisplay();
  this.rootNode.menuPanel.unsetOverlayMode();
}

module.exports = App;


text:
import {defaults, get} from 'lodash'
import {Item, Folder} from '../../models'
import Promise from 'bluebird'
import {t} from '../../common/utils'
const s = require('sugar')

export class catalogfolder {
  constructor(renderContext) {
    this.tags = ['catalogfolder']
  }

  parse(parser, nodes, lexer) {
    const tok = parser.nextToken();

    const root = parser.parseSignature(null, true);
    parser.advanceAfterBlockEnd(tok.value);

    let body = parser.parseUntilBlocks('endcatalogfolder');
    parser.advanceAfterBlockEnd();

    return new nodes.CallExtensionAsync(this, 'run', root, [body]);
  }

  async run({ctx}, catalog, options, body, callback) {
    if (ctx.inspect) {
      return callback(null, '')
    }

    try {
      const opts = defaults(options, {as: 'item', filter: '{}', sort: 'position'})
      const key = opts.as
      const originalValue = ctx[key]
      let folder
      let q
      const scope = get(ctx.site.documentTypes, [catalog, 'scopes', ctx.page.params])
      if (scope) {
        folder = {name: t(scope.label, ctx.req.locale)}
        q = eval(`(${scope.filter})`)
        if (scope.sort) {
          opts.sort = scope.sort
        }
      } else {
        folder = await Folder.findOne({catalog, site: ctx.site._id, _id: ctx.page.params})
        if (!folder) {
          callback(null, '')
          return
        }
        folder = await folder.toContext(ctx.req)
        q = {catalog, site: ctx.site._id, folder: ctx.page.params, deleted: false}
      }

      let items = Item.find(q).sort(opts.sort)
      folder.count = await Item.count(q)
      if (opts.pageSize) {
        let page = ctx.req.query.page
        if (!page || isNaN(page)) {
          page = 1
        }
        folder.pageNumber = Number(page)
        folder.pagesCount = Math.ceil(folder.count / opts.pageSize)
        items = items.skip((page - 1) * opts.pageSize).limit(opts.pageSize)
      }
      folder.items = await Promise.map(await items, item => item.toContext(ctx.req))
      ctx[key] = folder
      const result = await new Promise((resolve, reject) => {
        body((error, html) => {
          if (error) { reject(error) }
          else { resolve(html) }
        })
      })
      ctx[key] = originalValue

      callback(null, result)

    } catch (e) {
      console.error(e);
      callback(e)
    }
  }
}


text:
#include "tensorflow/core/distributed_runtime/device_resolver_distributed.h"

#include "tensorflow/core/common_runtime/device_mgr.h"
#include "tensorflow/core/distributed_runtime/test_utils.h"
#include "tensorflow/core/lib/core/notification.h"
#include "tensorflow/core/lib/core/status_test_util.h"
#include "tensorflow/core/lib/strings/strcat.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/test.h"
#include "tensorflow/core/util/device_name_utils.h"

namespace tensorflow {
namespace {

// Subclass of DeviceResolverDistributed which behaves identically but
// allows access to the attr_table_.
class TestableDeviceResolverDistributed : public DeviceResolverDistributed {
 public:
  TestableDeviceResolverDistributed(const DeviceMgr* dev_mgr,
                                    WorkerCacheInterface* worker_cache,
                                    const string& task)
      : DeviceResolverDistributed(dev_mgr, worker_cache, task) {}

  gtl::FlatMap<string, DeviceAttributes>& attr_table() { return attr_table_; }
};

// Create a fake 'Device' whose only interesting attribute is a non-default
// DeviceLocality.
static Device* NewDevice(const string& type, const string& name,
                         int numa_node) {
  class FakeDevice : public Device {
   public:
    explicit FakeDevice(const DeviceAttributes& attr) : Device(nullptr, attr) {}
    Status Sync() override { return Status::OK(); }
    Allocator* GetAllocator(AllocatorAttributes) override { return nullptr; }
  };
  DeviceAttributes attr;
  attr.set_name(name);
  attr.set_device_type(type);
  attr.mutable_locality()->set_numa_node(numa_node);
  return new FakeDevice(attr);
}

// Create a fake WorkerInterface that responds to requests without RPCs,
// in this case returning the DeviceAttributes of a fake remote worker.
class FakeWorker : public TestWorkerInterface {
 public:
  FakeWorker(const string& name, DeviceMgr* dev_mgr,
             DeviceResolverDistributed* dres)
      : name_(name), device_mgr_(dev_mgr), device_resolver_(dres) {}

  void GetStatusAsync(const GetStatusRequest* request,
                      GetStatusResponse* response,
                      StatusCallback done) override {
    std::vector<DeviceAttributes> dev_attr;
    device_mgr_->ListDeviceAttributes(&dev_attr);
    for (const auto& da : dev_attr) {
      *response->add_device_attributes() = da;
    }
    done(Status::OK());
  }

 private:
  string name_;
  DeviceMgr* device_mgr_;
  DeviceResolverDistributed* device_resolver_;
};

// An implementation of WorkerCacheInterface that routes all requests
// to local FakeWorkers, implementing only the methods needed for tests.
class FakeCache : public TestWorkerCache {
 public:
  // Override the Locality methods to actually pass through to the
  // worker.
  bool GetDeviceLocalityNonBlocking(const string& device,
                                    DeviceLocality* locality) override {
    return false;
  }

  void GetDeviceLocalityAsync(const string& device, DeviceLocality* locality,
                              StatusCallback done) override {
    string task_name;
    string dev_part;
    if (!DeviceNameUtils::SplitDeviceName(device, &task_name, &dev_part)) {
      done(errors::Internal("failed to parse device name"));
      return;
    }
    auto it = workers_.find(task_name);
    if (it == workers_.end()) {
      done(errors::Internal("failed to find worker ", task_name));
      return;
    }
    WorkerInterface* wi = it->second;
    GetStatusRequest req;
    GetStatusResponse resp;
    Notification note;
    Status status = wi->GetStatus(&req, &resp);
    if (!status.ok()) {
      done(status);
      return;
    }
    for (const auto& it : resp.device_attributes()) {
      if (it.name() == device) {
        *locality = it.locality();
        done(Status::OK());
        return;
      }
    }
    done(errors::Internal("device not found: ", device));
  }
};

class DeviceResDistTest : public ::testing::Test {
 protected:
  DeviceResDistTest() {}

  ~DeviceResDistTest() override {
    for (DeviceMgr* dm : device_mgrs_) {
      delete dm;
    }
    for (auto it : resolvers_) {
      delete it.second;
    }
    for (FakeWorker* w : workers_) {
      delete w;
    }
  }

  void DefineWorkers(int num_workers, int num_devices,
                     const string& device_type) {
    for (int w = 0; w < num_workers; ++w) {
      string name = strings::StrCat("/job:worker/replica:0/task:", w);
      DefineWorker(name, device_type, num_devices);
    }
  }

  void DefineWorker(const string& worker_name, const string& device_type,
                    int num_devices) {
    std::vector<Device*> devices;
    for (int i = 0; i < num_devices; ++i) {
      devices.push_back(NewDevice(
          device_type,
          strings::StrCat(worker_name, "/device:", device_type, ":", i), i));
    }
    DeviceMgr* dev_mgr = new DeviceMgr(devices);
    TestableDeviceResolverDistributed* dev_res =
        new TestableDeviceResolverDistributed(dev_mgr, &wc_, worker_name);
    resolvers_[worker_name] = dev_res;
    device_mgrs_.push_back(dev_mgr);
    std::vector<string>* dv = &dev_by_task_[worker_name];
    for (auto d : devices) {
      dv->push_back(d->name());
    }
    FakeWorker* fw = new FakeWorker(worker_name, dev_mgr, dev_res);
    workers_.push_back(fw);
    wc_.AddWorker(worker_name, fw);
  }

  FakeCache wc_;
  std::vector<DeviceMgr*> device_mgrs_;
  std::unordered_map<string, TestableDeviceResolverDistributed*> resolvers_;
  std::unordered_map<string, std::vector<string>> dev_by_task_;
  std::vector<FakeWorker*> workers_;
};

TEST_F(DeviceResDistTest, Workers3Devices4) {
  DefineWorkers(3, 4, "CPU");
  // Check that every device is available from every task.
  for (auto it : resolvers_) {
    DeviceResolverDistributed* dres = it.second;
    for (auto it2 : dev_by_task_) {
      const string& task_name = it2.first;
      for (const auto& dev_name : it2.second) {
        DeviceNameUtils::ParsedName parsed;
        ASSERT_TRUE(DeviceNameUtils::ParseFullName(dev_name, &parsed));
        Notification note;
        Status status;
        DeviceLocality locality;
        dres->GetLocalityAsync(dev_name, task_name, &locality,
                               [this, &note, &status](const Status& s) {
                                 status = s;
                                 note.Notify();
                               });
        note.WaitForNotification();
        TF_EXPECT_OK(status);
        EXPECT_EQ(parsed.id, locality.numa_node());
      }
    }
  }
  // Clear just task 0 from all.
  const string w0_name = "/job:worker/replica:0/task:0";
  for (auto it : resolvers_) {
    if (it.first == w0_name) continue;
    TestableDeviceResolverDistributed* dres = it.second;
    EXPECT_EQ(8, it.second->attr_table().size());
    dres->ClearTask("/job:worker/replica:0/task:0");
    EXPECT_EQ(4, it.second->attr_table().size());
  }
}

}  // namespace
}  // namespace tensorflow


text:
package javax.swing;

import java.beans.*;
import java.util.*;

import java.awt.*;
import java.awt.event.*;

import java.io.Serializable;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.IOException;

import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.border.*;

import javax.accessibility.*;

/**
 * The default model for combo boxes.
 *
 * @author Arnaud Weber
 * @author Tom Santos
 */

public class DefaultComboBoxModel extends AbstractListModel implements MutableComboBoxModel, Serializable {
    Vector objects;
    Object selectedObject;

    /**
     * Constructs an empty DefaultComboBoxModel object.
     */
    public DefaultComboBoxModel() {
        objects = new Vector();
    }

    /**
     * Constructs a DefaultComboBoxModel object initialized with
     * an array of objects.
     *
     * @param items  an array of Object objects
     */
    public DefaultComboBoxModel(final Object items[]) {
        objects = new Vector();
        objects.ensureCapacity( items.length );

        int i,c;
        for ( i=0,c=items.length;i<c;i++ )
            objects.addElement(items[i]);

        if ( getSize() > 0 ) {
            selectedObject = getElementAt( 0 );
        }
    }

    /**
     * Constructs a DefaultComboBoxModel object initialized with
     * a vector.
     *
     * @param v  a Vector object ...
     */
    public DefaultComboBoxModel(Vector<?> v) {
        objects = v;

        if ( getSize() > 0 ) {
            selectedObject = getElementAt( 0 );
        }
    }

    // implements javax.swing.ComboBoxModel
    /**
     * Set the value of the selected item. The selected item may be null.
     * <p>
     * @param anObject The combo box value or null for no selection.
     */
    public void setSelectedItem(Object anObject) {
        if ((selectedObject != null && !selectedObject.equals( anObject )) ||
            selectedObject == null && anObject != null) {
            selectedObject = anObject;
            fireContentsChanged(this, -1, -1);
        }
    }

    // implements javax.swing.ComboBoxModel
    public Object getSelectedItem() {
        return selectedObject;
    }

    // implements javax.swing.ListModel
    public int getSize() {
        return objects.size();
    }

    // implements javax.swing.ListModel
    public Object getElementAt(int index) {
        if ( index >= 0 && index < objects.size() )
            return objects.elementAt(index);
        else
            return null;
    }

    /**
     * Returns the index-position of the specified object in the list.
     *
     * @param anObject
     * @return an int representing the index position, where 0 is
     *         the first position
     */
    public int getIndexOf(Object anObject) {
        return objects.indexOf(anObject);
    }

    // implements javax.swing.MutableComboBoxModel
    public void addElement(Object anObject) {
        objects.addElement(anObject);
        fireIntervalAdded(this,objects.size()-1, objects.size()-1);
        if ( objects.size() == 1 && selectedObject == null && anObject != null ) {
            setSelectedItem( anObject );
        }
    }

    // implements javax.swing.MutableComboBoxModel
    public void insertElementAt(Object anObject,int index) {
        objects.insertElementAt(anObject,index);
        fireIntervalAdded(this, index, index);
    }

    // implements javax.swing.MutableComboBoxModel
    public void removeElementAt(int index) {
        if ( getElementAt( index ) == selectedObject ) {
            if ( index == 0 ) {
                setSelectedItem( getSize() == 1 ? null : getElementAt( index + 1 ) );
            }
            else {
                setSelectedItem( getElementAt( index - 1 ) );
            }
        }

        objects.removeElementAt(index);

        fireIntervalRemoved(this, index, index);
    }

    // implements javax.swing.MutableComboBoxModel
    public void removeElement(Object anObject) {
        int index = objects.indexOf(anObject);
        if ( index != -1 ) {
            removeElementAt(index);
        }
    }

    /**
     * Empties the list.
     */
    public void removeAllElements() {
        if ( objects.size() > 0 ) {
            int firstIndex = 0;
            int lastIndex = objects.size() - 1;
            objects.removeAllElements();
            selectedObject = null;
            fireIntervalRemoved(this, firstIndex, lastIndex);
        } else {
            selectedObject = null;
        }
    }
}


text:
@implementation KVOUITableViewController

#include "SuperKVOPrivateImplementation.h"

@end


text:
{{--

The MIT License (MIT)

WebCBT - Web based Cognitive Behavioral Therapy tool

http://webcbt.github.io

Copyright (c) 2014 Prashant Shah <pshah.webcbt@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

--}}

<!DOCTYPE html>

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

        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">

        {{ HTML::style('css/jquery-ui.min.css') }}
        {{ HTML::style('css/jquery-ui.structure.min.css') }}
        {{ HTML::style('css/jquery-ui.theme.min.css') }}
	{{ HTML::style('css/jquery-ui-timepicker-addon.css') }}
        {{ HTML::script('js/jquery-1.11.1.min.js') }}
        {{ HTML::script('js/jquery-ui.min.js') }}

        {{ HTML::script('js/jquery-ui-timepicker-addon.js') }}
        {{ HTML::style('css/jquery-ui-timepicker-addon.css') }}

        {{ HTML::style('css/bootstrap.min.css') }}
        {{ HTML::style('css/bootstrap-theme.min.css') }}
        {{ HTML::script('js/bootstrap.min.js') }}

        {{ HTML::style('css/bootstrap-select.min.css') }}
        {{ HTML::script('js/bootstrap-select.min.js') }}

        {{ HTML::script('js/Chart.min.js') }}

        {{ HTML::script('js/rails.js') }}

        @define $time = rand(0, 1000)

        {{ HTML::style('css/style.css?' . $time) }}

        @yield('head')

			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
				Toggle navigation

			</button>

 {{ Config::get('webcbt.SITE_NAME') }}

					{{ HTML::decode(HTML::linkAction(
					'DashboardController@getIndex',
					' Back to Dashboard')) }}

					{{ HTML::decode(HTML::linkAction(
					'UsersController@getLogout',
					' Logout')) }}

@yield('page-title')

			@if (Session::has('alert-success'))

				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
				{{ Session::get('alert-success') }}

			@endif
			@if (Session::has('alert-danger'))

				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
				{{ Session::get('alert-danger') }}

			@endif

				@yield('content')


text:
A framework for making 2D decision based games, built using C# and OpenTK.
Independent audio playback is supported by the ZPlay framework.
Video playback (with accompanying audio) is supported by the nVLC framework.

## Getting Started

Nothing to see here yet

## Dependencies

* VLC 1.1+ is required for video playback

## Setting Up

Nothing to set up currently.

## Current Tasks
* Rewrite SpriteBatch
* Rethink components to make serialization easier. Currently you have a ridiculous amount of properties for a single component, not to mention how to handle children...
* Refactor how the resource managers work, there's a lot of hardcoding to stuff like shaders which is not good!


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

[Download]
| [Documentation Index] | [Release Note]

WSO2 Application Server Class Loading

Contents

                Introduction

                Class Loading for Web Services

                        Parent First Class Loading

                        Child First Class Loading

                        Enabling Child First Class Loading for a particular Service

                Class Loading for Web Applications

Introduction

Most of the time, real Web Services and Web Applications which are deployed in
        production environments depend on external libraries for different functionalities.
        Web Services and Web Applications deployed in AppServer can load classes from
        different locations. Therefore, it is important to understand how you can place
        your external dependencies within WSO2 AppServer in the most suitable manner
        according to your requirement.

Class Loading for Web Services

Note: If any of the folders specified in this document doesn't exist by default,
        you can create those manually.

There are different kinds of services like AAR services, JAX-WS services etc.
        that can be deployed in WSO2 AppServer. You can upload those services from
        the management console. However, finally those service archives will be written
        to the relevant folder under the following location of the file system.

CARBON_HOME/repository/deployment/server/

In this folder, there are separate sub folders for different types of services.
        Those are called deployment folders for different service types.

Ex:

        AAR Services - CARBON_HOME/repository/deployment/server/axis2services
        JAX-WS Services - CARBON_HOME/repository/deployment/server/servicejars

These services can load classes from 4 different locations. Numbers 1, 2, 3, 4 will
        be used to refer the above 4 locations respectively.

CARBON_HOME/repository/components/lib

When a .jar file is copied into this location, it will be converted into an
                OSGi bundle and injected into the Carbon OSGi runtime. Any other OSGi bundle
                can import packages provided by the copied .jar file. We recommend users to
                copy external libraries into this location when it is necessary to make the
                dependency available within the OSGi environment.

Ex: If you've installed mediation features into WSO2 AppServer
                and you want to share the same library between a mediator and a AAR service.

Note: If your external dependency is already an OSGi bundle,
                you can directly copy that bundle into CARBON_HOME/repository/components/dropins
                folder and the behavior will be the same as above.

CARBON_HOME/repository/deployment/server/lib

As mentioned above, all sub folders relevant to different service types exist
                under the "server" folder. So this 'lib' is the place to copy libraries which
                should be shared across different services of different service types.

Ex: If you have a AAR service and a JAX-WS service which shares
                the same dependency, you can copy it into this location.

CARBON_HOME/repository/deployment/server/<deployment_folder>/lib

The "deployment_folder" here is the relevant folder for the service type. For
                AAR services, it is "axis2services". This 'lib' is the place to copy libraries
                which should be shared across different services of the same service type.

Ex: If you have two different AAR services which shares the
                same dependency, you can copy it into the axis2services/lib folder.

'lib' folder inside the service archive file

You can include your external libraries into the service archive file itself.
                Create a 'lib' folder on the top level of your archive file and include the
                dependency inside that folder. This is recommended to be done when the external
                library is used only by the particular service.

Ex: If your StudentMarks.aar service depends on foo.jar, embed
                the .jar file inside the AAR file as shown below.

                StudentMarks.aar
                    - META-INF
                        - services.xml
                    - lib
                        - foo.jar
                    - org
                        - wso2
                            - sample
                                - Marks.class

Now let's have a look at how we can change the class loading behavior among the above
        mentioned locations.

Parent First Class Loading

WSO2 AppServer follows parent first class loading by default. You can see that by
        opening the CARBON_HOME/repository/conf/axis2.xml file and checking the following
        parameter.

<parameter name="EnableChildFirstClassLoading">false</parameter>

That means the priority reduces in the order 1 > 2 > 3 > 4 above. So when loading
        classes, highest priority is given to location 1 above and the least priority is
        give to location 4 above.

Ex: If you have two different versions of the same library in 1 and 3
        above and your AAR service depends on that library, classes will be loaded from the library
        in location 1.

Child First Class Loading

If you want to enable child first class loading, you can do that by opening the
        CARBON_HOME/repository/conf/axis2.xml file and setting the value of the following
        parameter to 'true'.

<parameter name="EnableChildFirstClassLoading">true</parameter>

That means the priority reduces in the order 4 > 3 > 2 > 1 above. So when loading
        classes, highest priority is given to location 4 above and the least priority is give
        to location 1 above.

Ex: If you have two different versions of the same library in 1
        and 3 above and your AAR service depends on that library, classes will be loaded from
        the library in location 3.

Enabling Child First Class Loading for a particular Service

If you want to enable child first class loading only for a particular AAR service while
        the overall server behavior remains parent first, you can add the above parameter
        into the META-INF/services.xml file of the AAR file.

<parameter name="EnableChildFirstClassLoading">true</parameter>

Ex: If you have two different versions of the same library in
        location 1 and 4 above, adn your service depends on that library, classes will be loaded
        from the library in location 4.

Note: You can only control the behavior of location 4 using this method.
        Therefore, use this method only when you've embedded your libraries inside your
        service archive.

Class Loading for Web Applications

Web Applications deployed in WSO2 AppServer can load classes from two locations.

CARBON_HOME/lib

If you want to share the same library between two Web Applications, you can
                copy that into this location.

<webapp_name>.war/WEB-INF/lib

Libraries which is only used by a particular .war file can be put into
                this location.

Important: You have to be careful when copying libraries into above
        location 1 as it can change the behavior of the server if a conflict occurs with the
        existing libraries. Therefore, it is recommended to use location 2 whenever possible.

Class loading pattern for Web Applications is always child first and you can't change
        it. Therefore location 2 above is always given the highest priority when the same library
        exists in both locations.


text:
/* MACHINE GENERATED FILE, DO NOT EDIT */

package org.lwjgl.opengl;

import org.lwjgl.*;
import java.nio.*;

public final class ARBTextureStorageMultisample {

	private ARBTextureStorageMultisample() {}

	public static void glTexStorage2DMultisample(int target, int samples, int internalformat, int width, int height, boolean fixedsamplelocations) {
		GL43.glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations);
	}

	public static void glTexStorage3DMultisample(int target, int samples, int internalformat, int width, int height, int depth, boolean fixedsamplelocations) {
		GL43.glTexStorage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations);
	}

	public static void glTextureStorage2DMultisampleEXT(int texture, int target, int samples, int internalformat, int width, int height, boolean fixedsamplelocations) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.glTextureStorage2DMultisampleEXT;
		BufferChecks.checkFunctionAddress(function_pointer);
		nglTextureStorage2DMultisampleEXT(texture, target, samples, internalformat, width, height, fixedsamplelocations, function_pointer);
	}
	static native void nglTextureStorage2DMultisampleEXT(int texture, int target, int samples, int internalformat, int width, int height, boolean fixedsamplelocations, long function_pointer);

	public static void glTextureStorage3DMultisampleEXT(int texture, int target, int samples, int internalformat, int width, int height, int depth, boolean fixedsamplelocations) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.glTextureStorage3DMultisampleEXT;
		BufferChecks.checkFunctionAddress(function_pointer);
		nglTextureStorage3DMultisampleEXT(texture, target, samples, internalformat, width, height, depth, fixedsamplelocations, function_pointer);
	}
	static native void nglTextureStorage3DMultisampleEXT(int texture, int target, int samples, int internalformat, int width, int height, int depth, boolean fixedsamplelocations, long function_pointer);
}


text:
<?php

namespace Rxnet\InfluxDB\Database;

/**
 * @author Stephen "TheCodeAssassin" Hoogendijk
 */
class Exception extends \Rxnet\InfluxDB\Exception
{
}


text:
package com.intellij.refactoring.safeDelete.usageInfo;

import com.intellij.psi.*;
import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.util.IncorrectOperationException;

/**
 * @author dsl
 */
public class SafeDeleteFieldWriteReference extends SafeDeleteReferenceUsageInfo {
  private final PsiAssignmentExpression myExpression;

  public SafeDeleteFieldWriteReference(PsiAssignmentExpression expr, PsiField referencedElement) {
    super(expr, referencedElement, safeRemoveRHS(expr));
    myExpression = expr;
  }

  private static boolean safeRemoveRHS(PsiAssignmentExpression expression) {
    final PsiExpression rExpression = expression.getRExpression();
    final PsiElement parent = expression.getParent();
    return RefactoringUtil.verifySafeCopyExpression(rExpression) == RefactoringUtil.EXPR_COPY_SAFE
                            && parent instanceof PsiExpressionStatement
                            && ((PsiExpressionStatement) parent).getExpression() == expression;
  }

  public void deleteElement() throws IncorrectOperationException {
    myExpression.getParent().delete();
  }

}