instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public String getSuperProcessInstanceId() {
return superProcessInstanceId;
}
public void setSuperProcessInstanceId(String superProcessInstanceId) {
this.superProcessInstanceId = superProcessInstanceId;
}
@Override
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@Override
public String getName() {
if (localizedName != null && localizedName.length() > 0) {
return localizedName;
} else {
return name;
}
}
public void setName(String name) {
this.name = name;
}
public String getLocalizedName() {
return localizedName;
}
@Override
public void setLocalizedName(String localizedName) {
this.localizedName = localizedName;
}
@Override
public String getDescription() {
if (localizedDescription != null && localizedDescription.length() > 0) {
return localizedDescription;
} else {
return description;
}
}
public void setDescription(String description) {
this.description = description;
}
public String getLocalizedDescription() {
return localizedDescription;
} | @Override
public void setLocalizedDescription(String localizedDescription) {
this.localizedDescription = localizedDescription;
}
@Override
public Map<String, Object> getProcessVariables() {
Map<String, Object> variables = new HashMap<>();
if (queryVariables != null) {
for (HistoricVariableInstanceEntity variableInstance : queryVariables) {
if (variableInstance.getId() != null && variableInstance.getTaskId() == null) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
}
}
return variables;
}
public List<HistoricVariableInstanceEntity> getQueryVariables() {
if (queryVariables == null && Context.getCommandContext() != null) {
queryVariables = new HistoricVariableInitializingList();
}
return queryVariables;
}
public void setQueryVariables(List<HistoricVariableInstanceEntity> queryVariables) {
this.queryVariables = queryVariables;
}
// common methods //////////////////////////////////////////////////////////
@Override
public String toString() {
return "HistoricProcessInstanceEntity[superProcessInstanceId=" + superProcessInstanceId + "]";
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\HistoricProcessInstanceEntity.java | 1 |
请完成以下Java代码 | private final List<I_AD_Field_ContextMenu> retrieveContextMenuForClient(@CacheCtx final Properties ctx, final int adClientId)
{
return Services.get(IQueryBL.class).createQueryBuilder(I_AD_Field_ContextMenu.class, ctx, ITrx.TRXNAME_None)
.addInArrayOrAllFilter(I_AD_Field_ContextMenu.COLUMN_AD_Client_ID, 0, adClientId)
.addOnlyActiveRecordsFilter()
//
.orderBy()
.addColumn(I_AD_Field_ContextMenu.COLUMN_SeqNo)
.addColumn(I_AD_Field_ContextMenu.COLUMN_AD_Field_ContextMenu_ID)
.endOrderBy()
//
.create()
.list(I_AD_Field_ContextMenu.class);
} | @Override
public IContextMenuActionContext createContext(final VEditor editor)
{
final VTable vtable = null;
final int viewRow = IContextMenuActionContext.ROW_NA;
final int viewColumn = IContextMenuActionContext.COLUMN_NA;
return createContext(editor, vtable, viewRow, viewColumn);
}
@Override
public IContextMenuActionContext createContext(final VEditor editor, final VTable vtable, final int rowIndexView, final int columnIndexView)
{
return new DefaultContextMenuActionContext(editor, vtable, rowIndexView, columnIndexView);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\adempiere\ui\impl\ContextMenuProvider.java | 1 |
请完成以下Java代码 | private @Nullable HttpSession createNewSessionIfAllowed(SecurityContext context) {
if (this.httpSessionExistedAtStartOfRequest) {
this.logger.debug("HttpSession is now null, but was not null at start of request; "
+ "session was invalidated, so do not create a new session");
return null;
}
if (!HttpSessionSecurityContextRepository.this.allowSessionCreation) {
this.logger.debug("The HttpSession is currently null, and the "
+ HttpSessionSecurityContextRepository.class.getSimpleName()
+ " is prohibited from creating an HttpSession "
+ "(because the allowSessionCreation property is false) - SecurityContext thus not "
+ "stored for next request");
return null;
}
// Generate a HttpSession only if we need to
if (HttpSessionSecurityContextRepository.this.contextObject.equals(context)) {
this.logger.debug(LogMessage.format(
"HttpSession is null, but SecurityContext has not changed from "
+ "default empty context %s so not creating HttpSession or storing SecurityContext",
context));
return null;
} | try {
HttpSession session = this.request.getSession(true);
this.logger.debug("Created HttpSession as SecurityContext is non-default");
return session;
}
catch (IllegalStateException ex) {
// Response must already be committed, therefore can't create a new
// session
this.logger.warn("Failed to create a session, as response has been committed. "
+ "Unable to store SecurityContext.");
}
return null;
}
}
} | repos\spring-security-main\web\src\main\java\org\springframework\security\web\context\HttpSessionSecurityContextRepository.java | 1 |
请完成以下Java代码 | private void assignHUsFromReceiptLine(final I_M_MovementLine movementLine)
{
//
// Particular case: movement generated from Receipt Line (to move Qty to destination warehouse)
final I_M_InOutLine receiptLine = InterfaceWrapperHelper.create(movementLine.getM_InOutLine(), I_M_InOutLine.class);
if (receiptLine == null || receiptLine.getM_InOutLine_ID() <= 0)
{
return;
}
// Don't move HUs for InDispute receipt lines
if (receiptLine.isInDispute())
{
return;
}
//
// Fetch HUs which are currently assigned to Receipt Line
final List<I_M_HU> hus = Services.get(IHUAssignmentDAO.class).retrieveTopLevelHUsForModel(receiptLine);
if (hus.isEmpty())
{
return;
}
// | // Assign them to movement line
Services.get(IHUMovementBL.class).setAssignedHandlingUnits(movementLine, hus);
}
@DocValidate(timings = ModelValidator.TIMING_BEFORE_COMPLETE)
public void moveHandlingUnits(final I_M_Movement movement)
{
final boolean doReversal = false;
huMovementBL.moveHandlingUnits(movement, doReversal);
}
@DocValidate(timings = { ModelValidator.TIMING_BEFORE_REVERSECORRECT, ModelValidator.TIMING_BEFORE_REVERSEACCRUAL, ModelValidator.TIMING_BEFORE_VOID, ModelValidator.TIMING_BEFORE_REACTIVATE })
public void unmoveHandlingUnits(final I_M_Movement movement)
{
final boolean doReversal = true;
huMovementBL.moveHandlingUnits(movement, doReversal);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\model\validator\M_Movement.java | 1 |
请完成以下Java代码 | public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
} | @Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Address [locality=").append(locality).append(", city=").append(city).append(", zip=").append(zip).append("]");
return builder.toString();
}
public Address(String locality, String city, String zip) {
super();
this.locality = locality;
this.city = city;
this.zip = zip;
}
} | repos\tutorials-master\libraries-apache-commons-collections\src\main\java\com\baeldung\commons\collections\collectionutils\Address.java | 1 |
请完成以下Java代码 | public static void setCursors(Component[] components, boolean waiting) {
for( int i = 0; i < components.length; i++) {
setCursor(components[i], waiting);
}
}
public synchronized static void setCursorsFromParent(Container parent, boolean waiting) {
Container con = parent;
for(int i = 0; i < con.getComponentCount(); i++) {
setCursor(con.getComponent(i), waiting);
if(con.getComponent(i) instanceof Container) {
setCursorsFromParent((Container)con.getComponent(i), waiting);
}
}
}
public static Component searchComponent(Container parent, Class<?> clazz, boolean remove) {
Container con = parent;
Component retVal = null;
Component c = null;
for(int i = 0; i < con.getComponentCount(); i++) {
c = con.getComponent(i);
//Found the given class and breaks the loop
if(clazz.isInstance(c)) {
if(remove) {
con.remove(c);
}
return c;
}
//Recursively calling this method to search in deep
if(c instanceof Container) {
c = searchComponent((Container)c , clazz, remove);
if(clazz.isInstance(c)) {
if(remove) {
con.remove(retVal);
}
return c;
}
}
}
return null;
}
public static void addOpaque(JComponent c, final boolean opaque) {
ContainerAdapter ca = new ContainerAdapter() {
@Override
public void componentAdded(ContainerEvent e) {
setOpaque(e.getChild());
} | private void setOpaque(Component c) {
//ignores all selectable items, like buttons
if(c instanceof ItemSelectable) {
return;
}
// sets transparent
else if(c instanceof JComponent) {
((JComponent)c).setOpaque(opaque);
}
// recursively calls this method for all container components
else if(c instanceof Container) {
for(int i = 0; i > ((Container)c).getComponentCount(); i++) {
setOpaque(((Container)c).getComponent(i));
}
}
}
};
c.addContainerListener(ca);
}
public static KeyStroke getKeyStrokeFor(String name, List<KeyStroke> usedStrokes) {
return (name == null) ? null : getKeyStrokeFor(name.charAt(0), usedStrokes);
}
public static KeyStroke getKeyStrokeFor(char c, List<KeyStroke> usedStrokes) {
int m = Event.CTRL_MASK;
KeyStroke o = null;
for(Iterator<?> i = usedStrokes.iterator(); i.hasNext();) {
o = (KeyStroke)i.next();
if(c == o.getKeyChar()) {
if(c == o.getKeyChar()) {
if(o.getModifiers() != Event.SHIFT_MASK+Event.CTRL_MASK) {
m = Event.SHIFT_MASK+Event.CTRL_MASK;
}
else if(o.getModifiers() != Event.SHIFT_MASK+Event.ALT_MASK) {
m = Event.SHIFT_MASK+Event.ALT_MASK;
}
else {
m = -1;
}
}
}
}
KeyStroke s = null;
if(m != -1) {
s = KeyStroke.getKeyStroke(c, m);
usedStrokes.add(s);
}
return s;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\tools\swing\SwingTool.java | 1 |
请完成以下Java代码 | public String toString()
{
return MoreObjects.toStringHelper(this)
.addValue(paramsRO)
.toString();
}
public boolean isCollecting()
{
return params != null;
}
/**
* Directly append all sqlParams from the given {@code sqlQueryFilter}.
*
* @param sqlQueryFilter
*
*/
public void collectAll(@NonNull final ISqlQueryFilter sqlQueryFilter)
{
final List<Object> sqlParams = sqlQueryFilter.getSqlParams(Env.getCtx());
collectAll(sqlParams);
}
/**
* Directly append the given {@code sqlParams}. Please prefer using {@link #placeholder(Object)} instead.<br>
* "Package" scope because currently this method is needed only by {@link SqlDefaultDocumentFilterConverter}.
*
* Please avoid using it. It's used mainly to adapt with old code
*
* @param sqlParams
*/
public void collectAll(@Nullable final Collection<? extends Object> sqlParams)
{
if (sqlParams == null || sqlParams.isEmpty())
{
return;
}
if (params == null)
{
throw new IllegalStateException("Cannot append " + sqlParams + " to not collecting params");
}
params.addAll(sqlParams);
}
public void collect(@NonNull final SqlParamsCollector from)
{
collectAll(from.params);
}
/**
* Collects given SQL value and returns an SQL placeholder, i.e. "?"
*
* In case this is in non-collecting mode, the given SQL value will be converted to SQL code and it will be returned. | * The internal list won't be affected, because it does not exist.
*/
public String placeholder(@Nullable final Object sqlValue)
{
if (params == null)
{
return DB.TO_SQL(sqlValue);
}
else
{
params.add(sqlValue);
return "?";
}
}
/** @return readonly live list */
public List<Object> toList()
{
return paramsRO;
}
/** @return read/write live list */
public List<Object> toLiveList()
{
return params;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\document\filter\sql\SqlParamsCollector.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setC_POS_Order_ID (final int C_POS_Order_ID)
{
if (C_POS_Order_ID < 1)
set_Value (COLUMNNAME_C_POS_Order_ID, null);
else
set_Value (COLUMNNAME_C_POS_Order_ID, C_POS_Order_ID);
}
@Override
public int getC_POS_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_C_POS_Order_ID);
}
@Override
public de.metas.pos.repository.model.I_C_POS_Payment getC_POS_Payment()
{
return get_ValueAsPO(COLUMNNAME_C_POS_Payment_ID, de.metas.pos.repository.model.I_C_POS_Payment.class);
}
@Override
public void setC_POS_Payment(final de.metas.pos.repository.model.I_C_POS_Payment C_POS_Payment)
{
set_ValueFromPO(COLUMNNAME_C_POS_Payment_ID, de.metas.pos.repository.model.I_C_POS_Payment.class, C_POS_Payment);
}
@Override
public void setC_POS_Payment_ID (final int C_POS_Payment_ID)
{
if (C_POS_Payment_ID < 1)
set_Value (COLUMNNAME_C_POS_Payment_ID, null);
else
set_Value (COLUMNNAME_C_POS_Payment_ID, C_POS_Payment_ID);
}
@Override
public int getC_POS_Payment_ID()
{
return get_ValueAsInt(COLUMNNAME_C_POS_Payment_ID);
}
@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);
}
/**
* Type AD_Reference_ID=541892
* Reference name: C_POS_JournalLine_Type
*/
public static final int TYPE_AD_Reference_ID=541892;
/** CashPayment = CASH_PAY */
public static final String TYPE_CashPayment = "CASH_PAY";
/** CardPayment = CARD_PAY */
public static final String TYPE_CardPayment = "CARD_PAY";
/** CashInOut = CASH_INOUT */
public static final String TYPE_CashInOut = "CASH_INOUT";
/** CashClosingDifference = CASH_DIFF */
public static final String TYPE_CashClosingDifference = "CASH_DIFF";
@Override
public void setType (final java.lang.String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
@Override
public java.lang.String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.pos.base\src\main\java-gen\de\metas\pos\repository\model\X_C_POS_JournalLine.java | 2 |
请完成以下Java代码 | public Segment getSegment()
{
return segment;
}
@Override
public IDependencyParser setSegment(Segment segment)
{
this.segment = segment;
return this;
}
@Override
public Map<String, String> getDeprelTranslator()
{
return deprelTranslater;
}
@Override
public IDependencyParser setDeprelTranslator(Map<String, String> deprelTranslator)
{
this.deprelTranslater = deprelTranslator;
return this;
}
/**
* 设置映射表
* @param deprelTranslatorPath 映射表路径
* @return
*/
public IDependencyParser setDeprelTranslater(String deprelTranslatorPath)
{
deprelTranslater = GlobalObjectPool.get(deprelTranslatorPath);
if (deprelTranslater != null) return this;
IOUtil.LineIterator iterator = new IOUtil.LineIterator(deprelTranslatorPath);
deprelTranslater = new TreeMap<String, String>();
while (iterator.hasNext()) | {
String[] args = iterator.next().split("\\s");
deprelTranslater.put(args[0], args[1]);
}
if (deprelTranslater.size() == 0)
{
deprelTranslater = null;
}
GlobalObjectPool.put(deprelTranslatorPath, deprelTranslater);
return this;
}
@Override
public IDependencyParser enableDeprelTranslator(boolean enable)
{
enableDeprelTranslater = enable;
return this;
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dependency\AbstractDependencyParser.java | 1 |
请完成以下Java代码 | public abstract class AbstractTransactionContext implements TransactionContext {
public final static TransactionLogger LOG = ProcessEngineLogger.TX_LOGGER;
@Override
public void commit() {
// managed transaction, ignore
}
@Override
public void rollback() {
// managed transaction, mark rollback-only if not done so already.
try {
doRollback();
} catch (Exception e) {
throw LOG.exceptionWhileInteractingWithTransaction("setting transaction rollback only", e);
}
}
@Override
public void addTransactionListener(TransactionState transactionState, final TransactionListener transactionListener) {
CommandContext commandContext = Context.getCommandContext();
try {
addTransactionListener(transactionState, transactionListener, commandContext);
} catch (Exception e) {
throw LOG.exceptionWhileInteractingWithTransaction("registering synchronization", e);
}
}
public abstract static class TransactionStateSynchronization {
protected final TransactionListener transactionListener;
protected final TransactionState transactionState;
private final CommandContext commandContext;
public TransactionStateSynchronization(TransactionState transactionState, TransactionListener transactionListener, CommandContext commandContext) {
this.transactionState = transactionState;
this.transactionListener = transactionListener;
this.commandContext = commandContext;
}
public void beforeCompletion() {
if(TransactionState.COMMITTING.equals(transactionState)
|| TransactionState.ROLLINGBACK.equals(transactionState)) {
transactionListener.execute(commandContext);
}
}
public void afterCompletion(int status) { | if(isRolledBack(status) && TransactionState.ROLLED_BACK.equals(transactionState)) {
transactionListener.execute(commandContext);
} else if(isCommitted(status) && TransactionState.COMMITTED.equals(transactionState)) {
transactionListener.execute(commandContext);
}
}
protected abstract boolean isCommitted(int status);
protected abstract boolean isRolledBack(int status);
}
@Override
public boolean isTransactionActive() {
try {
return isTransactionActiveInternal();
} catch (Exception e) {
throw LOG.exceptionWhileInteractingWithTransaction("getting transaction state", e);
}
}
protected abstract void doRollback() throws Exception;
protected abstract boolean isTransactionActiveInternal() throws Exception;
protected abstract void addTransactionListener(TransactionState transactionState, TransactionListener transactionListener, CommandContext commandContext) throws Exception;
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cfg\jta\AbstractTransactionContext.java | 1 |
请完成以下Java代码 | public String getKeyword ()
{
return (String)get_Value(COLUMNNAME_Keyword);
}
public I_R_RequestProcessor getR_RequestProcessor() throws RuntimeException
{
return (I_R_RequestProcessor)MTable.get(getCtx(), I_R_RequestProcessor.Table_Name)
.getPO(getR_RequestProcessor_ID(), get_TrxName()); }
/** Set Request Processor.
@param R_RequestProcessor_ID
Processor for Requests
*/
public void setR_RequestProcessor_ID (int R_RequestProcessor_ID)
{
if (R_RequestProcessor_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_RequestProcessor_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_RequestProcessor_ID, Integer.valueOf(R_RequestProcessor_ID));
}
/** Get Request Processor.
@return Processor for Requests
*/
public int getR_RequestProcessor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_RequestProcessor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Request Routing.
@param R_RequestProcessor_Route_ID
Automatic routing of requests
*/
public void setR_RequestProcessor_Route_ID (int R_RequestProcessor_Route_ID)
{
if (R_RequestProcessor_Route_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_RequestProcessor_Route_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_RequestProcessor_Route_ID, Integer.valueOf(R_RequestProcessor_Route_ID));
}
/** Get Request Routing.
@return Automatic routing of requests
*/
public int getR_RequestProcessor_Route_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_RequestProcessor_Route_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_R_RequestType getR_RequestType() throws RuntimeException
{
return (I_R_RequestType)MTable.get(getCtx(), I_R_RequestType.Table_Name)
.getPO(getR_RequestType_ID(), get_TrxName()); }
/** Set Request Type.
@param R_RequestType_ID
Type of request (e.g. Inquiry, Complaint, ..)
*/
public void setR_RequestType_ID (int R_RequestType_ID)
{
if (R_RequestType_ID < 1)
set_Value (COLUMNNAME_R_RequestType_ID, null); | else
set_Value (COLUMNNAME_R_RequestType_ID, Integer.valueOf(R_RequestType_ID));
}
/** Get Request Type.
@return Type of request (e.g. Inquiry, Complaint, ..)
*/
public int getR_RequestType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_RequestType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** 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();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getSeqNo()));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_RequestProcessor_Route.java | 1 |
请完成以下Java代码 | private String getSql()
{
final I_M_Product product = Services.get(IProductDAO.class).getById(getRecord_ID());
final StringBuffer sb = new StringBuffer();
sb.append("SELECT productName, CustomerLabelName, additional_produktinfos, productValue, UPC, weight, country, guaranteedaysmin, ")
.append("warehouse_temperature, productDecription, componentName, IsPackagingMaterial,componentIngredients, qtybatch, ")
.append("allergen, nutritionName, nutritionqty FROM ")
.append(tableName)
.append(" WHERE ")
.append(tableName).append(".productValue = '").append(product.getValue()).append("'")
.append(" ORDER BY productValue ");
return sb.toString();
}
private List<String> getColumnHeaders()
{
final List<String> columnHeaders = new ArrayList<>();
columnHeaders.add("ProductName");
columnHeaders.add("CustomerLabelName");
columnHeaders.add("Additional_produktinfos");
columnHeaders.add("ProductValue");
columnHeaders.add("UPC");
columnHeaders.add("NetWeight");
columnHeaders.add("Country");
columnHeaders.add("ShelfLifeDays");
columnHeaders.add("Warehouse_temperature");
columnHeaders.add("ProductDescription");
columnHeaders.add("M_BOMProduct_ID");
columnHeaders.add("IsPackagingMaterial");
columnHeaders.add("Ingredients");
columnHeaders.add("QtyBatch");
columnHeaders.add("Allergen"); | columnHeaders.add("M_Product_Nutrition_ID");
columnHeaders.add("NutritionQty");
return columnHeaders;
}
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context)
{
if (!context.isSingleSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
return ProcessPreconditionsResolution.accept();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\de\metas\fresh\product\process\ExportProductSpecifications.java | 1 |
请完成以下Java代码 | public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** 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 Test Export Model.
@param TestExportModel Test Export Model */
public void setTestExportModel (String TestExportModel)
{
set_Value (COLUMNNAME_TestExportModel, TestExportModel);
}
/** Get Test Export Model.
@return Test Export Model */
public String getTestExportModel ()
{
return (String)get_Value(COLUMNNAME_TestExportModel);
}
/** Set Test Import Model.
@param TestImportModel Test Import Model */
public void setTestImportModel (String TestImportModel)
{
set_Value (COLUMNNAME_TestImportModel, TestImportModel);
}
/** Get Test Import Model.
@return Test Import Model */
public String getTestImportModel ()
{
return (String)get_Value(COLUMNNAME_TestImportModel);
}
/** 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);
}
/** Set Version.
@param Version
Version of the table definition
*/
public void setVersion (String Version)
{
set_Value (COLUMNNAME_Version, Version);
}
/** Get Version.
@return Version of the table definition
*/
public String getVersion ()
{
return (String)get_Value(COLUMNNAME_Version);
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_EXP_Format.java | 1 |
请完成以下Java代码 | public Long countByTenantId(TenantId tenantId) {
return assetRepository.countByTenantId(tenantId.getId());
}
@Override
public Asset findByTenantIdAndExternalId(UUID tenantId, UUID externalId) {
return DaoUtil.getData(assetRepository.findByTenantIdAndExternalId(tenantId, externalId));
}
@Override
public Asset findByTenantIdAndName(UUID tenantId, String name) {
return findAssetsByTenantIdAndName(tenantId, name).orElse(null);
}
@Override
public PageData<Asset> findByTenantId(UUID tenantId, PageLink pageLink) {
return findAssetsByTenantId(tenantId, pageLink);
}
@Override
public AssetId getExternalIdByInternal(AssetId internalId) {
return Optional.ofNullable(assetRepository.getExternalIdById(internalId.getId()))
.map(AssetId::new).orElse(null);
} | @Override
public PageData<Asset> findAllByTenantId(TenantId tenantId, PageLink pageLink) {
return findByTenantId(tenantId.getId(), pageLink);
}
@Override
public List<AssetFields> findNextBatch(UUID uuid, int batchSize) {
return assetRepository.findAllFields(uuid, Limit.of(batchSize));
}
@Override
public EntityType getEntityType() {
return EntityType.ASSET;
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\asset\JpaAssetDao.java | 1 |
请完成以下Java代码 | public OAuth2TokenValidatorResult validate(Jwt jwt) {
Map<String, Object> confirmationMethodClaim = jwt.getClaim("cnf");
String x509CertificateThumbprintClaim = null;
if (!CollectionUtils.isEmpty(confirmationMethodClaim) && confirmationMethodClaim.containsKey("x5t#S256")) {
x509CertificateThumbprintClaim = (String) confirmationMethodClaim.get("x5t#S256");
}
if (x509CertificateThumbprintClaim == null) {
return OAuth2TokenValidatorResult.success();
}
X509Certificate x509Certificate = this.x509CertificateSupplier.get();
if (x509Certificate == null) {
OAuth2Error error = new OAuth2Error(OAuth2ErrorCodes.INVALID_TOKEN,
"Unable to obtain X509Certificate from current request.", null);
if (this.logger.isDebugEnabled()) {
this.logger.debug(error.toString());
}
return OAuth2TokenValidatorResult.failure(error);
}
String x509CertificateThumbprint;
try {
x509CertificateThumbprint = computeSHA256Thumbprint(x509Certificate);
}
catch (Exception ex) {
OAuth2Error error = new OAuth2Error(OAuth2ErrorCodes.INVALID_TOKEN,
"Failed to compute SHA-256 Thumbprint for X509Certificate.", null);
if (this.logger.isDebugEnabled()) {
this.logger.debug(error.toString());
}
return OAuth2TokenValidatorResult.failure(error);
}
if (!x509CertificateThumbprint.equals(x509CertificateThumbprintClaim)) {
OAuth2Error error = new OAuth2Error(OAuth2ErrorCodes.INVALID_TOKEN,
"Invalid SHA-256 Thumbprint for X509Certificate.", null);
if (this.logger.isDebugEnabled()) {
this.logger.debug(error.toString());
}
return OAuth2TokenValidatorResult.failure(error);
}
return OAuth2TokenValidatorResult.success();
}
static String computeSHA256Thumbprint(X509Certificate x509Certificate) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA-256"); | byte[] digest = md.digest(x509Certificate.getEncoded());
return Base64.getUrlEncoder().withoutPadding().encodeToString(digest);
}
private static final class DefaultX509CertificateSupplier implements Supplier<X509Certificate> {
@Override
public X509Certificate get() {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) {
return null;
}
X509Certificate[] clientCertificateChain = (X509Certificate[]) requestAttributes
.getAttribute("jakarta.servlet.request.X509Certificate", RequestAttributes.SCOPE_REQUEST);
return (clientCertificateChain != null && clientCertificateChain.length > 0) ? clientCertificateChain[0]
: null;
}
}
} | repos\spring-security-main\oauth2\oauth2-jose\src\main\java\org\springframework\security\oauth2\jwt\X509CertificateThumbprintValidator.java | 1 |
请完成以下Java代码 | public class City {
private Integer id;
private String name;
private String countrycode;
private String district;
private Integer population;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getCountrycode() { | return countrycode;
}
public void setCountrycode(String countrycode) {
this.countrycode = countrycode == null ? null : countrycode.trim();
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district == null ? null : district.trim();
}
public Integer getPopulation() {
return population;
}
public void setPopulation(Integer population) {
this.population = population;
}
} | repos\spring-boot-quick-master\quick-modules\dao\src\main\java\com\modules\entity\City.java | 1 |
请完成以下Java代码 | public RetryTopicConfigurationBuilder listenerFactory(ConcurrentKafkaListenerContainerFactory<?, ?> factory) {
this.listenerContainerFactory = factory;
return this;
}
/**
* Configure the container factory to use via its bean name.
* @param factoryBeanName the factory bean name.
* @return the builder.
*/
public RetryTopicConfigurationBuilder listenerFactory(@Nullable String factoryBeanName) {
this.listenerContainerFactoryName = factoryBeanName;
return this;
}
/**
* Create the {@link RetryTopicConfiguration} with the provided template.
* @param sendToTopicKafkaTemplate the template.
* @return the configuration.
*/
// The templates are configured per ListenerContainerFactory. Only the first configured ones will be used.
public RetryTopicConfiguration create(KafkaOperations<?, ?> sendToTopicKafkaTemplate) {
ListenerContainerFactoryResolver.Configuration factoryResolverConfig =
new ListenerContainerFactoryResolver.Configuration(this.listenerContainerFactory,
this.listenerContainerFactoryName);
AllowDenyCollectionManager<String> allowListManager =
new AllowDenyCollectionManager<>(this.includeTopicNames, this.excludeTopicNames);
List<Long> backOffValues = new BackOffValuesGenerator(this.maxAttempts, this.backOff).generateValues();
List<DestinationTopic.Properties> destinationTopicProperties =
new DestinationTopicPropertiesFactory(this.retryTopicSuffix, this.dltSuffix, backOffValues,
buildExceptionMatcher(), this.topicCreationConfiguration.getNumPartitions(),
sendToTopicKafkaTemplate, this.dltStrategy,
this.topicSuffixingStrategy, this.sameIntervalTopicReuseStrategy, this.timeout, this.dltRoutingRules)
.autoStartDltHandler(this.autoStartDltHandler)
.createProperties();
return new RetryTopicConfiguration(destinationTopicProperties,
this.dltHandlerMethod, this.topicCreationConfiguration, allowListManager,
factoryResolverConfig, this.concurrency);
}
private ExceptionMatcher buildExceptionMatcher() {
if (this.exceptionEntriesConfigurer == null) {
return ExceptionMatcher.forAllowList().add(Throwable.class).build();
}
ExceptionMatcher.Builder builder = (this.exceptionEntriesConfigurer.matchIfFound)
? ExceptionMatcher.forAllowList() : ExceptionMatcher.forDenyList();
builder.addAll(this.exceptionEntriesConfigurer.entries);
if (this.traversingCauses != null) {
builder.traverseCauses(this.traversingCauses);
} | return builder.build();
}
/**
* Create a new instance of the builder.
* @return the new instance.
*/
public static RetryTopicConfigurationBuilder newInstance() {
return new RetryTopicConfigurationBuilder();
}
private static final class ExceptionEntriesConfigurer {
private final boolean matchIfFound;
private final Set<Class<? extends Throwable>> entries = new LinkedHashSet<>();
private ExceptionEntriesConfigurer(boolean matchIfFound) {
this.matchIfFound = matchIfFound;
}
}
} | repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\retrytopic\RetryTopicConfigurationBuilder.java | 1 |
请完成以下Java代码 | public static void example() {
try {
XMLExample xml = (XMLExample) JAXBHelper.getContextUnmarshaller(XMLExample.class).unmarshal(new File(XML_FILE_IN));
JAXBHelper.print(xml.toString());
ExampleHTML html = new ExampleHTML();
Body body = new Body();
CustomElement customElement = new CustomElement();
NestedElement nested = new NestedElement();
CustomElement child = new CustomElement();
customElement.setValue("descendantOne: " + xml.getAncestor().getDescendantOne().getValue());
child.setValue("descendantThree: " + xml.getAncestor().getDescendantTwo().getDescendantThree().getValue());
nested.setCustomElement(child); | body.setCustomElement(customElement);
body.setNestedElement(nested);
Meta meta = new Meta();
meta.setTitle("example");
html.getHead().add(meta);
html.setBody(body);
JAXBHelper.getContextMarshaller(ExampleHTML.class).marshal(html, new File(JAXB_FILE_OUT));
} catch (Exception ex) {
System.out.println(EXCEPTION_ENCOUNTERED + ex);
}
}
} | repos\tutorials-master\xml-modules\xml-2\src\main\java\com\baeldung\xmlhtml\helpers\jaxb\JAXBHelper.java | 1 |
请完成以下Java代码 | public void setLineNetAmt (final BigDecimal LineNetAmt)
{
set_Value (COLUMNNAME_LineNetAmt, LineNetAmt);
}
@Override
public BigDecimal getLineNetAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_LineNetAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setQtyOrdered (final BigDecimal QtyOrdered)
{
set_Value (COLUMNNAME_QtyOrdered, QtyOrdered);
} | @Override
public BigDecimal getQtyOrdered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOrdered);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyReceived (final BigDecimal QtyReceived)
{
set_Value (COLUMNNAME_QtyReceived, QtyReceived);
}
@Override
public BigDecimal getQtyReceived()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyReceived);
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_Order_Cost_Detail.java | 1 |
请完成以下Java代码 | private static Optional<IExpression<?>> buildExpression(final IExpressionFactory expressionFactory, final String expressionStr, final Class<?> fieldValueClass)
{
// Hardcoded: NULL
if (HARDCODED_DEFAUL_EXPRESSION_STRING_NULL.equalsIgnoreCase(expressionStr))
{
return Optional.empty();
}
// Hardcoded: SysDate
if (SysDateDateExpression.EXPRESSION_STRING.equals(expressionStr))
{
return SysDateDateExpression.optionalInstance;
}
final IExpression<?> expression;
if (Integer.class.equals(fieldValueClass))
{
expression = expressionFactory.compile(expressionStr, IntegerStringExpression.class);
}
else if (BigDecimal.class.equals(fieldValueClass))
{
expression = expressionFactory.compile(expressionStr, BigDecimalStringExpression.class);
}
else if (IntegerLookupValue.class.equals(fieldValueClass))
{
expression = expressionFactory.compile(expressionStr, IntegerStringExpression.class);
}
else if (StringLookupValue.class.equals(fieldValueClass))
{
final String expressionStrNorm = stripDefaultValueQuotes(expressionStr);
expression = expressionFactory.compile(expressionStrNorm, IStringExpression.class);
}
else if (TimeUtil.isDateOrTimeClass(fieldValueClass))
{
expression = expressionFactory.compile(expressionStr, DateStringExpression.class);
}
else if (Boolean.class.equals(fieldValueClass))
{
final String expressionStrNorm = stripDefaultValueQuotes(expressionStr);
expression = expressionFactory.compile(expressionStrNorm, BooleanStringExpression.class);
}
//
// Fallback
else
{
expression = expressionFactory.compile(expressionStr, IStringExpression.class);
}
if (expression.isNullExpression())
{
return Optional.empty();
}
return Optional.of(expression);
} | /**
* Strips default value expressions which are quoted strings.
* e.g.
* <ul>
* <li>we have some cases where a YesNo default value is 'N' or 'Y'
* <li>we have some cases where a List default value is something like 'P'
* <li>we have some cases where a Table's reference default value is something like 'de.metas.swat'
* </ul>
*
* @return fixed expression or same expression if does not apply
*/
@Nullable
private static String stripDefaultValueQuotes(final String expressionStr)
{
if (expressionStr == null || expressionStr.isEmpty())
{
return expressionStr;
}
if (expressionStr.startsWith("'") && expressionStr.endsWith("'"))
{
final String expressionStrNorm = expressionStr.substring(1, expressionStr.length() - 1);
logger.warn("Normalized string expression: [{}] -> [{}]", expressionStr, expressionStrNorm);
}
return expressionStr;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\factory\standard\DefaultValueExpressionsFactory.java | 1 |
请完成以下Java代码 | public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
return null;
}
public List<HistoryEvent> createHistoryEvents(HistoryEventProducer producer) {
return Collections.emptyList();
}
public void postHandleSingleHistoryEventCreated(HistoryEvent event) {
return;
}
}
/**
* Process an {@link HistoryEvent} and handle them directly after creation.
* The {@link HistoryEvent} is created with the help of the given | * {@link HistoryEventCreator} implementation.
*
* @param creator the creator is used to create the {@link HistoryEvent} which should be thrown
*/
public static void processHistoryEvents(HistoryEventCreator creator) {
HistoryEventProducer historyEventProducer = Context.getProcessEngineConfiguration().getHistoryEventProducer();
HistoryEventHandler historyEventHandler = Context.getProcessEngineConfiguration().getHistoryEventHandler();
HistoryEvent singleEvent = creator.createHistoryEvent(historyEventProducer);
if (singleEvent != null) {
historyEventHandler.handleEvent(singleEvent);
creator.postHandleSingleHistoryEventCreated(singleEvent);
}
List<HistoryEvent> eventList = creator.createHistoryEvents(historyEventProducer);
historyEventHandler.handleEvents(eventList);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoryEventProcessor.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class EnumUtil {
/**
* 根据code获取枚举
* @param enumClass
* @param code
* @param <E>
* @return
*/
public static <E extends Enum<?> & BaseEnum> E codeOf(Class<E> enumClass, int code) {
E[] enumConstants = enumClass.getEnumConstants();
for (E e : enumConstants) {
if (e.getCode() == code) {
return e;
}
}
return null;
}
/**
* 根据msg获取枚举
* @param enumClass | * @param msg
* @param <E>
* @return
*/
public static <E extends Enum<?> & BaseEnum> E msgOf(Class<E> enumClass, String msg) {
E[] enumConstants = enumClass.getEnumConstants();
for (E e : enumConstants) {
if (e.getMsg().equals(msg)) {
return e;
}
}
return null;
}
} | repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\utils\EnumUtil.java | 2 |
请完成以下Java代码 | public String getParentTaskId() {
return parentTaskId;
}
@Override
public Map<String, VariableInstanceEntity> getVariableInstanceEntities() {
ensureVariableInstancesInitialized();
return variableInstances;
}
public int getSuspensionState() {
return suspensionState;
}
public void setSuspensionState(int suspensionState) {
this.suspensionState = suspensionState;
}
@Override
public String getCategory() {
return category;
}
@Override
public boolean isSuspended() {
return suspensionState == SuspensionState.SUSPENDED.getStateCode();
}
@Override
public Map<String, Object> getTaskLocalVariables() {
Map<String, Object> variables = new HashMap<>();
if (queryVariables != null) {
for (VariableInstanceEntity variableInstance : queryVariables) {
if (variableInstance.getId() != null && variableInstance.getTaskId() != null) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
}
}
return variables;
}
@Override
public Map<String, Object> getProcessVariables() {
Map<String, Object> variables = new HashMap<>();
if (queryVariables != null) {
for (VariableInstanceEntity variableInstance : queryVariables) {
if (variableInstance.getId() != null && variableInstance.getTaskId() == null) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
}
}
return variables;
}
@Override
public String getTenantId() {
return tenantId;
}
@Override
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public List<VariableInstanceEntity> getQueryVariables() {
if (queryVariables == null && Context.getCommandContext() != null) { | queryVariables = new VariableInitializingList();
}
return queryVariables;
}
public void setQueryVariables(List<VariableInstanceEntity> queryVariables) {
this.queryVariables = queryVariables;
}
@Override
public String getState() {
return null;
}
@Override
public Date getInProgressStartTime() {
return null;
}
@Override
public String getInProgressStartedBy() {
return null;
}
@Override
public Date getClaimTime() {
return null;
}
@Override
public String getClaimedBy() {
return null;
}
@Override
public Date getSuspendedTime() {
return null;
}
@Override
public String getSuspendedBy() {
return null;
}
@Override
public Date getInProgressStartDueDate() {
return null;
}
@Override
public void setInProgressStartDueDate(Date inProgressStartDueDate) {
// nothing
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\TaskEntity.java | 1 |
请完成以下Java代码 | public boolean isSameLine ()
{
Object oo = get_Value(COLUMNNAME_IsSameLine);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Updateable.
@param IsUpdateable
Determines, if the field can be updated
*/
public void setIsUpdateable (boolean IsUpdateable)
{
set_Value (COLUMNNAME_IsUpdateable, Boolean.valueOf(IsUpdateable));
}
/** Get Updateable.
@return Determines, if the field can be updated
*/
public boolean isUpdateable ()
{
Object oo = get_Value(COLUMNNAME_IsUpdateable);
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
*/
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();
}
/** Set Max. Value.
@param ValueMax
Maximum Value for a field
*/
public void setValueMax (String ValueMax)
{
set_Value (COLUMNNAME_ValueMax, ValueMax);
} | /** Get Max. Value.
@return Maximum Value for a field
*/
public String getValueMax ()
{
return (String)get_Value(COLUMNNAME_ValueMax);
}
/** Set Min. Value.
@param ValueMin
Minimum Value for a field
*/
public void setValueMin (String ValueMin)
{
set_Value (COLUMNNAME_ValueMin, ValueMin);
}
/** Get Min. Value.
@return Minimum Value for a field
*/
public String getValueMin ()
{
return (String)get_Value(COLUMNNAME_ValueMin);
}
/** Set Value Format.
@param VFormat
Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"
*/
public void setVFormat (String VFormat)
{
set_Value (COLUMNNAME_VFormat, VFormat);
}
/** Get Value Format.
@return Format of the value; Can contain fixed format elements, Variables: "_lLoOaAcCa09"
*/
public String getVFormat ()
{
return (String)get_Value(COLUMNNAME_VFormat);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Attribute.java | 1 |
请完成以下Java代码 | private void generate0()
{
final OrdersCollector ordersCollector = OrdersCollector.newInstance();
final OrdersAggregator aggregator = OrdersAggregator.newInstance(ordersCollector);
for (final Iterator<I_PMM_PurchaseCandidate> it = getCandidates(); it.hasNext();)
{
final I_PMM_PurchaseCandidate candidateModel = it.next();
final PurchaseCandidate candidate = PurchaseCandidate.of(candidateModel);
aggregator.add(candidate);
}
aggregator.closeAllGroups();
}
public OrdersGenerator setCandidates(final Iterator<I_PMM_PurchaseCandidate> candidates)
{ | Check.assumeNotNull(candidates, "candidates not null");
this.candidates = candidates;
return this;
}
public OrdersGenerator setCandidates(final Iterable<I_PMM_PurchaseCandidate> candidates)
{
Check.assumeNotNull(candidates, "candidates not null");
setCandidates(candidates.iterator());
return this;
}
private Iterator<I_PMM_PurchaseCandidate> getCandidates()
{
return candidates;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\order\impl\OrdersGenerator.java | 1 |
请完成以下Java代码 | public void setPostingError_Issue_ID (final int PostingError_Issue_ID)
{
if (PostingError_Issue_ID < 1)
set_Value (COLUMNNAME_PostingError_Issue_ID, null);
else
set_Value (COLUMNNAME_PostingError_Issue_ID, PostingError_Issue_ID);
}
@Override
public int getPostingError_Issue_ID()
{
return get_ValueAsInt(COLUMNNAME_PostingError_Issue_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 setProcessing (final boolean Processing)
{
set_Value (COLUMNNAME_Processing, Processing);
}
@Override
public boolean isProcessing() | {
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
@Override
public org.compiere.model.I_S_TimeExpenseLine getS_TimeExpenseLine()
{
return get_ValueAsPO(COLUMNNAME_S_TimeExpenseLine_ID, org.compiere.model.I_S_TimeExpenseLine.class);
}
@Override
public void setS_TimeExpenseLine(final org.compiere.model.I_S_TimeExpenseLine S_TimeExpenseLine)
{
set_ValueFromPO(COLUMNNAME_S_TimeExpenseLine_ID, org.compiere.model.I_S_TimeExpenseLine.class, S_TimeExpenseLine);
}
@Override
public void setS_TimeExpenseLine_ID (final int S_TimeExpenseLine_ID)
{
if (S_TimeExpenseLine_ID < 1)
set_Value (COLUMNNAME_S_TimeExpenseLine_ID, null);
else
set_Value (COLUMNNAME_S_TimeExpenseLine_ID, S_TimeExpenseLine_ID);
}
@Override
public int getS_TimeExpenseLine_ID()
{
return get_ValueAsInt(COLUMNNAME_S_TimeExpenseLine_ID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_ProjectIssue.java | 1 |
请完成以下Java代码 | public MethodInfo getMethodInfo(ELContext context) throws ELException {
return node.getMethodInfo(bindings, context, type, types);
}
@Override
public String getExpressionString() {
return expr;
}
/**
* Evaluates the expression and invokes the method.
* @param context used to resolve properties (<code>base.property</code> and <code>base[property]</code>)
* @param paramValues
* @return method result or <code>null</code> if this is a literal text expression
* @throws ELException if evaluation fails (e.g. suitable method not found)
*/
@Override
public Object invoke(ELContext context, Object[] paramValues) throws ELException {
return node.invoke(bindings, context, type, types, paramValues);
}
/**
* @return <code>true</code> if this is a literal text expression
*/
@Override
public boolean isLiteralText() {
return node.isLiteralText();
}
/**
* @return <code>true</code> if this is a method invocation expression
*/
@Override
public boolean isParametersProvided() {
return node.isMethodInvocation();
}
/**
* Answer <code>true</code> if this is a deferred expression (starting with <code>#{</code>)
*/
public boolean isDeferred() {
return deferred;
}
/**
* Expressions are compared using the concept of a <em>structural id</em>:
* variable and function names are anonymized such that two expressions with
* same tree structure will also have the same structural id and vice versa.
* Two method expressions are equal if
* <ol>
* <li>their builders are equal</li> | * <li>their structural id's are equal</li>
* <li>their bindings are equal</li>
* <li>their expected types match</li>
* <li>their parameter types are equal</li>
* </ol>
*/
@Override
public boolean equals(Object obj) {
if (obj != null && obj.getClass() == getClass()) {
TreeMethodExpression other = (TreeMethodExpression)obj;
if (!builder.equals(other.builder)) {
return false;
}
if (type != other.type) {
return false;
}
if (!Arrays.equals(types, other.types)) {
return false;
}
return getStructuralId().equals(other.getStructuralId()) && bindings.equals(other.bindings);
}
return false;
}
@Override
public int hashCode() {
return getStructuralId().hashCode();
}
@Override
public String toString() {
return "TreeMethodExpression(" + expr + ")";
}
/**
* Print the parse tree.
* @param writer
*/
public void dump(PrintWriter writer) {
NodePrinter.dump(writer, node);
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
try {
node = builder.build(expr).getRoot();
} catch (ELException e) {
throw new IOException(e.getMessage());
}
}
} | repos\camunda-bpm-platform-master\juel\src\main\java\org\camunda\bpm\impl\juel\TreeMethodExpression.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private boolean isCurrencyMatching(final I_M_PriceList priceList)
{
if (currencyId == null)
{
return true;
}
else
{
return currencyId.equals(CurrencyId.ofRepoId(priceList.getC_Currency_ID()));
}
}
private boolean isCountryMatching(final I_M_PriceList priceList)
{
if (countryIds == null)
{
return true;
}
final CountryId priceListCountryId = CountryId.ofRepoIdOrNull(priceList.getC_Country_ID());
if (priceListCountryId == null && acceptNoCountry) | {
return true;
}
if (countryIds.isEmpty())
{
return priceListCountryId == null;
}
else
{
return countryIds.contains(priceListCountryId);
}
}
private boolean isSOTrxMatching(final I_M_PriceList priceList)
{
return soTrx == null || soTrx.isSales() == priceList.isSOPriceList();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\service\PriceListsCollection.java | 2 |
请完成以下Java代码 | public static LocatorQRCode fromGlobalQRCodeJsonString(final String qrCodeString)
{
return fromGlobalQRCode(GlobalQRCode.ofString(qrCodeString));
}
public static LocatorQRCode fromGlobalQRCode(@NonNull final GlobalQRCode globalQRCode)
{
if (!isTypeMatching(globalQRCode))
{
throw new AdempiereException("Invalid QR Code")
.setParameter("globalQRCode", globalQRCode); // avoid adding it to error message, it might be quite long
}
final GlobalQRCodeVersion version = globalQRCode.getVersion();
if (GlobalQRCodeVersion.equals(globalQRCode.getVersion(), JsonConverterV1.GLOBAL_QRCODE_VERSION)) | {
return JsonConverterV1.fromGlobalQRCode(globalQRCode);
}
else
{
throw new AdempiereException("Invalid QR Code version: " + version);
}
}
public static boolean isTypeMatching(final @NonNull GlobalQRCode globalQRCode)
{
return GlobalQRCodeType.equals(GLOBAL_QRCODE_TYPE, globalQRCode.getType());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\warehouse\qrcode\LocatorQRCodeJsonConverter.java | 1 |
请完成以下Java代码 | private AggregationId getInvoice_Aggregation_ID(final I_C_BPartner bpartner, final boolean isSOTrx, final String aggregationUsageLevel)
{
final int aggregationId;
if (X_C_Aggregation.AGGREGATIONUSAGELEVEL_Header.equals(aggregationUsageLevel))
{
aggregationId = isSOTrx ? bpartner.getSO_Invoice_Aggregation_ID() : bpartner.getPO_Invoice_Aggregation_ID();
}
else if (X_C_Aggregation.AGGREGATIONUSAGELEVEL_Line.equals(aggregationUsageLevel))
{
aggregationId = isSOTrx ? bpartner.getSO_InvoiceLine_Aggregation_ID() : bpartner.getPO_InvoiceLine_Aggregation_ID();
}
else
{
throw new IllegalArgumentException("Unknown AggregationUsageLevel: " + aggregationUsageLevel);
}
return AggregationId.ofRepoIdOrNull(aggregationId);
}
@Override
public Aggregation getAggregation(final Properties ctx, final I_C_BPartner bpartner, final boolean isSOTrx, final String aggregationUsageLevel)
{
final IAggregationDAO aggregationDAO = Services.get(IAggregationDAO.class);
final AggregationId aggregationId = getInvoice_Aggregation_ID(bpartner, isSOTrx, aggregationUsageLevel);
final Aggregation aggregation;
if (aggregationId != null)
{
aggregation = aggregationDAO.retrieveAggregation(ctx, aggregationId);
}
else
{
aggregation = aggregationDAO.retrieveDefaultAggregationOrNull(ctx, I_C_Invoice_Candidate.class, isSOTrx, aggregationUsageLevel);
if (aggregation == null)
{
throw new AdempiereException("@NotFound@ @C_Aggregation_ID@ (@IsDefault@=@Y@)"
+ "\n @C_BPartner_ID@: " + bpartner
+ "\n @IsSOTrx@: @" + isSOTrx + "@"
+ "\n @AggregationUsageLevel@: " + aggregationUsageLevel
+ "\n @TableName@: " + I_C_Invoice_Candidate.Table_Name);
}
}
return aggregation;
}
@Override
public IAggregationKeyBuilder<I_C_Invoice_Candidate> getPrepayOrderAggregationKeyBuilder(final Properties ctx)
{
final IAggregationFactory aggregationFactory = Services.get(IAggregationFactory.class); | final AggregationId aggregationId = getPrepayOrder_Invoice_Aggregation_ID();
final IAggregationKeyBuilder<I_C_Invoice_Candidate> aggregation;
if (aggregationId != null)
{
aggregation = aggregationFactory.getAggregationKeyBuilder(ctx, I_C_Invoice_Candidate.class, aggregationId);
}
else
{
aggregation = aggregationFactory.getDefaultAggregationKeyBuilder(ctx, I_C_Invoice_Candidate.class, true, X_C_Aggregation.AGGREGATIONUSAGELEVEL_Header);
}
return aggregation;
}
@Nullable
private AggregationId getPrepayOrder_Invoice_Aggregation_ID()
{
return AggregationId.ofRepoIdOrNull(Services.get(ISysConfigBL.class).getIntValue(INVOICE_AGGREGATION_ID_FOR_PREPAYORDER, -1));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceAggregationFactory.java | 1 |
请完成以下Java代码 | public void setCapacity(int capacity) {
synchronized (this.monitor) {
this.events = new AuditEvent[capacity];
}
}
@Override
public void add(AuditEvent event) {
Assert.notNull(event, "'event' must not be null");
synchronized (this.monitor) {
this.tail = (this.tail + 1) % this.events.length;
this.events[this.tail] = event;
}
}
@Override
public List<AuditEvent> find(@Nullable String principal, @Nullable Instant after, @Nullable String type) {
LinkedList<AuditEvent> events = new LinkedList<>();
synchronized (this.monitor) {
for (int i = 0; i < this.events.length; i++) {
AuditEvent event = resolveTailEvent(i);
if (event != null && isMatch(principal, after, type, event)) {
events.addFirst(event);
}
}
}
return events;
} | private boolean isMatch(@Nullable String principal, @Nullable Instant after, @Nullable String type,
AuditEvent event) {
boolean match = true;
match = match && (principal == null || event.getPrincipal().equals(principal));
match = match && (after == null || event.getTimestamp().isAfter(after));
match = match && (type == null || event.getType().equals(type));
return match;
}
private AuditEvent resolveTailEvent(int offset) {
int index = ((this.tail + this.events.length - offset) % this.events.length);
return this.events[index];
}
} | repos\spring-boot-4.0.1\module\spring-boot-actuator\src\main\java\org\springframework\boot\actuate\audit\InMemoryAuditEventRepository.java | 1 |
请完成以下Java代码 | public ActivityInstanceDto getActivityInstanceTree() {
RuntimeService runtimeService = engine.getRuntimeService();
ActivityInstance activityInstance = null;
try {
activityInstance = runtimeService.getActivityInstance(processInstanceId);
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.INTERNAL_SERVER_ERROR, e, e.getMessage());
}
if (activityInstance == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Process instance with id " + processInstanceId + " does not exist");
}
ActivityInstanceDto result = ActivityInstanceDto.fromActivityInstance(activityInstance);
return result;
}
@Override
public void updateSuspensionState(SuspensionStateDto dto) {
dto.updateSuspensionState(engine, processInstanceId);
}
@Override
public void modifyProcessInstance(ProcessInstanceModificationDto dto) {
if (dto.getInstructions() != null && !dto.getInstructions().isEmpty()) {
ProcessInstanceModificationBuilder modificationBuilder =
engine.getRuntimeService().createProcessInstanceModification(processInstanceId);
dto.applyTo(modificationBuilder, engine, objectMapper);
if (dto.getAnnotation() != null) {
modificationBuilder.setAnnotation(dto.getAnnotation());
}
modificationBuilder.cancellationSourceExternal(true); | modificationBuilder.execute(dto.isSkipCustomListeners(), dto.isSkipIoMappings());
}
}
@Override
public BatchDto modifyProcessInstanceAsync(ProcessInstanceModificationDto dto) {
Batch batch = null;
if (dto.getInstructions() != null && !dto.getInstructions().isEmpty()) {
ProcessInstanceModificationBuilder modificationBuilder =
engine.getRuntimeService().createProcessInstanceModification(processInstanceId);
dto.applyTo(modificationBuilder, engine, objectMapper);
if (dto.getAnnotation() != null) {
modificationBuilder.setAnnotation(dto.getAnnotation());
}
modificationBuilder.cancellationSourceExternal(true);
try {
batch = modificationBuilder.executeAsync(dto.isSkipCustomListeners(), dto.isSkipIoMappings());
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
return BatchDto.fromBatch(batch);
}
throw new InvalidRequestException(Status.BAD_REQUEST, "The provided instuctions are invalid.");
}
@Override
public ProcessInstanceCommentResource getProcessInstanceCommentResource() {
return new ProcessInstanceCommentResourceImpl(engine, processInstanceId);
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\runtime\impl\ProcessInstanceResourceImpl.java | 1 |
请完成以下Java代码 | public Builder authorities(Consumer<Collection<GrantedAuthority>> authorities) {
authorities.accept(this.authorities);
return this;
}
@Override
public Builder details(@Nullable Object details) {
this.details = details;
return this;
}
@Override
public Builder principal(@Nullable Object principal) {
this.principal = principal;
return this;
}
@Override | public Builder credentials(@Nullable Object credentials) {
this.credentials = credentials;
return this;
}
@Override
public Builder authenticated(boolean authenticated) {
this.authenticated = authenticated;
return this;
}
@Override
public Authentication build() {
return new SimpleAuthentication(this);
}
}
} | repos\spring-security-main\core\src\main\java\org\springframework\security\core\SimpleAuthentication.java | 1 |
请完成以下Java代码 | public class CustomerReflectionToString extends Customer {
private Integer score;
private List<String> orders;
private StringBuffer fullname;
public Integer getScore() {
return score;
}
public void setScore(Integer score) {
this.score = score;
}
public List<String> getOrders() {
return orders;
}
public void setOrders(List<String> orders) { | this.orders = orders;
}
public StringBuffer getFullname() {
return fullname;
}
public void setFullname(StringBuffer fullname) {
this.fullname = fullname;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
} | repos\tutorials-master\core-java-modules\core-java-string-operations-12\src\main\java\com\baeldung\tostring\CustomerReflectionToString.java | 1 |
请完成以下Java代码 | public static Date getLast7DaysStartTime() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, -7);
return DateUtil.beginOfDay(calendar.getTime());
}
/**
* 过去七天结束时间(不含今天)
*
* @return
*/
public static Date getLast7DaysEndTime() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(getLast7DaysStartTime());
calendar.add(Calendar.DATE, 6);
return DateUtil.endOfDay(calendar.getTime());
}
/**
* 昨天开始时间
*
* @return
*/
public static Date getYesterdayStartTime() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, -1);
return DateUtil.beginOfDay(calendar.getTime());
}
/**
* 昨天结束时间
*
* @return
*/
public static Date getYesterdayEndTime() {
return DateUtil.endOfDay(getYesterdayStartTime());
}
/**
* 明天开始时间
*
* @return
*/
public static Date getTomorrowStartTime() {
return DateUtil.beginOfDay(DateUtil.tomorrow());
}
/**
* 明天结束时间
* | * @return
*/
public static Date getTomorrowEndTime() {
return DateUtil.endOfDay(DateUtil.tomorrow());
}
/**
* 今天开始时间
*
* @return
*/
public static Date getTodayStartTime() {
return DateUtil.beginOfDay(new Date());
}
/**
* 今天结束时间
*
* @return
*/
public static Date getTodayEndTime() {
return DateUtil.endOfDay(new Date());
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\DateRangeUtils.java | 1 |
请完成以下Java代码 | public class AlipayAccountLogVO {
/** 支付宝账户余额 **/
private BigDecimal balance = BigDecimal.ZERO;
/** 购买人帐号 **/
private String buyerAccount;
/** 商品名称 **/
private String goodsTitle;
/** 平台账户入账金额 **/
private BigDecimal income = BigDecimal.ZERO;
/** 平台账户出款金额 **/
private BigDecimal outcome = BigDecimal.ZERO;
/** 商户订单号 **/
private String merchantOrderNo;
/** 银行费率 **/
private BigDecimal bankRate;
/** 订单金额 **/
private BigDecimal totalFee = BigDecimal.ZERO;
/** 银行流水 **/
private String tradeNo;
/** 交易类型 **/
private String transType;
/** 交易时间 **/
private Date transDate;
/** 银行(支付宝)该笔订单收取的手续费 **/
private BigDecimal bankFee = BigDecimal.ZERO;
/** 支付宝账户余额 **/
public BigDecimal getBalance() {
return balance;
}
/** 支付宝账户余额 **/
public void setBalance(BigDecimal balance) {
this.balance = balance;
}
/** 购买人帐号 **/
public String getBuyerAccount() {
return buyerAccount;
}
/** 购买人帐号 **/
public void setBuyerAccount(String buyerAccount) {
this.buyerAccount = buyerAccount;
}
/** 商品名称 **/
public String getGoodsTitle() {
return goodsTitle;
}
/** 商品名称 **/
public void setGoodsTitle(String goodsTitle) {
this.goodsTitle = goodsTitle;
}
/** 平台账户入账金额 **/
public BigDecimal getIncome() {
return income;
}
/** 平台账户入账金额 **/
public void setIncome(BigDecimal income) {
this.income = income;
}
/** 平台账户出款金额 **/
public BigDecimal getOutcome() {
return outcome;
}
/** 平台账户出款金额 **/
public void setOutcome(BigDecimal outcome) {
this.outcome = outcome;
}
/** 商户订单号 **/
public String getMerchantOrderNo() {
return merchantOrderNo;
}
/** 商户订单号 **/
public void setMerchantOrderNo(String merchantOrderNo) {
this.merchantOrderNo = merchantOrderNo;
}
/** 银行费率 **/
public BigDecimal getBankRate() {
return bankRate;
}
/** 银行费率 **/
public void setBankRate(BigDecimal bankRate) {
this.bankRate = bankRate; | }
/** 订单金额 **/
public BigDecimal getTotalFee() {
return totalFee;
}
/** 订单金额 **/
public void setTotalFee(BigDecimal totalFee) {
this.totalFee = totalFee;
}
/** 银行流水 **/
public String getTradeNo() {
return tradeNo;
}
/** 银行流水 **/
public void setTradeNo(String tradeNo) {
this.tradeNo = tradeNo;
}
/** 交易类型 **/
public String getTransType() {
return transType;
}
/** 交易类型 **/
public void setTransType(String transType) {
this.transType = transType;
}
/** 交易时间 **/
public Date getTransDate() {
return transDate;
}
/** 交易时间 **/
public void setTransDate(Date transDate) {
this.transDate = transDate;
}
/** 银行(支付宝)该笔订单收取的手续费 **/
public BigDecimal getBankFee() {
return bankFee;
}
/** 银行(支付宝)该笔订单收取的手续费 **/
public void setBankFee(BigDecimal bankFee) {
this.bankFee = bankFee;
}
} | repos\roncoo-pay-master\roncoo-pay-app-reconciliation\src\main\java\com\roncoo\pay\app\reconciliation\vo\AlipayAccountLogVO.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private PickingJob reinitializePickingTargetIfDestroyed(final PickingJob pickingJob)
{
if (isLineLevelPickTarget(pickingJob))
{
return pickingJob.withLuPickingTarget(lineId, this::reinitializeLUPickingTarget);
}
else
{
return pickingJob.withLuPickingTarget(null, this::reinitializeLUPickingTarget);
}
}
private boolean isLineLevelPickTarget(final PickingJob pickingJob) {return pickingJob.isLineLevelPickTarget();}
@Nullable
private LUPickingTarget reinitializeLUPickingTarget(@Nullable final LUPickingTarget luPickingTarget)
{
if (luPickingTarget == null)
{
return null;
}
final HuId luId = luPickingTarget.getLuId();
if (luId == null)
{
return luPickingTarget; | }
final I_M_HU lu = huService.getById(luId);
if (!huService.isDestroyedOrEmptyStorage(lu))
{
return luPickingTarget;
}
final HuPackingInstructionsIdAndCaption luPI = huService.getEffectivePackingInstructionsIdAndCaption(lu);
return LUPickingTarget.ofPackingInstructions(luPI);
}
//
//
//
@Value
@Builder
private static class StepUnpickInstructions
{
@NonNull PickingJobStepId stepId;
@NonNull PickingJobStepPickFromKey pickFromKey;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\service\commands\PickingJobUnPickCommand.java | 2 |
请完成以下Java代码 | public int getDLM_Partition_Size_Per_Table_V_ID()
{
final Integer ii = (Integer)get_Value(COLUMNNAME_DLM_Partition_Size_Per_Table_V_ID);
if (ii == null)
{
return 0;
}
return ii.intValue();
}
/**
* Set Anz. zugeordneter Datensätze.
*
* @param PartitionSize Anz. zugeordneter Datensätze
*/
@Override
public void setPartitionSize(final int PartitionSize)
{
set_ValueNoCheck(COLUMNNAME_PartitionSize, Integer.valueOf(PartitionSize));
}
/**
* Get Anz. zugeordneter Datensätze.
*
* @return Anz. zugeordneter Datensätze
*/
@Override
public int getPartitionSize()
{
final Integer ii = (Integer)get_Value(COLUMNNAME_PartitionSize); | if (ii == null)
{
return 0;
}
return ii.intValue();
}
/**
* Set Name der DB-Tabelle.
*
* @param TableName Name der DB-Tabelle
*/
@Override
public void setTableName(final java.lang.String TableName)
{
set_ValueNoCheck(COLUMNNAME_TableName, TableName);
}
/**
* Get Name der DB-Tabelle.
*
* @return Name der DB-Tabelle
*/
@Override
public java.lang.String getTableName()
{
return (java.lang.String)get_Value(COLUMNNAME_TableName);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.dlm\base\src\main\java-gen\de\metas\dlm\model\X_DLM_Partition_Size_Per_Table_V.java | 1 |
请完成以下Java代码 | public static ExternalSystemScriptedExportConversionConfigId ofRepoId(final int repoId)
{
return new ExternalSystemScriptedExportConversionConfigId(repoId);
}
@Nullable
public static ExternalSystemScriptedExportConversionConfigId ofRepoIdOrNull(@Nullable final Integer repoId)
{
return repoId != null && repoId > 0 ? new ExternalSystemScriptedExportConversionConfigId(repoId) : null;
}
public static ExternalSystemScriptedExportConversionConfigId cast(@NonNull final IExternalSystemChildConfigId id)
{
return (ExternalSystemScriptedExportConversionConfigId)id;
} | @JsonValue
public int toJson()
{
return getRepoId();
}
private ExternalSystemScriptedExportConversionConfigId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "ExternalSystem_Config_ScriptedExportConversion_ID");
}
@Override
public ExternalSystemType getType()
{
return ExternalSystemType.ScriptedExportConversion;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\scriptedexportconversion\ExternalSystemScriptedExportConversionConfigId.java | 1 |
请完成以下Java代码 | public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Resource.class, BPMN_ELEMENT_RESOURCE)
.namespaceUri(BPMN20_NS)
.extendsType(RootElement.class)
.instanceProvider(new ModelTypeInstanceProvider<Resource>() {
public Resource newInstance(ModelTypeInstanceContext instanceContext) {
return new ResourceImpl(instanceContext);
}
});
nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME)
.required()
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
resourceParameterCollection = sequenceBuilder.elementCollection(ResourceParameter.class)
.build();
typeBuilder.build();
} | public ResourceImpl(ModelTypeInstanceContext context) {
super(context);
}
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
}
public Collection<ResourceParameter> getResourceParameters() {
return resourceParameterCollection.get(this);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\ResourceImpl.java | 1 |
请完成以下Java代码 | public final class RequestMatchers {
/**
* Creates a {@link RequestMatcher} that matches if at least one of the given
* {@link RequestMatcher}s matches, if <code>matchers</code> are empty then the
* returned matcher never matches.
* @param matchers the {@link RequestMatcher}s to use
* @return the any-of composed {@link RequestMatcher}
* @see OrRequestMatcher
*/
public static RequestMatcher anyOf(RequestMatcher... matchers) {
return (matchers.length > 0) ? new OrRequestMatcher(List.of(matchers)) : (request) -> false;
}
/**
* Creates a {@link RequestMatcher} that matches if all the given
* {@link RequestMatcher}s match, if <code>matchers</code> are empty then the returned
* matcher always matches.
* @param matchers the {@link RequestMatcher}s to use
* @return the all-of composed {@link RequestMatcher} | * @see AndRequestMatcher
*/
public static RequestMatcher allOf(RequestMatcher... matchers) {
return (matchers.length > 0) ? new AndRequestMatcher(List.of(matchers)) : (request) -> true;
}
/**
* Creates a {@link RequestMatcher} that matches if the given {@link RequestMatcher}
* does not match.
* @param matcher the {@link RequestMatcher} to use
* @return the inverted {@link RequestMatcher}
*/
public static RequestMatcher not(RequestMatcher matcher) {
return (request) -> !matcher.matches(request);
}
private RequestMatchers() {
}
} | repos\spring-security-main\web\src\main\java\org\springframework\security\web\util\matcher\RequestMatchers.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Tag {
@Id
@GeneratedValue (strategy = GenerationType.IDENTITY)
private long id;
private String name;
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "tags")
private Set<Post> posts = new HashSet<>();
public Tag() {
}
public Tag(String name) {
super();
this.name = name;
}
public long getId() {
return id; | }
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Post> getPosts() {
return posts;
}
public void setPosts(Set<Post> posts) {
this.posts = posts;
}
} | repos\Spring-Boot-Advanced-Projects-main\springboot-hibernate-many-to-many-mapping\src\main\java\net\alanbinu\springboot\entity\Tag.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class CityESServiceImpl implements CityService {
private static final Logger LOGGER = LoggerFactory.getLogger(CityESServiceImpl.class);
// 分页参数 -> TODO 代码可迁移到具体项目的公共 common 模块
private static final Integer pageNumber = 0;
private static final Integer pageSize = 10;
Pageable pageable = new PageRequest(pageNumber, pageSize);
// ES 操作类
@Autowired
CityRepository cityRepository;
public Long saveCity(City city) {
City cityResult = cityRepository.save(city);
return cityResult.getId();
}
public List<City> findByDescriptionAndScore(String description, Integer score) {
return cityRepository.findByDescriptionAndScore(description, score);
}
public List<City> findByDescriptionOrScore(String description, Integer score) { | return cityRepository.findByDescriptionOrScore(description, score);
}
public List<City> findByDescription(String description) {
return cityRepository.findByDescription(description, pageable).getContent();
}
public List<City> findByDescriptionNot(String description) {
return cityRepository.findByDescriptionNot(description, pageable).getContent();
}
public List<City> findByDescriptionLike(String description) {
return cityRepository.findByDescriptionLike(description, pageable).getContent();
}
} | repos\springboot-learning-example-master\spring-data-elasticsearch-crud\src\main\java\org\spring\springboot\service\impl\CityESServiceImpl.java | 2 |
请完成以下Java代码 | public void setId(Long id) {
this.id = id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public User getAuthor() {
return author;
}
public void setAuthor(User author) {
this.author = author;
}
@Override
public boolean equals(Object o) { | if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Post post = (Post) o;
return Objects.equals(id, post.id);
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
} | repos\tutorials-master\persistence-modules\spring-boot-persistence-2\src\main\java\com\baeldung\nplusone\defaultfetch\list\Post.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class DatabaseProperties {
@Value("${db.name}")
private String name;
// Since Spring Boot 2.?. it supports list of strings from properties file directly
// if not , register DefaultConversionService
/**
* @Bean
* public ConversionService conversionService() {
* return new DefaultConversionService();
* }
*/
@Value("${db.cluster.ip}")
private List<String> clusterIp;
@Override
public String toString() {
return "DatabaseProperties{" +
"name='" + name + '\'' +
", clusterIp=" + clusterIp + | '}';
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getClusterIp() {
return clusterIp;
}
public void setClusterIp(List<String> clusterIp) {
this.clusterIp = clusterIp;
}
} | repos\spring-boot-master\spring-boot-externalize-config-3\src\main\java\com\mkyong\config\DatabaseProperties.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class DeliveryOrderParcel
{
@Nullable DeliveryOrderParcelId id;
@Nullable String content;
@NonNull BigDecimal grossWeightKg;
@NonNull PackageDimensions packageDimensions;
@Nullable CustomDeliveryLineData customDeliveryLineData;
@NonNull PackageId packageId;
@Nullable String awb;
@Nullable String trackingUrl;
@Nullable byte[] labelPdfBase64;
@NonNull ImmutableList<DeliveryOrderItem> items;
@Builder(toBuilder = true)
@Jacksonized
private DeliveryOrderParcel(
@Nullable final DeliveryOrderParcelId id,
@Nullable final String content,
@NonNull final BigDecimal grossWeightKg,
@NonNull final PackageDimensions packageDimensions,
@Nullable final CustomDeliveryLineData customDeliveryLineData,
@NonNull final PackageId packageId,
@Nullable final String awb,
@Nullable final String trackingUrl,
@Nullable final byte[] labelPdfBase64,
@Nullable final ImmutableList<DeliveryOrderItem> items)
{ | this.awb = awb;
this.trackingUrl = trackingUrl;
this.labelPdfBase64 = labelPdfBase64;
this.items = CoalesceUtil.coalesceNotNull(items, ImmutableList.of());
Check.assume(grossWeightKg.signum() > 0, "grossWeightKg > 0");
this.id = id;
this.grossWeightKg = grossWeightKg;
this.content = content;
this.packageDimensions = packageDimensions;
this.customDeliveryLineData = customDeliveryLineData;
this.packageId = packageId;
}
public DeliveryOrderParcel withCustomDeliveryData(@NonNull final CustomDeliveryLineData customDeliveryLineData)
{
if (Objects.equals(this.customDeliveryLineData, customDeliveryLineData))
{
return this;
}
return this.toBuilder()
.customDeliveryLineData(customDeliveryLineData)
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.spi\src\main\java\de\metas\shipper\gateway\spi\model\DeliveryOrderParcel.java | 2 |
请完成以下Java代码 | public PrintJobInstructionsStatusEnum getStatus()
{
return status;
}
public void setStatus(PrintJobInstructionsStatusEnum status)
{
this.status = status;
}
@Override
public String toString()
{
return "PrintJobInstructionsConfirm [printJobInstructionsID=" + printJobInstructionsID + ", errorMsg=" + errorMsg + ", status=" + status + "]";
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((errorMsg == null) ? 0 : errorMsg.hashCode());
result = prime * result + ((printJobInstructionsID == null) ? 0 : printJobInstructionsID.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true; | if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PrintJobInstructionsConfirm other = (PrintJobInstructionsConfirm)obj;
if (errorMsg == null)
{
if (other.errorMsg != null)
return false;
}
else if (!errorMsg.equals(other.errorMsg))
return false;
if (printJobInstructionsID == null)
{
if (other.printJobInstructionsID != null)
return false;
}
else if (!printJobInstructionsID.equals(other.printJobInstructionsID))
return false;
if (status != other.status)
return false;
return true;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.printing.common\de.metas.printing.api\src\main\java\de\metas\printing\esb\api\PrintJobInstructionsConfirm.java | 1 |
请完成以下Java代码 | public Config setOutputFile(String outputFile)
{
this.outputFile = outputFile;
return this;
}
public String getOutputFile()
{
return outputFile;
}
public Config setIter(int iter)
{
this.iter = iter;
return this;
}
public int getIter()
{
return iter;
}
public Config setWindow(int window)
{
this.window = window;
return this;
}
public int getWindow()
{
return window;
}
public Config setMinCount(int minCount)
{
this.minCount = minCount;
return this;
}
public int getMinCount()
{
return minCount;
}
public Config setNegative(int negative)
{
this.negative = negative;
return this;
}
public int getNegative()
{
return negative;
}
public Config setLayer1Size(int layer1Size)
{
this.layer1Size = layer1Size;
return this;
}
public int getLayer1Size()
{
return layer1Size;
}
public Config setNumThreads(int numThreads)
{
this.numThreads = numThreads;
return this;
}
public int getNumThreads()
{
return numThreads;
}
public Config setUseHierarchicalSoftmax(boolean hs)
{
this.hs = hs;
return this;
}
public boolean useHierarchicalSoftmax()
{
return hs;
} | public Config setUseContinuousBagOfWords(boolean cbow)
{
this.cbow = cbow;
return this;
}
public boolean useContinuousBagOfWords()
{
return cbow;
}
public Config setSample(float sample)
{
this.sample = sample;
return this;
}
public float getSample()
{
return sample;
}
public Config setAlpha(float alpha)
{
this.alpha = alpha;
return this;
}
public float getAlpha()
{
return alpha;
}
public Config setInputFile(String inputFile)
{
this.inputFile = inputFile;
return this;
}
public String getInputFile()
{
return inputFile;
}
public TrainingCallback getCallback()
{
return callback;
}
public void setCallback(TrainingCallback callback)
{
this.callback = callback;
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word2vec\Config.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);
}
/** Set Valid.
@param IsValid
Element is valid
*/
public void setIsValid (boolean IsValid)
{
set_Value (COLUMNNAME_IsValid, Boolean.valueOf(IsValid));
}
/** Get Valid.
@return Element is valid
*/
public boolean isValid ()
{
Object oo = get_Value(COLUMNNAME_IsValid);
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
*/
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_CM_Container_Element.java | 1 |
请完成以下Java代码 | public void setDecisionDefinitionKeyIn(String[] decisionDefinitionKeyIn) {
this.decisionDefinitionKeyIn = decisionDefinitionKeyIn;
}
@CamundaQueryParam(value = "tenantIdIn", converter = StringArrayConverter.class)
public void setTenantIdIn(String[] tenantIdIn) {
this.tenantIdIn = tenantIdIn;
}
@CamundaQueryParam(value = "withoutTenantId", converter = BooleanConverter.class)
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
@CamundaQueryParam(value = "compact", converter = BooleanConverter.class)
public void setCompact(Boolean compact) {
this.compact = compact;
}
@Override
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
@Override
protected CleanableHistoricDecisionInstanceReport createNewQuery(ProcessEngine engine) {
return engine.getHistoryService().createCleanableHistoricDecisionInstanceReport();
}
@Override | protected void applyFilters(CleanableHistoricDecisionInstanceReport query) {
if (decisionDefinitionIdIn != null && decisionDefinitionIdIn.length > 0) {
query.decisionDefinitionIdIn(decisionDefinitionIdIn);
}
if (decisionDefinitionKeyIn != null && decisionDefinitionKeyIn.length > 0) {
query.decisionDefinitionKeyIn(decisionDefinitionKeyIn);
}
if (Boolean.TRUE.equals(withoutTenantId)) {
query.withoutTenantId();
}
if (tenantIdIn != null && tenantIdIn.length > 0) {
query.tenantIdIn(tenantIdIn);
}
if (Boolean.TRUE.equals(compact)) {
query.compact();
}
}
@Override
protected void applySortBy(CleanableHistoricDecisionInstanceReport query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_FINISHED_VALUE)) {
query.orderByFinished();
}
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\CleanableHistoricDecisionInstanceReportDto.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ExternalSystemRabbitMQConfig implements IExternalSystemChildConfig
{
@NonNull
ExternalSystemRabbitMQConfigId id;
@NonNull
ExternalSystemParentConfigId parentId;
@NonNull
String value;
@NonNull
String routingKey;
@NonNull
String remoteUrl;
@NonNull
String authToken;
boolean isSyncBPartnerToRabbitMQ;
@Getter(AccessLevel.NONE)
boolean isAutoSendWhenCreatedByUserGroup;
@Nullable
UserGroupId userGroupId; | boolean isSyncExternalReferencesToRabbitMQ;
@NonNull
public static ExternalSystemRabbitMQConfig cast(@NonNull final IExternalSystemChildConfig childCondig)
{
return (ExternalSystemRabbitMQConfig)childCondig;
}
public boolean isAutoSendSubjectWhenCreatedByUserGroup()
{
return isAutoSendWhenCreatedByUserGroup && userGroupId != null;
}
public boolean shouldExportBasedOnUserGroup(@NonNull final Set<UserGroupId> assignedUserGroupIds)
{
return isAutoSendSubjectWhenCreatedByUserGroup() && assignedUserGroupIds.contains(userGroupId);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\rabbitmqhttp\ExternalSystemRabbitMQConfig.java | 2 |
请完成以下Java代码 | public synchronized void setRtAndSuccessQps(double avgRt, Long successQps) {
this.rt = avgRt * successQps;
this.successQps = successQps;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public String getApp() {
return app;
}
public void setApp(String app) {
this.app = app;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
this.resourceCode = resource.hashCode();
}
public Long getPassQps() {
return passQps;
}
public void setPassQps(Long passQps) {
this.passQps = passQps;
}
public Long getBlockQps() {
return blockQps;
}
public void setBlockQps(Long blockQps) {
this.blockQps = blockQps;
}
public Long getExceptionQps() {
return exceptionQps;
}
public void setExceptionQps(Long exceptionQps) {
this.exceptionQps = exceptionQps;
}
public double getRt() { | return rt;
}
public void setRt(double rt) {
this.rt = rt;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int getResourceCode() {
return resourceCode;
}
public Long getSuccessQps() {
return successQps;
}
public void setSuccessQps(Long successQps) {
this.successQps = successQps;
}
@Override
public String toString() {
return "MetricEntity{" +
"id=" + id +
", gmtCreate=" + gmtCreate +
", gmtModified=" + gmtModified +
", app='" + app + '\'' +
", timestamp=" + timestamp +
", resource='" + resource + '\'' +
", passQps=" + passQps +
", blockQps=" + blockQps +
", successQps=" + successQps +
", exceptionQps=" + exceptionQps +
", rt=" + rt +
", count=" + count +
", resourceCode=" + resourceCode +
'}';
}
} | repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\MetricEntity.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public LocalStorage create(String name, MultipartFile multipartFile) {
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
String type = FileUtil.getFileType(suffix);
File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator);
if(ObjectUtil.isNull(file)){
throw new BadRequestException("上传失败");
}
try {
name = StringUtils.isBlank(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name;
LocalStorage localStorage = new LocalStorage(
file.getName(),
name,
suffix,
file.getPath(),
type,
FileUtil.getSize(multipartFile.getSize())
);
return localStorageRepository.save(localStorage);
}catch (Exception e){
FileUtil.del(file);
throw e;
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(LocalStorage resources) {
LocalStorage localStorage = localStorageRepository.findById(resources.getId()).orElseGet(LocalStorage::new);
ValidationUtil.isNull( localStorage.getId(),"LocalStorage","id",resources.getId());
localStorage.copy(resources);
localStorageRepository.save(localStorage); | }
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
for (Long id : ids) {
LocalStorage storage = localStorageRepository.findById(id).orElseGet(LocalStorage::new);
FileUtil.del(storage.getPath());
localStorageRepository.delete(storage);
}
}
@Override
public void download(List<LocalStorageDto> queryAll, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (LocalStorageDto localStorageDTO : queryAll) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("文件名", localStorageDTO.getRealName());
map.put("备注名", localStorageDTO.getName());
map.put("文件类型", localStorageDTO.getType());
map.put("文件大小", localStorageDTO.getSize());
map.put("创建者", localStorageDTO.getCreateBy());
map.put("创建日期", localStorageDTO.getCreateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
} | repos\eladmin-master\eladmin-tools\src\main\java\me\zhengjie\service\impl\LocalStorageServiceImpl.java | 2 |
请完成以下Java代码 | public void turnOnPc() {
System.out.println("Computer turned on");
}
public void turnOffPc() {
System.out.println("Computer turned off");
}
public Double calculateValue(Double initialValue) {
return initialValue / 1.50;
}
@Override
public String toString() {
return "Computer{" + "age=" + age + ", color='" + color + '\'' + ", healty=" + healty + '}';
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false; | }
final Computer computer = (Computer) o;
return (age != null ? age.equals(computer.age) : computer.age == null) && (color != null ? color.equals(computer.color) : computer.color == null);
}
@Override
public int hashCode() {
int result = age != null ? age.hashCode() : 0;
result = 31 * result + (color != null ? color.hashCode() : 0);
return result;
}
} | repos\tutorials-master\core-java-modules\core-java-lambdas-2\src\main\java\com\baeldung\doublecolon\Computer.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private PickingJob getPickingJob()
{
return pickingJobSupplier.get();
}
private PickingJob retrievePickingJob()
{
@NonNull final PickingJob pickingJob = pickingJobService.getById(pickingJobId);
pickingJob.assertCanBeEditedBy(callerId);
return pickingJob;
}
@Nullable
private Quantity allocateLine(PickingJobLine line)
{
final Quantity qtyRemainingToPick = line.getQtyRemainingToPick();
if (line.isFullyPicked())
{
return qtyRemainingToPick.toZeroIfNegative();
}
final ProductAvailableStocks availableStocks = getAvailableStocks();
if (availableStocks == null)
{
return null; // N/A
}
return availableStocks.allocateQty(line.getProductId(), qtyRemainingToPick);
}
@Nullable
private ProductAvailableStocks getAvailableStocks()
{
return availableStocksSupplier.get();
} | @Nullable
private ProductAvailableStocks computeAvailableStocks()
{
final Workplace workplace = warehouseService.getWorkplaceByUserId(callerId).orElse(null);
if (workplace == null) {return null;}
final ProductAvailableStocks availableStocks = huService.newAvailableStocksProvider(workplace);
if (availableStocks == null) {return null;}
availableStocks.warmUpByProductIds(getProductIdsRemainingToBePicked());
return availableStocks;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\service\commands\get_qty_available\PickingJobGetQtyAvailableCommand.java | 2 |
请完成以下Java代码 | public void setCopying(final boolean copying) {setDynAttribute(DYNATTR_IsCopyWithDetailsInProgress, copying ? Boolean.TRUE : null);}
public boolean isCopiedFromOtherRecord() {return getDynAttribute(DYNATTR_CopiedFromRecordId) != null;}
public void setCopiedFromRecordId(final int fromRecordId) {setDynAttribute(DYNATTR_CopiedFromRecordId, fromRecordId);}
private class POReturningAfterInsertLoader implements ISqlUpdateReturnProcessor
{
private final List<String> columnNames;
private final StringBuilder sqlReturning;
public POReturningAfterInsertLoader()
{
this.columnNames = new ArrayList<>();
this.sqlReturning = new StringBuilder();
}
public void addColumnName(final String columnName)
{
// Make sure column was not already added
if (columnNames.contains(columnName))
{
return;
}
columnNames.add(columnName);
if (sqlReturning.length() > 0)
{
sqlReturning.append(", ");
}
sqlReturning.append(columnName);
}
public String getSqlReturning()
{
return sqlReturning.toString();
} | public boolean hasColumnNames()
{
return !columnNames.isEmpty();
}
@Override
public void process(final ResultSet rs) throws SQLException
{
for (final String columnName : columnNames)
{
final Object value = rs.getObject(columnName);
// NOTE: it is also setting the ID if applies
set_ValueNoCheck(columnName, value);
}
}
@Override
public String toString()
{
return "POReturningAfterInsertLoader [columnNames=" + columnNames + "]";
}
}
} // PO | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\PO.java | 1 |
请完成以下Java代码 | public void insertEditorSourceExtraForModel(String modelId, byte[] modelSource) {
ModelEntity model = findModelById(modelId);
if (model != null) {
ByteArrayRef ref = new ByteArrayRef(model.getEditorSourceExtraValueId());
ref.setValue("source-extra", modelSource);
if (model.getEditorSourceExtraValueId() == null) {
model.setEditorSourceExtraValueId(ref.getId());
updateModel(model);
}
}
}
public ModelQuery createNewModelQuery() {
return new ModelQueryImpl(Context.getProcessEngineConfiguration().getCommandExecutor());
}
@SuppressWarnings("unchecked")
public List<Model> findModelsByQueryCriteria(ModelQueryImpl query, Page page) {
return getDbSqlSession().selectList("selectModelsByQueryCriteria", query, page);
}
public long findModelCountByQueryCriteria(ModelQueryImpl query) {
return (Long) getDbSqlSession().selectOne("selectModelCountByQueryCriteria", query);
}
public ModelEntity findModelById(String modelId) {
return (ModelEntity) getDbSqlSession().selectOne("selectModel", modelId);
}
public byte[] findEditorSourceByModelId(String modelId) {
ModelEntity model = findModelById(modelId); | if (model == null || model.getEditorSourceValueId() == null) {
return null;
}
ByteArrayRef ref = new ByteArrayRef(model.getEditorSourceValueId());
return ref.getBytes();
}
public byte[] findEditorSourceExtraByModelId(String modelId) {
ModelEntity model = findModelById(modelId);
if (model == null || model.getEditorSourceExtraValueId() == null) {
return null;
}
ByteArrayRef ref = new ByteArrayRef(model.getEditorSourceExtraValueId());
return ref.getBytes();
}
@SuppressWarnings("unchecked")
public List<Model> findModelsByNativeQuery(Map<String, Object> parameterMap, int firstResult, int maxResults) {
return getDbSqlSession().selectListWithRawParameter("selectModelByNativeQuery", parameterMap, firstResult, maxResults);
}
public long findModelCountByNativeQuery(Map<String, Object> parameterMap) {
return (Long) getDbSqlSession().selectOne("selectModelCountByNativeQuery", parameterMap);
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\ModelEntityManager.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void importBPartner(final SyncBPartner syncBpartner)
{
//
// Import the BPartner only
final BPartner bpartner = importBPartnerNoCascade(syncBpartner);
if (bpartner == null)
{
return;
}
//
// Users
usersImportService.importUsers(bpartner, syncBpartner.getUsers());
//
// Contracts
if (syncBpartner.isSyncContracts())
{
try
{
contractsListImportService.importContracts(bpartner, syncBpartner.getContracts());
}
catch (final Exception ex)
{
logger.warn("Failed importing contracts for {}. Skipped", bpartner, ex);
}
}
//
// RfQs
try
{
final List<SyncRfQ> rfqs = syncBpartner.getRfqs();
rfqImportService.importRfQs(bpartner, rfqs);
}
catch (final Exception ex)
{
logger.warn("Failed importing contracts for {}. Skipped", bpartner, ex);
}
}
@Nullable | private BPartner importBPartnerNoCascade(final SyncBPartner syncBpartner)
{
//
// BPartner
BPartner bpartner = bpartnersRepo.findByUuid(syncBpartner.getUuid());
//
// Handle delete request
if (syncBpartner.isDeleted())
{
if (bpartner != null)
{
deleteBPartner(bpartner);
}
return bpartner;
}
if (bpartner == null)
{
bpartner = new BPartner();
bpartner.setUuid(syncBpartner.getUuid());
}
bpartner.setDeleted(false);
bpartner.setName(syncBpartner.getName());
bpartnersRepo.save(bpartner);
logger.debug("Imported: {} -> {}", syncBpartner, bpartner);
return bpartner;
}
private void deleteBPartner(final BPartner bpartner)
{
if (bpartner.isDeleted())
{
return;
}
bpartner.setDeleted(true);
bpartnersRepo.save(bpartner);
logger.debug("Deleted: {}", bpartner);
}
} | repos\metasfresh-new_dawn_uat\misc\services\procurement-webui\procurement-webui-backend\src\main\java\de\metas\procurement\webui\sync\SyncBPartnerImportService.java | 2 |
请完成以下Java代码 | public String toString()
{
final StringBuilder sb = new StringBuilder("MInventoryLine[");
sb.append(get_ID())
.append("-M_Product_ID=").append(getM_Product_ID())
.append(",QtyCount=").append(getQtyCount())
.append(",QtyInternalUse=").append(getQtyInternalUse())
.append(",QtyBook=").append(getQtyBook())
.append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID())
.append("]");
return sb.toString();
} // toString
@Override
protected boolean beforeSave(final boolean newRecord)
{
final IInventoryBL inventoryBL = Services.get(IInventoryBL.class);
if (newRecord && Services.get(IInventoryBL.class).isComplete(getM_Inventory()))
{
throw new AdempiereException("@ParentComplete@ @M_Inventory_ID@");
}
if (newRecord && is_ManualUserAction())
{
// Product requires ASI
if (getM_AttributeSetInstance_ID() <= 0)
{
final ProductId productId = ProductId.ofRepoId(getM_Product_ID());
if(Services.get(IProductBL.class).isASIMandatory(productId, isSOTrx()))
{
throw new FillMandatoryException(COLUMNNAME_M_AttributeSetInstance_ID);
}
} // No ASI
} // new or manual
// Set Line No
if (getLine() <= 0)
{
final String sql = "SELECT COALESCE(MAX(Line),0)+10 AS DefaultValue FROM M_InventoryLine WHERE M_Inventory_ID=?";
final int lineNo = DB.getSQLValueEx(get_TrxName(), sql, getM_Inventory_ID());
setLine(lineNo);
}
// Enforce Qty UOM
if (newRecord || is_ValueChanged(COLUMNNAME_QtyCount))
{
setQtyCount(getQtyCount());
}
if (newRecord || is_ValueChanged(COLUMNNAME_QtyInternalUse))
{
setQtyInternalUse(getQtyInternalUse());
}
// InternalUse Inventory
if (isInternalUseInventory())
{
if (!INVENTORYTYPE_ChargeAccount.equals(getInventoryType()))
{
setInventoryType(INVENTORYTYPE_ChargeAccount); | }
//
if (getC_Charge_ID() <= 0)
{
inventoryBL.setDefaultInternalChargeId(this);
}
}
else if (INVENTORYTYPE_ChargeAccount.equals(getInventoryType()))
{
if (getC_Charge_ID() <= 0)
{
throw new FillMandatoryException(COLUMNNAME_C_Charge_ID);
}
}
else if (getC_Charge_ID() > 0)
{
setC_Charge_ID(0);
}
// Set AD_Org to parent if not charge
if (getC_Charge_ID() <= 0)
{
setAD_Org_ID(getM_Inventory().getAD_Org_ID());
}
return true;
}
@Deprecated
private boolean isInternalUseInventory()
{
return Services.get(IInventoryBL.class).isInternalUseInventory(this);
}
/**
* @return true if is an outgoing transaction
*/
@Deprecated
private boolean isSOTrx()
{
return Services.get(IInventoryBL.class).isSOTrx(this);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MInventoryLine.java | 1 |
请完成以下Java代码 | public BigDecimal getOpenAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OpenAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** 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 Times Dunned.
@param TimesDunned
Number of times dunned previously
*/
public void setTimesDunned (int TimesDunned)
{
set_Value (COLUMNNAME_TimesDunned, Integer.valueOf(TimesDunned));
}
/** Get Times Dunned.
@return Number of times dunned previously
*/
public int getTimesDunned ()
{ | Integer ii = (Integer)get_Value(COLUMNNAME_TimesDunned);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Total Amount.
@param TotalAmt
Total Amount
*/
public void setTotalAmt (BigDecimal TotalAmt)
{
set_Value (COLUMNNAME_TotalAmt, TotalAmt);
}
/** Get Total Amount.
@return Total Amount
*/
public BigDecimal getTotalAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalAmt);
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_DunningRunLine.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class SpringbootBeatlsqlApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootBeatlsqlApplication.class, args);
}
//配置文件
@Bean(initMethod = "init", name = "beetlConfig")
public BeetlGroupUtilConfiguration getBeetlGroupUtilConfiguration() {
BeetlGroupUtilConfiguration beetlGroupUtilConfiguration = new BeetlGroupUtilConfiguration();
ResourcePatternResolver patternResolver = ResourcePatternUtils.getResourcePatternResolver(new DefaultResourceLoader());
try {
// WebAppResourceLoader 配置root路径是关键
WebAppResourceLoader webAppResourceLoader = new WebAppResourceLoader(patternResolver.getResource("classpath:/templates").getFile().getPath());
beetlGroupUtilConfiguration.setResourceLoader(webAppResourceLoader);
} catch (IOException e) {
e.printStackTrace();
}
//读取配置文件信息
return beetlGroupUtilConfiguration;
}
@Bean(name = "beetlViewResolver")
public BeetlSpringViewResolver getBeetlSpringViewResolver(@Qualifier("beetlConfig") BeetlGroupUtilConfiguration beetlGroupUtilConfiguration) {
BeetlSpringViewResolver beetlSpringViewResolver = new BeetlSpringViewResolver();
beetlSpringViewResolver.setContentType("text/html;charset=UTF-8");
beetlSpringViewResolver.setOrder(0);
beetlSpringViewResolver.setConfig(beetlGroupUtilConfiguration);
return beetlSpringViewResolver;
}
//配置包扫描
@Bean(name = "beetlSqlScannerConfigurer")
public BeetlSqlScannerConfigurer getBeetlSqlScannerConfigurer() {
BeetlSqlScannerConfigurer conf = new BeetlSqlScannerConfigurer(); | conf.setBasePackage("com.forezp.dao");
conf.setDaoSuffix("Dao");
conf.setSqlManagerFactoryBeanName("sqlManagerFactoryBean");
return conf;
}
@Bean(name = "sqlManagerFactoryBean")
@Primary
public SqlManagerFactoryBean getSqlManagerFactoryBean(@Qualifier("datasource") DataSource datasource) {
SqlManagerFactoryBean factory = new SqlManagerFactoryBean();
BeetlSqlDataSource source = new BeetlSqlDataSource();
source.setMasterSource(datasource);
factory.setCs(source);
factory.setDbStyle(new MySqlStyle());
factory.setInterceptors(new Interceptor[]{new DebugInterceptor()});
factory.setNc(new UnderlinedNameConversion());//开启驼峰
factory.setSqlLoader(new ClasspathLoader("/sql"));//sql文件路径
return factory;
}
//配置数据库
@Bean(name = "datasource")
public DataSource getDataSource() {
return DataSourceBuilder.create().url("jdbc:mysql://127.0.0.1:3306/test").username("root").password("123456").build();
}
//开启事务
@Bean(name = "txManager")
public DataSourceTransactionManager getDataSourceTransactionManager(@Qualifier("datasource") DataSource datasource) {
DataSourceTransactionManager dsm = new DataSourceTransactionManager();
dsm.setDataSource(datasource);
return dsm;
}
} | repos\SpringBootLearning-master\springboot-beatlsql\src\main\java\com\forezp\SpringbootBeatlsqlApplication.java | 2 |
请完成以下Java代码 | protected List<RelatedProcessDescriptor> getRelatedProcessDescriptors()
{
return ImmutableList.of(
createProcessDescriptor(WEBUI_ProductsProposal_SaveProductPriceToCurrentPriceListVersion.class),
createProcessDescriptor(WEBUI_ProductsProposal_ShowProductsToAddFromBasePriceList.class),
createProcessDescriptor(WEBUI_ProductsProposal_ShowProductsSoldToOtherCustomers.class),
createProcessDescriptor(WEBUI_ProductsProposal_Delete.class));
}
@Override
protected void beforeViewClose(@NonNull final ViewId viewId, @NonNull final ViewCloseAction closeAction)
{
if (ViewCloseAction.DONE.equals(closeAction))
{
final ProductsProposalView view = getById(viewId); | if (view.getOrderId() != null)
{
createOrderLines(view);
}
}
}
private void createOrderLines(final ProductsProposalView view)
{
OrderLinesFromProductProposalsProducer.builder()
.orderId(view.getOrderId().get())
.rows(view.getAllRows())
.build()
.produce();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\products_proposal\view\OrderProductsProposalViewFactory.java | 1 |
请完成以下Java代码 | public Double calculateValue(Double initialValue) {
return initialValue / 1.50;
}
@Override
public String toString() {
return "Computer{" + "age=" + age + ", color='" + color + '\'' + ", healty=" + healty + '}';
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false; | }
final Computer computer = (Computer) o;
return (age != null ? age.equals(computer.age) : computer.age == null) && (color != null ? color.equals(computer.color) : computer.color == null);
}
@Override
public int hashCode() {
int result = age != null ? age.hashCode() : 0;
result = 31 * result + (color != null ? color.hashCode() : 0);
return result;
}
} | repos\tutorials-master\core-java-modules\core-java-lambdas-2\src\main\java\com\baeldung\doublecolon\Computer.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public DataResponse<BatchResponse> getBatches(@ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams) {
BatchQuery query = managementService.createBatchQuery();
if (allRequestParams.containsKey("id")) {
query.batchId(allRequestParams.get("id"));
}
if (allRequestParams.containsKey("batchType")) {
query.batchType(allRequestParams.get("batchType"));
}
if (allRequestParams.containsKey("searchKey")) {
query.searchKey(allRequestParams.get("searchKey"));
}
if (allRequestParams.containsKey("searchKey2")) {
query.searchKey2(allRequestParams.get("searchKey2"));
}
if (allRequestParams.containsKey("createTimeBefore")) {
query.createTimeLowerThan(RequestUtil.getDate(allRequestParams, "createTimeBefore"));
}
if (allRequestParams.containsKey("createTimeAfter")) {
query.createTimeHigherThan(RequestUtil.getDate(allRequestParams, "createTimeAfter"));
}
if (allRequestParams.containsKey("completeTimeBefore")) {
query.completeTimeLowerThan(RequestUtil.getDate(allRequestParams, "completeTimeBefore"));
}
if (allRequestParams.containsKey("completeTimeAfter")) {
query.completeTimeHigherThan(RequestUtil.getDate(allRequestParams, "completeTimeAfter"));
} | if (allRequestParams.containsKey("status")) {
query.status(allRequestParams.get("status"));
}
if (allRequestParams.containsKey("tenantId")) {
query.tenantId(allRequestParams.get("tenantId"));
}
if (allRequestParams.containsKey("tenantIdLike")) {
query.tenantIdLike(allRequestParams.get("tenantIdLike"));
}
if (allRequestParams.containsKey("withoutTenantId")) {
if (Boolean.parseBoolean(allRequestParams.get("withoutTenantId"))) {
query.withoutTenantId();
}
}
if (restApiInterceptor != null) {
restApiInterceptor.accessBatchInfoWithQuery(query);
}
return paginateList(allRequestParams, query, "id", JobQueryProperties.PROPERTIES, restResponseFactory::createBatchResponse);
}
} | repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\management\BatchCollectionResource.java | 2 |
请完成以下Java代码 | public String getIp() {
return ip;
}
public ClusterClientModifyRequest setIp(String ip) {
this.ip = ip;
return this;
}
@Override
public Integer getPort() {
return port;
}
public ClusterClientModifyRequest setPort(Integer port) {
this.port = port;
return this;
}
@Override
public Integer getMode() {
return mode; | }
public ClusterClientModifyRequest setMode(Integer mode) {
this.mode = mode;
return this;
}
public ClusterClientConfig getClientConfig() {
return clientConfig;
}
public ClusterClientModifyRequest setClientConfig(
ClusterClientConfig clientConfig) {
this.clientConfig = clientConfig;
return this;
}
} | repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\domain\cluster\request\ClusterClientModifyRequest.java | 1 |
请完成以下Java代码 | public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Boolean getLocked() {
return locked;
}
public void setLocked(Boolean locked) { | this.locked = locked;
}
@PrePersist
public void prePersist() {
if (name == null) {
name = "John Snow";
}
if (age == null) {
age = 25;
}
if (locked == null) {
locked = false;
}
}
} | repos\tutorials-master\persistence-modules\java-jpa\src\main\java\com\baeldung\jpa\defaultvalues\UserEntity.java | 1 |
请完成以下Java代码 | public void checkCompleteContractsForWinners(final I_C_RfQResponse rfqResponse)
{
final IPMM_RfQ_DAO pmmRfqDAO = Services.get(IPMM_RfQ_DAO.class);
for (final I_C_RfQResponseLine rfqResponseLine : pmmRfqDAO.retrieveResponseLines(rfqResponse))
{
checkCompleteContractIfWinner(rfqResponseLine);
}
}
@Override
public void checkCompleteContractIfWinner(I_C_RfQResponseLine rfqResponseLine)
{
if (!rfqResponseLine.isSelectedWinner())
{
// TODO: make sure the is no contract
return;
}
final I_C_Flatrate_Term contract = rfqResponseLine.getC_Flatrate_Term();
if (contract == null)
{
throw new AdempiereException("@NotFound@ @C_Flatrate_Term_ID@: " + rfqResponseLine);
} | final IDocumentBL docActionBL = Services.get(IDocumentBL.class);
if (docActionBL.issDocumentDraftedOrInProgress(contract))
{
final IFlatrateBL flatrateBL = Services.get(IFlatrateBL.class);
flatrateBL.complete(contract);
}
else if (docActionBL.isDocumentCompleted(contract))
{
// already completed => nothing to do
}
else
{
throw new AdempiereException("@Invalid@ @DocStatus@: " + contract);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\impl\PMM_RfQ_BL.java | 1 |
请完成以下Java代码 | public void setNbOfNtries(String value) {
this.nbOfNtries = value;
}
/**
* Gets the value of the sum property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getSum() {
return sum;
}
/**
* Sets the value of the sum property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setSum(BigDecimal value) {
this.sum = value;
}
/**
* Gets the value of the ttlNetNtryAmt property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getTtlNetNtryAmt() {
return ttlNetNtryAmt;
}
/**
* Sets the value of the ttlNetNtryAmt property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setTtlNetNtryAmt(BigDecimal value) {
this.ttlNetNtryAmt = value;
} | /**
* Gets the value of the cdtDbtInd property.
*
* @return
* possible object is
* {@link CreditDebitCode }
*
*/
public CreditDebitCode getCdtDbtInd() {
return cdtDbtInd;
}
/**
* Sets the value of the cdtDbtInd property.
*
* @param value
* allowed object is
* {@link CreditDebitCode }
*
*/
public void setCdtDbtInd(CreditDebitCode value) {
this.cdtDbtInd = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\NumberAndSumOfTransactions2.java | 1 |
请完成以下Java代码 | public int getM_HU_Item_Storage_ID()
{
return get_ValueAsInt(COLUMNNAME_M_HU_Item_Storage_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{ | return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
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_HU_Item_Storage.java | 1 |
请完成以下Java代码 | 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代码 | private boolean isValidLineToExport(final InOutAndLineId inoutAndLineId)
{
final IInOutDAO inOutDAO = Services.get(IInOutDAO.class);
final InOutLineId inOutLineId = inoutAndLineId.getInOutLineId();
final I_M_InOutLine shipmentLineRecord = inOutDAO.getLineByIdOutOfTrx(inOutLineId, I_M_InOutLine.class);
if (shipmentLineRecord.isPackagingMaterial())
{
return false;
}
if (shipmentLineRecord.getC_OrderLine_ID() <= 0)
{
return false;
}
return true;
}
private boolean isValidShipment(final InOutId shipmentId)
{
final IInOutBL inOutBL = Services.get(IInOutBL.class); | final IInOutDAO inOutDAO = Services.get(IInOutDAO.class);
final I_M_InOut shipment = inOutDAO.getById(shipmentId);
if (!shipment.isSOTrx())
{
return false;
}
if (inOutBL.isReversal(shipment))
{
return false;
}
final DocStatus shipmentDocStatus = DocStatus.ofCode(shipment.getDocStatus());
if (!shipmentDocStatus.isCompletedOrClosed())
{
return false;
}
return true;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\customs\process\ShipmentLinesForCustomsInvoiceRepo.java | 1 |
请完成以下Java代码 | public void setPassword (java.lang.String Password)
{
set_Value (COLUMNNAME_Password, Password);
}
/** Get Kennwort.
@return Kennwort */
@Override
public java.lang.String getPassword ()
{
return (java.lang.String)get_Value(COLUMNNAME_Password);
}
/** Set Nutzerkennung.
@param UserID Nutzerkennung */
@Override
public void setUserID (java.lang.String UserID)
{
set_Value (COLUMNNAME_UserID, UserID);
}
/** Get Nutzerkennung.
@return Nutzerkennung */
@Override
public java.lang.String getUserID ()
{
return (java.lang.String)get_Value(COLUMNNAME_UserID);
}
/**
* Version AD_Reference_ID=540904 | * Reference name: MSV3_Version
*/
public static final int VERSION_AD_Reference_ID=540904;
/** 1 = 1 */
public static final String VERSION_1 = "1";
/** 2 = 2 */
public static final String VERSION_2 = "2";
/** Set Version.
@param Version
Version of the table definition
*/
@Override
public void setVersion (java.lang.String Version)
{
set_Value (COLUMNNAME_Version, Version);
}
/** Get Version.
@return Version of the table definition
*/
@Override
public java.lang.String getVersion ()
{
return (java.lang.String)get_Value(COLUMNNAME_Version);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.vendor.gateway.msv3\src\main\java-gen\de\metas\vertical\pharma\vendor\gateway\msv3\model\X_MSV3_Vendor_Config.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getRsaPrivateKey() {
return rsaPrivateKey;
}
public void setRsaPrivateKey(String rsaPrivateKey) {
this.rsaPrivateKey = rsaPrivateKey;
}
public String getRsaPublicKey() {
return rsaPublicKey;
}
public void setRsaPublicKey(String rsaPublicKey) {
this.rsaPublicKey = rsaPublicKey;
}
public String getPayWayCode() {
return payWayCode;
}
public void setPayWayCode(String payWayCode) {
this.payWayCode = payWayCode;
}
public String getPayWayName() {
return payWayName;
}
public void setPayWayName(String payWayName) {
this.payWayName = payWayName;
}
public String getPartnerKey() {
return partnerKey;
}
public void setPartnerKey(String partnerKey) {
this.partnerKey = partnerKey;
}
private static final long serialVersionUID = 1L;
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId == null ? null : appId.trim();
}
public String getAppSectet() {
return appSectet;
}
public void setAppSectet(String appSectet) {
this.appSectet = appSectet == null ? null : appSectet.trim();
}
public String getMerchantId() { | return merchantId;
}
public void setMerchantId(String merchantId) {
this.merchantId = merchantId == null ? null : merchantId.trim();
}
public String getAppType() {
return appType;
}
public void setAppType(String appType) {
this.appType = appType == null ? null : appType.trim();
}
public String getUserNo() {
return userNo;
}
public void setUserNo(String userNo) {
this.userNo = userNo == null ? null : userNo.trim();
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\user\entity\RpUserPayInfo.java | 2 |
请完成以下Java代码 | public final class NullHUIteratorListener implements IHUIteratorListener
{
public static final NullHUIteratorListener instance = new NullHUIteratorListener();
private final Result defaultResult = Result.CONTINUE;
private NullHUIteratorListener()
{
super();
}
@Override
public void setHUIterator(final IHUIterator iterator)
{
// do nothing; this is an immutable class
}
@Override
public Result beforeHU(final IMutable<I_M_HU> hu)
{
return defaultResult;
}
@Override
public Result afterHU(final I_M_HU hu)
{
return defaultResult; | }
@Override
public Result beforeHUItem(final IMutable<I_M_HU_Item> item)
{
return defaultResult;
}
@Override
public Result afterHUItem(final I_M_HU_Item item)
{
return defaultResult;
}
@Override
public Result beforeHUItemStorage(final IMutable<IHUItemStorage> itemStorage)
{
return defaultResult;
}
@Override
public Result afterHUItemStorage(final IHUItemStorage itemStorage)
{
return defaultResult;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\NullHUIteratorListener.java | 1 |
请完成以下Java代码 | public Builder addTotalNetAmt(final BigDecimal amtToAdd, final boolean approved, final boolean isPackingMaterial)
{
if (approved)
{
totalNetAmtApproved = totalNetAmtApproved.add(amtToAdd);
if (isPackingMaterial)
{
huNetAmtApproved = huNetAmtApproved.add(amtToAdd);
}
else
{
cuNetAmtApproved = cuNetAmtApproved.add(amtToAdd);
}
}
else
{
totalNetAmtNotApproved = totalNetAmtNotApproved.add(amtToAdd);
if (isPackingMaterial)
{
huNetAmtNotApproved = huNetAmtNotApproved.add(amtToAdd);
}
else
{
cuNetAmtNotApproved = cuNetAmtNotApproved.add(amtToAdd);
}
}
return this;
}
@SuppressWarnings("UnusedReturnValue")
public Builder addCurrencySymbol(final String currencySymbol)
{
if (Check.isEmpty(currencySymbol, true))
{ | // NOTE: prevent adding null values because ImmutableSet.Builder will fail in this case
currencySymbols.add("?");
}
else
{
currencySymbols.add(currencySymbol);
}
return this;
}
public void addCountToRecompute(final int countToRecomputeToAdd)
{
Check.assume(countToRecomputeToAdd > 0, "countToRecomputeToAdd > 0");
countTotalToRecompute += countToRecomputeToAdd;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandidatesAmtSelectionSummary.java | 1 |
请完成以下Java代码 | 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());
}
/** Set Overtime Amount.
@param OvertimeAmt
Hourly Overtime Rate
*/
public void setOvertimeAmt (BigDecimal OvertimeAmt)
{
set_Value (COLUMNNAME_OvertimeAmt, OvertimeAmt);
}
/** Get Overtime Amount.
@return Hourly Overtime Rate
*/
public BigDecimal getOvertimeAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OvertimeAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Overtime Cost.
@param OvertimeCost
Hourly Overtime Cost
*/
public void setOvertimeCost (BigDecimal OvertimeCost)
{
set_Value (COLUMNNAME_OvertimeCost, OvertimeCost);
}
/** Get Overtime Cost.
@return Hourly Overtime Cost
*/
public BigDecimal getOvertimeCost ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OvertimeCost);
if (bd == null) | return Env.ZERO;
return bd;
}
/** RemunerationType AD_Reference_ID=346 */
public static final int REMUNERATIONTYPE_AD_Reference_ID=346;
/** Hourly = H */
public static final String REMUNERATIONTYPE_Hourly = "H";
/** Daily = D */
public static final String REMUNERATIONTYPE_Daily = "D";
/** Weekly = W */
public static final String REMUNERATIONTYPE_Weekly = "W";
/** Monthly = M */
public static final String REMUNERATIONTYPE_Monthly = "M";
/** Twice Monthly = T */
public static final String REMUNERATIONTYPE_TwiceMonthly = "T";
/** Bi-Weekly = B */
public static final String REMUNERATIONTYPE_Bi_Weekly = "B";
/** Set Remuneration Type.
@param RemunerationType
Type of Remuneration
*/
public void setRemunerationType (String RemunerationType)
{
set_Value (COLUMNNAME_RemunerationType, RemunerationType);
}
/** Get Remuneration Type.
@return Type of Remuneration
*/
public String getRemunerationType ()
{
return (String)get_Value(COLUMNNAME_RemunerationType);
}
/** Set Standard Hours.
@param StandardHours
Standard Work Hours based on Remuneration Type
*/
public void setStandardHours (int StandardHours)
{
set_Value (COLUMNNAME_StandardHours, Integer.valueOf(StandardHours));
}
/** Get Standard Hours.
@return Standard Work Hours based on Remuneration Type
*/
public int getStandardHours ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_StandardHours);
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_C_Remuneration.java | 1 |
请完成以下Java代码 | public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_ValueNoCheck (COLUMNNAME_Record_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
@Override
public void setSEPA_Export_ID (final int SEPA_Export_ID)
{
if (SEPA_Export_ID < 1)
set_ValueNoCheck (COLUMNNAME_SEPA_Export_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SEPA_Export_ID, SEPA_Export_ID);
}
@Override
public int getSEPA_Export_ID()
{
return get_ValueAsInt(COLUMNNAME_SEPA_Export_ID);
}
@Override
public void setSEPA_Export_Line_ID (final int SEPA_Export_Line_ID)
{
if (SEPA_Export_Line_ID < 1)
set_ValueNoCheck (COLUMNNAME_SEPA_Export_Line_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SEPA_Export_Line_ID, SEPA_Export_Line_ID);
}
@Override
public int getSEPA_Export_Line_ID()
{ | return get_ValueAsInt(COLUMNNAME_SEPA_Export_Line_ID);
}
@Override
public void setSEPA_Export_Line_Ref_ID (final int SEPA_Export_Line_Ref_ID)
{
if (SEPA_Export_Line_Ref_ID < 1)
set_ValueNoCheck (COLUMNNAME_SEPA_Export_Line_Ref_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SEPA_Export_Line_Ref_ID, SEPA_Export_Line_Ref_ID);
}
@Override
public int getSEPA_Export_Line_Ref_ID()
{
return get_ValueAsInt(COLUMNNAME_SEPA_Export_Line_Ref_ID);
}
@Override
public void setStructuredRemittanceInfo (final @Nullable String StructuredRemittanceInfo)
{
set_Value (COLUMNNAME_StructuredRemittanceInfo, StructuredRemittanceInfo);
}
@Override
public String getStructuredRemittanceInfo()
{
return get_ValueAsString(COLUMNNAME_StructuredRemittanceInfo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java-gen\de\metas\payment\sepa\model\X_SEPA_Export_Line_Ref.java | 1 |
请完成以下Java代码 | public int getRecord_ID()
{
return io.get_ID();
}
@Override
public EMail sendEMail(I_AD_User from, String toEmail, String subject, final BoilerPlateContext attributes)
{
final BoilerPlateContext attributesEffective = attributes.toBuilder()
.setSourceDocumentFromObject(io)
.build();
//
String message = text.getTextSnippetParsed(attributesEffective);
//
if (Check.isEmpty(message, true))
{
return null;
}
//
final StringTokenizer st = new StringTokenizer(toEmail, " ,;", false);
EMailAddress to = EMailAddress.ofString(st.nextToken());
MClient client = MClient.get(ctx, Env.getAD_Client_ID(ctx));
if (orderUser != null)
{
to = EMailAddress.ofString(orderUser.getEMail());
}
EMail email = client.createEMail(
to,
text.getName(),
message,
true);
if (email == null)
{
throw new AdempiereException("Cannot create email. Check log.");
}
while (st.hasMoreTokens())
{
email.addTo(EMailAddress.ofString(st.nextToken()));
}
send(email);
return email;
}
}, false); | return "";
}
private void send(EMail email)
{
int maxRetries = p_SMTPRetriesNo > 0 ? p_SMTPRetriesNo : 0;
int count = 0;
do
{
final EMailSentStatus emailSentStatus = email.send();
count++;
if (emailSentStatus.isSentOK())
{
return;
}
// Timeout => retry
if (emailSentStatus.isSentConnectionError() && count < maxRetries)
{
log.warn("SMTP error: {} [ Retry {}/{} ]", emailSentStatus, count, maxRetries);
}
else
{
throw new EMailSendException(emailSentStatus);
}
}
while (true);
}
private void setNotified(I_M_PackageLine packageLine)
{
InterfaceWrapperHelper.getPO(packageLine).set_ValueOfColumn("IsSentMailNotification", true);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\shipping\model\validator\ShipperTransportationMailNotification.java | 1 |
请完成以下Java代码 | public FeelConvertException unableToConvertValue(String feelExpression, FeelConvertException cause) {
Object value = cause.getValue();
Class<?> type = cause.getType();
return new FeelConvertException(exceptionMessage(
"015",
"Unable to convert value '{}' of type '{}' to type '{}' in expression '{}'", value, value.getClass(), type, feelExpression),
cause
);
}
public UnsupportedOperationException simpleExpressionNotSupported() {
return new UnsupportedOperationException(exceptionMessage(
"016",
"Simple Expression not supported by FEEL engine")
);
}
public FeelException unableToEvaluateExpressionAsNotInputIsSet(String simpleUnaryTests, FeelMissingVariableException e) {
return new FeelException(exceptionMessage(
"017",
"Unable to evaluate expression '{}' as no input is set. Maybe the inputExpression is missing or empty.", simpleUnaryTests),
e
);
}
public FeelMethodInvocationException invalidDateAndTimeFormat(String dateTimeString, Throwable cause) {
return new FeelMethodInvocationException(exceptionMessage(
"018",
"Invalid date and time format in '{}'", dateTimeString),
cause, "date and time", dateTimeString
);
}
public FeelMethodInvocationException unableToInvokeMethod(String simpleUnaryTests, FeelMethodInvocationException cause) { | String method = cause.getMethod();
String[] parameters = cause.getParameters();
return new FeelMethodInvocationException(exceptionMessage(
"019",
"Unable to invoke method '{}' with parameters '{}' in expression '{}'", method, parameters, simpleUnaryTests),
cause.getCause(), method, parameters
);
}
public FeelSyntaxException invalidListExpression(String feelExpression) {
String description = "List expression can not have empty elements";
return syntaxException("020", feelExpression, description);
}
} | repos\camunda-bpm-platform-master\engine-dmn\feel-juel\src\main\java\org\camunda\bpm\dmn\feel\impl\juel\FeelEngineLogger.java | 1 |
请完成以下Java代码 | public void enqueueId(@NonNull final DDOrderCandidateId id)
{
enqueueIds(ImmutableSet.of(id));
}
public void enqueueIds(@NonNull final Collection<DDOrderCandidateId> ids)
{
if (ids.isEmpty())
{
return;
}
final PInstanceId selectionId = ddOrderCandidateRepository.createSelection(ids);
enqueueSelection(DDOrderCandidateEnqueueRequest.ofSelectionId(selectionId));
}
public void enqueueSelection(@NonNull final PInstanceId selectionId)
{
enqueueSelection(DDOrderCandidateEnqueueRequest.ofSelectionId(selectionId));
}
public void enqueueSelection(@NonNull final DDOrderCandidateEnqueueRequest request)
{
getQueue().newWorkPackage()
.parameter(WP_PARAM_request, toJsonString(request))
.setElementsLocker(toWorkPackageElementsLocker(request))
.bindToThreadInheritedTrx()
.buildAndEnqueue();
}
private IWorkPackageQueue getQueue()
{
return workPackageQueueFactory.getQueueForEnqueuing(Env.getCtx(), GenerateDDOrderFromDDOrderCandidate.class);
}
private ILockCommand toWorkPackageElementsLocker(final @NonNull DDOrderCandidateEnqueueRequest request)
{
final PInstanceId selectionId = request.getSelectionId();
final LockOwner lockOwner = LockOwner.newOwner(LOCK_OWNER_PREFIX, selectionId.getRepoId());
return lockManager
.lock()
.setOwner(lockOwner)
.setAutoCleanup(false)
.setFailIfAlreadyLocked(true)
.setRecordsBySelection(I_DD_Order_Candidate.class, selectionId);
} | private static String toJsonString(@NonNull final DDOrderCandidateEnqueueRequest request)
{
try
{
return JsonObjectMapperHolder.sharedJsonObjectMapper().writeValueAsString(request);
}
catch (final JsonProcessingException e)
{
throw new AdempiereException("Cannot convert to json: " + request, e);
}
}
public static DDOrderCandidateEnqueueRequest extractRequest(@NonNull final IParams params)
{
final String jsonString = params.getParameterAsString(WP_PARAM_request);
try
{
return JsonObjectMapperHolder.sharedJsonObjectMapper().readValue(jsonString, DDOrderCandidateEnqueueRequest.class);
}
catch (final JsonProcessingException e)
{
throw new AdempiereException("Cannot read json: " + jsonString, e);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\de\metas\distribution\ddordercandidate\async\DDOrderCandidateEnqueueService.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class EntityDescription implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String description;
@Any(
metaDef = "EntityDescriptionMetaDef",
metaColumn = @Column(name = "entity_type")
)
@JoinColumn(name = "entity_id")
private Serializable entity;
public EntityDescription() {
}
public EntityDescription(String description, Serializable entity) {
this.description = description;
this.entity = entity;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
} | public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Serializable getEntity() {
return entity;
}
public void setEntity(Serializable entity) {
this.entity = entity;
}
} | repos\tutorials-master\persistence-modules\hibernate5\src\main\java\com\baeldung\hibernate\pojo\EntityDescription.java | 2 |
请完成以下Java代码 | public class EndEventXMLConverter extends BaseBpmnXMLConverter {
protected Map<String, BaseChildElementParser> childParserMap = new HashMap<>();
public EndEventXMLConverter() {
OutParameterParser outParameterParser = new OutParameterParser();
childParserMap.put(outParameterParser.getElementName(), outParameterParser);
}
@Override
public Class<? extends BaseElement> getBpmnElementType() {
return EndEvent.class;
}
@Override
protected String getXMLElementName() {
return ELEMENT_EVENT_END;
}
@Override
@SuppressWarnings("unchecked")
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
EndEvent endEvent = new EndEvent();
BpmnXMLUtil.addXMLLocation(endEvent, xtr);
BpmnXMLUtil.addCustomAttributes(xtr, endEvent, defaultElementAttributes, defaultActivityAttributes);
parseChildElements(getXMLElementName(), endEvent, childParserMap, model, xtr);
return endEvent;
}
@Override
protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception { | }
@Override
protected boolean writeExtensionChildElements(BaseElement element, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
EndEvent endEvent = (EndEvent) element;
didWriteExtensionStartElement = BpmnXMLUtil.writeIOParameters(ELEMENT_OUT_PARAMETERS, endEvent.getOutParameters(), didWriteExtensionStartElement, xtw);
return didWriteExtensionStartElement;
}
@Override
protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
EndEvent endEvent = (EndEvent) element;
writeEventDefinitions(endEvent, endEvent.getEventDefinitions(), model, xtw);
}
} | repos\flowable-engine-main\modules\flowable-bpmn-converter\src\main\java\org\flowable\bpmn\converter\EndEventXMLConverter.java | 1 |
请完成以下Java代码 | public void setTimestamp (final @Nullable java.sql.Timestamp Timestamp)
{
set_Value (COLUMNNAME_Timestamp, Timestamp);
}
@Override
public java.sql.Timestamp getTimestamp()
{
return get_ValueAsTimestamp(COLUMNNAME_Timestamp);
}
/**
* Title AD_Reference_ID=541318
* Reference name: Title_List
*/
public static final int TITLE_AD_Reference_ID=541318;
/** Unbekannt = 0 */
public static final String TITLE_Unbekannt = "0";
/** Dr. = 1 */
public static final String TITLE_Dr = "1";
/** Prof. Dr. = 2 */
public static final String TITLE_ProfDr = "2";
/** Dipl. Ing. = 3 */
public static final String TITLE_DiplIng = "3";
/** Dipl. Med. = 4 */
public static final String TITLE_DiplMed = "4";
/** Dipl. Psych. = 5 */
public static final String TITLE_DiplPsych = "5";
/** Dr. Dr. = 6 */
public static final String TITLE_DrDr = "6";
/** Dr. med. = 7 */
public static final String TITLE_DrMed = "7";
/** Prof. Dr. Dr. = 8 */ | public static final String TITLE_ProfDrDr = "8";
/** Prof. = 9 */
public static final String TITLE_Prof = "9";
/** Prof. Dr. med. = 10 */
public static final String TITLE_ProfDrMed = "10";
/** Rechtsanwalt = 11 */
public static final String TITLE_Rechtsanwalt = "11";
/** Rechtsanwältin = 12 */
public static final String TITLE_Rechtsanwaeltin = "12";
/** Schwester (Orden) = 13 */
public static final String TITLE_SchwesterOrden = "13";
@Override
public void setTitle (final @Nullable java.lang.String Title)
{
set_Value (COLUMNNAME_Title, Title);
}
@Override
public java.lang.String getTitle()
{
return get_ValueAsString(COLUMNNAME_Title);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.healthcare.alberta\src\main\java-gen\de\metas\vertical\healthcare\alberta\model\X_AD_User_Alberta.java | 1 |
请完成以下Java代码 | protected String getTaskFormMediaType(String taskId) {
Task task = engine.getTaskService().createTaskQuery().initializeFormKeys().taskId(taskId).singleResult();
ensureNotNull("No task found for taskId '" + taskId + "'", "task", task);
String formKey = task.getFormKey();
if(formKey != null) {
return ContentTypeUtil.getFormContentType(formKey);
} else if(task.getCamundaFormRef() != null) {
return ContentTypeUtil.getFormContentType(task.getCamundaFormRef());
}
return MediaType.APPLICATION_XHTML_XML;
}
protected <V extends Object> V runWithoutAuthorization(Supplier<V> action) {
IdentityService identityService = engine.getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
try {
identityService.clearAuthentication();
return action.get(); | } catch (Exception e) {
throw e;
} finally {
identityService.setAuthentication(currentAuthentication);
}
}
private Map<String, VariableValueDto> getTaskVariables(boolean withTaskVariablesInReturn) {
VariableResource variableResource;
if (withTaskVariablesInReturn) {
variableResource = this.getVariables();
} else {
variableResource = this.getLocalVariables();
}
return variableResource.getVariables(true);
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\task\impl\TaskResourceImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public RouteDefinitionMetrics routeDefinitionMetrics(MeterRegistry meterRegistry,
RouteDefinitionLocator routeDefinitionLocator, GatewayMetricsProperties properties) {
return new RouteDefinitionMetrics(meterRegistry, routeDefinitionLocator, properties.getPrefix());
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(ObservationRegistry.class)
@ConditionalOnProperty(name = GatewayProperties.PREFIX + ".observability.enabled", matchIfMissing = true)
static class ObservabilityConfiguration {
@Bean
@ConditionalOnMissingBean
ObservedRequestHttpHeadersFilter observedRequestHttpHeadersFilter(ObservationRegistry observationRegistry,
ObjectProvider<GatewayObservationConvention> gatewayObservationConvention) {
return new ObservedRequestHttpHeadersFilter(observationRegistry,
gatewayObservationConvention.getIfAvailable(() -> null)); | }
@Bean
@ConditionalOnMissingBean
ObservedResponseHttpHeadersFilter observedResponseHttpHeadersFilter() {
return new ObservedResponseHttpHeadersFilter();
}
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
ObservationClosingWebExceptionHandler observationClosingWebExceptionHandler() {
return new ObservationClosingWebExceptionHandler();
}
}
} | repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\config\GatewayMetricsAutoConfiguration.java | 2 |
请完成以下Java代码 | public ServletRequest getRequest() {
return this.asyncContext.getRequest();
}
@Override
public ServletResponse getResponse() {
return this.asyncContext.getResponse();
}
@Override
public boolean hasOriginalRequestAndResponse() {
return this.asyncContext.hasOriginalRequestAndResponse();
}
@Override
public void dispatch() {
this.asyncContext.dispatch();
}
@Override
public void dispatch(String path) {
this.asyncContext.dispatch(path);
}
@Override
public void dispatch(ServletContext context, String path) {
this.asyncContext.dispatch(context, path);
}
@Override
public void complete() {
this.asyncContext.complete();
}
@Override
public void start(Runnable run) {
this.asyncContext.start(new DelegatingSecurityContextRunnable(run));
}
@Override
public void addListener(AsyncListener listener) { | this.asyncContext.addListener(listener);
}
@Override
public void addListener(AsyncListener listener, ServletRequest request, ServletResponse response) {
this.asyncContext.addListener(listener, request, response);
}
@Override
public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException {
return this.asyncContext.createListener(clazz);
}
@Override
public long getTimeout() {
return this.asyncContext.getTimeout();
}
@Override
public void setTimeout(long timeout) {
this.asyncContext.setTimeout(timeout);
}
}
} | repos\spring-security-main\web\src\main\java\org\springframework\security\web\servletapi\HttpServlet3RequestFactory.java | 1 |
请完成以下Java代码 | public TimerJobQuery orderByJobDuedate() {
return orderBy(JobQueryProperty.DUEDATE);
}
@Override
public TimerJobQuery orderByExecutionId() {
return orderBy(JobQueryProperty.EXECUTION_ID);
}
@Override
public TimerJobQuery orderByJobId() {
return orderBy(JobQueryProperty.JOB_ID);
}
@Override
public TimerJobQuery orderByProcessInstanceId() {
return orderBy(JobQueryProperty.PROCESS_INSTANCE_ID);
}
@Override
public TimerJobQuery orderByJobRetries() {
return orderBy(JobQueryProperty.RETRIES);
}
@Override
public TimerJobQuery orderByTenantId() {
return orderBy(JobQueryProperty.TENANT_ID);
}
// results //////////////////////////////////////////
@Override
public long executeCount(CommandContext commandContext) {
checkQueryOk();
return commandContext
.getTimerJobEntityManager()
.findTimerJobCountByQueryCriteria(this);
}
@Override
public List<Job> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
return commandContext
.getTimerJobEntityManager()
.findTimerJobsByQueryCriteria(this, page);
}
// getters //////////////////////////////////////////
public String getProcessInstanceId() {
return processInstanceId;
} | public String getExecutionId() {
return executionId;
}
public boolean getExecutable() {
return executable;
}
public Date getNow() {
return Context.getProcessEngineConfiguration().getClock().getCurrentTime();
}
public boolean isWithException() {
return withException;
}
public String getExceptionMessage() {
return exceptionMessage;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\TimerJobQueryImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PickAttributesConfig
{
@NonNull public static final PickAttributesConfig UNKNOWN = builder().build();
@NonNull public static final PickAttributesConfig DEFAULT = builder()
.attributeToRead(PickAttribute.BestBeforeDate, true)
.attributeToRead(PickAttribute.LotNo, true)
.build();
@NonNull ImmutableMap<PickAttribute, Boolean> attributesToRead;
@NonNull ImmutableSet<PickAttribute> attributesToReadSet;
@Builder
private PickAttributesConfig(@NonNull @Singular("attributeToRead") final ImmutableMap<PickAttribute, Boolean> attributesToRead)
{
this.attributesToRead = attributesToRead;
this.attributesToReadSet = attributesToRead.entrySet()
.stream() | .filter(Map.Entry::getValue)
.map(Map.Entry::getKey)
.collect(ImmutableSet.toImmutableSet());
}
public PickAttributesConfig fallbackTo(final @NonNull PickAttributesConfig fallback)
{
return builder()
.attributesToRead(CollectionUtils.mergeMaps(fallback.attributesToRead, this.attributesToRead))
.build();
}
public boolean isReadAttribute(@NonNull final PickAttribute pickAttribute)
{
return attributesToReadSet.contains(pickAttribute);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\config\mobileui\PickAttributesConfig.java | 2 |
请完成以下Java代码 | public class EnumFormType extends AbstractFormType {
private static final long serialVersionUID = 1L;
protected Map<String, String> values;
public EnumFormType(Map<String, String> values) {
this.values = values;
}
@Override
public String getName() {
return "enum";
}
@Override
public Object getInformation(String key) {
if ("values".equals(key)) {
return values;
}
return null;
}
@Override
public Object convertFormValueToModelValue(String propertyValue) {
validateValue(propertyValue);
return propertyValue;
}
@Override
public String convertModelValueToFormValue(Object modelValue) { | if (modelValue != null) {
if (!(modelValue instanceof String)) {
throw new FlowableIllegalArgumentException("Model value should be a String");
}
validateValue((String) modelValue);
}
return (String) modelValue;
}
protected void validateValue(String value) {
if (value != null) {
if (values != null && !values.containsKey(value)) {
throw new FlowableIllegalArgumentException("Invalid value for enum form property: " + value);
}
}
}
} | repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\form\EnumFormType.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class CandidateId implements RepoIdAware
{
/**
* Use this constant in a {@link CandidatesQuery} to indicate that the ID shall not be considered.
*/
public static final CandidateId UNSPECIFIED = new CandidateId(IdConstants.UNSPECIFIED_REPO_ID);
/**
* Use this constant in a {@link CandidatesQuery} to indicate that the ID be null (makes sense for parent-ID).
*/
public static final CandidateId NULL = new CandidateId(IdConstants.NULL_REPO_ID);
int repoId;
@JsonCreator
public static CandidateId ofRepoId(final int repoId)
{
if (repoId == NULL.repoId)
{
return NULL;
}
else if (repoId == UNSPECIFIED.repoId)
{
return UNSPECIFIED;
}
else
{
return new CandidateId(repoId);
}
}
public static CandidateId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? ofRepoId(repoId) : null;
}
public static int toRepoId(@Nullable final CandidateId candidateId)
{
return candidateId != null ? candidateId.getRepoId() : -1;
}
public static boolean isNull(@Nullable final CandidateId id)
{
return id == null || id.isNull();
}
private CandidateId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "MD_Candidate_ID");
}
@Override
@Deprecated
public String toString()
{
if (isNull())
{
return "NULL";
}
else if (isUnspecified())
{
return "UNSPECIFIED";
} | else
{
return String.valueOf(repoId);
}
}
@Override
@JsonValue
public int getRepoId()
{
if (isUnspecified())
{
throw Check.mkEx("Illegal call of getRepoId() on the unspecified CandidateId instance");
}
else if (isNull())
{
return -1;
}
else
{
return repoId;
}
}
public boolean isNull()
{
return repoId == IdConstants.NULL_REPO_ID;
}
public boolean isUnspecified()
{
return repoId == IdConstants.UNSPECIFIED_REPO_ID;
}
public boolean isRegular()
{
return !isNull() && !isUnspecified();
}
public static boolean isRegularNonNull(@Nullable final CandidateId candidateId)
{
return candidateId != null && candidateId.isRegular();
}
public void assertRegular()
{
if (!isRegular())
{
throw new AdempiereException("Expected " + this + " to be a regular ID");
}
}
public static boolean equals(@Nullable CandidateId id1, @Nullable CandidateId id2) {return Objects.equals(id1, id2);}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-commons\src\main\java\de\metas\material\dispo\commons\candidate\CandidateId.java | 2 |
请完成以下Java代码 | public class Demo {
@Contract("_ -> new")
Person fromName(String name) {
return new Person().withName(name);
}
@Contract(" -> fail")
void alwaysFail() {
throw new RuntimeException();
}
@Contract(" -> fail")
void doNothingWithWrongContract() {
}
@Contract("_, null -> null; null, _ -> param2; _, !null -> !null")
String concatenateOnlyIfSecondArgumentIsNotNull(String head, String tail) {
if (tail == null) {
return null;
}
if (head == null) {
return tail;
}
return head + tail;
}
void uselessNullCheck() {
String head = "1234";
String tail = "5678";
String concatenation = concatenateOnlyIfSecondArgumentIsNotNull(head, tail);
if (concatenation != null) {
System.out.println(concatenation);
}
}
void uselessNullCheckOnInferredAnnotation() {
if (StringUtils.isEmpty(null)) {
System.out.println("baeldung");
}
}
@Contract(pure = true)
String replace(String string, char oldChar, char newChar) {
return string.replace(oldChar, newChar);
}
@Contract(value = "true -> false; false -> true", pure = true)
boolean not(boolean input) {
return !input;
}
@Contract("true -> new")
void contractExpectsWrongParameterType(List<Integer> integers) {
}
@Contract("_, _ -> new")
void contractExpectsMoreParametersThanMethodHas(String s) {
}
@Contract("_ -> _; null -> !null")
String secondContractClauseNotReachable(String s) { | return "";
}
@Contract("_ -> true")
void contractExpectsWrongReturnType(String s) {
}
// NB: the following examples demonstrate how to use the mutates attribute of the annotation
// This attribute is currently experimental and could be changed or removed in the future
@Contract(mutates = "param")
void incrementArrayFirstElement(Integer[] integers) {
if (integers.length > 0) {
integers[0] = integers[0] + 1;
}
}
@Contract(pure = true, mutates = "param")
void impossibleToMutateParamInPureFunction(List<String> strings) {
if (strings != null) {
strings.forEach(System.out::println);
}
}
@Contract(mutates = "param3")
void impossibleToMutateThirdParamWhenMethodHasOnlyTwoParams(int a, int b) {
}
@Contract(mutates = "param")
void impossibleToMutableImmutableType(String s) {
}
@Contract(mutates = "this")
static void impossibleToMutateThisInStaticMethod() {
}
} | repos\tutorials-master\jetbrains-annotations\src\main\java\com\baeldung\annotations\Demo.java | 1 |
请完成以下Java代码 | public int getAD_WF_Node_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_WF_Node_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Workflow Node Asset.
@param PP_WF_Node_Asset_ID Workflow Node Asset */
public void setPP_WF_Node_Asset_ID (int PP_WF_Node_Asset_ID)
{
if (PP_WF_Node_Asset_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_WF_Node_Asset_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_WF_Node_Asset_ID, Integer.valueOf(PP_WF_Node_Asset_ID));
}
/** Get Workflow Node Asset.
@return Workflow Node Asset */
public int getPP_WF_Node_Asset_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PP_WF_Node_Asset_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first | */
public void setSeqNo (int SeqNo)
{
set_ValueNoCheck (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\eevolution\model\X_PP_WF_Node_Asset.java | 1 |
请完成以下Java代码 | protected void configure(HttpSecurity http) throws Exception {
http.addFilterBefore(validateCodeFilter, UsernamePasswordAuthenticationFilter.class) // 添加验证码校验过滤器
.addFilterBefore(smsCodeFilter,UsernamePasswordAuthenticationFilter.class) // 添加短信验证码校验过滤器
.formLogin() // 表单登录
// http.httpBasic() // HTTP Basic
.loginPage("/authentication/require") // 登录跳转 URL
.loginProcessingUrl("/login") // 处理表单登录 URL
.successHandler(authenticationSucessHandler) // 处理登录成功
.failureHandler(authenticationFailureHandler) // 处理登录失败
.and()
.authorizeRequests() // 授权配置
.antMatchers("/authentication/require",
"/login.html", "/code/image","/code/sms","/session/invalid", "/signout/success").permitAll() // 无需认证的请求路径
.anyRequest() // 所有请求
.authenticated() // 都需要认证
.and() | .sessionManagement() // 添加 Session管理器
.invalidSessionUrl("/session/invalid") // Session失效后跳转到这个链接
.maximumSessions(1)
.maxSessionsPreventsLogin(true)
.expiredSessionStrategy(sessionExpiredStrategy)
.and()
.and()
.logout()
.logoutUrl("/signout")
// .logoutSuccessUrl("/signout/success")
.logoutSuccessHandler(logOutSuccessHandler)
.deleteCookies("JSESSIONID")
.and()
.csrf().disable()
.apply(smsAuthenticationConfig); // 将短信验证码认证配置加到 Spring Security 中
}
} | repos\SpringAll-master\60.Spring-Security-Logout\src\main\java\cc\mrbird\security\browser\BrowserSecurityConfig.java | 1 |
请完成以下Java代码 | public void error(Marker marker, String msg) {
logger.error(marker, mdcValue(msg));
}
@Override
public void error(Marker marker, String format, Object arg) {
logger.error(marker, mdcValue(format), arg);
}
@Override
public void error(Marker marker, String format, Object arg1, Object arg2) {
logger.error(marker, mdcValue(format), arg1, arg2);
}
@Override
public void error(Marker marker, String format, Object... arguments) {
logger.error(marker, mdcValue(format), arguments);
}
@Override
public void error(Marker marker, String msg, Throwable t) {
logger.error(marker, mdcValue(msg), t);
}
/**
* 输出MDC容器中的值
*
* @param msg | * @return
*/
private String mdcValue(String msg) {
try {
StringBuilder sb = new StringBuilder();
sb.append(" [");
try {
sb.append(MDC.get(MdcConstant.SESSION_KEY) + ", ");
} catch (IllegalArgumentException e) {
sb.append(" , ");
}
try {
sb.append(MDC.get(MdcConstant.REQUEST_KEY));
} catch (IllegalArgumentException e) {
sb.append(" ");
}
sb.append("] ");
sb.append(msg);
return sb.toString();
} catch (Exception e) {
return msg;
}
}
} | repos\spring-boot-student-master\spring-boot-student-log\src\main\java\com\xiaolyuh\core\TrackLogger.java | 1 |
请完成以下Java代码 | public IHUAssignmentBuilder setTopLevelHU(final I_M_HU topLevelHU)
{
this.topLevelHU = topLevelHU;
return this;
}
@Override
public IHUAssignmentBuilder setM_LU_HU(final I_M_HU luHU)
{
this.luHU = luHU;
return this;
}
@Override
public IHUAssignmentBuilder setM_TU_HU(final I_M_HU tuHU)
{
this.tuHU = tuHU;
return this;
}
@Override
public IHUAssignmentBuilder setVHU(final I_M_HU vhu)
{
this.vhu = vhu;
return this;
}
@Override
public IHUAssignmentBuilder setQty(final BigDecimal qty)
{
this.qty = qty;
return this;
}
@Override
public IHUAssignmentBuilder setIsTransferPackingMaterials(final boolean isTransferPackingMaterials)
{
this.isTransferPackingMaterials = isTransferPackingMaterials;
return this;
}
@Override
public IHUAssignmentBuilder setIsActive(final boolean isActive)
{
this.isActive = isActive;
return this;
}
@Override
public boolean isActive()
{
return isActive;
}
@Override
public I_M_HU_Assignment getM_HU_Assignment()
{
return assignment;
}
@Override
public boolean isNewAssignment()
{
return InterfaceWrapperHelper.isNew(assignment);
}
@Override
public IHUAssignmentBuilder initializeAssignment(final Properties ctx, final String trxName)
{
final I_M_HU_Assignment assignment = InterfaceWrapperHelper.create(ctx, I_M_HU_Assignment.class, trxName);
setAssignmentRecordToUpdate(assignment);
return this;
}
@Override
public IHUAssignmentBuilder setTemplateForNewRecord(final I_M_HU_Assignment assignmentRecord)
{ | this.assignment = newInstance(I_M_HU_Assignment.class);
return updateFromRecord(assignmentRecord);
}
@Override
public IHUAssignmentBuilder setAssignmentRecordToUpdate(@NonNull final I_M_HU_Assignment assignmentRecord)
{
this.assignment = assignmentRecord;
return updateFromRecord(assignmentRecord);
}
private IHUAssignmentBuilder updateFromRecord(final I_M_HU_Assignment assignmentRecord)
{
setTopLevelHU(assignmentRecord.getM_HU());
setM_LU_HU(assignmentRecord.getM_LU_HU());
setM_TU_HU(assignmentRecord.getM_TU_HU());
setVHU(assignmentRecord.getVHU());
setQty(assignmentRecord.getQty());
setIsTransferPackingMaterials(assignmentRecord.isTransferPackingMaterials());
setIsActive(assignmentRecord.isActive());
return this;
}
@Override
public I_M_HU_Assignment build()
{
Check.assumeNotNull(model, "model not null");
Check.assumeNotNull(topLevelHU, "topLevelHU not null");
Check.assumeNotNull(assignment, "assignment not null");
TableRecordCacheLocal.setReferencedValue(assignment, model);
assignment.setM_HU(topLevelHU);
assignment.setM_LU_HU(luHU);
assignment.setM_TU_HU(tuHU);
assignment.setVHU(vhu);
assignment.setQty(qty);
assignment.setIsTransferPackingMaterials(isTransferPackingMaterials);
assignment.setIsActive(isActive);
InterfaceWrapperHelper.save(assignment);
return assignment;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUAssignmentBuilder.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public static class ApacheShiroProperties {
private String iniResourcePath;
public String getIniResourcePath() {
return this.iniResourcePath;
}
public void setIniResourcePath(String iniResourcePath) {
this.iniResourcePath = iniResourcePath;
}
}
public static class SecurityLogProperties {
private static final String DEFAULT_SECURITY_LOG_LEVEL = "config";
private String file;
private String level = DEFAULT_SECURITY_LOG_LEVEL;
public String getFile() {
return this.file;
}
public void setFile(String file) {
this.file = file;
}
public String getLevel() {
return this.level;
}
public void setLevel(String level) {
this.level = level;
}
} | public static class SecurityManagerProperties {
private String className;
public String getClassName() {
return this.className;
}
public void setClassName(String className) {
this.className = className;
}
}
public static class SecurityPostProcessorProperties {
private String className;
public String getClassName() {
return this.className;
}
public void setClassName(String className) {
this.className = className;
}
}
} | repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\SecurityProperties.java | 2 |
请完成以下Java代码 | public void setCM_AccessProfile_ID (int CM_AccessProfile_ID)
{
if (CM_AccessProfile_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, Integer.valueOf(CM_AccessProfile_ID));
}
/** Get Web Access Profile.
@return Web Access Profile
*/
public int getCM_AccessProfile_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_AccessProfile_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_CM_NewsChannel getCM_NewsChannel() throws RuntimeException
{
return (I_CM_NewsChannel)MTable.get(getCtx(), I_CM_NewsChannel.Table_Name)
.getPO(getCM_NewsChannel_ID(), get_TrxName()); }
/** Set News Channel.
@param CM_NewsChannel_ID
News channel for rss feed
*/
public void setCM_NewsChannel_ID (int CM_NewsChannel_ID)
{
if (CM_NewsChannel_ID < 1) | set_ValueNoCheck (COLUMNNAME_CM_NewsChannel_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_NewsChannel_ID, Integer.valueOf(CM_NewsChannel_ID));
}
/** Get News Channel.
@return News channel for rss feed
*/
public int getCM_NewsChannel_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_NewsChannel_ID);
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_CM_AccessNewsChannel.java | 1 |
请在Spring Boot框架中完成以下Java代码 | class OAuth2ResourceServerOpaqueTokenConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(OpaqueTokenIntrospector.class)
static class OpaqueTokenIntrospectionClientConfiguration {
@Bean
@ConditionalOnProperty(name = "spring.security.oauth2.resourceserver.opaquetoken.introspection-uri")
SpringOpaqueTokenIntrospector opaqueTokenIntrospector(OAuth2ResourceServerProperties properties) {
OAuth2ResourceServerProperties.Opaquetoken opaquetoken = properties.getOpaquetoken();
String introspectionUri = opaquetoken.getIntrospectionUri();
Assert.state(introspectionUri != null, "'introspectionUri' must not be null");
String clientId = opaquetoken.getClientId();
Assert.state(clientId != null, "'clientId' must not be null");
String clientSecret = opaquetoken.getClientSecret();
Assert.state(clientSecret != null, "'clientSecret' must not be null");
return SpringOpaqueTokenIntrospector.withIntrospectionUri(introspectionUri)
.clientId(clientId)
.clientSecret(clientSecret)
.build();
} | }
@Configuration(proxyBeanMethods = false)
@ConditionalOnDefaultWebSecurity
static class OAuth2SecurityFilterChainConfiguration {
@Bean
@ConditionalOnBean(OpaqueTokenIntrospector.class)
SecurityFilterChain opaqueTokenSecurityFilterChain(HttpSecurity http) {
http.authorizeHttpRequests((requests) -> requests.anyRequest().authenticated());
http.oauth2ResourceServer((resourceServer) -> resourceServer.opaqueToken(withDefaults()));
return http.build();
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-security-oauth2-resource-server\src\main\java\org\springframework\boot\security\oauth2\server\resource\autoconfigure\servlet\OAuth2ResourceServerOpaqueTokenConfiguration.java | 2 |
请完成以下Java代码 | public String getSummaryMessage()
{
final StringBuilder message = new StringBuilder();
message.append("@Netto@ (@ApprovalForInvoicing@): ");
final BigDecimal totalNetAmtApproved = getTotalNetAmtApproved();
message.append(getAmountFormatted(totalNetAmtApproved));
final BigDecimal huNetAmtApproved = getHUNetAmtApproved();
message.append(" - ").append("Gebinde ").append(getAmountFormatted(huNetAmtApproved));
final BigDecimal cuNetAmtApproved = getCUNetAmtApproved();
message.append(" - ").append("Ware ").append(getAmountFormatted(cuNetAmtApproved));
message.append(" | @Netto@ (@NotApprovedForInvoicing@): ");
final BigDecimal totalNetAmtNotApproved = getTotalNetAmtNotApproved();
message.append(getAmountFormatted(totalNetAmtNotApproved));
final BigDecimal huNetAmtNotApproved = getHUNetAmtNotApproved();
message.append(" - ").append("Gebinde ").append(getAmountFormatted(huNetAmtNotApproved));
final BigDecimal cuNetAmtNotApproved = getCUNetAmtNotApproved();
message.append(" - ").append("Ware ").append(getAmountFormatted(cuNetAmtNotApproved));
if (countTotalToRecompute > 0)
{
message.append(", @IsToRecompute@: ");
message.append(countTotalToRecompute);
}
return message.toString();
} | private String getAmountFormatted(final BigDecimal amt)
{
final DecimalFormat amountFormat = DisplayType.getNumberFormat(DisplayType.Amount);
final StringBuilder amountFormatted = new StringBuilder();
amountFormatted.append(amountFormat.format(amt));
final boolean isSameCurrency = currencySymbols.size() == 1;
String curSymbol = null;
if (isSameCurrency)
{
curSymbol = currencySymbols.iterator().next();
amountFormatted.append(curSymbol);
}
return amountFormatted.toString();
}
@Override
public String getSummaryMessageTranslated(final Properties ctx)
{
final String message = getSummaryMessage();
final String messageTrl = Services.get(IMsgBL.class).parseTranslation(ctx, message);
return messageTrl;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\invoicecandidate\ui\spi\impl\HUInvoiceCandidatesSelectionSummaryInfo.java | 1 |
请完成以下Java代码 | public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof User)) {
return false;
}
User that = (User) obj;
return this.getName().equals(that.getName());
}
@Override | public int hashCode() {
int hashValue = 17;
hashValue = 37 * hashValue + getName().hashCode();
return hashValue;
}
@Override
public String toString() {
return getName();
}
}
} | repos\spring-boot-data-geode-main\spring-geode-project\apache-geode-extensions\src\main\java\org\springframework\geode\security\TestSecurityManager.java | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.