本文整理汇总了Java中org.apache.olingo.odata2.api.annotation.edm.EdmFacets类的典型用法代码示例。如果您正苦于以下问题:Java EdmFacets类的具体用法?Java EdmFacets怎么用?Java EdmFacets使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EdmFacets类属于org.apache.olingo.odata2.api.annotation.edm包,在下文中一共展示了EdmFacets类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFacets
import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; //导入依赖的package包/类
private Facets createFacets(final EdmFacets facets, final EdmConcurrencyControl concurrencyControl) {
Facets resultFacets = new Facets().setNullable(facets.nullable());
if(facets.maxLength() > -1) {
resultFacets.setMaxLength(facets.maxLength());
}
if(facets.precision() > -1) {
resultFacets.setPrecision(facets.precision());
}
if(facets.scale() > -1) {
resultFacets.setScale(facets.scale());
}
if (concurrencyControl != null) {
resultFacets.setConcurrencyMode(EdmConcurrencyMode.Fixed);
}
return resultFacets;
}
示例2: calculateNetAmount
import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; //导入依赖的package包/类
@EdmFunctionImport(returnType = @ReturnType(type = Type.ENTITY, isCollection = false), entitySet = "SalesOrders")
public SalesOrderHeader calculateNetAmount(
@EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID)
throws ODataException {
if (soID <= 0L) {
throw new ODataException("Invalid SoID");
}
Query q = em
.createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = "
+ soID + "l");
if (q.getResultList().isEmpty()) {
return null;
}
SalesOrderHeader so = (SalesOrderHeader) q.getResultList().get(0);
double amount = 0;
for (SalesOrderItem soi : so.getSalesOrderItem()) {
amount = amount
+ (soi.getAmount() * soi.getDiscount() * soi.getQuantity());
}
so.setNetAmount(amount);
return so;
}
示例3: method1
import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; //导入依赖的package包/类
@EdmFunctionImport(name = "Method1", entitySet = "MockSet", returnType = @ReturnType(type = Type.ENTITY,
isCollection = true))
public List<JPACustomProcessorMock> method1(@EdmFunctionImportParameter(name = "Param1", facets = @EdmFacets(
nullable = true,
maxLength = 2)) final String param1, final int param2, @EdmFunctionImportParameter(name = "Param3",
facets = @EdmFacets(precision = 10, scale = 2)) final double param3) {
return new ArrayList<JPACustomProcessorMock>();
}
示例4: findAllSalesOrders
import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@EdmFunctionImport(name = "FindAllSalesOrders", entitySet = "SalesOrders", returnType = @ReturnType(
type = Type.ENTITY, isCollection = true))
public List<SalesOrderHeader> findAllSalesOrders(
@EdmFunctionImportParameter(name = "DeliveryStatusCode",
facets = @EdmFacets(maxLength = 2)) final String status) {
Query q = em
.createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.deliveryStatus = '"
+ status + "'");
List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q
.getResultList();
return soList;
}
示例5: checkATP
import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; //导入依赖的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;
}
}
示例6: getAddress
import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX))
public Address getAddress(
@EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID) {
Query q = em
.createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = "
+ soID + "l");
List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q
.getResultList();
if (!soList.isEmpty()) {
return soList.get(0).getCustomer().getAddress();
} else {
return null;
}
}
示例7: method2
import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; //导入依赖的package包/类
@EdmFunctionImport(name = "Method2", entitySet = "MockSet", returnType = @ReturnType(type = Type.ENTITY,
isCollection = true))
public List<JPACustomProcessorMock> method2(
@EdmFunctionImportParameter(facets = @EdmFacets(maxLength = 2), name = "Param2") final String param2) {
return new ArrayList<JPACustomProcessorMock>();
}
示例8: getImage
import org.apache.olingo.odata2.api.annotation.edm.EdmFacets; //导入依赖的package包/类
@EdmFunctionImport(returnType = @ReturnType(type = Type.SIMPLE))
public byte[] getImage(
@EdmFunctionImportParameter(name = "CustomerId", facets = @EdmFacets(nullable = false)) Long customerId) {
return CustomerImageLoader.loadImage(customerId);
}