001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.data.metadata.impl; 017 018import org.kuali.rice.krad.data.metadata.DataObjectCollectionSortAttribute; 019import org.kuali.rice.krad.data.metadata.SortDirection; 020 021/** 022* {@inheritDoc} 023*/ 024public class DataObjectCollectionSortAttributeImpl implements DataObjectCollectionSortAttribute { 025 private static final long serialVersionUID = 2221451853788207680L; 026 027 protected String attributeName; 028 protected SortDirection sortDirection = SortDirection.ASCENDING; 029 030 public DataObjectCollectionSortAttributeImpl() { 031 } 032 033 public DataObjectCollectionSortAttributeImpl(String attributeName, SortDirection sortDirection) { 034 super(); 035 this.attributeName = attributeName; 036 this.sortDirection = sortDirection; 037 } 038 039 /** 040 * {@inheritDoc} 041 */ 042 @Override 043 public String getAttributeName() { 044 return attributeName; 045 } 046 047 /** 048 * Sets attribute name. 049 * 050 * @param attributeName attribute name 051 */ 052 public void setAttributeName(String attributeName) { 053 this.attributeName = attributeName; 054 } 055 056 /** 057 * {@inheritDoc} 058 */ 059 @Override 060 public SortDirection getSortDirection() { 061 return sortDirection; 062 } 063 064 /** 065 * Sets sort direction. 066 * 067 * @param sortDirection sort direction. 068 */ 069 public void setSortDirection(SortDirection sortDirection) { 070 this.sortDirection = sortDirection; 071 } 072 073 /** 074 * {@inheritDoc} 075 */ 076 @Override 077 public String toString() { 078 StringBuilder builder = new StringBuilder(); 079 builder.append("[attributeName=").append(attributeName).append(" ").append(sortDirection).append("]"); 080 return builder.toString(); 081 } 082 083}