text:
package org.kuali.kpme.tklm.api.leave.block;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.kuali.kpme.core.api.KPMEConstants;
import org.kuali.kpme.core.api.accrualcategory.AccrualCategory;
import org.kuali.kpme.core.api.accrualcategory.rule.AccrualCategoryRule;
import org.kuali.kpme.core.api.groupkey.HrGroupKey;
import org.kuali.kpme.core.api.util.KpmeUtils;
import org.kuali.kpme.tklm.api.common.TkConstants;
import org.kuali.rice.core.api.CoreConstants;
import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
import org.kuali.rice.core.api.mo.ModelBuilder;
import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
import org.kuali.rice.core.api.util.jaxb.LocalDateAdapter;
import org.w3c.dom.Element;

@XmlRootElement(name = LeaveBlock.Constants.ROOT_ELEMENT_NAME)
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = LeaveBlock.Constants.TYPE_NAME, propOrder = {
        LeaveBlock.Elements.TASK,
        LeaveBlock.Elements.EARN_CODE,
        LeaveBlock.Elements.ACCRUAL_CATEGORY_RULE,
        LeaveBlock.Elements.ACCRUAL_CATEGORY_OBJ,
        LeaveBlock.Elements.ACCRUAL_CATEGORY_RULE_ID,
        LeaveBlock.Elements.ACCRUAL_CATEGORY,
        LeaveBlock.Elements.SUBMIT,
        LeaveBlock.Elements.BLOCK_ID,
        LeaveBlock.Elements.DESCRIPTION,
        LeaveBlock.Elements.ASSIGNMENT_TITLE,
        LeaveBlock.Elements.CALENDAR_ID,
        LeaveBlock.Elements.EARN_CODE_DESCRIPTION,
        LeaveBlock.Elements.LEAVE_BLOCK_TYPE,
        KPMEConstants.CommonElements.GROUP_KEY_CODE,
        KPMEConstants.CommonElements.GROUP_KEY,
        LeaveBlock.Elements.ASSIGNMENT_KEY,
        LeaveBlock.Elements.DOCUMENT_STATUS,
        LeaveBlock.Elements.LEAVE_REQUEST_DOCUMENT_ID,
        LeaveBlock.Elements.PLANNING_DESCRIPTION,
        LeaveBlock.Elements.TRANSACTIONAL_DOC_ID,
        LeaveBlock.Elements.BEGIN_DATE_TIME,
        LeaveBlock.Elements.END_DATE_TIME,
        LeaveBlock.Elements.LM_LEAVE_BLOCK_ID,
        LeaveBlock.Elements.LEAVE_AMOUNT,
        LeaveBlock.Elements.WORK_AREA,
        LeaveBlock.Elements.JOB_NUMBER,
        LeaveBlock.Elements.ACCRUAL_GENERATED,
        LeaveBlock.Elements.LEAVE_LOCAL_DATE,
        LeaveBlock.Elements.LEAVE_DATE_TIME,
        LeaveBlock.Elements.SCHEDULE_TIME_OFF_ID,
        LeaveBlock.Elements.REQUEST_STATUS,
        LeaveBlock.Elements.REQUEST_STATUS_STRING,
        LeaveBlock.Elements.REASON,
        LeaveBlock.Elements.HOURS,
        LeaveBlock.Elements.CREATE_TIME,
        LeaveBlock.Elements.HR_CALENDAR_BLOCK_ID,
        LeaveBlock.Elements.CONCRETE_BLOCK_TYPE,
        LeaveBlock.Elements.CONCRETE_BLOCK_ID,
        LeaveBlock.Elements.DOCUMENT_ID,
        LeaveBlock.Elements.PRINCIPAL_ID,
        LeaveBlock.Elements.AMOUNT,
        LeaveBlock.Elements.OVERTIME_PREF,
        LeaveBlock.Elements.LUNCH_DELETED,
        LeaveBlock.Elements.USER_PRINCIPAL_ID,
        LeaveBlock.Elements.AFFECTS_PAY,
        CoreConstants.CommonElements.OBJECT_ID,
        CoreConstants.CommonElements.VERSION_NUMBER,
        CoreConstants.CommonElements.FUTURE_ELEMENTS
})
public final class LeaveBlock
        extends AbstractDataTransferObject
        implements LeaveBlockContract
{

    private static final long serialVersionUID = -871236487733142844L;
    @XmlElement(name = Elements.TASK, required = false)
    private final Long task;
    @XmlElement(name = Elements.EARN_CODE, required = false)
    private final String earnCode;
    @XmlElement(name = KPMEConstants.CommonElements.GROUP_KEY_CODE, required = true)
    private final String groupKeyCode;
    @XmlElement(name = KPMEConstants.CommonElements.GROUP_KEY, required = false)
    private final HrGroupKey groupKey;
    @XmlElement(name = Elements.ACCRUAL_CATEGORY_RULE, required = false)
    private final AccrualCategoryRule accrualCategoryRule;
    @XmlElement(name = Elements.ACCRUAL_CATEGORY_OBJ, required = false)
    private final AccrualCategory accrualCategoryObj;
    @XmlElement(name = Elements.ACCRUAL_CATEGORY_RULE_ID, required = false)
    private final String accrualCategoryRuleId;
    @XmlElement(name = Elements.ACCRUAL_CATEGORY, required = false)
    private final String accrualCategory;
    @XmlElement(name = Elements.SUBMIT, required = false)
    private final boolean submit;
    @XmlElement(name = Elements.BLOCK_ID, required = false)
    private final Long blockId;
    @XmlElement(name = Elements.DESCRIPTION, required = false)
    private final String description;
    @XmlElement(name = Elements.ASSIGNMENT_TITLE, required = false)
    private final String assignmentTitle;
    @XmlElement(name = Elements.CALENDAR_ID, required = false)
    private final String calendarId;
    @XmlElement(name = Elements.EARN_CODE_DESCRIPTION, required = false)
    private final String earnCodeDescription;
    @XmlElement(name = Elements.LEAVE_BLOCK_TYPE, required = false)
    private final String leaveBlockType;
    @XmlElement(name = Elements.ASSIGNMENT_KEY, required = false)
    private final String assignmentKey;
    @XmlElement(name = Elements.DOCUMENT_STATUS, required = false)
    private final String documentStatus;
    @XmlElement(name = Elements.LEAVE_REQUEST_DOCUMENT_ID, required = false)
    private final String leaveRequestDocumentId;
    @XmlElement(name = Elements.PLANNING_DESCRIPTION, required = false)
    private final String planningDescription;
    @XmlElement(name = Elements.TRANSACTIONAL_DOC_ID, required = false)
    private final String transactionalDocId;
    @XmlElement(name = Elements.BEGIN_DATE_TIME, required = false)
    @XmlJavaTypeAdapter(DateTimeAdapter.class)
    private final DateTime beginDateTime;
    @XmlElement(name = Elements.END_DATE_TIME, required = false)
    @XmlJavaTypeAdapter(DateTimeAdapter.class)
    private final DateTime endDateTime;
    @XmlElement(name = Elements.LM_LEAVE_BLOCK_ID, required = false)
    private final String lmLeaveBlockId;
    @XmlElement(name = Elements.LEAVE_AMOUNT, required = false)
    private final BigDecimal leaveAmount;
    @XmlElement(name = Elements.WORK_AREA, required = false)
    private final Long workArea;
    @XmlElement(name = Elements.JOB_NUMBER, required = false)
    private final Long jobNumber;
    @XmlElement(name = Elements.ACCRUAL_GENERATED, required = false)
    private final Boolean accrualGenerated;
    @XmlElement(name = Elements.LEAVE_LOCAL_DATE, required = false)
    @XmlJavaTypeAdapter(LocalDateAdapter.class)
    private final LocalDate leaveLocalDate;
    @XmlElement(name = Elements.LEAVE_DATE_TIME, required = false)
    @XmlJavaTypeAdapter(DateTimeAdapter.class)
    private final DateTime leaveDateTime;
    @XmlElement(name = Elements.SCHEDULE_TIME_OFF_ID, required = false)
    private final String scheduleTimeOffId;
    @XmlElement(name = Elements.REQUEST_STATUS, required = false)
    private final String requestStatus;
    @XmlElement(name = Elements.REQUEST_STATUS_STRING, required = false)
    private final String requestStatusString;
    @XmlElement(name = Elements.REASON, required = false)
    private final String reason;
    @XmlElement(name = Elements.HOURS, required = false)
    private final BigDecimal hours;
    @XmlElement(name = Elements.CREATE_TIME, required = false)
    @XmlJavaTypeAdapter(DateTimeAdapter.class)
    private final DateTime createTime;
    @XmlElement(name = Elements.HR_CALENDAR_BLOCK_ID, required = false)
    private final String hrCalendarBlockId;
    @XmlElement(name = Elements.CONCRETE_BLOCK_TYPE, required = false)
    private final String concreteBlockType;
    @XmlElement(name = Elements.CONCRETE_BLOCK_ID, required = false)
    private final String concreteBlockId;
    @XmlElement(name = Elements.DOCUMENT_ID, required = false)
    private final String documentId;
    @XmlElement(name = Elements.PRINCIPAL_ID, required = false)
    private final String principalId;
    @XmlElement(name = Elements.AMOUNT, required = false)
    private final BigDecimal amount;
    @XmlElement(name = Elements.OVERTIME_PREF, required = false)
    private final String overtimePref;
    @XmlElement(name = Elements.LUNCH_DELETED, required = false)
    private final boolean lunchDeleted;
    @XmlElement(name = Elements.USER_PRINCIPAL_ID, required = false)
    private final String userPrincipalId;
    @XmlElement(name = Elements.AFFECTS_PAY, required = false)
    private final String affectsPay;
    @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
    private final String objectId;
    @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
    private final Long versionNumber;
    @SuppressWarnings("unused")
    @XmlAnyElement
    private final Collection<Element> _futureElements = null;

    /**
     * Private constructor used only by JAXB.
     *
     */
    private LeaveBlock() {
        this.task = null;
        this.earnCode = null;
        this.accrualCategoryRule = null;
        this.accrualCategoryObj = null;
        this.accrualCategoryRuleId = null;
        this.accrualCategory = null;
        this.submit = false;
        this.blockId = null;
        this.description = null;
        this.leaveDateTime = null;
        this.assignmentTitle = null;
        this.calendarId = null;
        this.earnCodeDescription = null;
        this.leaveBlockType = null;
        this.groupKeyCode = null;
        this.groupKey = null;
        this.assignmentKey = null;
        this.documentStatus = null;
        this.leaveRequestDocumentId = null;
        this.planningDescription = null;
        this.transactionalDocId = null;
        this.beginDateTime = null;
        this.endDateTime = null;
        this.lmLeaveBlockId = null;
        this.leaveAmount = null;
        this.workArea = null;
        this.jobNumber = null;
        this.accrualGenerated = null;
        this.leaveLocalDate = null;
        this.scheduleTimeOffId = null;
        this.requestStatus = null;
        this.requestStatusString = null;
        this.reason = null;
        this.hours = null;
        this.createTime = null;
        this.hrCalendarBlockId = null;
        this.concreteBlockType = null;
        this.concreteBlockId = null;
        this.documentId = null;
        this.principalId = null;
        this.amount = null;
        this.overtimePref = null;
        this.lunchDeleted = false;
        this.userPrincipalId = null;
        this.affectsPay = null;
        this.objectId = null;
        this.versionNumber = null;
    }

    private LeaveBlock(Builder builder) {
        this.task = builder.getTask();
        this.earnCode = builder.getEarnCode();
        this.accrualCategoryRule = builder.getAccrualCategoryRule() == null ? null : builder.getAccrualCategoryRule().build();
        this.accrualCategoryObj = builder.getAccrualCategoryObj() == null ? null : builder.getAccrualCategoryObj().build();
        this.accrualCategoryRuleId = builder.getAccrualCategoryRuleId();
        this.accrualCategory = builder.getAccrualCategory();
        this.submit = builder.isSubmit();
        this.blockId = builder.getBlockId();
        this.description = builder.getDescription();
        this.leaveDateTime = builder.getLeaveDateTime() == null ? null : builder.getLeaveDateTime();
        this.assignmentTitle = builder.getAssignmentTitle();
        this.calendarId = builder.getCalendarId();
        this.earnCodeDescription = builder.getEarnCodeDescription();
        this.leaveBlockType = builder.getLeaveBlockType();
        this.groupKeyCode = builder.getGroupKeyCode();
        this.groupKey = builder.getGroupKey() == null ? null : builder.getGroupKey().build();
        this.assignmentKey = builder.getAssignmentKey();
        this.documentStatus = builder.getDocumentStatus();
        this.leaveRequestDocumentId = builder.getLeaveRequestDocumentId();
        this.planningDescription = builder.getPlanningDescription();
        this.transactionalDocId = builder.getTransactionalDocId();
        this.beginDateTime = builder.getBeginDateTime();
        this.endDateTime = builder.getEndDateTime();
        this.lmLeaveBlockId = builder.getLmLeaveBlockId();
        this.leaveAmount = builder.getLeaveAmount();
        this.workArea = builder.getWorkArea();
        this.jobNumber = builder.getJobNumber();
        this.accrualGenerated = builder.isAccrualGenerated();
        this.leaveLocalDate = builder.getLeaveLocalDate();
        this.scheduleTimeOffId = builder.getScheduleTimeOffId();
        this.requestStatus = builder.getRequestStatus();
        this.requestStatusString = builder.getRequestStatusString();
        this.reason = builder.getReason();
        this.hours = builder.getHours();
        this.createTime = builder.getCreateTime();
        this.hrCalendarBlockId = builder.getHrCalendarBlockId();
        this.concreteBlockType = builder.getConcreteBlockType();
        this.concreteBlockId = builder.getConcreteBlockId();
        this.documentId = builder.getDocumentId();
        this.principalId = builder.getPrincipalId();
        this.amount = builder.getAmount();
        this.overtimePref = builder.getOvertimePref();
        this.lunchDeleted = builder.isLunchDeleted();
        this.userPrincipalId = builder.getUserPrincipalId();
        this.affectsPay = builder.getAffectPay();
        this.objectId = builder.getObjectId();
        this.versionNumber = builder.getVersionNumber();
    }

    @Override
    public Long getTask() {
        return this.task;
    }

    @Override
    public String getEarnCode() {
        return this.earnCode;
    }

    @Override
    public AccrualCategoryRule getAccrualCategoryRule() {
        return this.accrualCategoryRule;
    }

    @Override
    public AccrualCategory getAccrualCategoryObj() {
        return this.accrualCategoryObj;
    }

    @Override
    public String getAccrualCategoryRuleId() {
        return this.accrualCategoryRuleId;
    }

    @Override
    public String getAccrualCategory() {
        return this.accrualCategory;
    }

    @Override
    public HrGroupKey getGroupKey() {
        return groupKey;
    }

    @Override
    public String getGroupKeyCode() {
        return groupKeyCode;
    }

    @Override
    public boolean isSubmit() {
        return this.submit;
    }

    @Override
    public Long getBlockId() {
        return this.blockId;
    }

    @Override
    public String getDescription() {
        return this.description;
    }

    @Override
    public DateTime getLeaveDateTime() {
        return this.leaveDateTime;
    }

    @Override
    public String getAssignmentTitle() {
        return this.assignmentTitle;
    }

    @Override
    public String getCalendarId() {
        return this.calendarId;
    }

    @Override
    public String getEarnCodeDescription() {
        return this.earnCodeDescription;
    }

    @Override
    public String getLeaveBlockType() {
        return this.leaveBlockType;
    }

    //@Override
    //public boolean isEditable() {
    //    return this.editable;
    //}

    //@Override
    //public boolean isDeletable() {
    //    return this.deletable;
    //}

    @Override
    public String getAssignmentKey() {
        return this.assignmentKey;
    }

    @Override
    public String getDocumentStatus() {
        return this.documentStatus;
    }

    @Override
    public String getLeaveRequestDocumentId() {
        return this.leaveRequestDocumentId;
    }

    @Override
    public String getPlanningDescription() {
        return this.planningDescription;
    }

    @Override
    public String getTransactionalDocId() {
        return this.transactionalDocId;
    }

    @Override
    public DateTime getBeginDateTime() {
        return this.beginDateTime;
    }

    @Override
    public DateTime getEndDateTime() {
        return this.endDateTime;
    }

    @Override
    public String getLmLeaveBlockId() {
        return this.lmLeaveBlockId;
    }

    @Override
    public BigDecimal getLeaveAmount() {
        return this.leaveAmount;
    }

    @Override
    public Long getWorkArea() {
        return this.workArea;
    }

    @Override
    public Long getJobNumber() {
        return this.jobNumber;
    }

    @Override
    public Boolean isAccrualGenerated() {
        return this.accrualGenerated;
    }

    @Override
    public LocalDate getLeaveLocalDate() {
        return this.leaveLocalDate;
    }

    @Override
    public String getScheduleTimeOffId() {
        return this.scheduleTimeOffId;
    }

    @Override
    public String getRequestStatus() {
        return this.requestStatus;
    }

    @Override
    public String getRequestStatusString() {
        return this.requestStatusString;
    }

    @Override
    public String getReason() {
        return this.reason;
    }

    @Override
    public BigDecimal getHours() {
        return this.hours;
    }

    @Override
    public DateTime getCreateTime() {
        return this.createTime;
    }

    @Override
    public String getHrCalendarBlockId() {
        return this.hrCalendarBlockId;
    }

    @Override
    public String getConcreteBlockType() {
        return this.concreteBlockType;
    }

    @Override
    public String getConcreteBlockId() {
        return this.concreteBlockId;
    }

    @Override
    public String getDocumentId() {
        return this.documentId;
    }

    @Override
    public String getPrincipalId() {
        return this.principalId;
    }

    @Override
    public BigDecimal getAmount() {
        return this.amount;
    }

    @Override
    public String getOvertimePref() {
        return this.overtimePref;
    }

    @Override
    public boolean isLunchDeleted() {
        return this.lunchDeleted;
    }

    @Override
    public String getUserPrincipalId() {
        return this.userPrincipalId;
    }

    @Override
    public String getAffectPay() {
        return this.affectsPay;
    }

    @Override
    public String getObjectId() {
        return this.objectId;
    }

    @Override
    public Long getVersionNumber() {
        return this.versionNumber;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (obj.getClass() != getClass()) {
            return false;
        }
        LeaveBlock leaveBlock = (LeaveBlock) obj;
        return new EqualsBuilder()
                .append(principalId, leaveBlock.principalId)
                .append(jobNumber, leaveBlock.jobNumber)
                .append(groupKeyCode, leaveBlock.getGroupKeyCode())
                .append(workArea, leaveBlock.workArea)
                .append(task, leaveBlock.task)
                .append(earnCode, leaveBlock.earnCode)
                .append(leaveDateTime, leaveBlock.leaveDateTime)
                .append(KpmeUtils.nullSafeCompare(leaveAmount, leaveBlock.leaveAmount), 0)
                .append(accrualCategory, leaveBlock.accrualCategory)
                .append(earnCode, leaveBlock.earnCode)
                .append(description, leaveBlock.description)
                .append(leaveBlockType, leaveBlock.leaveBlockType)
                .isEquals();
    }
    /**
     * A builder which can be used to construct {@link LeaveBlock} instances.  Enforces the constraints of the {@link LeaveBlockContract}.
     *
     */
    public final static class Builder
            implements Serializable, LeaveBlockContract, ModelBuilder
    {

        private Long task;
        private String earnCode;
        private AccrualCategoryRule.Builder accrualCategoryRule;
        private AccrualCategory.Builder accrualCategoryObj;
        private String accrualCategoryRuleId;
        private String accrualCategory;
        private boolean submit;
        private Long blockId;
        private String description;
        private DateTime leaveDateTime;
        private String assignmentTitle;
        private String calendarId;
        private String earnCodeDescription;
        private String leaveBlockType;
        private String groupKeyCode;
        private HrGroupKey.Builder groupKey;
        private String assignmentKey;
        private String documentStatus;
        private String leaveRequestDocumentId;
        private String planningDescription;
        private String transactionalDocId;
        private DateTime beginDateTime;
        private DateTime endDateTime;
        private String lmLeaveBlockId;
        private BigDecimal leaveAmount;
        private Long workArea;
        private Long jobNumber;
        private Boolean accrualGenerated;
        private LocalDate leaveLocalDate;
        private String scheduleTimeOffId;
        private String requestStatus;
        private String requestStatusString;
        private String reason;
        private BigDecimal hours;
        private DateTime createTime;
        private String hrCalendarBlockId;
        private String concreteBlockType;
        private String concreteBlockId;
        private String documentId;
        private String principalId;
        private BigDecimal amount;
        private String overtimePref;
        private boolean lunchDeleted;
        private String userPrincipalId;
        private String affectsPay;
        private String objectId;
        private Long versionNumber;

        private Builder(String principalId, String earnCode, BigDecimal leaveAmount) {
            setPrincipalId(principalId);
            setEarnCode(earnCode);
            setLeaveAmount(leaveAmount);
        }

        public static Builder create(String principalId, String earnCode, BigDecimal leaveAmount) {
            return new Builder(principalId, earnCode, leaveAmount);
        }

        public static Builder create(String principalId, String earnCode, BigDecimal leaveAmount, LocalDate leaveLocalDate, String documentId) {
            Builder builder = create(principalId, earnCode, leaveAmount);
            builder.setLeaveLocalDate(leaveLocalDate);
            builder.setDocumentId(documentId);
            return builder;
        }

        public static Builder create(LeaveBlockContract contract) {
            if (contract == null) {
                throw new IllegalArgumentException("contract was null");
            }

            Builder builder = create(contract.getPrincipalId(), contract.getEarnCode(), contract.getLeaveAmount());
            builder.setTask(contract.getTask());
            builder.setAccrualCategoryRule(contract.getAccrualCategoryRule() == null ? null : AccrualCategoryRule.Builder.create(contract.getAccrualCategoryRule()));
            builder.setAccrualCategoryObj(contract.getAccrualCategoryObj() == null ? null : AccrualCategory.Builder.create(contract.getAccrualCategoryObj()));
            builder.setAccrualCategoryRuleId(contract.getAccrualCategoryRuleId());
            builder.setAccrualCategory(contract.getAccrualCategory());
            builder.setSubmit(contract.isSubmit());
            builder.setBlockId(contract.getBlockId());
            builder.setDescription(contract.getDescription());
            builder.setLeaveDateTime(contract.getLeaveDateTime());
            builder.setAssignmentTitle(contract.getAssignmentTitle());
            builder.setCalendarId(contract.getCalendarId());
            builder.setEarnCodeDescription(contract.getEarnCodeDescription());
            builder.setLeaveBlockType(contract.getLeaveBlockType());
            builder.setGroupKeyCode(contract.getGroupKeyCode());
            builder.setGroupKey(contract.getGroupKey() == null ? null : HrGroupKey.Builder.create(contract.getGroupKey()));
            builder.setAssignmentKey(contract.getAssignmentKey());
            builder.setDocumentStatus(contract.getDocumentStatus());
            builder.setLeaveRequestDocumentId(contract.getLeaveRequestDocumentId());
            builder.setPlanningDescription(contract.getPlanningDescription());
            builder.setTransactionalDocId(contract.getTransactionalDocId());
            builder.setBeginDateTime(contract.getBeginDateTime());
            builder.setEndDateTime(contract.getEndDateTime());
            builder.setLmLeaveBlockId(contract.getLmLeaveBlockId());
            builder.setWorkArea(contract.getWorkArea());
            builder.setJobNumber(contract.getJobNumber());
            builder.setAccrualGenerated(contract.isAccrualGenerated());
            builder.setLeaveLocalDate(contract.getLeaveLocalDate());
            builder.setScheduleTimeOffId(contract.getScheduleTimeOffId());
            builder.setRequestStatus(contract.getRequestStatus());
            builder.setRequestStatusString(contract.getRequestStatusString());
            builder.setReason(contract.getReason());
            builder.setHours(contract.getHours());
            builder.setCreateTime(contract.getCreateTime());
            builder.setHrCalendarBlockId(contract.getHrCalendarBlockId());
            builder.setConcreteBlockType(contract.getConcreteBlockType());
            builder.setConcreteBlockId(contract.getConcreteBlockId());
            builder.setDocumentId(contract.getDocumentId());
            builder.setAmount(contract.getAmount());
            builder.setOvertimePref(contract.getOvertimePref());
            builder.setLunchDeleted(contract.isLunchDeleted());
            builder.setUserPrincipalId(contract.getUserPrincipalId());
            builder.setAffectsPay(contract.getAffectPay());
            builder.setObjectId(contract.getObjectId());
            builder.setVersionNumber(contract.getVersionNumber());
            return builder;
        }

        public LeaveBlock build() {
            return new LeaveBlock(this);
        }

        @Override
        public Long getTask() {
            return this.task;
        }

        @Override
        public String getEarnCode() {
            return this.earnCode;
        }

        @Override
        public AccrualCategoryRule.Builder getAccrualCategoryRule() {
            return this.accrualCategoryRule;
        }

        @Override
        public AccrualCategory.Builder getAccrualCategoryObj() {
            return this.accrualCategoryObj;
        }

        @Override
        public String getAccrualCategoryRuleId() {
            return this.accrualCategoryRuleId;
        }

        @Override
        public String getAccrualCategory() {
            return this.accrualCategory;
        }

        @Override
        public boolean isSubmit() {
            return this.submit;
        }

        @Override
        public Long getBlockId() {
            return this.blockId;
        }

        @Override
        public String getDescription() {
            return this.description;
        }

        @Override
        public DateTime getLeaveDateTime() {
            return this.leaveDateTime;
        }

        @Override
        public String getAssignmentTitle() {
            return this.assignmentTitle;
        }

        @Override
        public String getCalendarId() {
            return this.calendarId;
        }

        @Override
        public String getEarnCodeDescription() {
            return this.earnCodeDescription;
        }

        @Override
        public String getLeaveBlockType() {
            return this.leaveBlockType;
        }

        //@Override
        //public boolean isEditable() {
        //    return this.editable;
        //}

        //@Override
        //public boolean isDeletable() {
        //    return this.deletable;
        //}

        @Override
        public String getAssignmentKey() {
            return this.assignmentKey;
        }

        @Override
        public String getDocumentStatus() {
            return this.documentStatus;
        }

        @Override
        public String getLeaveRequestDocumentId() {
            return this.leaveRequestDocumentId;
        }

        @Override
        public String getPlanningDescription() {
            return this.planningDescription;
        }

        @Override
        public String getTransactionalDocId() {
            return this.transactionalDocId;
        }

        @Override
        public DateTime getBeginDateTime() {
            return this.beginDateTime;
        }

        @Override
        public DateTime getEndDateTime() {
            return this.endDateTime;
        }

        @Override
        public String getLmLeaveBlockId() {
            return this.lmLeaveBlockId;
        }

        @Override
        public BigDecimal getLeaveAmount() {
            return this.leaveAmount;
        }

        @Override
        public Long getWorkArea() {
            return this.workArea;
        }

        @Override
        public Long getJobNumber() {
            return this.jobNumber;
        }

        @Override
        public Boolean isAccrualGenerated() {
            return this.accrualGenerated;
        }

        @Override
        public LocalDate getLeaveLocalDate() {
            return this.leaveLocalDate;
        }

        @Override
        public String getScheduleTimeOffId() {
            return this.scheduleTimeOffId;
        }

        @Override
        public String getRequestStatus() {
            return this.requestStatus;
        }

        @Override
        public String getRequestStatusString() {
            return this.requestStatusString;
        }

        @Override
        public String getReason() {
            return this.reason;
        }

        @Override
        public BigDecimal getHours() {
            return this.hours;
        }

        @Override
        public DateTime getCreateTime() {
            return this.createTime;
        }

        @Override
        public String getHrCalendarBlockId() {
            return this.hrCalendarBlockId;
        }

        @Override
        public String getConcreteBlockType() {
            return this.concreteBlockType;
        }

        @Override
        public String getConcreteBlockId() {
            return this.concreteBlockId;
        }

        @Override
        public String getDocumentId() {
            return this.documentId;
        }

        @Override
        public String getPrincipalId() {
            return this.principalId;
        }

        @Override
        public BigDecimal getAmount() {
            return this.amount;
        }

        @Override
        public String getOvertimePref() {
            return this.overtimePref;
        }

        @Override
        public boolean isLunchDeleted() {
            return this.lunchDeleted;
        }

        @Override
        public String getUserPrincipalId() {
            return this.userPrincipalId;
        }

        @Override
        public String getAffectPay() {
            return this.affectsPay;
        }

        @Override
        public String getObjectId() {
            return this.objectId;
        }

        @Override
        public Long getVersionNumber() {
            return this.versionNumber;
        }

        @Override
        public String getGroupKeyCode() {
            return groupKeyCode;
        }

        @Override
        public HrGroupKey.Builder getGroupKey() {
            return groupKey;
        }

        public void setTask(Long task) {

            this.task = task;
        }

        public void setEarnCode(String earnCode) {

            this.earnCode = earnCode;
        }

        public void setAccrualCategoryRule(AccrualCategoryRule.Builder accrualCategoryRule) {

            this.accrualCategoryRule = accrualCategoryRule;
        }

        public void setAccrualCategoryObj(AccrualCategory.Builder accrualCategoryObj) {

            this.accrualCategoryObj = accrualCategoryObj;
        }

        public void setAccrualCategoryRuleId(String accrualCategoryRuleId) {

            this.accrualCategoryRuleId = accrualCategoryRuleId;
        }

        public void setAccrualCategory(String accrualCategory) {

            this.accrualCategory = accrualCategory;
        }

        public void setSubmit(boolean submit) {

            this.submit = submit;
        }

        public void setBlockId(Long blockId) {

            this.blockId = blockId;
        }

        public void setDescription(String description) {

            this.description = description;
        }

        //public void setLeaveDate(Date leaveDate) {

        //   this.leaveDate = leaveDate;
        //}

        public void setAssignmentTitle(String assignmentTitle) {

            this.assignmentTitle = assignmentTitle;
        }

        public void setCalendarId(String calendarId) {

            this.calendarId = calendarId;
        }

        public void setEarnCodeDescription(String earnCodeDescription) {

            this.earnCodeDescription = earnCodeDescription;
        }

        public void setLeaveBlockType(String leaveBlockType) {

            this.leaveBlockType = leaveBlockType;
        }

        public void setGroupKeyCode(String groupKeyCode) {
            this.groupKeyCode = groupKeyCode;
        }

        public void setGroupKey(HrGroupKey.Builder groupKey) {
            this.groupKey = groupKey;
        }

        public void setAssignmentKey(String assignmentKey) {

            this.assignmentKey = assignmentKey;
        }

        public void setDocumentStatus(String documentStatus) {

            this.documentStatus = documentStatus;
        }

        public void setLeaveRequestDocumentId(String leaveRequestDocumentId) {

            this.leaveRequestDocumentId = leaveRequestDocumentId;
        }

        public void setPlanningDescription(String planningDescription) {

            this.planningDescription = planningDescription;
        }

        public void setTransactionalDocId(String transactionalDocId) {

            this.transactionalDocId = transactionalDocId;
        }

        public void setBeginDateTime(DateTime beginDateTime) {

            this.beginDateTime = beginDateTime;
        }

        public void setEndDateTime(DateTime endDateTime) {

            this.endDateTime = endDateTime;
        }

        public void setLmLeaveBlockId(String lmLeaveBlockId) {

            this.lmLeaveBlockId = lmLeaveBlockId;
        }

        public void setLeaveAmount(BigDecimal leaveAmount) {

            this.leaveAmount = leaveAmount;
        }

        public void setWorkArea(Long workArea) {

            this.workArea = workArea;
        }

        public void setJobNumber(Long jobNumber) {

            this.jobNumber = jobNumber;
        }

        public void setAccrualGenerated(Boolean accrualGenerated) {

            this.accrualGenerated = accrualGenerated;
        }

        public void setLeaveLocalDate(LocalDate leaveLocalDate) {

            this.leaveLocalDate = leaveLocalDate;
        }

        public void setScheduleTimeOffId(String scheduleTimeOffId) {

            this.scheduleTimeOffId = scheduleTimeOffId;
        }

        public void setRequestStatus(String requestStatus) {

            this.requestStatus = requestStatus;
        }

        public void setRequestStatusString(String requestStatusString) {

            this.requestStatusString = requestStatusString;
        }

        public void setReason(String reason) {

            this.reason = reason;
        }

        public void setHours(BigDecimal hours) {

            this.hours = hours;
        }

        public void setCreateTime(DateTime createTime) {

            this.createTime = createTime;
        }

        public void setHrCalendarBlockId(String hrCalendarBlockId) {

            this.hrCalendarBlockId = hrCalendarBlockId;
        }

        public void setConcreteBlockType(String concreteBlockType) {

            this.concreteBlockType = concreteBlockType;
        }

        public void setConcreteBlockId(String concreteBlockId) {

            this.concreteBlockId = concreteBlockId;
        }

        public void setDocumentId(String documentId) {

            this.documentId = documentId;
        }

        public void setPrincipalId(String principalId) {

            this.principalId = principalId;
        }

        public void setAmount(BigDecimal amount) {

            this.amount = amount;
        }

        public void setOvertimePref(String overtimePref) {

            this.overtimePref = overtimePref;
        }

        public void setLunchDeleted(boolean lunchDeleted) {

            this.lunchDeleted = lunchDeleted;
        }

        public void setUserPrincipalId(String userPrincipalId) {
            this.userPrincipalId = userPrincipalId;
        }

        public void setAffectsPay(String affectsPay) {
            this.affectsPay = affectsPay;
        }

        public void setLeaveDateTime(DateTime leaveDateTime) {
            this.leaveDateTime = leaveDateTime;
        }

        public void setObjectId(String objectId) {
            this.objectId = objectId;
        }

        public void setVersionNumber(Long versionNumber) {

            this.versionNumber = versionNumber;
        }
    }

    /**
     * Defines some internal constants used on this class.
     *
     */
    static class Constants {

        final static String ROOT_ELEMENT_NAME = "leaveBlock";
        final static String TYPE_NAME = "LeaveBlockType";

    }

    /**
     * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
     *
     */
    static class Elements {

        final static String TASK = "task";
        final static String EARN_CODE = "earnCode";
        final static String ACCRUAL_CATEGORY_RULE = "accrualCategoryRule";
        final static String ACCRUAL_CATEGORY_OBJ = "accrualCategoryObj";
        final static String ACCRUAL_CATEGORY_RULE_ID = "accrualCategoryRuleId";
        final static String ACCRUAL_CATEGORY = "accrualCategory";
        final static String SUBMIT = "submit";
        final static String BLOCK_ID = "blockId";
        final static String DESCRIPTION = "description";
        final static String ASSIGNMENT_TITLE = "assignmentTitle";
        final static String CALENDAR_ID = "calendarId";
        final static String EARN_CODE_DESCRIPTION = "earnCodeDescription";
        final static String LEAVE_BLOCK_TYPE = "leaveBlockType";
        final static String ASSIGNMENT_KEY = "assignmentKey";
        final static String DOCUMENT_STATUS = "documentStatus";
        final static String LEAVE_REQUEST_DOCUMENT_ID = "leaveRequestDocumentId";
        final static String PLANNING_DESCRIPTION = "planningDescription";
        final static String TRANSACTIONAL_DOC_ID = "transactionalDocId";
        final static String BEGIN_DATE_TIME = "beginDateTime";
        final static String END_DATE_TIME = "endDateTime";
        final static String LM_LEAVE_BLOCK_ID = "lmLeaveBlockId";
        final static String LEAVE_AMOUNT = "leaveAmount";
        final static String WORK_AREA = "workArea";
        final static String JOB_NUMBER = "jobNumber";
        final static String ACCRUAL_GENERATED = "accrualGenerated";
        final static String LEAVE_LOCAL_DATE = "leaveLocalDate";
        final static String SCHEDULE_TIME_OFF_ID = "scheduleTimeOffId";
        final static String REQUEST_STATUS = "requestStatus";
        final static String REQUEST_STATUS_STRING = "requestStatusString";
        final static String REASON = "reason";
        final static String HOURS = "hours";
        final static String CREATE_TIME = "createTime";
        final static String HR_CALENDAR_BLOCK_ID = "hrCalendarBlockId";
        final static String CONCRETE_BLOCK_TYPE = "concreteBlockType";
        final static String CONCRETE_BLOCK_ID = "concreteBlockId";
        final static String DOCUMENT_ID = "documentId";
        final static String PRINCIPAL_ID = "principalId";
        final static String AMOUNT = "amount";
        final static String OVERTIME_PREF = "overtimePref";
        final static String LUNCH_DELETED = "lunchDeleted";
        final static String USER_PRINCIPAL_ID = "userPrincipalId";
        final static String AFFECTS_PAY = "affectsPay";
        final static String LEAVE_DATE_TIME = "leaveDateTime";
    }

    public static final String CACHE_NAME = TkConstants.Namespace.NAMESPACE_PREFIX + "LeaveBlock";

}


text:
package org.wso2.developerstudio.eclipse.artifact.bpel.utils;

import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
import org.wso2.developerstudio.eclipse.utils.ui.ImageUtils;
import org.wso2.developerstudio.eclipse.artifact.bpel.Activator;

public class BPELImageUtils extends ImageUtils{

	private static ImageUtils instance;

	public static ImageUtils getInstance(){
		if (instance==null){
			instance=new BPELImageUtils();
		}
		return instance;
	}

	public Bundle getBundle(){
		return Platform.getBundle(Activator.PLUGIN_ID);
	}

}

redpajama_set_name: RedPajamaGithub


text:
"use strict";
module.exports = {
  name: 'capital',
  process: str => str? str.charAt(0).toUpperCase() + str.substring(1) : ''
};


text:
var util = require("../util");
require("tern/plugin/requirejs");

var IGNORE_UNUSED_VAR = {"rules" : {"UnusedVariable" : {"severity" : "none"}}};

exports['test RequireJS config'] = function() {

    // Boolean
    util.assertLint("requirejs.config({baseUrl:'', XXXX:true})", {
        messages : [{"message":"Invalid property at 2: XXXX is not a property in config",
                     "from":30,
                     "to":34,
                     "severity":"error",
                     "file":"test1.js"}]
    }, [ "ecmascript", "browser" ], { "requirejs" : {}}, IGNORE_UNUSED_VAR, true);

}


text:
// Fill out your copyright notice in the Description page of Project Settings.

#include "BattleOfShips.h"
#include "Kismet/KismetMathLibrary.h"
#include "BOS_CombatGameMode.h"
#include "BOS_BlockSpawnVolum.h"

// Sets default values
ABOS_BlockSpawnVolum::ABOS_BlockSpawnVolum()
{
	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = false;

	SpawnVolum = CreateDefaultSubobject<UBoxComponent>(TEXT("SpawnVolum"));
	SpawnVolum->SetBoxExtent(FVector(1000.f, 1000.f, 10.f));
	RootComponent = SpawnVolum;

}

// Called when the game starts or when spawned
void ABOS_BlockSpawnVolum::BeginPlay()
{
	Super::BeginPlay();

	auto world = GetWorld();
	if (world && world->IsServer() && HasAuthority())
	{
		InitialSpawn();
		//FTimerHandle initTimerHandle;
		//world->GetTimerManager().SetTimer(initTimerHandle, this, &ABOS_BlockSpawnVolum::InitialSpawn, 0.1f);
		world->GetTimerManager().SetTimer(SpawnTimerHandle, this, &ABOS_BlockSpawnVolum::OnSpawn, SpawnDelay, true);
	}
}

// Called every frame
void ABOS_BlockSpawnVolum::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

}

void ABOS_BlockSpawnVolum::OnSpawn()
{
	//UE_LOG(LogTemp, Warning, TEXT("%s begin"), ANSI_TO_TCHAR(__FUNCTION__));

	auto origin = SpawnVolum->Bounds.Origin;
	auto boxExtent = SpawnVolum->Bounds.BoxExtent;

	auto spawnPoint = UKismetMathLibrary::RandomPointInBoundingBox(origin, boxExtent);

	auto world = GetWorld();
	if (world && world->IsServer())
	{
		FActorSpawnParameters sp;
		if (SpawnClasses.Num() > 0)
		{
			auto randIndex = FMath::RandHelper(3);
			/*auto spawnClass = SpawnClasses[randIndex];
			auto actor = world->SpawnActor(spawnClass, &spawnPoint, &FRotator::ZeroRotator, sp);*/

			randIndex = (randIndex + 1) * 100 + 1;
			//UE_LOG(LogTemp, Warning, TEXT("randIndex:%d"), randIndex);
			auto gm = Cast<ABOS_CombatGameMode>(world->GetAuthGameMode());
			gm->ShipBlockFactory(randIndex, spawnPoint, FRotator::ZeroRotator);
		}
	}

	//UE_LOG(LogTemp, Warning, TEXT("%s end"), ANSI_TO_TCHAR(__FUNCTION__));
}

void ABOS_BlockSpawnVolum::InitialSpawn()
{
	//UE_LOG(LogTemp, Warning, TEXT("%s begin"), ANSI_TO_TCHAR(__FUNCTION__));

	auto i = InitialSpawnNum;

	while (i--)
	{
		OnSpawn();
	}
	//UE_LOG(LogTemp, Warning, TEXT("%s end"), ANSI_TO_TCHAR(__FUNCTION__));

}


text:
package com.corebanking.domain;

public class NewAccountRegModel {
	private String CUSTOMER_TYPE;
	private String RESIDENTIAL_STATUS;
	private String FULL_NAME;
	private String DOB;
	private String GENDER;
	private String NATIONALITY;
	private String COUNTRY;
	private String MOTHER_NAME;
	private Integer UID_NO;
	private NewAccountAddrsBO tempAddress;
	private NewAccountAddrsBO permanentAddress;

	public NewAccountAddrsBO getTempAddress() {
		return tempAddress;
	}

	public void setTempAddress(NewAccountAddrsBO tempAddress) {
		this.tempAddress = tempAddress;
	}

	public NewAccountAddrsBO getPermanentAddress() {
		return permanentAddress;
	}

	public void setPermanentAddress(NewAccountAddrsBO permanentAddress) {
		this.permanentAddress = permanentAddress;
	}

	public String getCUSTOMER_TYPE() {
		return CUSTOMER_TYPE;
	}

	public void setCUSTOMER_TYPE(String cUSTOMER_TYPE) {
		CUSTOMER_TYPE = cUSTOMER_TYPE;
	}

	public String getRESIDENTIAL_STATUS() {
		return RESIDENTIAL_STATUS;
	}

	public void setRESIDENTIAL_STATUS(String rESIDENTIAL_STATUS) {
		RESIDENTIAL_STATUS = rESIDENTIAL_STATUS;
	}

	public String getFULL_NAME() {
		return FULL_NAME;
	}

	public void setFULL_NAME(String fULL_NAME) {
		FULL_NAME = fULL_NAME;
	}

	public String getDOB() {
		return DOB;
	}

	public void setDOB(String dOB) {
		DOB = dOB;
	}

	public String getGENDER() {
		return GENDER;
	}

	public void setGENDER(String gENDER) {
		GENDER = gENDER;
	}

	public String getNATIONALITY() {
		return NATIONALITY;
	}

	public void setNATIONALITY(String nATIONALITY) {
		NATIONALITY = nATIONALITY;
	}

	public String getCOUNTRY() {
		return COUNTRY;
	}

	public void setCOUNTRY(String cOUNTRY) {
		COUNTRY = cOUNTRY;
	}

	public String getMOTHER_NAME() {
		return MOTHER_NAME;
	}

	public void setMOTHER_NAME(String mOTHER_NAME) {
		MOTHER_NAME = mOTHER_NAME;
	}

	public Integer getUID_NO() {
		return UID_NO;
	}

	public void setUID_NO(Integer uID_NO) {
		UID_NO = uID_NO;
	}

}


text:
SdkName="JavaScriptSDK"
delSrc=true

cd ..
. ./shared_build.sh


text:
import { expect } from 'chai';
import NotFoundError from '../../../src/errors/notfound';

describe('NotFoundError', () => {
    it('should be named NotFoundError', () => {
        let error = new NotFoundError();

        expect(error.name).to.equal('NotFoundError');
    });
});


text:
package com.google.jenkins.plugins.containersecurity.client;

import static com.google.jenkins.plugins.containersecurity.client.ClientUtil.getClientFactory;
import static com.google.jenkins.plugins.containersecurity.client.ClientUtil.getRobotCredentials;
import static com.google.jenkins.plugins.containersecurity.util.TestUtil.addCredentials;
import static com.google.jenkins.plugins.containersecurity.util.TestUtil.clearCredentials;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;

import com.google.cloud.graphite.platforms.plugin.client.ClientFactory;
import com.google.common.collect.ImmutableList;
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials;
import hudson.AbortException;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Optional;
import jenkins.model.Jenkins;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.WithoutJenkins;
import org.mockito.junit.MockitoJUnitRunner;

/** Tests {@link ClientUtil}. */
@RunWith(MockitoJUnitRunner.class)
public class ClientUtilTest {
  @Rule public JenkinsRule jenkinsRule = new JenkinsRule();

  @WithoutJenkins
  @Test(expected = NullPointerException.class)
  public void testGetClientFactoryNullItemGroup() throws AbortException {
    getClientFactory(null, ImmutableList.of(), "test", Optional.empty());
  }

  @WithoutJenkins
  @Test(expected = NullPointerException.class)
  public void testGetClientFactoryNullDomainRequirements() throws AbortException {
    getClientFactory(mock(Jenkins.class), null, "test", Optional.empty());
  }

  @WithoutJenkins
  @Test(expected = NullPointerException.class)
  public void testGetClientFactoryNullCredentialsId() throws AbortException {
    getClientFactory(mock(Jenkins.class), ImmutableList.of(), null, Optional.empty());
  }

  @WithoutJenkins
  @Test(expected = IllegalArgumentException.class)
  public void testGetClientFactoryEmptyCredentialsId() throws AbortException {
    getClientFactory(mock(Jenkins.class), ImmutableList.of(), "", Optional.empty());
  }

  @WithoutJenkins
  @Test(expected = NullPointerException.class)
  public void testGetClientFactoryNullTransport() throws AbortException {
    getClientFactory(mock(Jenkins.class), ImmutableList.of(), "test", null);
  }

  @Test(expected = AbortException.class)
  public void testGetClientFactoryNoCredentials() throws AbortException {
    clearCredentials();
    try {
      getClientFactory(jenkinsRule.jenkins, "test");
    } catch (AbortException e) {
      assertEquals(
          Messages.ClientFactory_FailedToInitializeHTTPTransport(
              "hudson.AbortException: "
                  + Messages.ClientFactory_FailedToRetrieveCredentials("test")),
          e.getMessage());
      throw e;
    }
  }

  @Test(expected = AbortException.class)
  public void testGetClientFactoryInvalidCredentials()
      throws GeneralSecurityException, IOException {
    clearCredentials();
    addCredentials("test", Optional.of(new GeneralSecurityException("test")));

    try {
      getClientFactory(jenkinsRule.jenkins, "test");
    } catch (AbortException e) {
      assertEquals(
          Messages.ClientFactory_FailedToInitializeHTTPTransport(
              "java.security.GeneralSecurityException: test"),
          e.getMessage());
      throw e;
    }
  }

  @Test
  public void testGetClientFactoryValidCredentials() throws GeneralSecurityException, IOException {
    clearCredentials();
    addCredentials("test");

    ClientFactory result = getClientFactory(jenkinsRule.jenkins, "test");
    assertNotNull(result);
  }

  @WithoutJenkins
  @Test(expected = NullPointerException.class)
  public void testGetRobotCredentialsNullItemGroup() throws AbortException {
    getRobotCredentials(null, ImmutableList.of(), "test");
  }

  @WithoutJenkins
  @Test(expected = NullPointerException.class)
  public void testGetRobotCredentialsNullDomainRequirements() throws AbortException {
    getRobotCredentials(mock(Jenkins.class), null, "test");
  }

  @WithoutJenkins
  @Test(expected = NullPointerException.class)
  public void testGetRobotCredentialsNullCredentialsId() throws AbortException {
    getRobotCredentials(mock(Jenkins.class), ImmutableList.of(), null);
  }

  @WithoutJenkins
  @Test(expected = IllegalArgumentException.class)
  public void testGetRobotCredentialsEmptyCredentialsId() throws AbortException {
    getRobotCredentials(mock(Jenkins.class), ImmutableList.of(), "");
  }

  @Test(expected = AbortException.class)
  public void testGetRobotCredentialsNoCredentials() throws AbortException {
    clearCredentials();
    try {
      getRobotCredentials(jenkinsRule.jenkins, ImmutableList.of(), "test");
    } catch (AbortException e) {
      assertEquals(Messages.ClientFactory_FailedToRetrieveCredentials("test"), e.getMessage());
      throw e;
    }
  }

  @Test
  public void testGetRobotCredentialsWithCredentials()
      throws GeneralSecurityException, IOException {
    clearCredentials();
    GoogleRobotCredentials expected = addCredentials("test", Optional.empty());

    GoogleRobotCredentials actual =
        getRobotCredentials(jenkinsRule.jenkins, ImmutableList.of(), "test");
    assertEquals(expected, actual);
  }
}


text:
module AMEE

  module CDP

    WIKINAME = "CDP_emissions_and_financial_metrics"

    SEARCH_TERMS = [
	    :sector,
	    :country,
	    :financial_metric
	  ]

    def self.get_company_data(options={})

      CDP.quote_search_terms(options.merge!({ :wikiname => WIKINAME }))

      AMEE::Search::WithinCategory.new(AMEE::Rails.connection, options).map do |item|
        {}.tap do |hash|
          item.data[:values].each { |value| hash[value[:path]] = value[:value] }
        end
      end
    end

    def self.quote_search_terms(options)
      SEARCH_TERMS.each { |attr| options[attr] = "\"#{options[attr]}\"" unless options[attr].blank? }
      options
    end

  end

end


text:
<?php

namespace Gifts\MainBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * CategoryCatalog
 *
 * @ORM\Table(name="category_catalog")
 * @ORM\Entity
 */
class CategoryCatalog
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity="Partner")
     * @ORM\JoinColumn(name="partner", referencedColumnName="id", nullable=true, onDelete="CASCADE")
     */
    private $partner;

    /**
     * @var integer
     *
     * @ORM\Column(name="partner_category", type="integer")
     */
    private $partnerCategory;

    /**
     * @ORM\ManyToOne(targetEntity="Category")
     * @ORM\JoinColumn(name="self_category", referencedColumnName="id", nullable=true, onDelete="CASCADE")
     */
    private $selfCategory;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set partner
     *
     * @param Partner $partner
     * @return CategoryCatalog
     */
    public function setPartner($partner)
    {
        $this->partner = $partner;

        return $this;
    }

    /**
     * Get partner
     *
     * @return Partner
     */
    public function getPartner()
    {
        return $this->partner;
    }

    /**
     * Set partnerCategory
     *
     * @param integer $partnerCategory
     * @return CategoryCatalog
     */
    public function setPartnerCategory($partnerCategory)
    {
        $this->partnerCategory = $partnerCategory;

        return $this;
    }

    /**
     * Get partnerCategory
     *
     * @return integer
     */
    public function getPartnerCategory()
    {
        return $this->partnerCategory;
    }

    /**
     * Set selfCategory
     *
     * @param Category $selfCategory
     * @return CategoryCatalog
     */
    public function setSelfCategory($selfCategory)
    {
        $this->selfCategory = $selfCategory;

        return $this;
    }

    /**
     * Get selfCategory
     *
     * @return Category
     */
    public function getSelfCategory()
    {
        return $this->selfCategory;
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

  <title>Index of /wp-content/themes/blocksy/static/sass/frontend/8-integrations/tutor</title>

Index of /wp-content/themes/blocksy/static/sass/frontend/8-integrations/tutor

 Parent Directory

 course.scss

 layout.scss

 lesson.scss

 main.scss

 sidebar.scss

 variables.scss


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

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "xfa/fxbarcode/cbc_code39.h"

#include "xfa/fxbarcode/oned/BC_OnedCode39Writer.h"

CBC_Code39::CBC_Code39() : CBC_OneCode(new CBC_OnedCode39Writer) {}

CBC_Code39::~CBC_Code39() {}

bool CBC_Code39::Encode(const CFX_WideStringC& contents,
                        bool isDevice,
                        int32_t& e) {
  if (contents.IsEmpty()) {
    e = BCExceptionNoContents;
    return false;
  }
  BCFORMAT format = BCFORMAT_CODE_39;
  int32_t outWidth = 0;
  int32_t outHeight = 0;
  CFX_WideString filtercontents =
      static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
          ->FilterContents(contents);
  CFX_WideString renderContents =
      static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
          ->RenderTextContents(contents);
  m_renderContents = renderContents;
  CFX_ByteString byteString = filtercontents.UTF8Encode();
  uint8_t* data = static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
                      ->Encode(byteString, format, outWidth, outHeight, e);
  if (e != BCExceptionNO)
    return false;
  static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
      ->RenderResult(renderContents.AsStringC(), data, outWidth, isDevice, e);
  FX_Free(data);
  if (e != BCExceptionNO)
    return false;
  return true;
}

bool CBC_Code39::RenderDevice(CFX_RenderDevice* device,
                              const CFX_Matrix* matrix,
                              int32_t& e) {
  CFX_WideString renderCon =
      static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
          ->encodedContents(m_renderContents.AsStringC(), e);
  static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
      ->RenderDeviceResult(device, matrix, renderCon.AsStringC(), e);
  if (e != BCExceptionNO)
    return false;
  return true;
}

bool CBC_Code39::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
  CFX_WideString renderCon =
      static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
          ->encodedContents(m_renderContents.AsStringC(), e);
  static_cast<CBC_OneDimWriter*>(m_pBCWriter.get())
      ->RenderBitmapResult(pOutBitmap, renderCon.AsStringC(), e);
  if (e != BCExceptionNO)
    return false;
  return true;
}

BC_TYPE CBC_Code39::GetType() {
  return BC_CODE39;
}

bool CBC_Code39::SetTextLocation(BC_TEXT_LOC location) {
  if (m_pBCWriter)
    return static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
        ->SetTextLocation(location);
  return false;
}

bool CBC_Code39::SetWideNarrowRatio(int32_t ratio) {
  if (m_pBCWriter)
    return static_cast<CBC_OnedCode39Writer*>(m_pBCWriter.get())
        ->SetWideNarrowRatio(ratio);
  return false;
}


text:
package com.baidubce.services.blb.model;

import com.baidubce.model.AbstractBceResponse;

/**
 * The response for appBlb serverGroup port.
 */
public class AppSgPortResponse extends AbstractBceResponse {

    /**
     * the short id of the AppServerGroup.
     */
    private String id;
    /**
     * the status of AppServerGroup.
     */
    private String status;
    /**
     * the port of AppServerGroup.
     */
    private Integer port;
    /**
     * the type of port.
     */
    private String type;
    /**
     * the protocol of health check.
     */
    private String healthCheck;
    /**
     * the port of health check.
     */
    private Integer healthCheckPort;
    /**
     * the uri of health check.
     */
    private String healthCheckUrlPath;
    /**
     * the timeout (in second) of health check.
     */
    private Integer healthCheckTimeoutInSecond;
    /**
     * the interval (in second) of health check.
     */
    private Integer healthCheckIntervalInSecond;
    /**
     * down retry times of health check.
     */
    private Integer healthCheckDownRetry;
    /**
     * up retry times of health check.
     */
    private Integer healthCheckUpRetry;
    /**
     * the normal status of health check.
     */
    private String healthCheckNormalStatus;
    /**
     * the string of udp health check.
     */
    private String udpHealthCheckString;

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getHealthCheck() {
        return healthCheck;
    }

    public void setHealthCheck(String healthCheck) {
        this.healthCheck = healthCheck;
    }

    public Integer getHealthCheckPort() {
        return healthCheckPort;
    }

    public void setHealthCheckPort(Integer healthCheckPort) {
        this.healthCheckPort = healthCheckPort;
    }

    public String getHealthCheckUrlPath() {
        return healthCheckUrlPath;
    }

    public void setHealthCheckUrlPath(String healthCheckUrlPath) {
        this.healthCheckUrlPath = healthCheckUrlPath;
    }

    public Integer getHealthCheckTimeoutInSecond() {
        return healthCheckTimeoutInSecond;
    }

    public void setHealthCheckTimeoutInSecond(Integer healthCheckTimeoutInSecond) {
        this.healthCheckTimeoutInSecond = healthCheckTimeoutInSecond;
    }

    public Integer getHealthCheckIntervalInSecond() {
        return healthCheckIntervalInSecond;
    }

    public void setHealthCheckIntervalInSecond(Integer healthCheckIntervalInSecond) {
        this.healthCheckIntervalInSecond = healthCheckIntervalInSecond;
    }

    public Integer getHealthCheckDownRetry() {
        return healthCheckDownRetry;
    }

    public void setHealthCheckDownRetry(Integer healthCheckDownRetry) {
        this.healthCheckDownRetry = healthCheckDownRetry;
    }

    public Integer getHealthCheckUpRetry() {
        return healthCheckUpRetry;
    }

    public void setHealthCheckUpRetry(Integer healthCheckUpRetry) {
        this.healthCheckUpRetry = healthCheckUpRetry;
    }

    public String getHealthCheckNormalStatus() {
        return healthCheckNormalStatus;
    }

    public void setHealthCheckNormalStatus(String healthCheckNormalStatus) {
        this.healthCheckNormalStatus = healthCheckNormalStatus;
    }

    public String getUdpHealthCheckString() {
        return udpHealthCheckString;
    }

    public void setUdpHealthCheckString(String udpHealthCheckString) {
        this.udpHealthCheckString = udpHealthCheckString;
    }

    public String getId() {
        return id;
    }

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

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}


text:
package org.kie.uberfire.social.activities.persistence;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.google.gson.Gson;
import org.kie.uberfire.social.activities.model.DefaultTypes;
import org.kie.uberfire.social.activities.model.SocialActivitiesEvent;
import org.kie.uberfire.social.activities.model.SocialEventType;
import org.kie.uberfire.social.activities.model.SocialUser;
import org.kie.uberfire.social.activities.repository.SocialEventTypeRepository;
import org.kie.uberfire.social.activities.security.SocialSecurityConstraintsManager;
import org.uberfire.io.IOService;

public class SocialTimelineCacheInstancePersistenceUnitTestWrapper extends SocialTimelineCacheInstancePersistence {

    public SocialTimelineCacheInstancePersistenceUnitTestWrapper() {
        super( null, null, null, null, null, null, null, null );
    }

    public SocialTimelineCacheInstancePersistenceUnitTestWrapper(SocialSecurityConstraintsManager socialSecurityConstraintsManager) {
        super( null, null, null, null, null, null, null, socialSecurityConstraintsManager );
    }

    public SocialTimelineCacheInstancePersistenceUnitTestWrapper( Gson gson,
                                                                  Type gsonCollectionType,
                                                                  IOService ioService,
                                                                  SocialEventTypeRepository socialEventTypeRepository,
                                                                  SocialUserClusterPersistence socialUserService ) {
        super( gson, gsonCollectionType, ioService, socialEventTypeRepository, socialUserService, null, null, null );
    }

    @Override
    void cacheControl( SocialUser user ) {
    }

    @Override
    void cacheControl( SocialActivitiesEvent event ) {
    }

    @Override
    public Integer getUserMostRecentFileIndex( SocialUser user ) {
        return 5;
    }

    public Integer getTypeMostRecentFileIndex( SocialEventType type ) {
        return 5;
    }

    SocialEventType findType( SocialActivitiesEvent event ) {
        return DefaultTypes.DUMMY_EVENT;
    }

    @Override
    public List<SocialActivitiesEvent> getTimeline( SocialUser socialUser,
                                                    String timelineFile ) {

        return createFakeTimeline( timelineFile );
    }

    @Override
    public List<SocialActivitiesEvent> getTimeline( SocialEventType type,
                                                    String timelineFile ) {

        return createFakeTimeline( timelineFile );
    }

    private List<SocialActivitiesEvent> createFakeTimeline( String timelineFile ) {
        if ( timelineFile.equals( "5" ) ) {
            return createTimeline( "5", 5 );
        }
        if ( timelineFile.equals( "4" ) ) {
            return createTimeline( "4", 5 );
        }
        if ( timelineFile.equals( "3" ) ) {
            return createTimeline( "3", 5 );
        }
        if ( timelineFile.equals( "2" ) ) {
            return createTimeline( "2", 5 );
        }
        if ( timelineFile.equals( "1" ) ) {
            //empty timeline
            return new ArrayList<SocialActivitiesEvent>();
        }
        if ( timelineFile.equals( "0" ) ) {
            return createTimeline( "0", 5 );
        }
        throw new RuntimeException();
    }

    private List<SocialActivitiesEvent> createTimeline( String name,
                                                        int numEvents ) {
        List<SocialActivitiesEvent> events = new ArrayList<SocialActivitiesEvent>();
        for ( int i = 0; i < numEvents; i++ ) {
            events.add( new SocialActivitiesEvent( new SocialUser( name ), DefaultTypes.DUMMY_EVENT, new Date() ).withAdicionalInfo( i + "" ) );
        }
        return events;
    }

    @Override
    public Integer getNumberOfEventsOnFile( SocialUser socialUser,
                                            String originalFilename ) {
        return -1;
    }

    @Override
    public Integer getNumberOfEventsOnFile( SocialEventType type,
                                            String originalFilename ) {
        return -1;
    }
}


text:
using buzz::QName;
using buzz::XmlElement;

namespace remoting {
namespace protocol {

const char ContentDescription::kChromotingContentName[] = "chromoting";

namespace {

const char kDefaultNs[] = "";

// Following constants are used to format session description in XML.
const char kDescriptionTag[] = "description";
const char kControlTag[] = "control";
const char kEventTag[] = "event";
const char kVideoTag[] = "video";
const char kAudioTag[] = "audio";
const char kDeprecatedResolutionTag[] = "initial-resolution";

const char kTransportAttr[] = "transport";
const char kVersionAttr[] = "version";
const char kCodecAttr[] = "codec";
const char kDeprecatedWidthAttr[] = "width";
const char kDeprecatedHeightAttr[] = "height";

const NameMapElement<ChannelConfig::TransportType> kTransports[] = {
  { ChannelConfig::TRANSPORT_STREAM, "stream" },
  { ChannelConfig::TRANSPORT_MUX_STREAM, "mux-stream" },
  { ChannelConfig::TRANSPORT_DATAGRAM, "datagram" },
  { ChannelConfig::TRANSPORT_NONE, "none" },
};

const NameMapElement<ChannelConfig::Codec> kCodecs[] = {
  { ChannelConfig::CODEC_VERBATIM, "verbatim" },
  { ChannelConfig::CODEC_VP8, "vp8" },
  { ChannelConfig::CODEC_VP9, "vp9" },
  { ChannelConfig::CODEC_ZIP, "zip" },
  { ChannelConfig::CODEC_OPUS, "opus" },
  { ChannelConfig::CODEC_SPEEX, "speex" },
};

// Format a channel configuration tag for chromotocol session description,
// e.g. for video channel:
//    <video transport="stream" version="1" codec="vp8" />
XmlElement* FormatChannelConfig(const ChannelConfig& config,
                                const std::string& tag_name) {
  XmlElement* result = new XmlElement(
      QName(kChromotingXmlNamespace, tag_name));

  result->AddAttr(QName(kDefaultNs, kTransportAttr),
                  ValueToName(kTransports, config.transport));

  if (config.transport != ChannelConfig::TRANSPORT_NONE) {
    result->AddAttr(QName(kDefaultNs, kVersionAttr),
                    base::IntToString(config.version));

    if (config.codec != ChannelConfig::CODEC_UNDEFINED) {
      result->AddAttr(QName(kDefaultNs, kCodecAttr),
                      ValueToName(kCodecs, config.codec));
    }
  }

  return result;
}

// Returns false if the element is invalid.
bool ParseChannelConfig(const XmlElement* element, bool codec_required,
                        ChannelConfig* config) {
  if (!NameToValue(
          kTransports, element->Attr(QName(kDefaultNs, kTransportAttr)),
          &config->transport)) {
    return false;
  }

  // Version is not required when transport="none".
  if (config->transport != ChannelConfig::TRANSPORT_NONE) {
    if (!base::StringToInt(element->Attr(QName(kDefaultNs, kVersionAttr)),
                           &config->version)) {
      return false;
    }

    // Codec is not required when transport="none".
    if (codec_required) {
      if (!NameToValue(kCodecs, element->Attr(QName(kDefaultNs, kCodecAttr)),
                       &config->codec)) {
        return false;
      }
    } else {
      config->codec = ChannelConfig::CODEC_UNDEFINED;
    }
  } else {
    config->version = 0;
    config->codec = ChannelConfig::CODEC_UNDEFINED;
  }

  return true;
}

}  // namespace

ContentDescription::ContentDescription(
    scoped_ptr<CandidateSessionConfig> config,
    scoped_ptr<buzz::XmlElement> authenticator_message)
    : candidate_config_(config.Pass()),
      authenticator_message_(authenticator_message.Pass()) {
}

ContentDescription::~ContentDescription() { }

ContentDescription* ContentDescription::Copy() const {
  if (!candidate_config_.get() || !authenticator_message_.get()) {
    return nullptr;
  }
  scoped_ptr<XmlElement> message(new XmlElement(*authenticator_message_));
  return new ContentDescription(candidate_config_->Clone(), message.Pass());
}

// ToXml() creates content description for chromoting session. The
// description looks as follows:
//   <description xmlns="google:remoting">
//     <control transport="stream" version="1" />
//     <event transport="datagram" version="1" />
//     <video transport="stream" codec="vp8" version="1" />
//     <audio transport="stream" codec="opus" version="1" />
//     <authentication>
//      Message created by Authenticator implementation.
//     </authentication>
//   </description>
//
XmlElement* ContentDescription::ToXml() const {
  XmlElement* root = new XmlElement(
      QName(kChromotingXmlNamespace, kDescriptionTag), true);

  std::list<ChannelConfig>::const_iterator it;

  for (it = config()->control_configs().begin();
       it != config()->control_configs().end(); ++it) {
    root->AddElement(FormatChannelConfig(*it, kControlTag));
  }

  for (it = config()->event_configs().begin();
       it != config()->event_configs().end(); ++it) {
    root->AddElement(FormatChannelConfig(*it, kEventTag));
  }

  for (it = config()->video_configs().begin();
       it != config()->video_configs().end(); ++it) {
    root->AddElement(FormatChannelConfig(*it, kVideoTag));
  }

  for (it = config()->audio_configs().begin();
       it != config()->audio_configs().end(); ++it) {
    ChannelConfig config = *it;
    root->AddElement(FormatChannelConfig(config, kAudioTag));
  }

  // Older endpoints require an initial-resolution tag, but otherwise ignore it.
  XmlElement* resolution_tag = new XmlElement(
      QName(kChromotingXmlNamespace, kDeprecatedResolutionTag));
  resolution_tag->AddAttr(QName(kDefaultNs, kDeprecatedWidthAttr), "640");
  resolution_tag->AddAttr(QName(kDefaultNs, kDeprecatedHeightAttr), "480");
  root->AddElement(resolution_tag);

  if (authenticator_message_.get()) {
    DCHECK(Authenticator::IsAuthenticatorMessage(authenticator_message_.get()));
    root->AddElement(new XmlElement(*authenticator_message_));
  }

  return root;
}

// static
// Adds the channel configs corresponding to |tag_name|,
// found in |element|, to |configs|.
bool ContentDescription::ParseChannelConfigs(
    const XmlElement* const element,
    const char tag_name[],
    bool codec_required,
    bool optional,
    std::list<ChannelConfig>* const configs) {

  QName tag(kChromotingXmlNamespace, tag_name);
  const XmlElement* child = element->FirstNamed(tag);
  while (child) {
    ChannelConfig channel_config;
    if (ParseChannelConfig(child, codec_required, &channel_config)) {
      configs->push_back(channel_config);
    }
    child = child->NextNamed(tag);
  }
  if (optional && configs->empty()) {
      // If there's no mention of the tag, implicitly assume disabled channel.
      configs->push_back(ChannelConfig::None());
  }
  return true;
}

// static
scoped_ptr<ContentDescription> ContentDescription::ParseXml(
    const XmlElement* element) {
  if (element->Name() != QName(kChromotingXmlNamespace, kDescriptionTag)) {
    LOG(ERROR) << "Invalid description: " << element->Str();
    return nullptr;
  }
  scoped_ptr<CandidateSessionConfig> config(
      CandidateSessionConfig::CreateEmpty());
  if (!ParseChannelConfigs(element, kControlTag, false, false,
                           config->mutable_control_configs()) ||
      !ParseChannelConfigs(element, kEventTag, false, false,
                           config->mutable_event_configs()) ||
      !ParseChannelConfigs(element, kVideoTag, true, false,
                           config->mutable_video_configs()) ||
      !ParseChannelConfigs(element, kAudioTag, true, true,
                           config->mutable_audio_configs())) {
    return nullptr;
  }

  scoped_ptr<XmlElement> authenticator_message;
  const XmlElement* child = Authenticator::FindAuthenticatorMessage(element);
  if (child)
    authenticator_message.reset(new XmlElement(*child));

  return make_scoped_ptr(
      new ContentDescription(config.Pass(), authenticator_message.Pass()));
}

}  // namespace protocol
}  // namespace remoting


text:
package io.github.dunwu.javaee.server;

import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Lists;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;

import java.util.ArrayList;

/**
 * JettyFactory 可以工作在 Eclipse 和 Intellij 中,用来启动 jetty 服务。 Intellij
 * 并不支持jetty,所以要想类似eclipse一样的使用jetty,需要配置webdefault.xml。
 *
 * @author Zhang Peng
 */
@SuppressWarnings("unused")
public class JettyFactory {
    private static final int PORT = 8080;
    private static final String CONTEXT = "/";
    private static final String RESOURCE_BASE_PATH = "src/main/webapp";
    private static final String WEB_XML_PATH = "/WEB-INF/web.xml";
    private static final String[] TLD_JAR_NAMES =
            new String[]{"sitemesh", "spring-webmvc", "shiro-web", "tiles"};
    private static final String WINDOWS_WEBDEFAULT_PATH = "jetty/webdefault.xml";

    public static final int IDE_ECLIPSE = 0;
    public static final int IDE_INTELLIJ = 1;

    public static Server initServer() {
        Profiles.setProfileAsSystemProperty(Profiles.DEVELOPMENT);
        WebAppContext webAppContext = new WebAppContext();
        Server server = new Server(PORT);
        server.setHandler(webAppContext);
        return server;
    }

    public static void initWebAppContext(Server server, int type) throws Exception {
        System.out.println("[INFO] Application loading");
        WebAppContext webAppContext = (WebAppContext) server.getHandler();
        webAppContext.setContextPath(CONTEXT);
        webAppContext.setResourceBase(getAbsolutePath() + RESOURCE_BASE_PATH);
        webAppContext.setDescriptor(getAbsolutePath() + RESOURCE_BASE_PATH + WEB_XML_PATH);

        if (IDE_INTELLIJ == type) {
            webAppContext.setDefaultsDescriptor(WINDOWS_WEBDEFAULT_PATH);
            supportJspAndSetTldJarNames(server, TLD_JAR_NAMES);
        } else {
            webAppContext.setParentLoaderPriority(true);
        }

        System.out.println("[INFO] Application loaded");
    }

    public static void reloadWebAppContext(Server server) throws Exception {
        WebAppContext webAppContext = (WebAppContext) server.getHandler();
        System.out.println("[INFO] Application reloading");
        webAppContext.stop();
        WebAppClassLoader classLoader = new WebAppClassLoader(webAppContext);
        classLoader.addClassPath(getAbsolutePath() + "target/classes");
        classLoader.addClassPath(getAbsolutePath() + "target/test-classes");
        webAppContext.setClassLoader(classLoader);
        webAppContext.start();
        System.out.println("[INFO] Application reloaded");
    }

    public static void startServer(Server server) throws Exception {
        System.out.println("[HINT] Don't forget to set -XX:MaxPermSize=128m");
        server.start();
        System.out.println("Server running at http://localhost:" + PORT + CONTEXT);
        System.out.println("[HINT] Hit Enter to reload the application quickly");
    }

    public static String getAbsolutePath() {
        String path = null;
        String folderPath = JettyFactory.class.getProtectionDomain().getCodeSource().getLocation()
                .getPath().substring(1);
        if (folderPath.indexOf("target") > 0) {
            path = folderPath.substring(0, folderPath.indexOf("target"));
        }
        return path;
    }

    public static void supportJspAndSetTldJarNames(Server server, String... jarNames) {
        WebAppContext context = (WebAppContext) server.getHandler();
        // This webapp will use jsps and jstl. We need to enable the AnnotationConfiguration in
        // order to correctly set up the jsp container
        org.eclipse.jetty.webapp.Configuration.ClassList classlist =
                org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
        classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
                "org.eclipse.jetty.annotations.AnnotationConfiguration");
        // Set the ContainerIncludeJarPattern so that jetty examines these container-path jars for
        // tlds, web-fragments etc.
        // If you omit the jar that contains the jstl .tlds, the jsp engine will scan for them
        // instead.
        ArrayList jarNameExprssions = Lists.newArrayList(".*/[^/]*servlet-api-[^/]*\\.jar$",
                ".*/javax.servlet.jsp.jstl-.*\\.jar$", ".*/[^/]*taglibs.*\\.jar$");

        for (String jarName : jarNames) {
            jarNameExprssions.add(".*/" + jarName + "-[^/]*\\.jar$");
        }

        context.setAttribute("org.eclipse.jetty.io.github.dunwu.javaee.server.webapp.ContainerIncludeJarPattern",
                StringUtils.join(jarNameExprssions, '|'));
    }
}


text:
package jade.tools.sniffer;

//#DOTNET_EXCLUDE_BEGIN
import java.awt.event.ActionEvent;
//#DOTNET_EXCLUDE_END
import jade.util.leap.List;
import jade.util.leap.ArrayList;

/*#DOTNET_INCLUDE_BEGIN
import System.Windows.Forms.MenuItem;
import System.Windows.Forms.MouseEventArgs;
#DOTNET_INCLUDE_END*/

  /**
   Javadoc documentation for the file
   @author Francisco Regi, Andrea Soracchi - Universita` di Parma

    Andrea Soracchi(e-mail)
   @version $Date: 2005-04-15 17:45:02 +0200 (ven, 15 apr 2005) $ $Revision: 5669 $
 */

  /**
   * This class includes the method ActionPerformed that is
   * associated with the PopupMenu of the Agent in the canvas.
   * @see jade.tools.sniffer.PopNoSniffAgent
   * @see jade.tools.sniffer.PopShowAgent
   */

public class PopSniffAgent
	//#DOTNET_EXCLUDE_BEGIN
	extends AbstractPopup
	//#DOTNET_EXCLUDE_END
	/*#DOTNET_INCLUDE_BEGIN
	extends MenuItem
	#DOTNET_INCLUDE_END*/
{

private PopupAgent popAg;
private Sniffer mySniffer;
private List sniffedAgent=new ArrayList();
private MMCanvas canvAgent;

 public PopSniffAgent(PopupAgent popAg,Sniffer mySniffer,MMCanvas canvAgent) {
   super ("Do Sniff this Agent");
   this.popAg=popAg;
   this.mySniffer=mySniffer;
   this.canvAgent=canvAgent;
 }
 //#DOTNET_EXCLUDE_BEGIN
 public void actionPerformed(ActionEvent avt) {
 //#DOTNET_EXCLUDE_END
 /*#DOTNET_INCLUDE_BEGIN
 public void OnClick(System.EventArgs e) {
 #DOTNET_INCLUDE_END*/
   if (!canvAgent.isPresent(popAg.agent.agentName))
     canvAgent.addAgent(popAg.agent);   // add Agent in the Canvas
     canvAgent.rAgfromNoSniffVector(popAg.agent);
     sniffedAgent.add(popAg.agent);
     mySniffer.sniffMsg(sniffedAgent,Sniffer.SNIFF_ON);   // Sniff the Agents
     sniffedAgent.clear();
   }

}


text:
exports.name = 'restify';
exports.category = 'server';
exports.homepage = "https://github.com/mcavage/node-restify";


text:
package org.apache.olingo.server.api.debug;

import org.apache.olingo.server.api.ODataResponse;

/**
 * This class supports applications in creating debug responses.
 */
public interface DebugResponseHelper {

  /**
   * Creates a debug response based on the given parameters. Will never throw an exception.
   * @param request
   * @param applicationResponse
   * @param exception
   * @param serverEnvironmentVaribles
   * @param runtimeInformation
   * @return the debug response or the raw application response in case an exception occurred.
   */
  ODataResponse createDebugResponse(DebugInformation debugInfo);
}


text:
"""Tests for the Quotes app."""
import pytest
from django.core import exceptions

from . import models

@pytest.mark.django_db
def test_quote_similarity_pk_order():
    """Pairs of quotes must be ordered by PK."""

    # Small/big in terms of their IDs.
    small_quote = models.Quote.objects.create(content='foo', pk=500)
    big_quote = models.Quote.objects.create(content='bar', pk=505)

    # Wrong order raises an exception.
    with pytest.raises(exceptions.ValidationError):
        models.QuoteSimilarity.objects.create(
            quote_1=big_quote, quote_2=small_quote, score=0.3)

    # Good order works fine.
    models.QuoteSimilarity.objects.create(
        quote_1=small_quote, quote_2=small_quote, score=0.3)

@pytest.mark.django_db
class TestQuoteSimilarityStore(object):
    """QuoteSimilarity.store sorts out which quote gets which number."""

    @pytest.fixture(autouse=True)
    def make_quotes(self):
        """Create small/big quote."""
        # pylint: disable=attribute-defined-outside-init
        self.small_quote = models.Quote.objects.create(content='foo', pk=500)
        self.big_quote = models.Quote.objects.create(content='bar', pk=505)

    def test_from_scratch(self):
        """Will create a new QuoteSimilarity instance properly."""
        inst, created = models.QuoteSimilarity.store(
            self.big_quote, self.small_quote, 0.3)

        assert created
        assert inst.quote_1 == self.small_quote
        assert inst.quote_2 == self.big_quote
        assert inst.score == 0.3

    def test_updates_existing(self):
        """If an existing score is found, updates that instance."""
        sim_score = models.QuoteSimilarity.objects.create(
            quote_1=self.small_quote, quote_2=self.big_quote, score=0.4)

        inst, created = models.QuoteSimilarity.store(
            self.big_quote, self.small_quote, 0.9)

        assert not created
        assert inst.pk == sim_score.pk
        assert inst.quote_1 == self.small_quote
        assert inst.quote_2 == self.big_quote
        assert inst.score == 0.9


text:
/**
 *
 */

(function () {
	// Need to create some default styles, want them in a style sheet so that they can be
	// over written in the apps css file.
	var cssTitle = "mngCoverupStyleSheet";

	// The zIndex to apply to the divs created.
	// This needs to be higher than the zIndex of other siblings...
	// FIXME: look at all siblings and set the zindex accordingly???
	// FIXME: along with that, add an attribute to skip zindex checking mng-coverup-clickable???
	var zIndex   = 1000;

	angular.module('mngCoverup', [])

	.directive('mngCoverup', ['$interval', function ($interval) {

		if ( !hasCSS() ) addCSS();

		return {
			restrict     : 'EA',

			scope        : {
				centered           : '=?',
				centeredHorizontal : '=?',
				centeredVertical   : '=?'
			},

			transclude   : true,
			template    : '
'+
			'

'+
			'

'+
			'
',

			link : mngCoverupLink
		}
	}]);

	function hasCSS () {
		for (var i=0; i<document.styleSheets.length; i++) {
			if ( document.styleSheets[i].title === cssTitle) {
				return true;
			}
		}
		return false;
	}

	function addCSS () {
		var style = document.createElement("style");
		style.type = 'text/css';
		style.title = cssTitle;

		// put at the top of the list so that things specified by the user are used.
		if (document.head.childNodes.length === 0) {
			document.head.appendChild(style);
		}
		else {
			document.head.insertBefore(style, document.head.childNodes[0]);
		}

		style.sheet.addRule(
				'.mngCoverupContainer',
				'position : absolute; '+
				'top      : 0px; '+
				'left     : 0px; '+
				'height   : 100%; '+
				'width    : 100%; '+
				'z-index  : '+zIndex+'; '+
				'display  : block; '
		);

		style.sheet.addRule(
				'.mngCoverupBackground',
				'position         : absolute; '+
				'top              : 0px; '+
				'left             : 0px; '+
				'z-index          : '+zIndex+'; '+
				'height           : 100%; '+
				'width            : 100%; '+
				'background-color : #808080; '+
				'opacity          : 0.3; '
		);

		style.sheet.addRule(
				'.mngCoverupContent',
				'position : absolute; '+
				'z-index  : '+zIndex+'; '
		);
	}

	function mngCoverupLink ( scope, element, attrs ) {

		// if neither centered-horizontal nor centered-vertical, then set both to be centered (or true)
		if ( scope.centeredHorizontal === undefined && scope.centeredVertical === undefined ) {
			if ( scope.centered === undefined || scope.centered ) {
				scope.centeredHorizontal = true;
				scope.centeredVertical   = true;
			}
			else {
				scope.centeredHorizontal = false;
				scope.centeredVertical   = false;
			}
		}
		else if ( scope.centeredHorizontal === undefined ) {
			scope.centeredHorizontal = !scope.centeredVertical;
		}
		else if ( scope.centeredVertical === undefined ) {
			scope.centeredVertical = !scope.centeredHorizontal;
		}

		var content   = element.find('div .mngCoverupContent');
		var container = element.find('div .mngCoverupContainer');

		var divs = element.find("div");
		for (var i=0; i<divs.length; i++) {
			var el = divs[i];
			if ( el.getAttribute('class') === 'mngCoverupContent') {
				content = el;
			}
			if ( el.getAttribute('class') === 'mngCoverupContainer') {
				container = el;
			}
		};

		// Changes to either the content or the container size will make the placement change
		//   to keep the content centered.
		if ( scope.centeredVertical || scope.centeredHorizontal ) {
			scope.$watch(
					function () {
						var contentRect   = content.getBoundingClientRect();
						var containerRect = container.getBoundingClientRect();
						return containerRect.height+','+containerRect.width+'|'+contentRect.height+','+contentRect.width;
					},
					function () { placeContent(scope, content, container); }
			);
		}
		else {
			// the watch isn't added if the content isn't centered, so place here once.
			placeContent(scope, content, container);
		}
	}

	// move the content div to the correct place.
	function placeContent ( scope, content, container) {

		var containerRect = container.getBoundingClientRect();
		var contentRect   = content.getBoundingClientRect();

		// When centering horizontally, don't let the top edge of the content go above the container
		if ( scope.centeredHorizontal ) {
			if ( contentRect.width < containerRect.width ) {
				content.style.left       = '50%';
				content.style.marginLeft = -1*contentRect.width/2+'px';
			}
			else {
				content.style.left       = 0;
				content.style.marginLeft = 0;
			}
		}

		// When centering vertically, don't let the left edge of the content go past the container
		if ( scope.centeredVertical ) {
			if ( contentRect.height < containerRect.height ) {
				content.style.top        = '50%';
				content.style.marginTop  = -1*contentRect.height/2+'px';
			}
			else {
				content.style.top        = 0;
				content.style.marginTop  = 0;
			}
		}
	}

})();


text:
package org.eclipse.php.internal.core.buildpath;

import java.util.*;

import org.eclipse.core.runtime.IPath;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IBuildpathEntry;
import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ModelException;

public class BuildPathUtils {

	/**
	 * Adds the given entries to the Build Path
	 *
	 * @param scriptProject
	 * @param entries
	 * @throws ModelException
	 */
	public static void addEntriesToBuildPath(IScriptProject scriptProject,
			List<IBuildpathEntry> entries) throws ModelException {
		IBuildpathEntry[] rawBuildpath = scriptProject.getRawBuildpath();

		// get the current buildpath entries, in order to add/remove entries
		Set<IBuildpathEntry> newRawBuildpath = new HashSet<IBuildpathEntry>();

		// get all of the source folders and the language library from the
		// existing build path
		for (IBuildpathEntry buildpathEntry : rawBuildpath) {
			newRawBuildpath.add(buildpathEntry);
		}
		// add all of the entries added in this dialog
		for (IBuildpathEntry buildpathEntry : entries) {
			newRawBuildpath.add(buildpathEntry);
		}

		// set the new updated buildpath for the project
		scriptProject.setRawBuildpath(newRawBuildpath
				.toArray(new IBuildpathEntry[newRawBuildpath.size()]), null);

	}

	/**
	 * Adds the given entries to the Build Path. Check duplicating before
	 * adding.
	 *
	 * @param scriptProject
	 * @param entries
	 * @throws ModelException
	 */
	public static void addNonDupEntriesToBuildPath(
			IScriptProject scriptProject, List<IBuildpathEntry> entries)
			throws ModelException {

		// get the current buildpath entries, in order to add/remove entries
		Set<IBuildpathEntry> newRawBuildpath = new HashSet<IBuildpathEntry>();

		IBuildpathEntry[] rawBuildpath = scriptProject.getRawBuildpath();

		// get all of the source folders and the language library from the
		// existing build path
		for (IBuildpathEntry buildpathEntry : rawBuildpath) {
			newRawBuildpath.add(buildpathEntry);
		}

		for (IBuildpathEntry buildpathEntry : entries) {
			if (!buildpathContains(newRawBuildpath
					.toArray(new IBuildpathEntry[newRawBuildpath.size()]),
					buildpathEntry)) {
				newRawBuildpath.add(buildpathEntry);
			}
		}

		// set the new updated buildpath for the project
		scriptProject.setRawBuildpath(newRawBuildpath
				.toArray(new IBuildpathEntry[newRawBuildpath.size()]), null);

	}

	/**
	 * Returns if the given item is in the list if the given list contains the
	 * specified entry. If the list does not contain the entry, false is
	 * returned. The check is applied on path only. exclusion/inclusion patterns
	 * are ignored.
	 */
	public static boolean buildpathContains(IBuildpathEntry[] list,
			IBuildpathEntry entry) {
		for (int i = 0; i < list.length; i++) {
			IBuildpathEntry other = list[i];
			if (other.getContentKind() == entry.getContentKind()
					&& other.getEntryKind() == entry.getEntryKind()
					&& other.isExported() == entry.isExported()
					&& other.getPath().equals(entry.getPath())) {
				return true;
			}
		}
		return false;
	}

	/**
	 * Removes the given entry from the build path (according to the path)
	 *
	 * @param scriptProject
	 * @param buildpathEntry
	 * @throws ModelException
	 */
	public static void removeEntryFromBuildPath(IScriptProject scriptProject,
			IBuildpathEntry buildpathEntry) throws ModelException {
		IBuildpathEntry[] rawBuildpath = scriptProject.getRawBuildpath();

		// get the current buildpath entries, in order to remove the given
		// entries
		List<IBuildpathEntry> newRawBuildpath = new ArrayList<IBuildpathEntry>();

		for (IBuildpathEntry entry : rawBuildpath) {
			if (!(entry.getPath().equals(buildpathEntry.getPath()))) {
				newRawBuildpath.add(entry);
			}

		}

		// set the new updated buildpath for the project
		scriptProject.setRawBuildpath(newRawBuildpath
				.toArray(new IBuildpathEntry[newRawBuildpath.size()]), null);

	}

	/**
	 * Returns whether the given path is "under" the buildpath definitions
	 * Meaning if one of the entries in the build path has the same path or
	 * contains this resource
	 *
	 * @param project
	 * @param resourcePath
	 * @return
	 */
	public static boolean isContainedInBuildpath(IPath resourcePath,
			IScriptProject project) {
		boolean result = false;
		if (resourcePath == null) {
			return false;
		}

		IBuildpathEntry[] buildpath = null;
		try {
			buildpath = project.getRawBuildpath();
		} catch (ModelException e) {
			if (DLTKCore.DEBUG) {
				e.printStackTrace();
			}
			return false;
		}

		// go over the build path entries and for each one of the "sources"
		// check if they are the same as the given include path entry or if they
		// contain it
		for (IBuildpathEntry buildpathEntry : buildpath) {
			if (buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_SOURCE) {
				IPath buildPathEntryPath = buildpathEntry.getPath();
				if (buildPathEntryPath.isPrefixOf(resourcePath)
						|| resourcePath.toString().equals(
								buildPathEntryPath.toString())) {
					result = true;
				}
			}
		}
		return result;
	}

	/**
	 * Returns whether the include path is a part of build path
	 *
	 * @param resourcePath
	 *            Include path
	 * @param project
	 * @return
	 */
	public static boolean isInBuildpath(IPath resourcePath,
			IScriptProject project) {
		boolean result = false;
		if (resourcePath == null) {
			return false;
		}

		IBuildpathEntry[] buildpath = null;
		try {
			buildpath = project.getRawBuildpath();
		} catch (ModelException e) {
			if (DLTKCore.DEBUG) {
				e.printStackTrace();
			}
			return false;
		}

		// go over the build path entries and for each one of the "sources"
		// check if they are the same as the given include path entry
		for (IBuildpathEntry buildpathEntry : buildpath) {
			if (buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_SOURCE) {
				IPath buildPathEntryPath = buildpathEntry.getPath();
				if (resourcePath.toString().equals(
						buildPathEntryPath.toString())) {
					result = true;
				}
			}
		}
		return result;
	}

	/**
	 * Returns whether the include path is a part of build path
	 *
	 * @param resourcePath
	 *            Include path
	 * @param project
	 * @return
	 */
	public static List<IBuildpathEntry> getContainedBuildpathes(
			IPath resourcePath, IScriptProject project) {
		if (resourcePath == null) {
			return Collections.EMPTY_LIST;
		}

		IBuildpathEntry[] buildpath = null;
		try {
			buildpath = project.getRawBuildpath();
		} catch (ModelException e) {
			if (DLTKCore.DEBUG) {
				e.printStackTrace();
			}
			return Collections.EMPTY_LIST;
		}

		ArrayList<IBuildpathEntry> result = new ArrayList<IBuildpathEntry>();
		// go over the build path entries and for each one of the "sources"
		// check if they are the same as the given include path entry or if they
		// contain it
		for (IBuildpathEntry buildpathEntry : buildpath) {
			if (buildpathEntry.getEntryKind() == IBuildpathEntry.BPE_SOURCE) {
				IPath buildPathEntryPath = buildpathEntry.getPath();
				if (resourcePath.isPrefixOf(buildPathEntryPath)
						|| resourcePath.toString().equals(
								buildPathEntryPath.toString())) {
					result.add(buildpathEntry);
				}
			}
		}

		return result;
	}
}


text:
package com.jcodes.xml;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * 工具类
 *
 * @author zangweiren 2010-4-19
 *
 */
public class Toolkit {
	private static long start_time;
	private static List<String> times = new ArrayList<String>();

	public static void endTime(Parser parser) {
		long end_time = System.currentTimeMillis();
		double seconds = (end_time - start_time) / 1000.0;

		StringBuilder b = new StringBuilder();
		b.append("--------------\n");
		b.append(parser.getName() + " Time used:" + seconds + " s");
		times.add(b.toString());
	}

	public static void printTimes() {
		for (Iterator<String> ts = times.iterator(); ts.hasNext();) {
			System.out.println(ts.next());
		}
		times.clear();
	}

	public static void startTime(Parser parser) {
		start_time = System.currentTimeMillis();
	}
}


text:
require 'spec_helper'

RSpec.describe CustomEmoji do
  describe 'Associations' do
    it { is_expected.to belong_to(:namespace) }
    it { is_expected.to have_db_column(:file) }
    it { is_expected.to validate_length_of(:name).is_at_most(36) }
    it { is_expected.to validate_presence_of(:name) }
    it { is_expected.to have_db_column(:external) }
  end

  describe 'exclusion of duplicated emoji' do
    let(:emoji_name) { Gitlab::Emoji.emojis_names.sample }

    it 'disallows emoji names of built-in emoji' do
      new_emoji = build(:custom_emoji, name: emoji_name)

      expect(new_emoji).not_to be_valid
      expect(new_emoji.errors.messages).to eq(name: ["#{emoji_name} is already being used for another emoji"])
    end

    it 'disallows duplicate custom emoji names within namespace' do
      old_emoji = create(:custom_emoji)
      new_emoji = build(:custom_emoji, name: old_emoji.name, namespace: old_emoji.namespace)

      expect(new_emoji).not_to be_valid
      expect(new_emoji.errors.messages).to eq(name: ["has already been taken"])
    end
  end
end


text:
set -e

echo ""
echo "RELEASE"
echo ""

# Go to project dir
cd $(dirname $0)/../..

git checkout master; git pull origin master
npm run build
standard-version -- --prerelease alpha
cp package.json dist/package.json
git push --follow-tags origin master; npm publish dist