instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public class ArrayKeyBuilder
{
private final ArrayList<Object> keyParts = new ArrayList<>();
/* package */ ArrayKeyBuilder()
{
}
public ArrayKey build()
{
return new ArrayKey(keyParts.toArray());
}
/**
* Directly append given object.
*
* @param obj object to append (could be null)
* @return this
*/
public ArrayKeyBuilder append(final Object obj)
{
keyParts.add(obj);
return this;
}
public ArrayKeyBuilder appendAll(@NonNull final Collection<Object> objs)
{
keyParts.addAll(objs);
return this;
}
public ArrayKeyBuilder append(final String name, final Object obj)
{
keyParts.add(name);
keyParts.add(obj);
return this;
}
|
/**
* Appends given ID. If ID is less or equal with ZERO then -1 will be appended.
*
* @param id ID to append
* @return this
*/
public ArrayKeyBuilder appendId(final int id)
{
keyParts.add(id <= 0 ? -1 : id);
return this;
}
public ArrayKeyBuilder appendModelId(final Object model)
{
final int modelId;
if (model == null)
{
modelId = -1;
}
else
{
modelId = InterfaceWrapperHelper.getId(model);
}
keyParts.add(modelId);
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\util\ArrayKeyBuilder.java
| 1
|
请完成以下Java代码
|
public void updateVariable(boolean isAdmin, UpdateTaskVariablePayload updateTaskVariablePayload) {
if (!isAdmin) {
assertCanModifyTask(getInternalTask(updateTaskVariablePayload.getTaskId()));
}
taskVariablesValidator.handleUpdateTaskVariablePayload(updateTaskVariablePayload);
assertVariableExists(updateTaskVariablePayload);
taskService.setVariableLocal(
updateTaskVariablePayload.getTaskId(),
updateTaskVariablePayload.getName(),
updateTaskVariablePayload.getValue()
);
}
private void assertVariableExists(UpdateTaskVariablePayload updateTaskVariablePayload) {
Map<String, VariableInstance> variables = taskService.getVariableInstancesLocal(
updateTaskVariablePayload.getTaskId()
);
|
if (variables == null) {
throw new IllegalStateException("Variable does not exist");
}
if (!variables.containsKey(updateTaskVariablePayload.getName())) {
throw new IllegalStateException("Variable does not exist");
}
}
public void handleCompleteTaskPayload(CompleteTaskPayload completeTaskPayload) {
completeTaskPayload.setVariables(
taskVariablesValidator.handlePayloadVariables(completeTaskPayload.getVariables())
);
}
public void handleSaveTaskPayload(SaveTaskPayload saveTaskPayload) {
saveTaskPayload.setVariables(taskVariablesValidator.handlePayloadVariables(saveTaskPayload.getVariables()));
}
}
|
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-task-runtime-impl\src\main\java\org\activiti\runtime\api\impl\TaskRuntimeHelper.java
| 1
|
请完成以下Java代码
|
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
public org.compiere.model.I_IMP_Processor getIMP_Processor() throws RuntimeException
{
return (org.compiere.model.I_IMP_Processor)MTable.get(getCtx(), org.compiere.model.I_IMP_Processor.Table_Name)
.getPO(getIMP_Processor_ID(), get_TrxName()); }
/** Set Import Processor.
@param IMP_Processor_ID Import Processor */
public void setIMP_Processor_ID (int IMP_Processor_ID)
{
if (IMP_Processor_ID < 1)
set_ValueNoCheck (COLUMNNAME_IMP_Processor_ID, null);
else
set_ValueNoCheck (COLUMNNAME_IMP_Processor_ID, Integer.valueOf(IMP_Processor_ID));
}
/** Get Import Processor.
@return Import Processor */
public int getIMP_Processor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_IMP_Processor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Import Processor Parameter.
@param IMP_ProcessorParameter_ID Import Processor Parameter */
public void setIMP_ProcessorParameter_ID (int IMP_ProcessorParameter_ID)
{
if (IMP_ProcessorParameter_ID < 1)
set_ValueNoCheck (COLUMNNAME_IMP_ProcessorParameter_ID, null);
else
set_ValueNoCheck (COLUMNNAME_IMP_ProcessorParameter_ID, Integer.valueOf(IMP_ProcessorParameter_ID));
}
/** Get Import Processor Parameter.
@return Import Processor Parameter */
public int getIMP_ProcessorParameter_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_IMP_ProcessorParameter_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
|
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Parameter Value.
@param ParameterValue Parameter Value */
public void setParameterValue (String ParameterValue)
{
set_Value (COLUMNNAME_ParameterValue, ParameterValue);
}
/** Get Parameter Value.
@return Parameter Value */
public String getParameterValue ()
{
return (String)get_Value(COLUMNNAME_ParameterValue);
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_IMP_ProcessorParameter.java
| 1
|
请完成以下Java代码
|
public void setIsNullFieldValue (boolean IsNullFieldValue)
{
set_Value (COLUMNNAME_IsNullFieldValue, Boolean.valueOf(IsNullFieldValue));
}
/** Get Null Value.
@return Null Value */
public boolean isNullFieldValue ()
{
Object oo = get_Value(COLUMNNAME_IsNullFieldValue);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Eintraege; die kleinste Zahl kommt zuerst
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Eintraege; die kleinste Zahl kommt zuerst
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
|
/** Type AD_Reference_ID=540203 */
public static final int TYPE_AD_Reference_ID=540203;
/** Set Field Value = SV */
public static final String TYPE_SetFieldValue = "SV";
/** Set Art.
@param Type
Type of Validation (SQL, Java Script, Java Language)
*/
public void setType (String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
/** Get Art.
@return Type of Validation (SQL, Java Script, Java Language)
*/
public String getType ()
{
return (String)get_Value(COLUMNNAME_Type);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\org\adempiere\model\X_AD_TriggerUI_Action.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public String getBankCode() {
return bankCode;
}
public void setBankCode(String bankCode) {
this.bankCode = bankCode;
}
public String getUserNo() {
return userNo;
}
public void setUserNo(String userNo) {
this.userNo = userNo;
}
public String getCvn2() {
return cvn2;
}
public void setCvn2(String cvn2) {
this.cvn2 = cvn2;
}
public String getExpDate() {
return expDate;
|
}
public void setExpDate(String expDate) {
this.expDate = expDate;
}
public String getIsDefault() {
return isDefault;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public String getIsAuth() {
return isAuth;
}
public void setIsAuth(String isAuth) {
this.isAuth = isAuth;
}
public String getStatusDesc() {
if (StringUtil.isEmpty(this.getStatus())) {
return "";
} else {
return PublicStatusEnum.getEnum(this.getStatus()).getDesc();
}
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\user\entity\RpUserQuickPayBankAccount.java
| 2
|
请完成以下Java代码
|
public class CmmnResourceEntityImpl extends AbstractCmmnEngineNoRevisionEntity implements CmmnResourceEntity, Serializable {
private static final long serialVersionUID = 1L;
protected String name;
protected byte[] bytes;
protected String deploymentId;
protected boolean generated;
public CmmnResourceEntityImpl() {
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public byte[] getBytes() {
return bytes;
}
@Override
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
@Override
public String getDeploymentId() {
return deploymentId;
|
}
@Override
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
@Override
public Object getPersistentState() {
return CmmnResourceEntityImpl.class;
}
@Override
public boolean isGenerated() {
return false;
}
@Override
public void setGenerated(boolean generated) {
this.generated = generated;
}
@Override
public String toString() {
return "CmmnResourceEntity[id=" + id + ", name=" + name + "]";
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\persistence\entity\CmmnResourceEntityImpl.java
| 1
|
请完成以下Java代码
|
public static void closeQuietly(Closeable c)
{
try
{
if (c != null) c.close();
}
catch (IOException ignored)
{
}
}
/**
* @param raf
*/
public static void closeQuietly(RandomAccessFile raf)
{
try
{
if (raf != null) raf.close();
}
catch (IOException ignored)
{
}
}
public static void closeQuietly(InputStream is)
{
try
{
if (is != null) is.close();
}
catch (IOException ignored)
{
}
}
public static void closeQuietly(Reader r)
{
try
{
if (r != null) r.close();
}
|
catch (IOException ignored)
{
}
}
public static void closeQuietly(OutputStream os)
{
try
{
if (os != null) os.close();
}
catch (IOException ignored)
{
}
}
public static void closeQuietly(Writer w)
{
try
{
if (w != null) w.close();
}
catch (IOException ignored)
{
}
}
/**
* 数组分割
*
* @param from 源
* @param to 目标
* @param <T> 类型
* @return 目标
*/
public static <T> T[] shrink(T[] from, T[] to)
{
assert to.length <= from.length;
System.arraycopy(from, 0, to, 0, to.length);
return to;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word2vec\Utility.java
| 1
|
请完成以下Java代码
|
public class HistoryDecisionEvaluationListener implements DmnDecisionEvaluationListener {
protected DmnHistoryEventProducer eventProducer;
protected HistoryLevel historyLevel;
public HistoryDecisionEvaluationListener(DmnHistoryEventProducer historyEventProducer) {
this.eventProducer = historyEventProducer;
}
public void notify(DmnDecisionEvaluationEvent evaluationEvent) {
HistoryEvent historyEvent = createHistoryEvent(evaluationEvent);
if(historyEvent != null) {
Context.getProcessEngineConfiguration()
.getHistoryEventHandler()
.handleEvent(historyEvent);
}
}
protected HistoryEvent createHistoryEvent(DmnDecisionEvaluationEvent evaluationEvent) {
if (historyLevel == null) {
historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
}
DmnDecision decisionTable = evaluationEvent.getDecisionResult().getDecision();
if(isDeployedDecisionTable(decisionTable) && historyLevel.isHistoryEventProduced(HistoryEventTypes.DMN_DECISION_EVALUATE, decisionTable)) {
CoreExecutionContext<? extends CoreExecution> executionContext = Context.getCoreExecutionContext();
if (executionContext != null) {
CoreExecution coreExecution = executionContext.getExecution();
if (coreExecution instanceof ExecutionEntity) {
ExecutionEntity execution = (ExecutionEntity) coreExecution;
return eventProducer.createDecisionEvaluatedEvt(execution, evaluationEvent);
}
else if (coreExecution instanceof CaseExecutionEntity) {
CaseExecutionEntity caseExecution = (CaseExecutionEntity) coreExecution;
|
return eventProducer.createDecisionEvaluatedEvt(caseExecution, evaluationEvent);
}
}
return eventProducer.createDecisionEvaluatedEvt(evaluationEvent);
} else {
return null;
}
}
protected boolean isDeployedDecisionTable(DmnDecision decision) {
if(decision instanceof DecisionDefinition) {
return ((DecisionDefinition) decision).getId() != null;
} else {
return false;
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\parser\HistoryDecisionEvaluationListener.java
| 1
|
请完成以下Java代码
|
public static SessionFactory getSessionFactory() throws IOException {
return getSessionFactory(null);
}
public static SessionFactory getSessionFactory(String propertyFileName) throws IOException {
PROPERTY_FILE_NAME = propertyFileName;
ServiceRegistry serviceRegistry = configureServiceRegistry();
return makeSessionFactory(serviceRegistry);
}
public static SessionFactory getSessionFactoryByProperties(Properties properties) throws IOException {
ServiceRegistry serviceRegistry = configureServiceRegistry(properties);
return makeSessionFactory(serviceRegistry);
}
private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) {
MetadataSources metadataSources = new MetadataSources(serviceRegistry);
metadataSources.addPackage("com.baeldung.hibernate.pojo");
metadataSources.addAnnotatedClass(Student.class);
metadataSources.addAnnotatedClass(PointEntity.class);
metadataSources.addAnnotatedClass(PolygonEntity.class);
Metadata metadata = metadataSources.getMetadataBuilder()
.build();
return metadata.getSessionFactoryBuilder()
.build();
}
private static ServiceRegistry configureServiceRegistry() throws IOException {
return configureServiceRegistry(getProperties());
}
|
private static ServiceRegistry configureServiceRegistry(Properties properties) throws IOException {
return new StandardServiceRegistryBuilder().applySettings(properties)
.build();
}
public static Properties getProperties() throws IOException {
Properties properties = new Properties();
URL propertiesURL = Thread.currentThread()
.getContextClassLoader()
.getResource(StringUtils.defaultString(PROPERTY_FILE_NAME, "hibernate.properties"));
try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) {
properties.load(inputStream);
}
return properties;
}
}
|
repos\tutorials-master\persistence-modules\hibernate-enterprise\src\main\java\com\baeldung\hibernate\HibernateUtil.java
| 1
|
请完成以下Java代码
|
private int handleNewBPartnerLocationRequest(final NewRecordDescriptor.ProcessNewRecordDocumentRequest request)
{
@NonNull final BPartnerId bpartnerId = getBPartnerId(request);
final I_C_BPartner_Location_QuickInput template = InterfaceWrapperHelper.getPO(request.getDocument());
updateTemplateForTriggeringField(template, request.getTriggeringField());
final BPartnerLocationId bpLocationId = bpartnerLocationQuickInputService.createBPartnerLocationFromTemplate(template, bpartnerId);
return bpLocationId.getRepoId();
}
private void updateTemplateForTriggeringField(@NonNull final I_C_BPartner_Location_QuickInput template, @NonNull final String triggeringField)
{
switch (triggeringField)
{
case I_C_Order.COLUMNNAME_C_BPartner_Location_ID:
case I_C_Order.COLUMNNAME_DropShip_Location_ID:
template.setIsShipTo(true);
return;
case I_C_Order.COLUMNNAME_Bill_Location_ID:
template.setIsBillTo(true);
return;
case I_C_Order.COLUMNNAME_HandOver_Location_ID:
template.setIsHandOverLocation(true);
}
}
@NonNull
private BPartnerId getBPartnerId(final NewRecordDescriptor.ProcessNewRecordDocumentRequest request)
{
if (request.getTriggeringDocumentPath() == null)
{
throw new AdempiereException("Unknown triggering path");
}
if (request.getTriggeringField() == null)
|
{
throw new AdempiereException("Unknown triggering field");
}
final String bpartnerFieldName = getBPartnerFieldName(request.getTriggeringField());
final Document triggeringDocument = documentCollection.getDocumentReadonly(request.getTriggeringDocumentPath());
return triggeringDocument.getFieldView(bpartnerFieldName)
.getValueAsId(BPartnerId.class)
.orElseThrow(() -> new AdempiereException("No bpartner ID found"));
}
@NonNull
private static String getBPartnerFieldName(@NonNull final String triggeringField)
{
switch (triggeringField)
{
case I_C_Order.COLUMNNAME_C_BPartner_Location_ID:
return I_C_Order.COLUMNNAME_C_BPartner_ID;
case I_C_Order.COLUMNNAME_Bill_Location_ID:
return I_C_Order.COLUMNNAME_Bill_BPartner_ID;
case I_C_Order.COLUMNNAME_HandOver_Location_ID:
return I_C_Order.COLUMNNAME_HandOver_Partner_ID;
case I_C_Order.COLUMNNAME_DropShip_Location_ID:
return I_C_Order.COLUMNNAME_DropShip_BPartner_ID;
default:
throw new AdempiereException("Unknown triggering field: " + triggeringField);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\bpartner\quickinput\BPartnerLocationQuickInputConfiguration.java
| 1
|
请完成以下Java代码
|
public void updateArticle(ArticleUpdateRequest updateRequest) {
contents.updateArticleContentsIfPresent(updateRequest);
}
public Article updateFavoriteByUser(User user) {
favorited = userFavorited.contains(user);
return this;
}
public User getAuthor() {
return author;
}
public ArticleContents getContents() {
return contents;
}
public Instant getCreatedAt() {
return createdAt;
}
public Instant getUpdatedAt() {
return updatedAt;
}
public int getFavoritedCount() {
return userFavorited.size();
}
|
public boolean isFavorited() {
return favorited;
}
public Set<Comment> getComments() {
return comments;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
var article = (Article) o;
return author.equals(article.author) && contents.getTitle().equals(article.contents.getTitle());
}
@Override
public int hashCode() {
return Objects.hash(author, contents.getTitle());
}
}
|
repos\realworld-springboot-java-master\src\main\java\io\github\raeperd\realworld\domain\article\Article.java
| 1
|
请完成以下Java代码
|
private void createUpdateShipmentLine(@NonNull final ShipmentScheduleWithHU candidate)
{
//
// If we cannot add this "candidate" to current shipment line builder
// then create shipment line (if any) and reset the builder
if (currentShipmentLineBuilder != null && !currentShipmentLineBuilder.canAdd(candidate))
{
createShipmentLineIfAny(); // => currentShipmentLineBuilder is null after this
}
//
// If we don't have an active shipment line builder
// then create one
if (currentShipmentLineBuilder == null)
{
currentShipmentLineBuilder = new ShipmentLineBuilder(currentShipment, shipmentLineNoInfo);
currentShipmentLineBuilder.setManualPackingMaterial(candidate.isAdviseManualPackingMaterial());
currentShipmentLineBuilder.setQtyTypeToUse(candidate.getQtyTypeToUse());
currentShipmentLineBuilder.setAlreadyAssignedTUIds(tuIdsAlreadyAssignedToShipmentLine);
}
//
// Add current "candidate"
currentShipmentLineBuilder.add(candidate);
}
@Override
public InOutGenerateResult getResult()
{
return result;
}
@Override
public IInOutProducerFromShipmentScheduleWithHU setProcessShipments(final boolean processShipments)
{
this.processShipments = processShipments;
return this;
}
@Override
|
public IInOutProducerFromShipmentScheduleWithHU setCreatePackingLines(final boolean createPackingLines)
{
this.createPackingLines = createPackingLines;
return this;
}
@Override
public IInOutProducerFromShipmentScheduleWithHU computeShipmentDate(final CalculateShippingDateRule calculateShippingDateRule)
{
this.calculateShippingDateRule = calculateShippingDateRule;
return this;
}
@Override
public IInOutProducerFromShipmentScheduleWithHU setScheduleIdToExternalInfo(@NonNull final ImmutableMap<ShipmentScheduleId, ShipmentScheduleExternalInfo> scheduleId2ExternalInfo)
{
this.scheduleId2ExternalInfo.putAll(scheduleId2ExternalInfo);
return this;
}
@Override
public String toString()
{
return "InOutProducerFromShipmentSchedule [result=" + result
+ ", shipmentScheduleKeyBuilder=" + shipmentScheduleKeyBuilder + ", huShipmentScheduleKeyBuilder=" + huShipmentScheduleKeyBuilder
+ ", processorCtx=" + processorCtx + ", currentShipment=" + currentShipment
+ ", currentShipmentLineBuilder=" + currentShipmentLineBuilder + ", currentCandidates=" + currentCandidates
+ ", lastItem=" + lastItem + "]";
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\shipmentschedule\spi\impl\InOutProducerFromShipmentScheduleWithHU.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class R_Request_StartProject extends JavaProcess implements IProcessPrecondition
{
private final ServiceRepairProjectService serviceRepairProjectService = SpringContextHolder.instance.getBean(ServiceRepairProjectService.class);
private final IRequestBL requestBL = Services.get(IRequestBL.class);
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context)
{
final RequestId requestId = RequestId.ofRepoIdOrNull(context.getSingleSelectedRecordId());
if (requestId == null)
{
return ProcessPreconditionsResolution.reject();
}
final I_R_Request request = requestBL.getById(requestId);
final ProjectId projectId = ProjectId.ofRepoIdOrNull(request.getC_Project_ID());
if (projectId != null)
{
return ProcessPreconditionsResolution.rejectWithInternalReason("project already created");
}
// TODO: check if it's an Service/Repair Request
return ProcessPreconditionsResolution.accept();
}
|
@Override
protected String doIt()
{
final RequestId requestId = RequestId.ofRepoId(getRecord_ID());
final ProjectId projectId = serviceRepairProjectService.createProjectFromRequest(requestId);
getResult().setRecordToOpen(ProcessExecutionResult.RecordsToOpen.builder()
.record(TableRecordReference.of(I_C_Project.Table_Name, projectId))
.adWindowId(String.valueOf(ServiceRepairProjectService.AD_WINDOW_ID.getRepoId()))
.target(ProcessExecutionResult.RecordsToOpen.OpenTarget.SingleDocument)
.targetTab(ProcessExecutionResult.RecordsToOpen.TargetTab.NEW_TAB)
.build());
return MSG_OK;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.servicerepair.webui\src\main\java\de\metas\servicerepair\request\process\R_Request_StartProject.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@NotNull
@Size(min = 3, max = 80)
private String email;
@NotNull
@Size(min = 2, max = 80)
private String name;
public User() { }
public User(long id) {
this.id = id;
}
public User(String email, String name) {
this.email = email;
this.name = name;
}
public long getId() {
return id;
}
public void setId(long value) {
this.id = value;
}
|
public String getEmail() {
return email;
}
public void setEmail(String value) {
this.email = value;
}
public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
} // class User
|
repos\spring-boot-samples-master\spring-boot-mysql-hibernate\src\main\java\netgloo\models\User.java
| 2
|
请完成以下Java代码
|
public void setMandatoryType (final java.lang.String MandatoryType)
{
set_Value (COLUMNNAME_MandatoryType, MandatoryType);
}
@Override
public java.lang.String getMandatoryType()
{
return get_ValueAsString(COLUMNNAME_MandatoryType);
}
@Override
public void setM_AttributeSet_ID (final int M_AttributeSet_ID)
{
if (M_AttributeSet_ID < 0)
set_ValueNoCheck (COLUMNNAME_M_AttributeSet_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_AttributeSet_ID, M_AttributeSet_ID);
}
@Override
public int getM_AttributeSet_ID()
{
|
return get_ValueAsInt(COLUMNNAME_M_AttributeSet_ID);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_AttributeSet.java
| 1
|
请完成以下Java代码
|
public void init() {
initOrganizations();
initPrivileges();
initUsers();
}
private void initUsers() {
final Privilege privilege1 = privilegeRepository.findByName("FOO_READ_PRIVILEGE");
final Privilege privilege2 = privilegeRepository.findByName("FOO_WRITE_PRIVILEGE");
final User user1 = new User();
user1.setUsername("john");
user1.setPassword(encoder.encode("123"));
user1.setPrivileges(new HashSet<>(Arrays.asList(privilege1)));
user1.setOrganization(organizationRepository.findByName("FirstOrg"));
userRepository.save(user1);
final User user2 = new User();
user2.setUsername("tom");
user2.setPassword(encoder.encode("111"));
user2.setPrivileges(new HashSet<>(Arrays.asList(privilege1, privilege2)));
user2.setOrganization(organizationRepository.findByName("SecondOrg"));
userRepository.save(user2);
}
private void initOrganizations() {
|
final Organization org1 = new Organization("FirstOrg");
organizationRepository.save(org1);
final Organization org2 = new Organization("SecondOrg");
organizationRepository.save(org2);
}
private void initPrivileges() {
final Privilege privilege1 = new Privilege("FOO_READ_PRIVILEGE");
privilegeRepository.save(privilege1);
final Privilege privilege2 = new Privilege("FOO_WRITE_PRIVILEGE");
privilegeRepository.save(privilege2);
}
}
|
repos\tutorials-master\spring-security-modules\spring-security-web-boot-1\src\main\java\com\baeldung\roles\custom\persistence\SetupData.java
| 1
|
请完成以下Java代码
|
public void setEntityType (String EntityType)
{
set_ValueNoCheck (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Model Validation Class.
@param ModelValidationClass Model Validation Class */
public void setModelValidationClass (String ModelValidationClass)
{
set_Value (COLUMNNAME_ModelValidationClass, ModelValidationClass);
}
/** Get Model Validation Class.
@return Model Validation Class */
public String getModelValidationClass ()
{
return (String)get_Value(COLUMNNAME_ModelValidationClass);
}
/** Set Name.
@param Name
|
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ModelValidator.java
| 1
|
请完成以下Java代码
|
public class OnlineUser {
/**
* 主键
*/
private Long id;
/**
* 用户名
*/
private String username;
/**
* 昵称
*/
private String nickname;
/**
* 手机
*/
private String phone;
/**
* 邮箱
|
*/
private String email;
/**
* 生日
*/
private Long birthday;
/**
* 性别,男-1,女-2
*/
private Integer sex;
public static OnlineUser create(User user) {
OnlineUser onlineUser = new OnlineUser();
BeanUtil.copyProperties(user, onlineUser);
// 脱敏
onlineUser.setPhone(StrUtil.hide(user.getPhone(), 3, 7));
onlineUser.setEmail(StrUtil.hide(user.getEmail(), 1, StrUtil.indexOfIgnoreCase(user.getEmail(), Consts.SYMBOL_EMAIL)));
return onlineUser;
}
}
|
repos\spring-boot-demo-master\demo-rbac-security\src\main\java\com\xkcoding\rbac\security\vo\OnlineUser.java
| 1
|
请完成以下Java代码
|
public java.sql.Timestamp getEndDate ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_EndDate);
}
/**
* Frequency AD_Reference_ID=540870
* Reference name: C_NonBusinessDay_Frequency
*/
public static final int FREQUENCY_AD_Reference_ID=540870;
/** Weekly = W */
public static final String FREQUENCY_Weekly = "W";
/** Yearly = Y */
public static final String FREQUENCY_Yearly = "Y";
/** Set Häufigkeit.
@param Frequency
Häufigkeit von Ereignissen
*/
@Override
public void setFrequency (java.lang.String Frequency)
{
set_Value (COLUMNNAME_Frequency, Frequency);
}
/** Get Häufigkeit.
@return Häufigkeit von Ereignissen
*/
@Override
public java.lang.String getFrequency ()
{
return (java.lang.String)get_Value(COLUMNNAME_Frequency);
}
/** Set Repeat.
@param IsRepeat Repeat */
@Override
public void setIsRepeat (boolean IsRepeat)
{
set_Value (COLUMNNAME_IsRepeat, Boolean.valueOf(IsRepeat));
|
}
/** Get Repeat.
@return Repeat */
@Override
public boolean isRepeat ()
{
Object oo = get_Value(COLUMNNAME_IsRepeat);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_NonBusinessDay.java
| 1
|
请完成以下Java代码
|
public void setQty (int Qty)
{
set_Value (COLUMNNAME_Qty, Integer.valueOf(Qty));
}
/** Get Quantity.
@return Quantity
*/
public int getQty ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Qty);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Start Date.
|
@param StartDate
First effective day (inclusive)
*/
public void setStartDate (Timestamp StartDate)
{
set_Value (COLUMNNAME_StartDate, StartDate);
}
/** Get Start Date.
@return First effective day (inclusive)
*/
public Timestamp getStartDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StartDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_HR_Year.java
| 1
|
请完成以下Java代码
|
public SignalEventReceivedBuilder withoutTenantId() {
// tenant-id is null
isTenantIdSet = true;
return this;
}
@Override
public void send() {
if (executionId != null && isTenantIdSet) {
throw LOG.exceptionDeliverSignalToSingleExecutionWithTenantId();
}
SignalEventReceivedCmd command = new SignalEventReceivedCmd(this);
commandExecutor.execute(command);
}
public String getSignalName() {
return signalName;
}
|
public String getExecutionId() {
return executionId;
}
public String getTenantId() {
return tenantId;
}
public boolean isTenantIdSet() {
return isTenantIdSet;
}
public VariableMap getVariables() {
return variables;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\SignalEventReceivedBuilderImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private Instant getDate(@NonNull final CandidateType candidateType)
{
return TimeUtil.getDay(computeDate(abstractDDOrderEvent, ddOrderLine, candidateType), orgZone);
}
@NonNull
private MainDataRecordIdentifier getMainRecordIdentifier(@NonNull final CandidateType candidateType)
{
return MainDataRecordIdentifier.builder()
.date(getDate(candidateType))
.warehouseId(getWarehouseIdForType(candidateType))
.productDescriptor(ddOrderLine.getProductDescriptor())
.build();
}
@NonNull
private UpdateMainDataRequest buildUpdateMainDataRequest(
@NonNull final MainDataRecordIdentifier mainDataRecordIdentifier,
|
@NonNull final CandidateType candidateType,
@NonNull final BigDecimal qtyPending)
{
final UpdateMainDataRequest.UpdateMainDataRequestBuilder updateMainDataRequestBuilder = UpdateMainDataRequest.builder()
.identifier(mainDataRecordIdentifier);
switch (candidateType)
{
case DEMAND:
return updateMainDataRequestBuilder.qtyDemandDDOrder(qtyPending).build();
case SUPPLY:
return updateMainDataRequestBuilder.qtySupplyDDOrder(qtyPending).build();
default:
throw new AdempiereException("CandidateType not supported! CandidateType = " + candidateType);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-service\src\main\java\de\metas\material\dispo\service\event\handler\ddorder\DDOrderMainDataHandler.java
| 2
|
请完成以下Java代码
|
public final class OAuth2TokenFormat implements Serializable {
@Serial
private static final long serialVersionUID = -3808658977410337294L;
/**
* Self-contained tokens use a protected, time-limited data structure that contains
* token metadata and claims of the user and/or client. JSON Web Token (JWT) is a
* widely used format.
*/
public static final OAuth2TokenFormat SELF_CONTAINED = new OAuth2TokenFormat("self-contained");
/**
* Reference (opaque) tokens are unique identifiers that serve as a reference to the
* token metadata and claims of the user and/or client, stored at the provider.
*/
public static final OAuth2TokenFormat REFERENCE = new OAuth2TokenFormat("reference");
private final String value;
/**
* Constructs an {@code OAuth2TokenFormat} using the provided value.
* @param value the value of the token format
*/
public OAuth2TokenFormat(String value) {
Assert.hasText(value, "value cannot be empty");
this.value = value;
}
/**
* Returns the value of the token format.
|
* @return the value of the token format
*/
public String getValue() {
return this.value;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
OAuth2TokenFormat that = (OAuth2TokenFormat) obj;
return getValue().equals(that.getValue());
}
@Override
public int hashCode() {
return getValue().hashCode();
}
}
|
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\settings\OAuth2TokenFormat.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setTaskId(String taskId) {
this.taskId = taskId;
}
@Override
public String getExecutionId() {
return executionId;
}
@Override
public String getScopeId() {
return scopeId;
}
@Override
public String getScopeType() {
return scopeType;
}
@Override
public void setScopeId(String scopeId) {
this.scopeId = scopeId;
}
@Override
public String getSubScopeId() {
return subScopeId;
}
@Override
public void setSubScopeId(String subScopeId) {
this.subScopeId = subScopeId;
}
@Override
public void setScopeType(String scopeType) {
this.scopeType = scopeType;
}
@Override
public String getScopeDefinitionId() {
return scopeDefinitionId;
}
@Override
public void setScopeDefinitionId(String scopeDefinitionId) {
this.scopeDefinitionId = scopeDefinitionId;
}
@Override
public String getMetaInfo() {
return metaInfo;
}
@Override
public void setMetaInfo(String metaInfo) {
this.metaInfo = metaInfo;
}
// The methods below are not relevant, as getValue() is used directly to return the value set during the transaction
|
@Override
public String getTextValue() {
return null;
}
@Override
public void setTextValue(String textValue) {
}
@Override
public String getTextValue2() {
return null;
}
@Override
public void setTextValue2(String textValue2) {
}
@Override
public Long getLongValue() {
return null;
}
@Override
public void setLongValue(Long longValue) {
}
@Override
public Double getDoubleValue() {
return null;
}
@Override
public void setDoubleValue(Double doubleValue) {
}
@Override
public byte[] getBytes() {
return null;
}
@Override
public void setBytes(byte[] bytes) {
}
@Override
public Object getCachedValue() {
return null;
}
@Override
public void setCachedValue(Object cachedValue) {
}
}
|
repos\flowable-engine-main\modules\flowable-variable-service\src\main\java\org\flowable\variable\service\impl\persistence\entity\TransientVariableInstance.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private ConnectionFactory findJndiConnectionFactory(JndiLocatorDelegate jndiLocatorDelegate) {
for (String name : JNDI_LOCATIONS) {
try {
return jndiLocatorDelegate.lookup(name, ConnectionFactory.class);
}
catch (NamingException ex) {
// Swallow and continue
}
}
throw new IllegalStateException(
"Unable to find ConnectionFactory in JNDI locations " + Arrays.asList(JNDI_LOCATIONS));
}
/**
* Condition for JNDI name or a specific property.
*/
static class JndiOrPropertyCondition extends AnyNestedCondition {
JndiOrPropertyCondition() {
|
super(ConfigurationPhase.PARSE_CONFIGURATION);
}
@ConditionalOnJndi({ "java:/JmsXA", "java:/XAConnectionFactory" })
static class Jndi {
}
@ConditionalOnProperty("spring.jms.jndi-name")
static class Property {
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-jms\src\main\java\org\springframework\boot\jms\autoconfigure\JndiConnectionFactoryAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public boolean isParentChanged(PO po)
{
return po.is_ValueChanged(I_M_Product_Category.COLUMNNAME_M_Product_Category_Parent_ID);
}
@Override
public int getOldParent_ID(PO po)
{
return po.get_ValueOldAsInt(I_M_Product_Category.COLUMNNAME_M_Product_Category_Parent_ID);
}
@Override
public String getParentIdSQL()
{
return I_M_Product_Category.COLUMNNAME_M_Product_Category_Parent_ID;
}
|
@Override
public MTreeNode getNodeInfo(GridTab gridTab)
{
MTreeNode info = super.getNodeInfo(gridTab);
info.setAllowsChildren(true); // we always allow children because IsSummary field will be automatically
// maintained
return info;
}
@Override
public MTreeNode loadNodeInfo(MTree tree, ResultSet rs) throws SQLException
{
MTreeNode info = super.loadNodeInfo(tree, rs);
info.setAllowsChildren(true); // we always allow children because IsSummary field will be automatically
info.setImageIndicator(I_M_Product_Category.Table_Name);
return info;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\product\tree\spi\impl\MProductCategoryTreeSupport.java
| 1
|
请完成以下Java代码
|
public static String convertId2String(long id)
{
StringBuilder sbId = new StringBuilder(7);
sbId.append((char)(id / (26 * 10 * 10 * 26 * 10 * 10) + 'A'));
sbId.append((char)(id % (26 * 10 * 10 * 26 * 10 * 10) / (10 * 10 * 26 * 10 * 10) + 'a'));
sbId.append((char)(id % (10 * 10 * 26 * 10 * 10) / (10 * 26 * 10 * 10) + '0'));
sbId.append((char)(id % (10 * 26 * 10 * 10) / (26 * 10 * 10) + '0'));
sbId.append((char)(id % (26 * 10 * 10) / (10 * 10) + 'A'));
sbId.append((char)(id % (10 * 10) / (10) + '0'));
sbId.append((char)(id % (10) / (1) + '0'));
return sbId.toString();
}
public static long convertString2IdWithIndex(String idString, long index)
{
long id = convertString2Id(idString);
|
id = id * MAX_WORDS + index;
return id;
}
public static long convertString2IdWithIndex(String idString, int index)
{
return convertString2IdWithIndex(idString, (long) index);
}
public static String convertId2StringWithIndex(long id)
{
String idString = convertId2String(id / MAX_WORDS);
long index = id % MAX_WORDS;
return String.format("%s%0" + MAX_INDEX_LENGTH + "d", idString, index);
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\corpus\synonym\SynonymHelper.java
| 1
|
请完成以下Java代码
|
public class ExecuteInactiveBehaviorsOperation extends AbstractOperation {
private static final Logger logger = LoggerFactory.getLogger(ExecuteInactiveBehaviorsOperation.class);
protected Collection<ExecutionEntity> involvedExecutions;
public ExecuteInactiveBehaviorsOperation(CommandContext commandContext) {
super(commandContext, null);
this.involvedExecutions = commandContext.getInvolvedExecutions();
}
@Override
public void run() {
/*
* Algorithm: for each execution that is involved in this command context,
*
* 1) Get its process definition
* 2) Verify if its process definitions has any InactiveActivityBehavior behaviours.
* 3) If so, verify if there are any executions inactive in those activities
* 4) Execute the inactivated behavior
*
*/
for (ExecutionEntity executionEntity : involvedExecutions) {
Process process = ProcessDefinitionUtil.getProcess(executionEntity.getProcessDefinitionId());
Collection<String> flowNodeIdsWithInactivatedBehavior = new ArrayList<String>();
for (FlowNode flowNode : process.findFlowElementsOfType(FlowNode.class)) {
if (flowNode.getBehavior() instanceof InactiveActivityBehavior) {
flowNodeIdsWithInactivatedBehavior.add(flowNode.getId());
}
}
if (flowNodeIdsWithInactivatedBehavior.size() > 0) {
Collection<ExecutionEntity> inactiveExecutions = commandContext
.getExecutionEntityManager()
.findInactiveExecutionsByProcessInstanceId(executionEntity.getProcessInstanceId());
for (ExecutionEntity inactiveExecution : inactiveExecutions) {
if (
!inactiveExecution.isActive() &&
|
flowNodeIdsWithInactivatedBehavior.contains(inactiveExecution.getActivityId()) &&
!inactiveExecution.isDeleted()
) {
FlowNode flowNode = (FlowNode) process.getFlowElement(inactiveExecution.getActivityId(), true);
InactiveActivityBehavior inactiveActivityBehavior =
((InactiveActivityBehavior) flowNode.getBehavior());
logger.debug(
"Found InactiveActivityBehavior instance of class {} that can be executed on activity '{}'",
inactiveActivityBehavior.getClass(),
flowNode.getId()
);
inactiveActivityBehavior.executeInactive(inactiveExecution);
}
}
}
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\agenda\ExecuteInactiveBehaviorsOperation.java
| 1
|
请完成以下Java代码
|
public ProductId extractProductId(@NonNull final List<RefundConfig> refundConfigs)
{
final ProductId productId = extractSingleElement(
refundConfigs,
RefundConfig::getProductId);
return productId;
}
public void assertValid(@NonNull final List<RefundConfig> refundConfigs)
{
Check.assumeNotEmpty(refundConfigs, "refundConfigs");
if (hasDifferentValues(refundConfigs, RefundConfig::getRefundBase))
{
Loggables.addLog("The given refundConfigs need to all have the same RefundBase; refundConfigs={}", refundConfigs);
throw new AdempiereException(MSG_REFUND_CONFIG_SAME_REFUND_BASE).markAsUserValidationError();
}
if (hasDifferentValues(refundConfigs, RefundConfig::getRefundMode))
{
Loggables.addLog("The given refundConfigs need to all have the same RefundMode; refundConfigs={}", refundConfigs);
throw new AdempiereException(MSG_REFUND_CONFIG_SAME_REFUND_MODE).markAsUserValidationError();
}
if (RefundMode.APPLY_TO_ALL_QTIES.equals(extractRefundMode(refundConfigs)))
{
// we have one IC with different configs, so those configs need to have the consistent settings
if (hasDifferentValues(refundConfigs, RefundConfig::getInvoiceSchedule))
{
Loggables.addLog(
|
"Because refundMode={}, all the given refundConfigs need to all have the same invoiceSchedule; refundConfigs={}",
RefundMode.APPLY_TO_ALL_QTIES, refundConfigs);
throw new AdempiereException(MSG_REFUND_CONFIG_SAME_INVOICE_SCHEDULE).markAsUserValidationError();
}
if (hasDifferentValues(refundConfigs, RefundConfig::getRefundInvoiceType))
{
Loggables.addLog(
"Because refundMode={}, all the given refundConfigs need to all have the same refundInvoiceType; refundConfigs={}",
RefundMode.APPLY_TO_ALL_QTIES, refundConfigs);
throw new AdempiereException(MSG_REFUND_CONFIG_SAME_REFUND_INVOICE_TYPE).markAsUserValidationError();
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\refund\RefundConfigs.java
| 1
|
请完成以下Java代码
|
public class SignalDto {
private String name;
private String executionId;
private Map<String, VariableValueDto> variables;
private String tenantId;
private boolean withoutTenantId;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getTenantId() {
return tenantId;
}
|
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public Map<String, VariableValueDto> getVariables() {
return variables;
}
public void setVariables(Map<String, VariableValueDto> variables) {
this.variables = variables;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public void setWithoutTenantId(boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\SignalDto.java
| 1
|
请完成以下Java代码
|
public static class OAuth2AuthorizedClientRowMapper
implements BiFunction<Row, RowMetadata, OAuth2AuthorizedClientHolder> {
@Override
public OAuth2AuthorizedClientHolder apply(Row row, RowMetadata rowMetadata) {
String dbClientRegistrationId = row.get("client_registration_id", String.class);
OAuth2AccessToken.TokenType tokenType = null;
if (OAuth2AccessToken.TokenType.BEARER.getValue()
.equalsIgnoreCase(row.get("access_token_type", String.class))) {
tokenType = OAuth2AccessToken.TokenType.BEARER;
}
String tokenValue = new String(row.get("access_token_value", ByteBuffer.class).array(),
StandardCharsets.UTF_8);
Instant issuedAt = row.get("access_token_issued_at", LocalDateTime.class).toInstant(ZoneOffset.UTC);
Instant expiresAt = row.get("access_token_expires_at", LocalDateTime.class).toInstant(ZoneOffset.UTC);
Set<String> scopes = Collections.emptySet();
String accessTokenScopes = row.get("access_token_scopes", String.class);
if (accessTokenScopes != null) {
scopes = StringUtils.commaDelimitedListToSet(accessTokenScopes);
}
|
final OAuth2AccessToken accessToken = new OAuth2AccessToken(tokenType, tokenValue, issuedAt, expiresAt,
scopes);
OAuth2RefreshToken refreshToken = null;
ByteBuffer refreshTokenValue = row.get("refresh_token_value", ByteBuffer.class);
if (refreshTokenValue != null) {
tokenValue = new String(refreshTokenValue.array(), StandardCharsets.UTF_8);
issuedAt = null;
LocalDateTime refreshTokenIssuedAt = row.get("refresh_token_issued_at", LocalDateTime.class);
if (refreshTokenIssuedAt != null) {
issuedAt = refreshTokenIssuedAt.toInstant(ZoneOffset.UTC);
}
refreshToken = new OAuth2RefreshToken(tokenValue, issuedAt);
}
String dbPrincipalName = row.get("principal_name", String.class);
return new OAuth2AuthorizedClientHolder(dbClientRegistrationId, dbPrincipalName, accessToken, refreshToken);
}
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\R2dbcReactiveOAuth2AuthorizedClientService.java
| 1
|
请完成以下Spring Boot application配置
|
spring:
application:
# name: ENC(xQZuD8KnkqzIGep0FFH0DYJ3Re9TrKTdvu2fxIlWNpwFcdNGhkpCag==)
# name: ENC(KoaHnIhRGiCdWh0T2lby899Cov6MyiAXrW5PadJ3XFY=)
name: demo-application
jasypt:
# jasypt 配置项,对应 JasyptEncryptorConfigurationPr
|
operties 配置类
encryptor:
algorithm: PBEWithMD5AndDES # 加密算法
password: ${JASYPT_PASSWORD} # 加密秘钥
|
repos\SpringBoot-Labs-master\lab-43\lab-43-demo-jasypt\src\main\resources\application.yaml
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Result<String> deleteUserByPassword(@RequestBody SysUser sysUser,HttpServletRequest request){
Integer tenantId = oConvertUtils.getInteger(TokenUtils.getTenantIdByRequest(request), null);
sysTenantService.deleteUserByPassword(sysUser, tenantId);
return Result.ok("删除用户成功");
}
/**
* 查询当前用户的所有有效租户【知识库专用接口】
* @return
*/
@RequestMapping(value = "/getCurrentUserTenantForFile", method = RequestMethod.GET)
public Result<Map<String,Object>> getCurrentUserTenantForFile() {
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
try {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<SysTenant> tenantList = sysTenantService.getTenantListByUserId(sysUser.getId());
Map<String,Object> map = new HashMap<>(5);
//在开启saas租户隔离的时候并且租户数据不为空,则返回租户信息
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL && CollectionUtil.isNotEmpty(tenantList)) {
map.put("list", tenantList);
}
result.setSuccess(true);
result.setResult(map);
}catch(Exception e) {
log.error(e.getMessage(), e);
result.error500("查询失败!");
}
return result;
}
/**
* 目前只给敲敲云人员与部门下的用户删除使用
*
* 删除用户
*/
|
@DeleteMapping("/deleteUser")
public Result<String> deleteUser(@RequestBody SysUser sysUser,HttpServletRequest request){
Integer tenantId = oConvertUtils.getInteger(TokenUtils.getTenantIdByRequest(request), null);
sysTenantService.deleteUser(sysUser, tenantId);
return Result.ok("删除用户成功");
}
/**
* 根据租户id和用户id获取用户的产品包列表和当前用户下的产品包id
*
* @param tenantId
* @param request
* @return
*/
@GetMapping("/listPackByTenantUserId")
public Result<Map<String, Object>> listPackByTenantUserId(@RequestParam("tenantId") String tenantId,
@RequestParam("userId") String userId,
HttpServletRequest request) {
if (null == tenantId) {
return null;
}
List<SysTenantPack> list = sysTenantPackService.getPackListByTenantId(tenantId);
List<String> userPackIdList = sysTenantPackService.getPackIdByUserIdAndTenantId(userId, oConvertUtils.getInt(tenantId));
Map<String, Object> map = new HashMap<>(5);
map.put("packList", list);
map.put("userPackIdList", userPackIdList);
return Result.ok(map);
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\controller\SysTenantController.java
| 2
|
请完成以下Java代码
|
public class StartupWindowConstraint extends Constraint
{
public static final StartupWindowConstraint ofAD_Form_ID(final int adFormId)
{
if (adFormId <= 0)
{
return NULL;
}
return new StartupWindowConstraint(adFormId);
}
public static final StartupWindowConstraint NULL = new StartupWindowConstraint();
private final int adFormId;
private StartupWindowConstraint(int adFormId)
{
super();
Check.assume(adFormId > 0, "adFormId > 0");
this.adFormId = adFormId;
}
/** Null constructor */
private StartupWindowConstraint()
{
super();
|
this.adFormId = -1;
}
@Override
public String toString()
{
// NOTE: we are making it translateable friendly because it's displayed in Prefereces->Info->Rollen
return "StartupWindow[@AD_Form_ID@:" + adFormId + "]";
}
/** @return false, i.e. never inherit this constraint because it shall be defined by current role itself */
@Override
public boolean isInheritable()
{
return false;
}
public int getAD_Form_ID()
{
return adFormId;
}
public boolean isNull()
{
return this == NULL;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\permissions\StartupWindowConstraint.java
| 1
|
请完成以下Java代码
|
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
|
}
@Override
public void setQtyToDispose (final BigDecimal QtyToDispose)
{
set_Value (COLUMNNAME_QtyToDispose, QtyToDispose);
}
@Override
public BigDecimal getQtyToDispose()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyToDispose);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_Inventory_Candidate.java
| 1
|
请完成以下Java代码
|
public List<ProductionMaterialType> getTypes()
{
if (types == null)
{
return Collections.emptyList();
}
return types;
}
@Override
public IProductionMaterialQuery setM_Product(final I_M_Product product)
{
this.product = product;
return this;
}
@Override
public I_M_Product getM_Product()
{
return product;
|
}
@Override
public IProductionMaterialQuery setPP_Order(final I_PP_Order ppOrder)
{
this.ppOrder = ppOrder;
return this;
}
@Override
public I_PP_Order getPP_Order()
{
return ppOrder;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\impl\ProductionMaterialQuery.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private <I extends EntityId, E extends ExportableEntity<I>, D extends EntityExportData<E>> EntityExportService<I, E, D> getExportService(EntityType entityType) {
EntityExportService<?, ?, ?> exportService = exportServices.get(entityType);
if (exportService == null) {
throw new IllegalArgumentException("Export for entity type " + entityType + " is not supported");
}
return (EntityExportService<I, E, D>) exportService;
}
@SuppressWarnings("unchecked")
private <I extends EntityId, E extends ExportableEntity<I>, D extends EntityExportData<E>> EntityImportService<I, E, D> getImportService(EntityType entityType) {
EntityImportService<?, ?, ?> importService = importServices.get(entityType);
if (importService == null) {
throw new IllegalArgumentException("Import for entity type " + entityType + " is not supported");
}
return (EntityImportService<I, E, D>) importService;
}
@Autowired
private void setExportServices(DefaultEntityExportService<?, ?, ?> defaultExportService,
Collection<BaseEntityExportService<?, ?, ?>> exportServices) {
exportServices.stream()
.sorted(Comparator.comparing(exportService -> exportService.getSupportedEntityTypes().size(), Comparator.reverseOrder()))
.forEach(exportService -> {
exportService.getSupportedEntityTypes().forEach(entityType -> {
this.exportServices.put(entityType, exportService);
|
});
});
SUPPORTED_ENTITY_TYPES.forEach(entityType -> {
this.exportServices.putIfAbsent(entityType, defaultExportService);
});
}
@Autowired
private void setImportServices(Collection<EntityImportService<?, ?, ?>> importServices) {
importServices.forEach(entityImportService -> {
this.importServices.put(entityImportService.getEntityType(), entityImportService);
});
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\sync\ie\DefaultEntitiesExportImportService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private IDeviceParameterValueSupplier getParameterValueSupplier()
{
Check.assumeNotNull(parameterValueSupplier, "Parameter parameterValueSupplier is not null");
return parameterValueSupplier;
}
public DeviceConfig.Builder setRequestClassnamesSupplier(final IDeviceRequestClassnamesSupplier requestClassnamesSupplier)
{
this.requestClassnamesSupplier = requestClassnamesSupplier;
return this;
}
private IDeviceRequestClassnamesSupplier getRequestClassnamesSupplier()
{
Check.assumeNotNull(requestClassnamesSupplier, "Parameter requestClassnamesSupplier is not null");
return requestClassnamesSupplier;
}
public DeviceConfig.Builder setAssignedWarehouseIds(final Set<WarehouseId> assignedWareouseIds)
{
this.assignedWareouseIds = assignedWareouseIds;
return this;
}
private ImmutableSet<WarehouseId> getAssignedWarehouseIds()
{
return assignedWareouseIds == null ? ImmutableSet.of() : ImmutableSet.copyOf(assignedWareouseIds);
}
@NonNull
private ImmutableSet<LocatorId> getAssignedLocatorIds()
{
return assignedLocatorIds == null ? ImmutableSet.of() : ImmutableSet.copyOf(assignedLocatorIds);
}
@NonNull
public DeviceConfig.Builder setAssignedLocatorIds(final Set<LocatorId> assignedLocatorIds)
{
this.assignedLocatorIds = assignedLocatorIds;
|
return this;
}
@NonNull
public DeviceConfig.Builder setBeforeHooksClassname(@NonNull final ImmutableList<String> beforeHooksClassname)
{
this.beforeHooksClassname = beforeHooksClassname;
return this;
}
@NonNull
private ImmutableList<String> getBeforeHooksClassname()
{
return Optional.ofNullable(beforeHooksClassname).orElseGet(ImmutableList::of);
}
@NonNull
public DeviceConfig.Builder setDeviceConfigParams(@NonNull final ImmutableMap<String, String> deviceConfigParams)
{
this.deviceConfigParams = deviceConfigParams;
return this;
}
@NonNull
private ImmutableMap<String, String> getDeviceConfigParams()
{
return deviceConfigParams == null ? ImmutableMap.of() : deviceConfigParams;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.device.adempiere\src\main\java\de\metas\device\config\DeviceConfig.java
| 2
|
请完成以下Java代码
|
public class DecisionTaskItemHandler extends CallingTaskItemHandler {
protected void initializeActivity(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
super.initializeActivity(element, activity, context);
initializeResultVariable(element, activity, context);
initializeDecisionTableResultMapper(element, activity, context);
}
protected void initializeResultVariable(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
DecisionTask decisionTask = getDefinition(element);
DmnDecisionTaskActivityBehavior behavior = getActivityBehavior(activity);
String resultVariable = decisionTask.getCamundaResultVariable();
behavior.setResultVariable(resultVariable);
}
protected void initializeDecisionTableResultMapper(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
DecisionTask decisionTask = getDefinition(element);
DmnDecisionTaskActivityBehavior behavior = getActivityBehavior(activity);
String mapper = decisionTask.getCamundaMapDecisionResult();
DecisionResultMapper decisionResultMapper = getDecisionResultMapperForName(mapper);
behavior.setDecisionTableResultMapper(decisionResultMapper);
}
protected BaseCallableElement createCallableElement() {
return new BaseCallableElement();
}
protected CmmnActivityBehavior getActivityBehavior() {
return new DmnDecisionTaskActivityBehavior();
}
protected DmnDecisionTaskActivityBehavior getActivityBehavior(CmmnActivity activity) {
return (DmnDecisionTaskActivityBehavior) activity.getActivityBehavior();
}
protected String getDefinitionKey(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
DecisionTask definition = getDefinition(element);
String decision = definition.getDecision();
if (decision == null) {
DecisionRefExpression decisionExpression = definition.getDecisionExpression();
if (decisionExpression != null) {
decision = decisionExpression.getText();
}
}
|
return decision;
}
protected String getBinding(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
DecisionTask definition = getDefinition(element);
return definition.getCamundaDecisionBinding();
}
protected String getVersion(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
DecisionTask definition = getDefinition(element);
return definition.getCamundaDecisionVersion();
}
protected String getTenantId(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context) {
DecisionTask definition = getDefinition(element);
return definition.getCamundaDecisionTenantId();
}
protected DecisionTask getDefinition(CmmnElement element) {
return (DecisionTask) super.getDefinition(element);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\handler\DecisionTaskItemHandler.java
| 1
|
请完成以下Java代码
|
public List<String> getTaskMetricIds() {
return taskMetricIds;
}
public void setTaskMetricIds(List<String> taskMetricIds) {
this.taskMetricIds = taskMetricIds;
}
/**
* Size of the batch.
*/
public int size() {
return historicProcessInstanceIds.size() + historicDecisionInstanceIds.size() + historicCaseInstanceIds.size() + historicBatchIds.size() + taskMetricIds.size();
}
public void performCleanup() {
CommandContext commandContext = Context.getCommandContext();
HistoryCleanupHelper.prepareNextBatch(this, commandContext);
if (size() > 0) {
if (historicProcessInstanceIds.size() > 0) {
commandContext.getHistoricProcessInstanceManager().deleteHistoricProcessInstanceByIds(historicProcessInstanceIds);
}
if (historicDecisionInstanceIds.size() > 0) {
commandContext.getHistoricDecisionInstanceManager().deleteHistoricDecisionInstanceByIds(historicDecisionInstanceIds);
}
if (historicCaseInstanceIds.size() > 0) {
commandContext.getHistoricCaseInstanceManager().deleteHistoricCaseInstancesByIds(historicCaseInstanceIds);
}
if (historicBatchIds.size() > 0) {
commandContext.getHistoricBatchManager().deleteHistoricBatchesByIds(historicBatchIds);
}
if (taskMetricIds.size() > 0) {
commandContext.getMeterLogManager().deleteTaskMetricsById(taskMetricIds);
}
}
}
@Override
protected Map<String, Long> reportMetrics() {
Map<String, Long> reports = new HashMap<>();
if (historicProcessInstanceIds.size() > 0) {
reports.put(Metrics.HISTORY_CLEANUP_REMOVED_PROCESS_INSTANCES, (long) historicProcessInstanceIds.size());
}
if (historicDecisionInstanceIds.size() > 0) {
reports.put(Metrics.HISTORY_CLEANUP_REMOVED_DECISION_INSTANCES, (long) historicDecisionInstanceIds.size());
}
if (historicCaseInstanceIds.size() > 0) {
|
reports.put(Metrics.HISTORY_CLEANUP_REMOVED_CASE_INSTANCES, (long) historicCaseInstanceIds.size());
}
if (historicBatchIds.size() > 0) {
reports.put(Metrics.HISTORY_CLEANUP_REMOVED_BATCH_OPERATIONS, (long) historicBatchIds.size());
}
if (taskMetricIds.size() > 0) {
reports.put(Metrics.HISTORY_CLEANUP_REMOVED_TASK_METRICS, (long) taskMetricIds.size());
}
return reports;
}
@Override
boolean shouldRescheduleNow() {
return size() >= getBatchSizeThreshold();
}
public Integer getBatchSizeThreshold() {
return Context
.getProcessEngineConfiguration()
.getHistoryCleanupBatchThreshold();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\historycleanup\HistoryCleanupBatch.java
| 1
|
请完成以下Java代码
|
public String getTopic() {
return topic;
}
@Override
public void subscribe() {
partitions = Collections.singleton(new TopicPartitionInfo(topic, null, null, true));
subscribed = true;
}
@Override
public void subscribe(Set<TopicPartitionInfo> partitions) {
this.partitions = partitions;
subscribed = true;
}
@Override
public void stop() {
stopped = true;
}
@Override
public void unsubscribe() {
stopped = true;
subscribed = false;
}
@Override
public List<T> poll(long durationInMillis) {
if (subscribed) {
@SuppressWarnings("unchecked")
List<T> messages = partitions
.stream()
.map(tpi -> {
try {
return storage.get(tpi.getFullTopicName());
} catch (InterruptedException e) {
if (!stopped) {
log.error("Queue was interrupted.", e);
}
return Collections.emptyList();
}
})
.flatMap(List::stream)
.map(msg -> (T) msg).collect(Collectors.toList());
if (messages.size() > 0) {
return messages;
|
}
try {
Thread.sleep(durationInMillis);
} catch (InterruptedException e) {
if (!stopped) {
log.error("Failed to sleep.", e);
}
}
}
return Collections.emptyList();
}
@Override
public void commit() {
}
@Override
public boolean isStopped() {
return stopped;
}
@Override
public Set<TopicPartitionInfo> getPartitions() {
return partitions;
}
@Override
public List<String> getFullTopicNames() {
return partitions.stream().map(TopicPartitionInfo::getFullTopicName).collect(Collectors.toList());
}
}
|
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\memory\InMemoryTbQueueConsumer.java
| 1
|
请完成以下Java代码
|
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Type AD_Reference_ID=101 */
public static final int TYPE_AD_Reference_ID=101;
/** SQL = S */
public static final String TYPE_SQL = "S";
/** Java = J */
public static final String TYPE_Java = "J";
|
/** Java-Script = E */
public static final String TYPE_Java_Script = "E";
/** Composite = C */
public static final String TYPE_Composite = "C";
/** Set Art.
@param Type
Type of Validation (SQL, Java Script, Java Language)
*/
public void setType (String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
/** Get Art.
@return Type of Validation (SQL, Java Script, Java Language)
*/
public String getType ()
{
return (String)get_Value(COLUMNNAME_Type);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Val_Rule.java
| 1
|
请完成以下Java代码
|
public void setPackageWeight (final @Nullable BigDecimal PackageWeight)
{
set_Value (COLUMNNAME_PackageWeight, PackageWeight);
}
@Override
public BigDecimal getPackageWeight()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PackageWeight);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProductName (final @Nullable java.lang.String ProductName)
{
throw new IllegalArgumentException ("ProductName is virtual column"); }
@Override
public java.lang.String getProductName()
{
return get_ValueAsString(COLUMNNAME_ProductName);
}
@Override
public void setProductValue (final @Nullable java.lang.String ProductValue)
{
|
throw new IllegalArgumentException ("ProductValue is virtual column"); }
@Override
public java.lang.String getProductValue()
{
return get_ValueAsString(COLUMNNAME_ProductValue);
}
@Override
public void setQtyLU (final @Nullable BigDecimal QtyLU)
{
set_Value (COLUMNNAME_QtyLU, QtyLU);
}
@Override
public BigDecimal getQtyLU()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyLU);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyTU (final @Nullable BigDecimal QtyTU)
{
set_Value (COLUMNNAME_QtyTU, QtyTU);
}
@Override
public BigDecimal getQtyTU()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyTU);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\shipping\model\X_M_ShippingPackage.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void prepareExternalStatusCreateRequest(@NonNull final Exchange exchange, @NonNull final JsonExternalStatus externalStatus)
{
final OnDemandRequest onDemandRouteRequest = exchange.getIn().getBody(OnDemandRequest.class);
final JsonExternalSystemRequest externalSystemRequest = onDemandRouteRequest.getExternalSystemRequest();
final IExternalSystemService externalSystemService = onDemandRouteRequest.getExternalSystemService();
final JsonStatusRequest jsonStatusRequest = JsonStatusRequest.builder()
.status(externalStatus)
.pInstanceId(externalSystemRequest.getAdPInstanceId())
.build();
final ExternalStatusCreateCamelRequest camelRequest = ExternalStatusCreateCamelRequest.builder()
.jsonStatusRequest(jsonStatusRequest)
.externalSystemChildConfigValue(externalSystemRequest.getExternalSystemChildConfigValue())
.externalSystemConfigType(externalSystemService.getExternalSystemTypeCode())
.serviceValue(externalSystemService.getServiceValue())
.build();
exchange.getIn().setBody(camelRequest);
}
|
private void disableRoute(@NonNull final Exchange exchange) throws Exception
{
final StopOnDemandRouteRequest request = exchange.getIn().getBody(StopOnDemandRouteRequest.class);
if (exchange.getContext().getRoute(request.getRouteId()) == null)
{
return;
}
exchange.getContext().getRouteController().stopRoute(request.getRouteId());
exchange.getContext().removeRoute(request.getRouteId());
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-pcm-file-import\src\main\java\de\metas\camel\externalsystems\pcm\service\OnDemandRoutesPCMController.java
| 2
|
请完成以下Java代码
|
public List<AbstractProcessInstanceModificationCommand> getInstructions() {
return instructions;
}
public void setInstructions(List<AbstractProcessInstanceModificationCommand> instructions) {
this.instructions = instructions;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public boolean isInitialVariables() {
return initialVariables;
}
public void setInitialVariables(boolean initialVariables) {
this.initialVariables = initialVariables;
}
public boolean isSkipCustomListeners() {
return skipCustomListeners;
}
public void setSkipCustomListeners(boolean skipCustomListeners) {
|
this.skipCustomListeners = skipCustomListeners;
}
public boolean isSkipIoMappings() {
return skipIoMappings;
}
public void setSkipIoMappings(boolean skipIoMappings) {
this.skipIoMappings = skipIoMappings;
}
public boolean isWithoutBusinessKey() {
return withoutBusinessKey;
}
public void setWithoutBusinessKey(boolean withoutBusinessKey) {
this.withoutBusinessKey = withoutBusinessKey;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\RestartProcessInstancesBatchConfiguration.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class HouseKeepingService
{
private static final Logger logger = LogManager.getLogger(HouseKeepingService.class);
public static final String SYSCONFIG_SKIP_HOUSE_KEEPING = "de.metas.housekeeping.SkipHouseKeeping";
private final ImmutableList<IStartupHouseKeepingTask> startupTasks;
public HouseKeepingService(final Optional<List<IStartupHouseKeepingTask>> startupTasks)
{
this.startupTasks = startupTasks.map(ImmutableList::copyOf).orElseGet(ImmutableList::of);
logger.info("Startup tasks: {}", this.startupTasks);
}
public void runStartupHouseKeepingTasks()
{
final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
// first check if we shall run at all
final boolean skipHouseKeeping = sysConfigBL.getBooleanValue(SYSCONFIG_SKIP_HOUSE_KEEPING, false);
if (skipHouseKeeping)
{
logger.warn("SysConfig {} = {} => skipping execution of the housekeeping tasks", SYSCONFIG_SKIP_HOUSE_KEEPING, skipHouseKeeping);
return;
}
logger.info("Executing the registered house keeping tasks; disable with SysConfig {}=true", SYSCONFIG_SKIP_HOUSE_KEEPING);
final Stopwatch allTasksWatch = Stopwatch.createStarted();
final ILoggable loggable = Loggables.logback(logger, Level.INFO);
try (final IAutoCloseable ignored = Loggables.temporarySetLoggable(loggable);)
{
for (final IStartupHouseKeepingTask task : startupTasks)
|
{
//
final String taskName = task.getClass().getName();
final String sysConfigSkipTaskName = SYSCONFIG_SKIP_HOUSE_KEEPING + "." + taskName;
final boolean skipTask = sysConfigBL.getBooleanValue(sysConfigSkipTaskName, false);
if (skipTask)
{
logger.warn("SysConfig {}={} => skipping execution of task {}", sysConfigSkipTaskName, skipTask, taskName);
continue;
}
logger.info("Executing task {}; disable with SysConfig {}=true", taskName, sysConfigSkipTaskName);
final Stopwatch currentTaskWatch = Stopwatch.createStarted();
try
{
task.executeTask();
logger.info("Finished executing task {}; elapsed time={}", taskName, currentTaskWatch.stop());
}
catch (final Exception e)
{
logger.warn("Failed to execute task {}; skipped; elapsed time={}; exception={}", taskName, currentTaskWatch.stop(), e);
}
}
}
final String elapsedTime = allTasksWatch.stop().toString();
logger.info("Finished executing the house keeping tasks; overall elapsed time={}", elapsedTime);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\housekeeping\HouseKeepingService.java
| 2
|
请完成以下Java代码
|
public GroupQuery groupType(String type) {
if (type == null) {
throw new FlowableIllegalArgumentException("Provided type is null");
}
this.type = type;
return this;
}
@Override
public GroupQuery groupMember(String userId) {
if (userId == null) {
throw new FlowableIllegalArgumentException("Provided userId is null");
}
this.userId = userId;
return this;
}
@Override
public GroupQuery groupMembers(List<String> userIds) {
if (userIds == null) {
throw new FlowableIllegalArgumentException("Provided userIds is null");
}
this.userIds = userIds;
return this;
}
// sorting ////////////////////////////////////////////////////////
@Override
public GroupQuery orderByGroupId() {
return orderBy(GroupQueryProperty.GROUP_ID);
}
@Override
public GroupQuery orderByGroupName() {
return orderBy(GroupQueryProperty.NAME);
}
@Override
public GroupQuery orderByGroupType() {
return orderBy(GroupQueryProperty.TYPE);
}
// results ////////////////////////////////////////////////////////
|
@Override
public long executeCount(CommandContext commandContext) {
return CommandContextUtil.getGroupEntityManager(commandContext).findGroupCountByQueryCriteria(this);
}
@Override
public List<Group> executeList(CommandContext commandContext) {
return CommandContextUtil.getGroupEntityManager(commandContext).findGroupByQueryCriteria(this);
}
// getters ////////////////////////////////////////////////////////
@Override
public String getId() {
return id;
}
public List<String> getIds() {
return ids;
}
public String getName() {
return name;
}
public String getNameLike() {
return nameLike;
}
public String getNameLikeIgnoreCase() {
return nameLikeIgnoreCase;
}
public String getType() {
return type;
}
public String getUserId() {
return userId;
}
public List<String> getUserIds() {
return userIds;
}
}
|
repos\flowable-engine-main\modules\flowable-idm-engine\src\main\java\org\flowable\idm\engine\impl\GroupQueryImpl.java
| 1
|
请完成以下Java代码
|
void followAlbum(Album album) {
this.followingAlbums.add(album);
}
void createPlaylist(String name) {
this.playlists.add(new Playlist(name, this));
}
void addSongToFavorites(Song song) {
this.favoriteSongs.add(new FavoriteSong(song, this));
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
|
return false;
User user = (User) o;
return Objects.equals(id, user.id);
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
protected User() {
}
}
|
repos\tutorials-master\persistence-modules\java-jpa-3\src\main\java\com\baeldung\jpa\multiplebagfetchexception\User.java
| 1
|
请完成以下Java代码
|
public class M_ReceiptSchedule_AddTo_M_ShipperTransportation extends JavaProcess implements IProcessPrecondition
{
private static final int MAX_SELECTION_SIZE = 100;
private final PurchaseOrderToShipperTransportationService orderToShipperTransportationService = SpringContextHolder.instance.getBean(PurchaseOrderToShipperTransportationService.class);
private final IReceiptScheduleDAO receiptScheduleDAO = Services.get(IReceiptScheduleDAO.class);
@Param(parameterName = I_M_ShipperTransportation.COLUMNNAME_M_ShipperTransportation_ID)
private ShipperTransportationId p_M_ShipperTransportation_ID;
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(@NonNull final IProcessPreconditionsContext context)
{
if (context.isNoSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
if (context.isMoreThanAllowedSelected(MAX_SELECTION_SIZE))
{
return ProcessPreconditionsResolution.rejectBecauseTooManyRecordsSelected(MAX_SELECTION_SIZE);
}
return ProcessPreconditionsResolution.accept();
}
@Override
protected String doIt() throws Exception
{
final Set<OrderAndLineId> orderAndLineIds = getOrderAndLineIds();
final Set<OrderLineId> orderLineIds = orderAndLineIds.stream()
|
.map(OrderAndLineId::getOrderLineId)
.collect(Collectors.toSet());
orderToShipperTransportationService.deleteShippingPackagesForOrderLines(orderLineIds);
orderToShipperTransportationService.addOrderLinesToShipperTransportation(p_M_ShipperTransportation_ID, orderAndLineIds);
return MSG_OK;
}
private Set<OrderAndLineId> getOrderAndLineIds()
{
final IQueryFilter<I_M_ReceiptSchedule> queryFilterOrElseFalse = getProcessInfo().getQueryFilterOrElseFalse();
return receiptScheduleDAO.createQueryForReceiptScheduleSelection(getCtx(), queryFilterOrElseFalse)
.create()
.stream()
.map(rs -> OrderAndLineId.ofRepoIds(rs.getC_Order_ID(), rs.getC_OrderLine_ID()))
.collect(Collectors.toSet());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\process\M_ReceiptSchedule_AddTo_M_ShipperTransportation.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void createDatabaseIndexes() throws Exception {
if (schemaIdxSql != null) {
log.info("Installing SQL DataBase schema indexes part: " + schemaIdxSql);
executeQueryFromFile(schemaIdxSql);
}
}
void executeQueryFromFile(String schemaIdxSql) throws SQLException, IOException {
Path schemaIdxFile = Paths.get(installScripts.getDataDir(), SQL_DIR, schemaIdxSql);
String sql = Files.readString(schemaIdxFile);
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
conn.createStatement().execute(sql); //NOSONAR, ignoring because method used to load initial thingsboard database schema
}
}
protected void executeQuery(String query) {
|
executeQuery(query, null);
}
protected void executeQuery(String query, String logQuery) {
logQuery = logQuery != null ? logQuery : query;
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
conn.createStatement().execute(query); //NOSONAR, ignoring because method used to execute thingsboard database upgrade script
log.info("Successfully executed query: {}", logQuery);
Thread.sleep(5000);
} catch (InterruptedException | SQLException e) {
throw new RuntimeException("Failed to execute query: " + logQuery, e);
}
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\install\SqlAbstractDatabaseSchemaService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class EDIImpCUOMLookupUOMSymbolType {
@XmlElement(name = "X12DE355", required = true)
protected String x12DE355;
/**
* Gets the value of the x12DE355 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getX12DE355() {
return x12DE355;
|
}
/**
* Sets the value of the x12DE355 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setX12DE355(String value) {
this.x12DE355 = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_metasfreshinhousev1\de\metas\edi\esb\jaxb\metasfreshinhousev1\EDIImpCUOMLookupUOMSymbolType.java
| 2
|
请完成以下Java代码
|
public boolean hasNatureStartsWith(String prefix)
{
for (Nature n : nature)
{
if (n.startsWith(prefix)) return true;
}
return false;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < nature.length; ++i)
{
sb.append(nature[i]).append(' ').append(frequency[i]).append(' ');
}
return sb.toString();
}
public void save(DataOutputStream out) throws IOException
{
out.writeInt(totalFrequency);
out.writeInt(nature.length);
for (int i = 0; i < nature.length; ++i)
{
out.writeInt(nature[i].ordinal());
out.writeInt(frequency[i]);
}
}
}
|
/**
* 获取词语的ID
*
* @param a 词语
* @return ID, 如果不存在, 则返回-1
*/
public static int getWordID(String a)
{
return CoreDictionary.trie.exactMatchSearch(a);
}
/**
* 热更新核心词典<br>
* 集群环境(或其他IOAdapter)需要自行删除缓存文件
*
* @return 是否成功
*/
public static boolean reload()
{
String path = CoreDictionary.path;
IOUtil.deleteFile(path + Predefine.BIN_EXT);
return load(path);
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dictionary\CoreDictionary.java
| 1
|
请完成以下Java代码
|
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
|
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Desktop.java
| 1
|
请完成以下Java代码
|
private static SendSmsRequest buildSendSmsRequest(
String phone,
JSONObject templateParamJson,
DySmsEnum dySmsEnum,
JeecgTencent tencent) {
SendSmsRequest req = new SendSmsRequest();
// 1. 设置短信应用ID
String sdkAppId = tencent.getSdkAppId();
req.setSmsSdkAppId(sdkAppId);
// 2. 设置短信签名
String signName = getSmsSignName(dySmsEnum);
req.setSignName(signName);
// 3. 设置模板ID
String templateId = getSmsTemplateId(dySmsEnum);
req.setTemplateId(templateId);
// 4. 设置模板参数
String[] templateParams = extractTemplateParams(templateParamJson);
req.setTemplateParamSet(templateParams);
// 5. 设置手机号码
String[] phoneNumberSet = { phone };
req.setPhoneNumberSet(phoneNumberSet);
logger.debug("构建短信请求完成 - 应用ID: {}, 签名: {}, 模板ID: {}, 手机号: {}",
sdkAppId, signName, templateId, phone);
return req;
}
/**
* 获取短信签名名称
*
* @param dySmsEnum 腾讯云对象
*/
private static String getSmsSignName(DySmsEnum dySmsEnum) {
JeecgSmsTemplateConfig baseConfig = SpringContextUtils.getBean(JeecgSmsTemplateConfig.class);
String signName = dySmsEnum.getSignName();
if (StringUtils.isNotEmpty(baseConfig.getSignature())) {
logger.debug("yml中读取签名名称: {}", baseConfig.getSignature());
signName = baseConfig.getSignature();
}
return signName;
}
/**
* 获取短信模板ID
*
* @param dySmsEnum 腾讯云对象
*/
private static String getSmsTemplateId(DySmsEnum dySmsEnum) {
JeecgSmsTemplateConfig baseConfig = SpringContextUtils.getBean(JeecgSmsTemplateConfig.class);
String templateCode = dySmsEnum.getTemplateCode();
if (StringUtils.isNotEmpty(baseConfig.getSignature())) {
Map<String, String> smsTemplate = baseConfig.getTemplateCode();
if (smsTemplate.containsKey(templateCode) &&
|
StringUtils.isNotEmpty(smsTemplate.get(templateCode))) {
templateCode = smsTemplate.get(templateCode);
logger.debug("yml中读取短信模板ID: {}", templateCode);
}
}
return templateCode;
}
/**
* 从JSONObject中提取模板参数(按原始顺序)
*
* @param templateParamJson 模板参数
*/
private static String[] extractTemplateParams(JSONObject templateParamJson) {
if (templateParamJson == null || templateParamJson.isEmpty()) {
return new String[0];
}
List<String> params = new ArrayList<>();
for (String key : templateParamJson.keySet()) {
Object value = templateParamJson.get(key);
if (value != null) {
params.add(value.toString());
} else {
// 处理null值
params.add("");
}
}
logger.debug("提取模板参数: {}", params);
return params.toArray(new String[0]);
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\TencentSms.java
| 1
|
请完成以下Java代码
|
public String getSkill() {
return skill;
}
public void setSkill(String skill) {
this.skill = skill;
}
public Integer getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
public Integer getLoginCount() {
return loginCount;
}
public void setLoginCount(Integer loginCount) {
this.loginCount = loginCount;
}
public List<Role> getRoles() {
return roles;
}
|
public void setRoles(List<Role> roles) {
this.roles = roles;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", cnname=" + cnname +
", username=" + username +
", password=" + password +
", email=" + email +
", telephone=" + telephone +
", mobilePhone=" + mobilePhone +
", wechatId=" + wechatId +
", skill=" + skill +
", departmentId=" + departmentId +
", loginCount=" + loginCount +
'}';
}
}
|
repos\springBoot-master\springboot-shiro\src\main\java\com\us\bean\User.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected static final class EDIConfigurationContext
{
private final String CamelFileName;
private final String EDIMessageDatePattern;
private final String ADClientValue;
// private final BigInteger ADOrgID;
private final String ADInputDataDestination_InternalName;
private final BigInteger ADInputDataSourceID;
private final BigInteger ADUserEnteredByID;
private final String DeliveryRule;
private final String DeliveryViaRule;
public EDIConfigurationContext(final String CamelFileName,
final String EDIMessageDatePattern,
final String ADClientValue,
final BigInteger ADOrgID,
final String ADInputDataDestination_InternalName,
final BigInteger ADInputDataSourceID,
final BigInteger ADUserEnteredByID,
final String DeliveryRule,
final String DeliveryViaRule)
{
this.CamelFileName = CamelFileName;
this.EDIMessageDatePattern = EDIMessageDatePattern;
this.ADClientValue = ADClientValue;
// this.ADOrgID = ADOrgID;
this.ADInputDataDestination_InternalName = ADInputDataDestination_InternalName;
this.ADInputDataSourceID = ADInputDataSourceID;
this.ADUserEnteredByID = ADUserEnteredByID;
this.DeliveryRule = DeliveryRule;
this.DeliveryViaRule = DeliveryViaRule;
}
public String getCamelFileName()
{
return CamelFileName;
}
public String getEDIMessageDatePattern()
{
return EDIMessageDatePattern;
}
public String getADClientValue()
{
return ADClientValue;
}
public String getADInputDataDestination_InternalName()
{
return ADInputDataDestination_InternalName;
}
|
public BigInteger getADInputDataSourceID()
{
return ADInputDataSourceID;
}
public BigInteger getADUserEnteredByID()
{
return ADUserEnteredByID;
}
public String getDeliveryRule()
{
return DeliveryRule;
}
public String getDeliveryViaRule()
{
return DeliveryViaRule;
}
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\ordersimport\AbstractEDIOrdersBean.java
| 2
|
请完成以下Java代码
|
public class CloseableCollector implements IAutoCloseable
{
@NonNull private final JSONDocumentChangedWebSocketEventCollector collector = JSONDocumentChangedWebSocketEventCollector.newInstance();
@NonNull private final AtomicBoolean closed = new AtomicBoolean(false);
@Override
public String toString()
{
return "CloseableCollector[" + collector + "]";
}
private void open()
{
if (THREAD_LOCAL_COLLECTOR.get() != null)
{
throw new AdempiereException("A thread level collector was already set");
}
THREAD_LOCAL_COLLECTOR.set(collector);
}
@Override
|
public void close()
{
if (closed.getAndSet(true))
{
return; // already closed
}
THREAD_LOCAL_COLLECTOR.set(null);
sendAllAndClose(collector, websocketSender);
}
@VisibleForTesting
ImmutableList<JSONDocumentChangedWebSocketEvent> getEvents() {return collector.getEvents();}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\events\DocumentWebsocketPublisher.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PickingJobLineId implements RepoIdAware
{
int repoId;
private PickingJobLineId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "M_Picking_Job_Line_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public static int toRepoId(final PickingJobLineId id)
{
return id != null ? id.getRepoId() : -1;
}
public static PickingJobLineId ofRepoId(final int repoId)
{
return new PickingJobLineId(repoId);
}
public static PickingJobLineId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new PickingJobLineId(repoId) : null;
}
@NonNull
@JsonCreator
public static PickingJobLineId ofString(@NonNull final String string)
{
try
{
return ofRepoId(Integer.parseInt(string));
}
catch (final Exception ex)
|
{
throw new AdempiereException("Invalid id string: `" + string + "`", ex);
}
}
@Nullable
public static PickingJobLineId ofNullableString(@Nullable final String string)
{
final String stringNorm = StringUtils.trimBlankToNull(string);
return stringNorm != null ? ofString(stringNorm) : null;
}
public String getAsString() {return String.valueOf(getRepoId());}
public static boolean equals(@Nullable final PickingJobLineId id1, @Nullable final PickingJobLineId id2) {return Objects.equals(id1, id2);}
public TableRecordReference toTableRecordReference()
{
return TableRecordReference.of(I_M_Picking_Job_Line.Table_Name, repoId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\model\PickingJobLineId.java
| 2
|
请完成以下Java代码
|
public BigDecimal getPriceStd()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PriceStd);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setValidFrom (final java.sql.Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
@Override
public java.sql.Timestamp getValidFrom()
{
|
return get_ValueAsTimestamp(COLUMNNAME_ValidFrom);
}
@Override
public void setValidTo (final java.sql.Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
@Override
public java.sql.Timestamp getValidTo()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidTo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Campaign_Price.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class User {
// ========================
// PRIVATE FIELDS
// ========================
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
// Mapped as DATETIME (on MySQL)
// For JSON binding use the format: "1970-01-01T00:00:00.000+0000"
// @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
private DateTime createTime;
// Mapped as DATE (on MySQL)
// For JSON binding use the format: "1970-01-01" (yyyy-MM-dd)
// @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDate")
private LocalDate birthdayDate;
// ========================
// PUBLIC METHODS
// ========================
public long getId() {
return id;
}
public DateTime getCreateTime() {
return createTime;
}
public LocalDate getBirthdayDate() {
|
return birthdayDate;
}
public void setId(long id) {
this.id = id;
}
public void setCreateTime(DateTime createTime) {
this.createTime = createTime;
}
public void setBirthdayDate(LocalDate birthdayDate) {
this.birthdayDate = birthdayDate;
}
} // class User
|
repos\spring-boot-samples-master\spring-boot-hibernate-joda-time\src\main\java\netgloo\models\User.java
| 2
|
请完成以下Java代码
|
private void buildSql()
{
if (sqlBuilt)
{
return;
}
if (values == null || values.isEmpty())
{
sqlWhereClause = defaultReturnWhenEmpty ? SQL_TRUE : SQL_FALSE;
sqlParams = ImmutableList.of();
}
else if (values.size() == 1)
{
final Object value = values.get(0);
if (value == null)
{
sqlWhereClause = columnName + " IS NULL";
sqlParams = ImmutableList.of();
}
else if (embedSqlParams)
{
sqlWhereClause = columnName + "=" + DB.TO_SQL(value);
sqlParams = ImmutableList.of();
}
else
{
sqlWhereClause = columnName + "=?";
sqlParams = ImmutableList.of(value);
}
}
else
{
final List<Object> sqlParamsBuilt = new ArrayList<>(values.size());
final StringBuilder sqlWhereClauseBuilt = new StringBuilder();
boolean hasNullValues = false;
boolean hasNonNullValues = false;
for (final Object value : values)
{
//
// Null Value - just set the flag, we need to add the where clause separately
if (value == null)
{
hasNullValues = true;
continue;
}
//
// Non Null Value
if (hasNonNullValues)
{
sqlWhereClauseBuilt.append(",");
}
else
{
// First time we are adding a non-NULL value => we are adding "ColumnName IN (" first
|
sqlWhereClauseBuilt.append(columnName).append(" IN (");
}
if (embedSqlParams)
{
sqlWhereClauseBuilt.append(DB.TO_SQL(value));
}
else
{
sqlWhereClauseBuilt.append("?");
sqlParamsBuilt.add(value);
}
hasNonNullValues = true;
}
// Closing the bracket from "ColumnName IN (".
if (hasNonNullValues)
{
sqlWhereClauseBuilt.append(")");
}
// We have NULL and non-NULL values => we need to join the expressions with an OR
if (hasNonNullValues && hasNullValues)
{
sqlWhereClauseBuilt.append(" OR ");
}
// Add the IS NULL expression
if (hasNullValues)
{
sqlWhereClauseBuilt.append(columnName).append(" IS NULL");
}
// If we have both NULL and non-NULL values, we need to enclose the expression in brackets because of the "OR"
if (hasNonNullValues && hasNullValues)
{
sqlWhereClauseBuilt.insert(0, '(').append(')');
}
this.sqlWhereClause = sqlWhereClauseBuilt.toString();
this.sqlParams = sqlParamsBuilt;
}
sqlBuilt = true;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\InArrayQueryFilter.java
| 1
|
请完成以下Java代码
|
public class Comment {
private @Id String id;
private String country;
private String description;
@SaiIndexed
@VectorType(dimensions = 5) private Vector embedding;
public Comment() {}
public Comment(String country, String description, Vector embedding) {
this.id = UUID.randomUUID().toString();
this.country = country;
this.description = description;
this.embedding = embedding;
}
public static Comment of(Comment source) {
return new Comment(source.getCountry(), source.getDescription(), source.getEmbedding());
}
public String getId() {
return id;
}
|
public String getCountry() {
return country;
}
public String getDescription() {
return description;
}
public Vector getEmbedding() {
return embedding;
}
@Override
public String toString() {
return "%s (%s)".formatted(getDescription(), getCountry());
}
}
|
repos\spring-data-examples-main\cassandra\vector-search\src\main\java\example\springdata\vector\Comment.java
| 1
|
请完成以下Java代码
|
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_ImpEx_ConnectorType[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Classname.
@param Classname
Java Classname
*/
public void setClassname (String Classname)
{
set_Value (COLUMNNAME_Classname, Classname);
}
/** Get Classname.
@return Java Classname
*/
public String getClassname ()
{
return (String)get_Value(COLUMNNAME_Classname);
}
/** Set Beschreibung.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Direction AD_Reference_ID=540086 */
public static final int DIRECTION_AD_Reference_ID=540086;
/** Import = I */
public static final String DIRECTION_Import = "I";
/** Export = E */
public static final String DIRECTION_Export = "E";
/** Set Richtung.
@param Direction Richtung */
public void setDirection (String Direction)
{
|
set_Value (COLUMNNAME_Direction, Direction);
}
/** Get Richtung.
@return Richtung */
public String getDirection ()
{
return (String)get_Value(COLUMNNAME_Direction);
}
/** Set Konnektor-Typ.
@param ImpEx_ConnectorType_ID Konnektor-Typ */
public void setImpEx_ConnectorType_ID (int ImpEx_ConnectorType_ID)
{
if (ImpEx_ConnectorType_ID < 1)
set_ValueNoCheck (COLUMNNAME_ImpEx_ConnectorType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_ImpEx_ConnectorType_ID, Integer.valueOf(ImpEx_ConnectorType_ID));
}
/** Get Konnektor-Typ.
@return Konnektor-Typ */
public int getImpEx_ConnectorType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ImpEx_ConnectorType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\impex\model\X_ImpEx_ConnectorType.java
| 1
|
请完成以下Java代码
|
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getSystemHost() {
return systemHost;
}
public void setSystemHost(String systemHost) {
this.systemHost = systemHost;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getStartTimestamp() {
return startTimestamp;
}
public void setStartTimestamp(Date startTimestamp) {
this.startTimestamp = startTimestamp;
}
|
public Date getLastAccessTime() {
return lastAccessTime;
}
public void setLastAccessTime(Date lastAccessTime) {
this.lastAccessTime = lastAccessTime;
}
public Long getTimeout() {
return timeout;
}
public void setTimeout(Long timeout) {
this.timeout = timeout;
}
}
|
repos\SpringAll-master\17.Spring-Boot-Shiro-Session\src\main\java\com\springboot\pojo\UserOnline.java
| 1
|
请完成以下Java代码
|
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Period Action.
@param PeriodAction
Action taken for this period
*/
public void setPeriodAction (String PeriodAction)
{
set_Value (COLUMNNAME_PeriodAction, PeriodAction);
}
/** Get Period Action.
@return Action taken for this period
*/
public String getPeriodAction ()
{
return (String)get_Value(COLUMNNAME_PeriodAction);
}
/** Set Period No.
@param PeriodNo
Unique Period Number
*/
public void setPeriodNo (int PeriodNo)
{
set_Value (COLUMNNAME_PeriodNo, Integer.valueOf(PeriodNo));
}
/** Get Period No.
@return Unique Period Number
*/
public int getPeriodNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PeriodNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Period Status.
@param PeriodStatus
Current state of this period
*/
public void setPeriodStatus (String PeriodStatus)
{
set_Value (COLUMNNAME_PeriodStatus, PeriodStatus);
}
/** Get Period Status.
@return Current state of this period
*/
public String getPeriodStatus ()
{
return (String)get_Value(COLUMNNAME_PeriodStatus);
}
/** Set Processed.
@param Processed
The document has been processed
*/
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Processed.
@return The document has been processed
*/
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
|
}
return false;
}
/** Set Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Start Date.
@param StartDate
First effective day (inclusive)
*/
public void setStartDate (Timestamp StartDate)
{
set_Value (COLUMNNAME_StartDate, StartDate);
}
/** Get Start Date.
@return First effective day (inclusive)
*/
public Timestamp getStartDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StartDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_HR_Period.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void migrate() {
if(!enabled){
return;
}
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
Map<String, DataSource> dataSources = ds.getDataSources();
dataSources.forEach((k, v) -> {
if("master".equals(k)){
String databaseType = environment.getProperty("spring.datasource.dynamic.datasource." + k + ".url");
if (databaseType != null && databaseType.contains("mysql")) {
try {
Flyway flyway = Flyway.configure()
.dataSource(v)
.locations(locations)
.encoding(encoding)
.sqlMigrationPrefix(sqlMigrationPrefix)
.sqlMigrationSeparator(sqlMigrationSeparator)
.placeholderPrefix(placeholderPrefix)
.placeholderSuffix(placeholderSuffix)
|
.sqlMigrationSuffixes(sqlMigrationSuffixes)
.validateOnMigrate(validateOnMigrate)
.baselineOnMigrate(baselineOnMigrate)
.cleanDisabled(cleanDisabled)
.load();
flyway.migrate();
log.info("【数据库升级】平台集成了MySQL库的Flyway,数据库版本自动升级! ");
} catch (FlywayException e) {
log.error("【数据库升级】flyway执行sql脚本失败", e);
}
} else {
log.warn("【数据库升级】平台只集成了MySQL库的Flyway,实现了数据库版本自动升级! 其他类型的数据库,您可以考虑手工升级~");
}
}
});
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-start\src\main\java\org\jeecg\config\flyway\FlywayConfig.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class ApiRequestAuditId implements RepoIdAware
{
@JsonCreator
public static ApiRequestAuditId ofRepoId(final int repoId)
{
return new ApiRequestAuditId(repoId);
}
@Nullable
public static ApiRequestAuditId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new ApiRequestAuditId(repoId) : null;
}
public static int toRepoId(@Nullable final ApiRequestAuditId apiRequestAuditId)
{
return apiRequestAuditId != null ? apiRequestAuditId.getRepoId() : -1;
}
|
int repoId;
private ApiRequestAuditId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "API_Request_Audit_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\audit\apirequest\request\ApiRequestAuditId.java
| 2
|
请完成以下Java代码
|
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Datensatz-ID.
@param Record_ID
Direct internal record ID
*/
@Override
public void setRecord_ID (int Record_ID)
{
if (Record_ID < 0)
set_ValueNoCheck (COLUMNNAME_Record_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID));
}
/** Get Datensatz-ID.
@return Direct internal record ID
*/
@Override
public int getRecord_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Referenz.
@param Reference
Reference for this record
*/
@Override
public void setReference (java.lang.String Reference)
{
set_Value (COLUMNNAME_Reference, Reference);
}
/** Get Referenz.
@return Reference for this record
*/
@Override
public java.lang.String getReference ()
{
return (java.lang.String)get_Value(COLUMNNAME_Reference);
}
/** Set Mitteilung.
@param TextMsg
Text Message
*/
@Override
public void setTextMsg (java.lang.String TextMsg)
{
set_Value (COLUMNNAME_TextMsg, TextMsg);
}
/** Get Mitteilung.
@return Text Message
*/
@Override
public java.lang.String getTextMsg ()
{
return (java.lang.String)get_Value(COLUMNNAME_TextMsg);
}
/** Set View ID.
@param ViewId View ID */
@Override
public void setViewId (java.lang.String ViewId)
|
{
set_Value (COLUMNNAME_ViewId, ViewId);
}
/** Get View ID.
@return View ID */
@Override
public java.lang.String getViewId ()
{
return (java.lang.String)get_Value(COLUMNNAME_ViewId);
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
@Override
public void setWhereClause (java.lang.String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
@Override
public java.lang.String getWhereClause ()
{
return (java.lang.String)get_Value(COLUMNNAME_WhereClause);
}
/**
* NotificationSeverity AD_Reference_ID=541947
* Reference name: NotificationSeverity
*/
public static final int NOTIFICATIONSEVERITY_AD_Reference_ID=541947;
/** Notice = Notice */
public static final String NOTIFICATIONSEVERITY_Notice = "Notice";
/** Warning = Warning */
public static final String NOTIFICATIONSEVERITY_Warning = "Warning";
/** Error = Error */
public static final String NOTIFICATIONSEVERITY_Error = "Error";
@Override
public void setNotificationSeverity (final java.lang.String NotificationSeverity)
{
set_Value (COLUMNNAME_NotificationSeverity, NotificationSeverity);
}
@Override
public java.lang.String getNotificationSeverity()
{
return get_ValueAsString(COLUMNNAME_NotificationSeverity);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Note.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected List<Class<? extends Entity>> getEntityInsertionOrder() {
return EntityDependencyOrder.INSERT_ORDER;
}
@Override
protected List<Class<? extends Entity>> getEntityDeletionOrder() {
return EntityDependencyOrder.DELETE_ORDER;
}
@Override
protected ProcessEngine buildEngine() {
if (processEngineConfiguration == null) {
throw new FlowableException("ProcessEngineConfiguration is required");
}
return processEngineConfiguration.buildProcessEngine();
}
|
public ProcessEngineConfiguration getProcessEngineConfiguration() {
return processEngineConfiguration;
}
public ProcessEngineConfigurator setProcessEngineConfiguration(ProcessEngineConfiguration processEngineConfiguration) {
this.processEngineConfiguration = processEngineConfiguration;
return this;
}
protected JobServiceConfiguration getJobServiceConfiguration(AbstractEngineConfiguration engineConfiguration) {
if (engineConfiguration.getServiceConfigurations().containsKey(EngineConfigurationConstants.KEY_JOB_SERVICE_CONFIG)) {
return (JobServiceConfiguration) engineConfiguration.getServiceConfigurations().get(EngineConfigurationConstants.KEY_JOB_SERVICE_CONFIG);
}
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-engine-configurator\src\main\java\org\flowable\engine\configurator\ProcessEngineConfigurator.java
| 2
|
请完成以下Java代码
|
public SortedMap<Integer, ConstantWorkpackagePrio> get()
{
final Map<String, String> valuesForPrefix = Services.get(ISysConfigBL.class).getValuesForPrefix(sysConfigPrefix,
ClientAndOrgId.ofClientAndOrg(AD_Client_ID, AD_Org_ID));
// initialize reverse-sorted map (biggest number first)
final TreeMap<Integer, ConstantWorkpackagePrio> sortedMap = new TreeMap<Integer, ConstantWorkpackagePrio>(new Comparator<Integer>()
{
@Override
public int compare(Integer o1, Integer o2)
{
return o2 - o1;
}
});
// add our values to the map
for (final Entry<String, String> entry : valuesForPrefix.entrySet())
{
final int sizeInt = parseInt(entry.getKey(), sysConfigPrefix);
if (sizeInt < 0)
{
// ignore it; note that we already logged a warning.
continue;
}
final ConstantWorkpackagePrio constrantPrio = ConstantWorkpackagePrio.fromString(entry.getValue());
if (constrantPrio == null)
{
logger.warn("Unable to parse the the priority string {}.\nPlease fix the value of the AD_SysConfig record with name={}", entry.getValue(), entry.getKey());
continue;
|
}
sortedMap.put(sizeInt, constrantPrio);
}
return sortedMap;
}
});
return sortedMap;
}
private int parseInt(final String completeString,
final String prefix)
{
final String sizeStr = completeString.substring(prefix.length());
int size = -1;
try
{
size = Integer.parseInt(sizeStr);
}
catch (NumberFormatException e)
{
logger.warn("Unable to parse the prio int value from AD_SysConfig.Name={}. Ignoring its value.", completeString);
}
return size;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\spi\impl\SysconfigBackedSizeBasedWorkpackagePrioConfig.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public PaymentAllocationBuilder allowPurchaseSalesInvoiceCompensation(final boolean allowPurchaseSalesInvoiceCompensation)
{
assertNotBuilt();
this.allowPurchaseSalesInvoiceCompensation = allowPurchaseSalesInvoiceCompensation;
return this;
}
public PaymentAllocationBuilder payableRemainingOpenAmtPolicy(@NonNull final PayableRemainingOpenAmtPolicy payableRemainingOpenAmtPolicy)
{
assertNotBuilt();
this.payableRemainingOpenAmtPolicy = payableRemainingOpenAmtPolicy;
return this;
}
public PaymentAllocationBuilder dryRun()
{
this.dryRun = true;
return this;
}
public PaymentAllocationBuilder payableDocuments(final Collection<PayableDocument> payableDocuments)
{
_payableDocuments = ImmutableList.copyOf(payableDocuments);
return this;
}
public PaymentAllocationBuilder paymentDocuments(final Collection<PaymentDocument> paymentDocuments)
{
_paymentDocuments = ImmutableList.copyOf(paymentDocuments);
return this;
}
public PaymentAllocationBuilder paymentDocument(final PaymentDocument paymentDocument)
{
return paymentDocuments(ImmutableList.of(paymentDocument));
}
|
@VisibleForTesting
final ImmutableList<PayableDocument> getPayableDocuments()
{
return _payableDocuments;
}
@VisibleForTesting
final ImmutableList<PaymentDocument> getPaymentDocuments()
{
return _paymentDocuments;
}
public PaymentAllocationBuilder invoiceProcessingServiceCompanyService(@NonNull final InvoiceProcessingServiceCompanyService invoiceProcessingServiceCompanyService)
{
assertNotBuilt();
this.invoiceProcessingServiceCompanyService = invoiceProcessingServiceCompanyService;
return this;
}
/**
* @param allocatePayableAmountsAsIs if true, we allow the allocated amount to exceed the payment's amount,
* if the given payable is that big.
* We need this behavior when we want to allocate a remittance advice and know that *in sum* the payables' amounts will match the payment
*/
public PaymentAllocationBuilder allocatePayableAmountsAsIs(final boolean allocatePayableAmountsAsIs)
{
assertNotBuilt();
this.allocatePayableAmountsAsIs = allocatePayableAmountsAsIs;
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\paymentallocation\service\PaymentAllocationBuilder.java
| 2
|
请完成以下Java代码
|
public CostAmountAndQtyDetailed add(@NonNull final CostAmountAndQtyDetailed other)
{
return builder()
.main(main.add(other.main))
.costAdjustment(costAdjustment.add(other.costAdjustment))
.alreadyShipped(alreadyShipped.add(other.alreadyShipped))
.build();
}
public CostAmountAndQtyDetailed negateIf(final boolean condition)
{
return condition ? negate() : this;
}
public CostAmountAndQtyDetailed negate()
{
return builder()
.main(main.negate())
.costAdjustment(costAdjustment.negate())
.alreadyShipped(alreadyShipped.negate())
.build();
}
public CostAmountAndQty getAmtAndQty(final CostAmountType type)
{
final CostAmountAndQty costAmountAndQty;
switch (type)
{
case MAIN:
costAmountAndQty = main;
break;
case ADJUSTMENT:
costAmountAndQty = costAdjustment;
break;
case ALREADY_SHIPPED:
costAmountAndQty = alreadyShipped;
|
break;
default:
throw new IllegalArgumentException();
}
return costAmountAndQty;
}
public CostAmountDetailed getAmt()
{
return CostAmountDetailed.builder()
.mainAmt(main.getAmt())
.costAdjustmentAmt(costAdjustment.getAmt())
.alreadyShippedAmt(alreadyShipped.getAmt())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\costing\methods\CostAmountAndQtyDetailed.java
| 1
|
请完成以下Java代码
|
protected boolean shouldWriteHistoricDetail(HistoricVariableUpdateEventEntity historyEvent) {
return Context.getProcessEngineConfiguration().getHistoryLevel()
.isHistoryEventProduced(HistoryEventTypes.VARIABLE_INSTANCE_UPDATE_DETAIL, historyEvent)
&& !historyEvent.isEventOfType(HistoryEventTypes.VARIABLE_INSTANCE_MIGRATE);
}
protected void insertHistoricDecisionEvaluationEvent(HistoricDecisionEvaluationEvent event) {
Context
.getCommandContext()
.getHistoricDecisionInstanceManager()
.insertHistoricDecisionInstances(event);
}
protected boolean isInitialEvent(HistoryEvent historyEvent) {
return historyEvent.getEventType() == null
|
|| historyEvent.isEventOfType(HistoryEventTypes.ACTIVITY_INSTANCE_START)
|| historyEvent.isEventOfType(HistoryEventTypes.PROCESS_INSTANCE_START)
|| historyEvent.isEventOfType(HistoryEventTypes.TASK_INSTANCE_CREATE)
|| historyEvent.isEventOfType(HistoryEventTypes.FORM_PROPERTY_UPDATE)
|| historyEvent.isEventOfType(HistoryEventTypes.INCIDENT_CREATE)
|| historyEvent.isEventOfType(HistoryEventTypes.CASE_INSTANCE_CREATE)
|| historyEvent.isEventOfType(HistoryEventTypes.DMN_DECISION_EVALUATE)
|| historyEvent.isEventOfType(HistoryEventTypes.BATCH_START)
|| historyEvent.isEventOfType(HistoryEventTypes.IDENTITY_LINK_ADD)
|| historyEvent.isEventOfType(HistoryEventTypes.IDENTITY_LINK_DELETE)
;
}
protected DbEntityManager getDbEntityManager() {
return Context.getCommandContext().getDbEntityManager();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\handler\DbHistoryEventHandler.java
| 1
|
请完成以下Java代码
|
public class SetJobRetriesByProcessAsyncBuilderImpl implements SetJobRetriesByProcessAsyncBuilder {
protected final static CommandLogger LOG = ProcessEngineLogger.CMD_LOGGER;
protected final CommandExecutor commandExecutor;
protected List<String> processInstanceIds;
protected ProcessInstanceQuery processInstanceQuery;
protected HistoricProcessInstanceQuery historicProcessInstanceQuery;
protected Integer retries;
protected Date dueDate;
protected boolean isDueDateSet;
public SetJobRetriesByProcessAsyncBuilderImpl(CommandExecutor commandExecutor, int retries) {
this.commandExecutor = commandExecutor;
this.retries = retries;
}
@Override
public SetJobRetriesByProcessAsyncBuilder processInstanceIds(List<String> processInstanceIds) {
this.processInstanceIds = processInstanceIds;
return this;
}
@Override
public SetJobRetriesByProcessAsyncBuilder processInstanceQuery(ProcessInstanceQuery query) {
this.processInstanceQuery = query;
return this;
}
@Override
public SetJobRetriesByProcessAsyncBuilder historicProcessInstanceQuery(HistoricProcessInstanceQuery query) {
this.historicProcessInstanceQuery = query;
return this;
}
@Override
|
public SetJobRetriesByProcessAsyncBuilder dueDate(Date dueDate) {
this.dueDate = dueDate;
isDueDateSet = true;
return this;
}
@Override
public Batch executeAsync() {
validateParameters();
return commandExecutor.execute(new SetJobsRetriesByProcessBatchCmd(processInstanceIds, processInstanceQuery,
historicProcessInstanceQuery, retries, dueDate, isDueDateSet));
}
protected void validateParameters() {
ensureNotNull("commandExecutor", commandExecutor);
ensureNotNull("retries", retries);
boolean isProcessInstanceIdsNull = processInstanceIds == null || processInstanceIds.isEmpty();
boolean isProcessInstanceQueryNull = processInstanceQuery == null;
boolean isHistoricProcessInstanceQueryNull = historicProcessInstanceQuery == null;
if(isProcessInstanceIdsNull && isProcessInstanceQueryNull && isHistoricProcessInstanceQueryNull) {
throw LOG.exceptionSettingJobRetriesAsyncNoProcessesSpecified();
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\management\SetJobRetriesByProcessAsyncBuilderImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static PackingSlot ofPickingSlotId(@NonNull final PickingSlotId pickingSlotId)
{
return ofInt(pickingSlotId.getRepoId());
}
public static PackingSlot ofInt(final int value)
{
if (value == UNPACKED.value)
{
throw new AdempiereException("Reusing the value of UNPACKED is not allowed: " + value);
}
if (value == DEFAULT_PACKED.value)
{
throw new AdempiereException("Reusing the value of DEFAULT_PACKED is not allowed: " + value);
}
|
return new PackingSlot(value);
}
private int value;
public PackingSlot(final int value)
{
this.value = value;
}
public boolean isUnpacked()
{
return value == UNPACKED.value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\picking\service\PackingSlot.java
| 2
|
请完成以下Java代码
|
public R getValue() {
return this.getRight();
}
/**
* This is not allowed since the pair itself is immutable.
*
* @return never
* @throws UnsupportedOperationException
*/
@Override
public R setValue(R value) {
throw new UnsupportedOperationException("setValue not allowed for an ImmutablePair");
}
/**
* Compares the pair based on the left element followed by the right element.
* The types must be {@code Comparable}.
*
* @param other
* the other pair, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
@SuppressWarnings("unchecked")
public int compareTo(ImmutablePair<L, R> o) {
if (o == null) {
throw new IllegalArgumentException("Pair to compare to must not be null");
}
try {
int leftComparison = compare((Comparable<L>) getLeft(), (Comparable<L>) o.getLeft());
return leftComparison == 0 ? compare((Comparable<R>) getRight(), (Comparable<R>) o.getRight()) : leftComparison;
} catch (ClassCastException cce) {
throw new IllegalArgumentException("Please provide comparable elements", cce);
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
protected int compare(Comparable original, Comparable other) {
if (original == other) {
return 0;
}
if (original == null) {
return -1;
|
}
if (other == null) {
return 1;
}
return original.compareTo(other);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
} else if (!(obj instanceof Entry)) {
return false;
} else {
Entry<?, ?> other = (Entry<?, ?>) obj;
return Objects.equals(this.getKey(), other.getKey()) &&
Objects.equals(this.getValue(), other.getValue());
}
}
@Override
public int hashCode() {
return (this.getKey() == null ? 0 : this.getKey().hashCode()) ^
(this.getValue() == null ? 0 : this.getValue().hashCode());
}
@Override
public String toString() {
return "(" + this.getLeft() + ',' + this.getRight() + ')';
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\util\ImmutablePair.java
| 1
|
请完成以下Java代码
|
public final class PayloadExchangeMatcherReactiveAuthorizationManager
implements ReactiveAuthorizationManager<PayloadExchange> {
private final List<PayloadExchangeMatcherEntry<ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext>>> mappings;
private PayloadExchangeMatcherReactiveAuthorizationManager(
List<PayloadExchangeMatcherEntry<ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext>>> mappings) {
Assert.notEmpty(mappings, "mappings cannot be null");
this.mappings = mappings;
}
@Override
@SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1290
public Mono<AuthorizationResult> authorize(Mono<Authentication> authentication, PayloadExchange exchange) {
return Flux.fromIterable(this.mappings)
.concatMap((mapping) -> mapping.getMatcher()
.matches(exchange)
.filter(PayloadExchangeMatcher.MatchResult::isMatch)
.mapNotNull(MatchResult::getVariables)
.flatMap((variables) -> mapping.getEntry()
.authorize(authentication, new PayloadExchangeAuthorizationContext(exchange, variables))))
.next()
.switchIfEmpty(Mono.fromCallable(() -> new AuthorizationDecision(false)));
}
public static PayloadExchangeMatcherReactiveAuthorizationManager.Builder builder() {
return new PayloadExchangeMatcherReactiveAuthorizationManager.Builder();
}
public static final class Builder {
private final List<PayloadExchangeMatcherEntry<ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext>>> mappings = new ArrayList<>();
|
private Builder() {
}
public PayloadExchangeMatcherReactiveAuthorizationManager.Builder add(
PayloadExchangeMatcherEntry<ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext>> entry) {
this.mappings.add(entry);
return this;
}
public PayloadExchangeMatcherReactiveAuthorizationManager build() {
return new PayloadExchangeMatcherReactiveAuthorizationManager(this.mappings);
}
}
}
|
repos\spring-security-main\rsocket\src\main\java\org\springframework\security\rsocket\authorization\PayloadExchangeMatcherReactiveAuthorizationManager.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PayPalOrder
{
@Nullable
PayPalOrderId id;
@NonNull
PaymentReservationId paymentReservationId;
/** i.e. the paypal order id */
@NonNull
PayPalOrderExternalId externalId;
@NonNull
PayPalOrderStatus status;
@Nullable
PayPalOrderAuthorizationId authorizationId;
@Nullable
String payerApproveUrlString;
@Nullable
String bodyAsJson;
public boolean isAuthorized()
{
return authorizationId != null;
}
public URL getPayerApproveUrl()
|
{
if (payerApproveUrlString == null)
{
throw new AdempiereException("No payer url");
}
try
{
return new URL(payerApproveUrlString);
}
catch (MalformedURLException e)
{
throw AdempiereException.wrapIfNeeded(e);
}
}
public PayPalOrder withId(@NonNull final PayPalOrderId id)
{
if (Objects.equals(this.id, id))
{
return this;
}
else
{
return toBuilder().id(id).build();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.paypal\src\main\java\de\metas\payment\paypal\client\PayPalOrder.java
| 2
|
请完成以下Java代码
|
public void setClrSysRef(String value) {
this.clrSysRef = value;
}
/**
* Gets the value of the acctOwnrTxId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAcctOwnrTxId() {
return acctOwnrTxId;
}
/**
* Sets the value of the acctOwnrTxId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAcctOwnrTxId(String value) {
this.acctOwnrTxId = value;
}
/**
* Gets the value of the acctSvcrTxId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAcctSvcrTxId() {
return acctSvcrTxId;
}
/**
* Sets the value of the acctSvcrTxId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAcctSvcrTxId(String value) {
this.acctSvcrTxId = value;
}
/**
* Gets the value of the mktInfrstrctrTxId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMktInfrstrctrTxId() {
return mktInfrstrctrTxId;
}
/**
* Sets the value of the mktInfrstrctrTxId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMktInfrstrctrTxId(String value) {
this.mktInfrstrctrTxId = value;
}
/**
* Gets the value of the prcgId property.
*
* @return
* possible object is
* {@link String }
*
|
*/
public String getPrcgId() {
return prcgId;
}
/**
* Sets the value of the prcgId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPrcgId(String value) {
this.prcgId = value;
}
/**
* Gets the value of the prtry property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the prtry property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPrtry().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ProprietaryReference1 }
*
*
*/
public List<ProprietaryReference1> getPrtry() {
if (prtry == null) {
prtry = new ArrayList<ProprietaryReference1>();
}
return this.prtry;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\TransactionReferences3.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private void resreshRouter(String delRouterId) {
//更新redis路由缓存
addRoute2Redis(CacheConstant.GATEWAY_ROUTES);
BaseMap params = new BaseMap();
params.put(GlobalConstants.HANDLER_NAME, GlobalConstants.LODER_ROUDER_HANDLER);
params.put("delRouterId", delRouterId);
//刷新网关
redisTemplate.convertAndSend(GlobalConstants.REDIS_TOPIC_NAME, params);
}
@Override
public void clearRedis() {
redisTemplate.opsForValue().set(CacheConstant.GATEWAY_ROUTES, null);
}
/**
* 还原逻辑删除
* @param ids
*/
@Override
public void revertLogicDeleted(List<String> ids) {
this.baseMapper.revertLogicDeleted(ids);
resreshRouter(null);
}
/**
* 彻底删除
* @param ids
*/
@Override
public void deleteLogicDeleted(List<String> ids) {
this.baseMapper.deleteLogicDeleted(ids);
resreshRouter(ids.get(0));
}
/**
* 路由复制
* @param id
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public SysGatewayRoute copyRoute(String id) {
log.info("--gateway 路由复制--");
SysGatewayRoute targetRoute = new SysGatewayRoute();
try {
SysGatewayRoute sourceRoute = this.baseMapper.selectById(id);
//1.复制路由
BeanUtils.copyProperties(sourceRoute,targetRoute);
//1.1 获取当前日期
String formattedDate = dateFormat.format(new Date());
String copyRouteName = sourceRoute.getName() + "_copy_";
//1.2 判断数据库是否存在
Long count = this.baseMapper.selectCount(new LambdaQueryWrapper<SysGatewayRoute>().eq(SysGatewayRoute::getName, copyRouteName + formattedDate));
//1.3 新的路由名称
copyRouteName += count > 0?RandomUtil.randomNumbers(4):formattedDate;
|
targetRoute.setId(null);
targetRoute.setName(copyRouteName);
targetRoute.setCreateTime(new Date());
targetRoute.setStatus(0);
targetRoute.setDelFlag(CommonConstant.DEL_FLAG_0);
this.baseMapper.insert(targetRoute);
//2.刷新路由
resreshRouter(null);
} catch (Exception e) {
log.error("路由配置解析失败", e);
resreshRouter(null);
e.printStackTrace();
}
return targetRoute;
}
/**
* 查询删除列表
* @return
*/
@Override
public List<SysGatewayRoute> getDeletelist() {
return baseMapper.queryDeleteList();
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\service\impl\SysGatewayRouteServiceImpl.java
| 2
|
请完成以下Java代码
|
public void setContentType (final @Nullable java.lang.String ContentType)
{
set_Value (COLUMNNAME_ContentType, ContentType);
}
@Override
public java.lang.String getContentType()
{
return get_ValueAsString(COLUMNNAME_ContentType);
}
@Override
public void setDescription (final @Nullable java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setFileName (final java.lang.String FileName)
{
set_Value (COLUMNNAME_FileName, FileName);
}
@Override
public java.lang.String getFileName()
{
return get_ValueAsString(COLUMNNAME_FileName);
}
@Override
public void setTags (final @Nullable java.lang.String Tags)
{
set_Value (COLUMNNAME_Tags, Tags);
}
@Override
public java.lang.String getTags()
{
return get_ValueAsString(COLUMNNAME_Tags);
}
/**
* Type AD_Reference_ID=540751
* Reference name: AD_AttachmentEntry_Type
*/
public static final int TYPE_AD_Reference_ID=540751;
/** Data = D */
public static final String TYPE_Data = "D";
/** URL = U */
public static final String TYPE_URL = "U";
|
/** Local File-URL = LU */
public static final String TYPE_LocalFile_URL = "LU";
@Override
public void setType (final java.lang.String Type)
{
set_ValueNoCheck (COLUMNNAME_Type, Type);
}
@Override
public java.lang.String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
@Override
public void setURL (final @Nullable java.lang.String URL)
{
set_Value (COLUMNNAME_URL, URL);
}
@Override
public java.lang.String getURL()
{
return get_ValueAsString(COLUMNNAME_URL);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_AttachmentEntry.java
| 1
|
请完成以下Java代码
|
public void resetQtyAvailableToPromise(@NonNull final I_C_Order orderRecord)
{
final Stream<I_C_OrderLine> orderLineRecords = queryBL
.createQueryBuilder(I_C_OrderLine.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_OrderLine.COLUMNNAME_C_Order_ID, orderRecord.getC_Order_ID())
.create()
.stream();
orderLineRecords.forEach(orderLineRecord -> {
orderLineRecord.setQty_AvailableToPromise(BigDecimal.ZERO);
saveRecord(orderLineRecord);
});
}
public void updateOrderLineRecordAndDoNotSave(@NonNull final I_C_OrderLine orderLineRecord)
{
// we use the date at which the order needs to be ready for shipping
final ZonedDateTime preparationDate = TimeUtil.asZonedDateTime(orderLineRecord.getC_Order().getPreparationDate());
final OrderLineKey orderLineKey = createOrderKeyForOrderLineRecord(orderLineRecord);
final AvailableToPromiseQuery query = createSingleQuery(preparationDate, orderLineKey);
final BigDecimal result = stockRepository.retrieveAvailableStockQtySum(query);
orderLineRecord.setQty_AvailableToPromise(result);
}
private static AvailableToPromiseQuery createSingleQuery(
@NonNull final ZonedDateTime preparationDate,
@NonNull final OrderLineKey orderLineKey)
{
final AvailableToPromiseQuery query = AvailableToPromiseQuery
.builder()
.productId(orderLineKey.getProductId())
.storageAttributesKeyPattern(AttributesKeyPatternsUtil.ofAttributeKey(orderLineKey.getAttributesKey()))
.bpartner(orderLineKey.getBpartner())
.date(preparationDate)
.build();
return query;
}
private OrderLineKey createOrderKeyForOrderLineRecord(@NonNull final I_C_OrderLine orderLineRecord)
{
final ProductDescriptor productDescriptor = productDescriptorFactory.createProductDescriptor(orderLineRecord, AttributesKey.ALL);
final BPartnerId bpartnerId = BPartnerId.ofRepoId(orderLineRecord.getC_BPartner_ID()); // this column is mandatory and always > 0
|
return new OrderLineKey(
productDescriptor.getProductId(),
productDescriptor.getStorageAttributesKey(),
BPartnerClassifier.specific(bpartnerId));
}
@Value
private static class OrderLineKey
{
int productId;
AttributesKey attributesKey;
BPartnerClassifier bpartner;
private static OrderLineKey forResultGroup(@NonNull final AvailableToPromiseResultGroup resultGroup)
{
return new OrderLineKey(
resultGroup.getProductId().getRepoId(),
resultGroup.getStorageAttributesKey(),
resultGroup.getBpartner());
}
private OrderLineKey(
final int productId,
@NonNull final AttributesKey attributesKey,
@NonNull final BPartnerClassifier bpartner)
{
this.productId = productId;
this.attributesKey = attributesKey;
this.bpartner = bpartner;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-commons\src\main\java\de\metas\material\dispo\commons\interceptor\OrderAvailableToPromiseTool.java
| 1
|
请完成以下Java代码
|
public void setValidFrom (final @Nullable java.sql.Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
@Override
public java.sql.Timestamp getValidFrom()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidFrom);
}
@Override
public void setVATaxID (final @Nullable java.lang.String VATaxID)
{
set_Value (COLUMNNAME_VATaxID, VATaxID);
}
|
@Override
public java.lang.String getVATaxID()
{
return get_ValueAsString(COLUMNNAME_VATaxID);
}
@Override
public void setVisitorsAddress (final boolean VisitorsAddress)
{
set_Value (COLUMNNAME_VisitorsAddress, VisitorsAddress);
}
@Override
public boolean isVisitorsAddress()
{
return get_ValueAsBoolean(COLUMNNAME_VisitorsAddress);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BPartner_Location.java
| 1
|
请完成以下Java代码
|
public static String truncate(String string, int maxLength, Function<Integer, String> truncationMarkerFunc) {
if (string == null || maxLength <= 0 || string.length() <= maxLength) {
return string;
}
int truncatedSymbols = string.length() - maxLength;
return string.substring(0, maxLength) + truncationMarkerFunc.apply(truncatedSymbols);
}
public static List<String> splitByCommaWithoutQuotes(String value) {
List<String> splitValues = List.of(value.trim().split("\\s*,\\s*"));
List<String> result = new ArrayList<>();
char lastWayInputValue = '#';
for (String str : splitValues) {
char startWith = str.charAt(0);
char endWith = str.charAt(str.length() - 1);
|
// if first value is not quote, so we return values after split
if (startWith != '\'' && startWith != '"') return splitValues;
// if value is not in quote, so we return values after split
if (startWith != endWith) return splitValues;
// if different way values, so don't replace quote and return values after split
if (lastWayInputValue != '#' && startWith != lastWayInputValue) return splitValues;
result.add(str.substring(1, str.length() - 1));
lastWayInputValue = startWith;
}
return result;
}
}
|
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\StringUtils.java
| 1
|
请完成以下Java代码
|
private static KPIField extractCaptionField(final List<KPIField> fields, @Nullable final KPIField... excludeFields)
{
final List<KPIField> remainingFields = excludeFields(fields, excludeFields);
for (final KPIField field : remainingFields)
{
final String fieldName = field.getFieldName();
if ("Name".equals(fieldName)
|| "Caption".equals(fieldName)
|| "Title".equals(fieldName))
{
return field;
}
}
return null;
}
@Nullable
private static KPIField extractOpenTargetField(final List<KPIField> fields, @Nullable final KPIField... excludeFields)
{
final List<KPIField> remainingFields = excludeFields(fields, excludeFields);
for (final KPIField field : remainingFields)
{
final String fieldName = field.getFieldName();
if ("Target".equals(fieldName)
|| "OpenTarget".equals(fieldName))
{
return field;
}
}
return null;
}
private static List<KPIField> excludeFields(final List<KPIField> fields, @Nullable final KPIField... excludeFields)
{
final List<KPIField> excludeFieldsList = excludeFields != null && excludeFields.length > 0
? Stream.of(excludeFields).filter(Objects::nonNull).collect(Collectors.toList())
: null;
|
if (excludeFieldsList == null || excludeFieldsList.isEmpty())
{
return fields;
}
return fields.stream()
.filter(field -> !excludeFieldsList.contains(field))
.collect(ImmutableList.toImmutableList());
}
@Override
public void loadRowToResult(@NonNull final KPIDataResult.Builder data, @NonNull final ResultSet rs) throws SQLException
{
final KPIDataValue url = SQLRowLoaderUtils.retrieveValue(rs, urlField);
final KPIDataSetValuesMap.KPIDataSetValuesMapBuilder resultEntry = data
.dataSet("URLs")
.dataSetValue(KPIDataSetValuesAggregationKey.of(url))
.put("url", url);
loadField(resultEntry, rs, "caption", captionField);
loadField(resultEntry, rs, "target", openTargetField);
}
public static void loadField(
@NonNull final KPIDataSetValuesMap.KPIDataSetValuesMapBuilder resultEntry,
@NonNull final ResultSet rs,
@NonNull final String targetFieldName,
@Nullable final KPIField field) throws SQLException
{
if (field == null)
{
return;
}
final KPIDataValue value = SQLRowLoaderUtils.retrieveValue(rs, field);
resultEntry.put(targetFieldName, value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\kpi\data\sql\URLsSQLRowLoader.java
| 1
|
请完成以下Java代码
|
private void aggregateCUsToTUs(@NonNull final Set<ShipmentScheduleId> shipmentScheduleIds)
{
if (shipmentScheduleIds.isEmpty())
{
return;
}
ShipmentSchedulesCUsToTUsAggregator.builder()
.huShipmentScheduleBL(huShipmentScheduleBL)
.shipmentScheduleAllocDAO(shipmentScheduleAllocDAO)
.handlingUnitsBL(handlingUnitsBL)
//
.shipmentScheduleIds(shipmentScheduleIds)
//
.build().execute();
|
}
@NonNull
public Set<InOutLineId> retrieveInOuLineIdByShipScheduleId(@NonNull final ShipmentScheduleAndJobScheduleIdSet scheduleIds)
{
return shipmentScheduleAllocDAO.retrieveOnShipmentLineRecordsByScheduleIds(scheduleIds)
.values()
.stream()
.map(de.metas.inoutcandidate.model.I_M_ShipmentSchedule_QtyPicked::getM_InOutLine_ID)
.map(InOutLineId::ofRepoIdOrNull)
.filter(Objects::nonNull)
.collect(ImmutableSet.toImmutableSet());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\shipmentschedule\api\ShipmentScheduleWithHUService.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Book {
@EmbeddedId
private BookId id;
private String genre;
private Integer price;
public Book() {
}
public Book(String author, String name, String genre, Integer price) {
BookId id = new BookId(author, name);
this.id = id;
this.genre = genre;
this.price = price;
}
public BookId getId() {
return id;
}
public void setId(BookId id) {
this.id = id;
}
public String getGenre() {
|
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
}
|
repos\tutorials-master\persistence-modules\spring-data-jpa-annotations\src\main\java\com\baeldung\composite\entity\Book.java
| 2
|
请完成以下Java代码
|
public String benchmarkIntegerToString() {
return Integer.toString(sampleNumber);
}
@Benchmark
public String benchmarkStringValueOf() {
return String.valueOf(sampleNumber);
}
@Benchmark
public String benchmarkStringConvertPlus() {
return sampleNumber + "";
}
@Benchmark
public String benchmarkStringFormat_d() {
return String.format(formatDigit, sampleNumber);
}
@Benchmark
public boolean benchmarkStringEquals() {
return longString.equals(baeldung);
}
@Benchmark
public boolean benchmarkStringEqualsIgnoreCase() {
return longString.equalsIgnoreCase(baeldung);
}
@Benchmark
public boolean benchmarkStringMatches() {
return longString.matches(baeldung);
}
@Benchmark
public boolean benchmarkPrecompiledMatches() {
return longPattern.matcher(baeldung).matches();
|
}
@Benchmark
public int benchmarkStringCompareTo() {
return longString.compareTo(baeldung);
}
@Benchmark
public boolean benchmarkStringIsEmpty() {
return longString.isEmpty();
}
@Benchmark
public boolean benchmarkStringLengthZero() {
return longString.length() == 0;
}
public static void main(String[] args) throws Exception {
Options options = new OptionsBuilder()
.include(StringPerformance.class.getSimpleName()).threads(1)
.forks(1).shouldFailOnError(true)
.shouldDoGC(true)
.jvmArgs("-server").build();
new Runner(options).run();
}
}
|
repos\tutorials-master\core-java-modules\core-java-strings\src\main\java\com\baeldung\stringperformance\StringPerformance.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class LoginServiceImpl implements LoginService {
private final Map<String, String> users;
private final Set<Token> tokens;
public LoginServiceImpl() {
this.users = new ConcurrentHashMap<>();
this.tokens = new HashSet<>();
this.users.put("admin", "secret");
}
@Override
public Mono<Token> login(LoginRequest loginRequest) {
String password = users.get(loginRequest.getUsername());
if (password != null && password.equals(loginRequest.getPassword())) {
Token token = new Token(UUID.randomUUID().toString());
this.tokens.add(token);
|
return Mono.just(token);
}
return Mono.error(new RuntimeException());
}
@Override
public boolean validate(Token token) {
return this.tokens.contains(token);
}
@Override
public Mono<Void> logout(Token token) {
this.tokens.remove(token);
return Mono.empty();
}
}
|
repos\spring-examples-java-17\spring-webflux\src\main\java\itx\examples\webflux\services\LoginServiceImpl.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public void publishAllConfig()
{
final List<MSV3UserChangedEvent> events = Services.get(IQueryBL.class)
.createQueryBuilder(I_MSV3_Customer_Config.class)
// .addOnlyActiveRecordsFilter() // ALL, even if is not active. For those inactive we will generate delete events
.orderBy(I_MSV3_Customer_Config.COLUMN_MSV3_Customer_Config_ID)
.create()
.stream(I_MSV3_Customer_Config.class)
.map(configRecord -> toMSV3UserChangedEvent(configRecord))
.collect(ImmutableList.toImmutableList());
msv3ServerPeerService.publishUserChangedEvent(MSV3UserChangedBatchEvent.builder()
.events(events)
.deleteAllOtherUsers(true)
.build());
}
private static MSV3UserChangedEvent toMSV3UserChangedEvent(final I_MSV3_Customer_Config configRecord)
{
final MSV3MetasfreshUserId externalId = MSV3MetasfreshUserId.of(configRecord.getMSV3_Customer_Config_ID());
|
if (configRecord.isActive())
{
return MSV3UserChangedEvent.prepareCreatedOrUpdatedEvent(externalId)
.username(configRecord.getUserID())
.password(configRecord.getPassword())
.bpartnerId(configRecord.getC_BPartner_ID())
.bpartnerLocationId(configRecord.getC_BPartner_Location_ID())
.build();
}
else
{
return MSV3UserChangedEvent.deletedEvent(externalId);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.server-peer-metasfresh\src\main\java\de\metas\vertical\pharma\msv3\server\peer\metasfresh\services\MSV3CustomerConfigService.java
| 2
|
请完成以下Java代码
|
void addAll(Throwable exception, ExitCodeExceptionMapper... mappers) {
Assert.notNull(exception, "'exception' must not be null");
Assert.notNull(mappers, "'mappers' must not be null");
addAll(exception, Arrays.asList(mappers));
}
void addAll(Throwable exception, Iterable<? extends ExitCodeExceptionMapper> mappers) {
Assert.notNull(exception, "'exception' must not be null");
Assert.notNull(mappers, "'mappers' must not be null");
for (ExitCodeExceptionMapper mapper : mappers) {
add(exception, mapper);
}
}
void add(Throwable exception, ExitCodeExceptionMapper mapper) {
Assert.notNull(exception, "'exception' must not be null");
Assert.notNull(mapper, "'mapper' must not be null");
add(new MappedExitCodeGenerator(exception, mapper));
}
void addAll(ExitCodeGenerator... generators) {
Assert.notNull(generators, "'generators' must not be null");
addAll(Arrays.asList(generators));
}
void addAll(Iterable<? extends ExitCodeGenerator> generators) {
Assert.notNull(generators, "'generators' must not be null");
for (ExitCodeGenerator generator : generators) {
add(generator);
}
}
void add(ExitCodeGenerator generator) {
Assert.notNull(generator, "'generator' must not be null");
this.generators.add(generator);
AnnotationAwareOrderComparator.sort(this.generators);
}
@Override
public Iterator<ExitCodeGenerator> iterator() {
return this.generators.iterator();
}
/**
* Get the final exit code that should be returned. The final exit code is the first
* non-zero exit code that is {@link ExitCodeGenerator#getExitCode generated}.
* @return the final exit code.
*/
int getExitCode() {
int exitCode = 0;
|
for (ExitCodeGenerator generator : this.generators) {
try {
int value = generator.getExitCode();
if (value != 0) {
exitCode = value;
break;
}
}
catch (Exception ex) {
exitCode = 1;
ex.printStackTrace();
}
}
return exitCode;
}
/**
* Adapts an {@link ExitCodeExceptionMapper} to an {@link ExitCodeGenerator}.
*/
private static class MappedExitCodeGenerator implements ExitCodeGenerator {
private final Throwable exception;
private final ExitCodeExceptionMapper mapper;
MappedExitCodeGenerator(Throwable exception, ExitCodeExceptionMapper mapper) {
this.exception = exception;
this.mapper = mapper;
}
@Override
public int getExitCode() {
return this.mapper.getExitCode(this.exception);
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\ExitCodeGenerators.java
| 1
|
请完成以下Java代码
|
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
@Override
public boolean isProcessing()
{
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
@Override
public void setStatementDate (java.sql.Timestamp StatementDate)
{
set_Value (COLUMNNAME_StatementDate, StatementDate);
|
}
@Override
public java.sql.Timestamp getStatementDate()
{
return get_ValueAsTimestamp(COLUMNNAME_StatementDate);
}
@Override
public void setStatementDifference (java.math.BigDecimal StatementDifference)
{
set_Value (COLUMNNAME_StatementDifference, StatementDifference);
}
@Override
public java.math.BigDecimal getStatementDifference()
{
BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_StatementDifference);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BankStatement.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static class VelocityConfiguration {
@Bean
@ConditionalOnMissingBean
VelocityLanguageDriver velocityLanguageDriver(VelocityLanguageDriverConfig config) {
return new VelocityLanguageDriver(config);
}
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".velocity")
public VelocityLanguageDriverConfig velocityLanguageDriverConfig() {
return VelocityLanguageDriverConfig.newInstance();
}
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(ThymeleafLanguageDriver.class)
public static class ThymeleafConfiguration {
@Bean
@ConditionalOnMissingBean
ThymeleafLanguageDriver thymeleafLanguageDriver(ThymeleafLanguageDriverConfig config) {
return new ThymeleafLanguageDriver(config);
}
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf")
public ThymeleafLanguageDriverConfig thymeleafLanguageDriverConfig() {
return ThymeleafLanguageDriverConfig.newInstance();
}
// This class provides to avoid the https://github.com/spring-projects/spring-boot/issues/21626 as workaround.
|
@SuppressWarnings("unused")
private static class MetadataThymeleafLanguageDriverConfig extends ThymeleafLanguageDriverConfig {
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf.dialect")
@Override
public DialectConfig getDialect() {
return super.getDialect();
}
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf.template-file")
@Override
public TemplateFileConfig getTemplateFile() {
return super.getTemplateFile();
}
}
}
}
|
repos\spring-boot-starter-master\mybatis-spring-boot-autoconfigure\src\main\java\org\mybatis\spring\boot\autoconfigure\MybatisLanguageDriverAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public void setOverUnderAmt (BigDecimal OverUnderAmt)
{
set_Value (COLUMNNAME_OverUnderAmt, OverUnderAmt);
}
/** Get Over/Under Payment.
@return Over-Payment (unallocated) or Under-Payment (partial payment) Amount
*/
public BigDecimal getOverUnderAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OverUnderAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Remaining Amt.
@param RemainingAmt
Remaining Amount
*/
public void setRemainingAmt (BigDecimal RemainingAmt)
{
throw new IllegalArgumentException ("RemainingAmt is virtual column"); }
/** Get Remaining Amt.
@return Remaining Amount
*/
public BigDecimal getRemainingAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RemainingAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
|
/** Set Write-off Amount.
@param WriteOffAmt
Amount to write-off
*/
public void setWriteOffAmt (BigDecimal WriteOffAmt)
{
set_Value (COLUMNNAME_WriteOffAmt, WriteOffAmt);
}
/** Get Write-off Amount.
@return Amount to write-off
*/
public BigDecimal getWriteOffAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_WriteOffAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_PaymentAllocate.java
| 1
|
请完成以下Java代码
|
public class MProductPriceValidator implements ModelValidator
{
private int ad_Client_ID = -1;
private final IProductPA productPA = Services.get(IProductPA.class);
@Override
public String docValidate(PO po, int timing)
{
return null;
}
@Override
public int getAD_Client_ID()
{
return ad_Client_ID;
}
@Override
public final void initialize(final ModelValidationEngine engine, final MClient client)
{
if (client != null)
{
ad_Client_ID = client.getAD_Client_ID();
}
engine.addModelChange(I_M_ProductPrice.Table_Name, this);
}
@Override
public String login(int AD_Org_ID, int AD_Role_ID, int AD_User_ID)
{
return null;
}
@Override
public String modelChange(final PO po, final int type) throws Exception
{
if (type != ModelValidator.TYPE_AFTER_CHANGE
&& type != ModelValidator.TYPE_AFTER_NEW
&& type != ModelValidator.TYPE_BEFORE_DELETE)
{
return null;
}
if (!po.is_ManualUserAction())
{
return null;
}
final I_M_ProductPrice productPrice = create(po, I_M_ProductPrice.class);
final String useScalePrice = productPrice.getUseScalePrice();
if (Objects.equals(useScalePrice, X_M_ProductPrice.USESCALEPRICE_DonTUseScalePrice))
{
return null;
}
if (type == ModelValidator.TYPE_BEFORE_DELETE)
{
productPriceDelete(productPrice);
}
else
{
final IProductPA productPA = Services.get(IProductPA.class);
|
if (!Objects.equals(useScalePrice, X_M_ProductPrice.USESCALEPRICE_DonTUseScalePrice))
{
final String trxName = getTrxName(productPrice);
final I_M_ProductScalePrice productScalePrice = productPA.retrieveOrCreateScalePrices(
productPrice.getM_ProductPrice_ID(),
BigDecimal.ONE, // Qty
true, // createNew=true => if the scalePrice doesn't exist yet, create a new one
trxName);
// copy the price from the productPrice
productScalePrice.setM_ProductPrice_ID(productPrice.getM_ProductPrice_ID());
productScalePrice.setPriceLimit(productPrice.getPriceLimit());
productScalePrice.setPriceList(productPrice.getPriceList());
productScalePrice.setPriceStd(productPrice.getPriceStd());
save(productScalePrice);
}
}
return null;
}
private void productPriceDelete(final I_M_ProductPrice productPrice)
{
if (productPrice.getM_ProductPrice_ID() <= 0)
{
return;
}
final String trxName = getTrxName(productPrice);
for (final I_M_ProductScalePrice psp : productPA.retrieveScalePrices(productPrice.getM_ProductPrice_ID(), trxName))
{
if (psp.getM_ProductPrice_ID() != productPrice.getM_ProductPrice_ID())
{
// the psp comes from cache and is stale
// NOTE: i think this problem does not apply anymore, so we can safely delete this check
continue;
}
delete(psp);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\product\modelvalidator\MProductPriceValidator.java
| 1
|
请完成以下Java代码
|
public final class HUPackingInfos
{
private HUPackingInfos()
{
}
public static IHUPackingInfo of(@NonNull final I_M_HU_LUTU_Configuration lutuConfig)
{
return new LUTUConfigAsPackingInfo(lutuConfig);
}
public static IHUPackingInfo of(@NonNull final I_M_HU hu)
{
final IHandlingUnitsBL handlingUnitsBL = Services.get(IHandlingUnitsBL.class);
if (handlingUnitsBL.isAggregateHU(hu))
{
return new AggregatedTUPackingInfo(hu);
}
final String huUnitType = handlingUnitsBL.getHU_UnitType(hu);
if (X_M_HU_PI_Version.HU_UNITTYPE_LoadLogistiqueUnit.equals(huUnitType))
|
{
return new LUPIPackingInfo(handlingUnitsBL.getPI(hu));
}
else if (X_M_HU_PI_Version.HU_UNITTYPE_TransportUnit.equals(huUnitType))
{
return new TUPackingInfo(hu);
}
else if (X_M_HU_PI_Version.HU_UNITTYPE_VirtualPI.equals(huUnitType))
{
return new VHUPackingInfo(hu);
}
throw new IllegalArgumentException("HU type not supported: " + huUnitType
+ "\n HU: " + hu);
}
public IHUPackingInfo of(final IHUProductStorage huProductStorage)
{
return new VHUPackingInfo(huProductStorage);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\util\HUPackingInfos.java
| 1
|
请完成以下Java代码
|
public Object readValue(final I_M_AttributeInstance ai)
{
return readMethod.apply(ai);
}
private void writeValue(final I_M_AttributeInstance ai, final IDocumentFieldView field)
{
writeMethod.accept(ai, field);
}
private static void writeValueFromLookup(final I_M_AttributeInstance ai, final IDocumentFieldView field, boolean isNumericKey)
{
final LookupValue lookupValue = isNumericKey
? field.getValueAs(IntegerLookupValue.class)
: field.getValueAs(StringLookupValue.class);
final AttributeValueId attributeValueId = field.getDescriptor().getLookupDescriptor()
.orElseThrow(() -> new AdempiereException("No lookup defined for " + field))
.cast(ASILookupDescriptor.class)
|
.getAttributeValueId(lookupValue);
ai.setValueNumber(lookupValue != null && isNumericKey ? BigDecimal.valueOf(lookupValue.getIdAsInt()) : null); // IMPORTANT: always setValueNumber before setValue because setValueNumber is overriden and set the Value string too. wtf?!
ai.setValue(lookupValue == null ? null : lookupValue.getIdAsString());
ai.setM_AttributeValue_ID(AttributeValueId.toRepoId(attributeValueId));
}
public I_M_AttributeInstance createAndSaveM_AttributeInstance(final I_M_AttributeSetInstance asiRecord, final IDocumentFieldView asiField)
{
final I_M_AttributeInstance aiRecord = InterfaceWrapperHelper.newInstance(I_M_AttributeInstance.class, asiRecord);
aiRecord.setM_AttributeSetInstance(asiRecord);
aiRecord.setM_Attribute_ID(attributeId.getRepoId());
writeValue(aiRecord, asiField);
InterfaceWrapperHelper.save(aiRecord);
return aiRecord;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pattribute\ASIDescriptorFactory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private static ShipmentScheduleAndJobScheduleId extractScheduleId(final I_M_Picking_Job_Line line)
{
return ShipmentScheduleAndJobScheduleId.ofRepoIds(line.getM_ShipmentSchedule_ID(), line.getM_Picking_Job_Schedule_ID());
}
@NonNull
private static ShipmentScheduleAndJobScheduleId extractScheduleId(final I_M_Picking_Job_Step step)
{
return ShipmentScheduleAndJobScheduleId.ofRepoIds(step.getM_ShipmentSchedule_ID(), step.getM_Picking_Job_Schedule_ID());
}
private ImmutableSetMultimap<PickingJobId, ShipmentScheduleAndJobScheduleId> getScheduleIds(final Set<PickingJobId> pickingJobIds)
{
final ImmutableSetMultimap.Builder<PickingJobId, ShipmentScheduleAndJobScheduleId> result = ImmutableSetMultimap.builder();
for (final PickingJobId pickingJobId : pickingJobIds)
{
final ShipmentScheduleAndJobScheduleIdSet scheduleIds = getScheduleIds(pickingJobId);
result.putAll(pickingJobId, scheduleIds);
}
return result.build();
}
private Map<PickingJobId, Boolean> computePickingJobHasLocks(@NonNull final Set<PickingJobId> pickingJobIds)
{
if (pickingJobIds.isEmpty())
{
return ImmutableMap.of();
}
final ImmutableSetMultimap<PickingJobId, ShipmentScheduleAndJobScheduleId> scheduleIdsByPickingJobId = getScheduleIds(pickingJobIds);
final ShipmentScheduleAndJobScheduleIdSet scheduleIds = ShipmentScheduleAndJobScheduleIdSet.ofCollection(scheduleIdsByPickingJobId.values());
final ScheduledPackageableLocks existingLocks = loadingSupportingServices.getLocks(scheduleIds);
final ImmutableMap.Builder<PickingJobId, Boolean> result = ImmutableMap.builder();
|
for (final PickingJobId pickingJobId : pickingJobIds)
{
final boolean hasLocks = existingLocks.isLockedAnyOf(scheduleIdsByPickingJobId.get(pickingJobId));
result.put(pickingJobId, hasLocks);
}
return result.build();
}
private OptionalBoolean getShipmentSchedulesIsLocked(@NonNull final PickingJobId pickingJobId)
{
return OptionalBoolean.ofNullableBoolean(hasLocks.get(pickingJobId));
}
private PickingUnit computePickingUnit(@Nullable final UomId catchUomId, @NonNull final HUPIItemProduct packingInfo, @NonNull final PickingJobOptions options)
{
// If catch weight, always pick at CU level because user has to weight the products
if (!options.isCatchWeightTUPickingEnabled() && catchUomId != null)
{
return PickingUnit.CU;
}
return packingInfo.isFiniteTU() ? PickingUnit.TU : PickingUnit.CU;
}
private PickingJobOptions getPickingJobOptions(@Nullable final BPartnerId customerId)
{
return loadingSupportingServices.getPickingJobOptions(customerId);
}
private PickingJobOptions getPickingJobOptions(@Nullable final BPartnerLocationId deliveryLocationId)
{
return loadingSupportingServices.getPickingJobOptions(deliveryLocationId != null ? deliveryLocationId.getBpartnerId() : null);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\repository\PickingJobLoaderAndSaver.java
| 2
|
请完成以下Java代码
|
protected ScopeImpl getScope(PvmExecutionImpl execution) {
return execution.getProcessDefinition();
}
protected String getEventName() {
return ExecutionListener.EVENTNAME_START;
}
protected PvmExecutionImpl eventNotificationsStarted(PvmExecutionImpl execution) {
// restoring the starting flag in case this operation is executed
// asynchronously
execution.setProcessInstanceStarting(true);
if (execution.getActivity() != null && execution.getActivity().isAsyncBefore()) {
LegacyBehavior.createMissingHistoricVariables(execution);
}
return execution;
}
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
execution.continueIfExecutionDoesNotAffectNextOperation(new Callback<PvmExecutionImpl, Void>() {
@Override
public Void callback(PvmExecutionImpl execution) {
execution.dispatchEvent(null);
return null;
}
}, new Callback<PvmExecutionImpl, Void>() {
|
@Override
public Void callback(PvmExecutionImpl execution) {
execution.setIgnoreAsync(true);
execution.performOperation(ACTIVITY_START_CREATE_SCOPE);
return null;
}
}, execution);
}
public String getCanonicalName() {
return "process-start";
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\pvm\runtime\operation\PvmAtomicOperationProcessStart.java
| 1
|
请完成以下Java代码
|
public String getDescritpion() {
return descritpion;
}
public void setDescritpion(String descritpion) {
this.descritpion = descritpion;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public int getPid() {
|
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
}
|
repos\springBoot-master\springboot-springSecurity3\src\main\java\com\us\example\domain\Permission.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.