public static String prettyPrint(PagingType paging) { if (paging == null) { return "null"; } StringBuilder sb = new StringBuilder("Paging("); if (paging.getOffset() != null) { sb.append(paging.getOffset()).append(","); } else { sb.append(","); } if (paging.getMaxSize() != null) { sb.append(paging.getMaxSize()).append(","); } else { sb.append(","); } if (paging.getOrderBy() != null) { sb.append(prettyPrint(paging.getOrderBy())).append(","); } else { sb.append(","); } if (paging.getOrderDirection() != null) { sb.append(paging.getOrderDirection()); } sb.append(")"); return sb.toString(); }
/** * Creates a new {@code PagingType} instance by deeply copying a given {@code PagingType} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public PagingType(final PagingType o) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 super(); if (o == null) { throw new NullPointerException("Cannot create a copy of 'PagingType' from 'null'."); } this.orderBy = (o.orderBy == null)?null:o.orderBy.clone(); // CEnumLeafInfo: com.evolveum.prism.xml.ns._public.query_3.OrderDirectionType this.orderDirection = ((o.orderDirection == null)?null:o.getOrderDirection()); // CBuiltinLeafInfo: java.lang.Integer this.offset = ((o.offset == null)?null:o.getOffset()); // CBuiltinLeafInfo: java.lang.Integer this.maxSize = ((o.maxSize == null)?null:o.getMaxSize()); this.groupBy = (o.groupBy == null)?null:o.groupBy.clone(); }
/** * Creates and returns a deep copy of this object. * * * @return * A deep copy of this object. */ @Override public PagingType clone() { try { { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 final PagingType clone = ((PagingType) super.clone()); // CWildcardTypeInfo: org.w3c.dom.Element clone.orderBy = ((this.orderBy == null)?null:((this.getOrderBy() == null)?null:(this.getOrderBy().clone()))); // CEnumLeafInfo: com.evolveum.prism.xml.ns._public.query_3.OrderDirectionType clone.orderDirection = ((this.orderDirection == null)?null:this.getOrderDirection()); // CBuiltinLeafInfo: java.lang.Integer clone.offset = ((this.offset == null)?null:this.getOffset()); // CBuiltinLeafInfo: java.lang.Integer clone.maxSize = ((this.maxSize == null)?null:this.getMaxSize()); // CWildcardTypeInfo: org.w3c.dom.Element clone.groupBy = ((this.groupBy == null)?null:((this.getGroupBy() == null)?null:(this.getGroupBy().clone()))); return clone; } } catch (CloneNotSupportedException e) { // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ throw new AssertionError(e); } }
public static ObjectPaging createObjectPaging(PagingType pagingType, PrismContext prismContext) { if (pagingType == null) { return null; } if (pagingType.getOrderBy() != null && pagingType.getGroupBy() != null) { return prismContext.queryFactory().createPaging(pagingType.getOffset(), pagingType.getMaxSize(), pagingType.getOrderBy().getItemPath(), toOrderDirection(pagingType.getOrderDirection()), pagingType.getGroupBy().getItemPath()); } if (pagingType.getOrderBy() != null) { return prismContext.queryFactory().createPaging(pagingType.getOffset(), pagingType.getMaxSize(), pagingType.getOrderBy().getItemPath(), toOrderDirection(pagingType.getOrderDirection())); } if (pagingType.getGroupBy() != null) { return prismContext.queryFactory().createPaging(pagingType.getGroupBy().getItemPath()); } else { return prismContext.queryFactory().createPaging(pagingType.getOffset(), pagingType.getMaxSize()); } }
@Test public void testConvertQueryNullFilter() throws Exception { ObjectQuery query = getQueryFactory().createQuery(getQueryFactory().createPaging(0, 10)); QueryType queryType = getQueryConverter().createQueryType(query); assertNotNull(queryType); assertNull(queryType.getFilter()); PagingType paging = queryType.getPaging(); assertNotNull(paging); assertEquals(new Integer(0), paging.getOffset()); assertEquals(new Integer(10), paging.getMaxSize()); }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { ItemPathType theOrderBy; theOrderBy = this.getOrderBy(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "orderBy", theOrderBy), currentHashCode, theOrderBy); } { OrderDirectionType theOrderDirection; theOrderDirection = this.getOrderDirection(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "orderDirection", theOrderDirection), currentHashCode, theOrderDirection); } { Integer theOffset; theOffset = this.getOffset(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "offset", theOffset), currentHashCode, theOffset); } { Integer theMaxSize; theMaxSize = this.getMaxSize(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "maxSize", theMaxSize), currentHashCode, theMaxSize); } { ItemPathType theGroupBy; theGroupBy = this.getGroupBy(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "groupBy", theGroupBy), currentHashCode, theGroupBy); } return currentHashCode; }