001    /**
002     * Copyright 2004-2013 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     */
016    package org.kuali.hr.lm.balancetransfer;
017    
018    import java.util.Set;
019    
020    import org.apache.commons.lang.StringUtils;
021    import org.apache.log4j.Logger;
022    import org.kuali.hr.time.util.TKContext;
023    import org.kuali.rice.kew.api.KewApiServiceLocator;
024    import org.kuali.rice.kim.api.identity.Person;
025    import org.kuali.rice.kns.document.authorization.TransactionalDocumentAuthorizerBase;
026    import org.kuali.rice.krad.document.Document;
027    import org.kuali.rice.krad.maintenance.MaintenanceDocumentAuthorizerBase;
028    import org.kuali.rice.krad.util.KRADConstants;
029    
030    public class BalanceTransferAuthorizer extends MaintenanceDocumentAuthorizerBase {
031    
032            private Logger LOG = Logger.getLogger(BalanceTransferAuthorizer.class);
033            
034            @Override
035            public boolean canEditDocumentOverview(Document document, Person user) {
036                    return true;
037            }
038    
039    /*      @Override
040            public Set<String> getDocumentActions(Document document, Person user,
041                            Set<String> documentActions) {
042                    Set<String> author =  super.getDocumentActions(document, user, documentActions);
043                    MissedPunchDocument mpDoc = (MissedPunchDocument)document;
044                    if(StringUtils.equals(mpDoc.getDocumentStatus(),"R") ){
045                            if(KewApiServiceLocator.getWorkflowDocumentActionsService().isFinalApprover(mpDoc.getDocumentNumber(), TKContext.getPrincipalId())){
046                                    author.add(KRADConstants.KUALI_ACTION_CAN_EDIT);
047                                    author.add(KRADConstants.KUALI_ACTION_CAN_APPROVE);
048                                    
049                                    author.remove(KRADConstants.KUALI_ACTION_CAN_DISAPPROVE);
050                            }
051                    } else if(!StringUtils.equals(mpDoc.getDocumentStatus(), "A")){
052                            author.add(KRADConstants.KUALI_ACTION_CAN_EDIT);
053                            author.add(KRADConstants.KUALI_ACTION_CAN_ROUTE);
054                    }
055                    author.remove(KRADConstants.KUALI_ACTION_CAN_ADD_ADHOC_REQUESTS);
056                    author.remove(KRADConstants.KUALI_ACTION_CAN_SEND_ADHOC_REQUESTS);
057                    return author;
058            }*/
059            
060            
061            
062    }