本文整理汇总了Java中org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod类的典型用法代码示例。如果您正苦于以下问题:Java HttpMethod类的具体用法?Java HttpMethod怎么用?Java HttpMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpMethod类属于org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport包,在下文中一共展示了HttpMethod类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deleteOrderDetail
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = FunctionImportNames.DELETE_ORDER, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.DELETE)
public boolean deleteOrderDetail(@EdmFunctionImportParameter(name = ORDER_ID, type = INT64) Long orderId) throws AppODataException {
final OrderDetailDAO orderDetailDAO = new OrderDetailDAO();
final Order order = orderDetailDAO.getOrderByOrderDetailsId(orderId);
final OrderDetails details = orderDetailDAO.getById(orderId);
final UserPoints userPoints = getUserPoints(order);
try {
order.removeOrderDetails(details);
userPoints.addPoints(calcPointsToAdd(details));
userPointsDAO.save(userPoints);
orderDetailDAO.delete(orderId);
return true;
} catch (IllegalArgumentException ex) {
logger.error("Error occur while deleting order with id:{}", orderId, ex); //$NON-NLS-1$
throw new AppODataException("Error occur while deleting order", ex); //$NON-NLS-1$
}
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:18,代码来源:OrderService.java
示例2: editCampaign
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = EDIT_CAMPAIGN, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.POST)
public boolean editCampaign(@EdmFunctionImportParameter(name = START_DATE, type = DATE_TIME) Date startDate,
@EdmFunctionImportParameter(name = "endDate", type = DATE_TIME) Date endDate,
@EdmFunctionImportParameter(name = "campaignid", type = INT64) Long campaignId) throws AppODataException {
final Campaign selectedCampaign = campaignDAO.getById(campaignId);
if (selectedCampaign == null) {
throw new AppODataException("Campaign does not exist"); //$NON-NLS-1$
} else if (startDate == null || endDate == null || startDate.compareTo(endDate) >= 0) {
throw new AppODataException("Incorrect campaign dates"); //$NON-NLS-1$
}
selectedCampaign.setStartDate(startDate);
selectedCampaign.setEndDate(endDate);
campaignDAO.save(selectedCampaign);
return true;
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:18,代码来源:CampaignService.java
示例3: checkATP
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = "CheckATP", returnType = @ReturnType(type = Type.SIMPLE, isCollection = false),
httpMethod = HttpMethod.GET)
public boolean checkATP(
@EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID,
@EdmFunctionImportParameter(name = "LiId", facets = @EdmFacets(nullable = false)) final Long lineItemID) {
if (soID == 2L) {
return false;
} else {
return true;
}
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:12,代码来源:SalesOrderHeaderProcessor.java
示例4: resetDatabase
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = RESET_DB, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.POST)
public boolean resetDatabase() {
cleanDB();
forceSubsequentInitialization();
final BenefitsDataImporter benefitImporter = new BenefitsDataImporter();
try {
benefitImporter.importDataFromCSV(BENEFITS_CSV_PATH);
} catch (IOException e) {
logger.error("Could not insert beneits data into DB", e); //$NON-NLS-1$
return false;
}
return true;
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:16,代码来源:AdministrationService.java
示例5: getUIConfigurationData
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = UI_CONFIG, returnType = @ReturnType(type = Type.COMPLEX, isCollection = false), httpMethod = HttpMethod.GET)
public UIConfig getUIConfigurationData() {
final UIConfig config = new UIConfig();
if (UserManager.getIsUserAdmin()) {
config.initAdminConfiguration();
} else {
config.initEmployeeConfiguration();
}
return config;
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:12,代码来源:AdministrationService.java
示例6: addOrder
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = FunctionImportNames.ADD_ORDER, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.POST)
public boolean addOrder(@EdmFunctionImportParameter(name = CAMPAIGN_ID, type = INT64) Long campaignId,
@EdmFunctionImportParameter(name = USER_ID, type = STRING) String userId,
@EdmFunctionImportParameter(name = QUANTITY, type = INT64) Long quantity,
@EdmFunctionImportParameter(name = BENEFIT_TYPE_ID, type = INT64) Long benefitTypeId) throws AppODataException {
final User loggedInUser = getLoggedInSfUser();
if (!(loggedInUser.getUserId().equals(userId) || UserManager.getIsUserAdmin())) {
throw new AppODataException("Unauthorized"); //$NON-NLS-1$
}
final User user = userDAO.getByUserId(userId);
final Campaign campaign = campaignDAO.getById(campaignId);
if (campaign == null) {
throw new AppODataException("Incorrect campaign id"); //$NON-NLS-1$
}
if (!campaign.getActive()) {
throw new AppODataException("The campaign with id " + campaignId + " is not active"); //$NON-NLS-1$ //$NON-NLS-2$
}
final OrderDAO orderDAO = new OrderDAO();
final Order userOrder = getOrCreateUserOrder(user, campaign, orderDAO);
final BenefitTypeDAO benefitTypeDAO = new BenefitTypeDAO();
final BenefitType benefitType = benefitTypeDAO.getById(benefitTypeId);
if (benefitType == null) {
throw new AppODataException("Incorrect benefit type id"); //$NON-NLS-1$
}
final OrderDetails orderDetails = createOrderDetails(quantity, benefitType);
final UserPoints userPoints = getUserPoints(userOrder);
final long orderDetailsTotal = calcPointsToAdd(orderDetails);
if (userPoints.getAvailablePoints() < orderDetailsTotal) {
throw new AppODataException(ORDER_DETAIL_NOT_VALID_MESSAGE);
}
userOrder.addOrderDetails(orderDetails);
new OrderDetailDAO().saveNew(orderDetails);
userPoints.subtractPoints(orderDetailsTotal);
userPointsDAO.save(userPoints);
return true;
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:41,代码来源:OrderService.java
示例7: getHrManagerPhoto
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = FunctionImportNames.HR_PHOTO, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.GET)
public String getHrManagerPhoto(@EdmFunctionImportParameter(name = PHOTO_TYPE, type = EdmType.INT32) Integer photoType) throws AppODataException {
User hrManager = getLoggedInSfUser().getHrManager();
if (hrManager == null) {
return ""; //$NON-NLS-1$
}
return getUserPhoto(hrManager.getUserId(), photoType);
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:9,代码来源:UserService.java
示例8: getCampaignUserPoints
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = FunctionImportNames.USER_POINTS, entitySet = FunctionImportEntitySets.USER_POINTS, returnType = @ReturnType(type = Type.ENTITY), httpMethod = HttpMethod.GET)
public UserPoints getCampaignUserPoints(@EdmFunctionImportParameter(name = CAMPAIGN_ID, type = EdmType.INT64) Long campaignId,
@EdmFunctionImportParameter(name = USER_ID, type = EdmType.STRING) String userId) {
User currentUser = getLoggedInSfUser();
if (UserManager.getIsUserAdmin() || currentUser.getUserId().equals(userId)) {
return new UserPointsDAO().getUserPoints(userId, campaignId);
}
throw new IllegalArgumentException("Missing user points for campaign wit id " + campaignId); //$NON-NLS-1$
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:10,代码来源:UserService.java
示例9: startCampaign
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = START_CAMPAIGN, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.POST)
public boolean startCampaign(@EdmFunctionImportParameter(name = CAMPAIGN_ID, type = INT64) Long campaignId) {
final StartCampaignDetails startCampaignDetails = this.canStartCampaign(campaignId);
if (startCampaignDetails.getCanBeStarted()) {
final Campaign campaign = campaignDAO.getById(campaignId);
campaign.setActive(true);
campaignDAO.save(campaign);
return true;
}
return false;
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:12,代码来源:CampaignService.java
示例10: stopCampaign
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = STOP_CAMPAIGN, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.POST)
public boolean stopCampaign(@EdmFunctionImportParameter(name = CAMPAIGN_ID, type = INT64) Long campaignId) throws AppODataException {
final Campaign campaign = campaignDAO.getById(campaignId);
if (campaign == null) {
throw new AppODataException("Campaign with this name does not exist"); //$NON-NLS-1$
}
campaign.setActive(false);
campaignDAO.save(campaign);
return true;
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:13,代码来源:CampaignService.java
示例11: addCampaign
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = ADD_CAMPAIGN, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.POST)
public boolean addCampaign(@EdmFunctionImportParameter(name = NAME, type = STRING) String campaignName) throws AppODataException {
final User user = getLoggedInSfUser();
if (campaignDAO.getByCaseInsensitiveName(campaignName, user) != null) {
throw new AppODataException("Campaign with this name already exist"); //$NON-NLS-1$
}
final Campaign newCampaign = new Campaign();
newCampaign.setName(campaignName);
newCampaign.setOwner(user);
campaignDAO.saveNew(newCampaign);
new UserPointsDAO().createCampaignUserPoints(newCampaign);
return true;
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:15,代码来源:CampaignService.java
示例12: deleteCampaign
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = DELETE_CAMPAIGN, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.DELETE)
public boolean deleteCampaign(@EdmFunctionImportParameter(name = CAMPAIGN_ID, type = INT64) Long campaignId) throws AppODataException {
try {
campaignDAO.delete(campaignId);
return true;
} catch (IllegalArgumentException ex) {
throw new AppODataException("Error occur while deleting campaign", ex); //$NON-NLS-1$
}
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:10,代码来源:CampaignService.java
示例13: getUserPhoto
import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod; //导入依赖的package包/类
@EdmFunctionImport(name = FunctionImportNames.USER_PHOTO, returnType = @ReturnType(type = Type.SIMPLE, isCollection = false), httpMethod = HttpMethod.GET)
public String getUserPhoto(@EdmFunctionImportParameter(name = PHOTO_TYPE, type = EdmType.INT32) Integer photoType) throws AppODataException {
return getUserPhoto(getLoggedInSfUser().getUserId(), photoType);
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:5,代码来源:UserService.java
注:本文中的org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.HttpMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论