1 17 package org.alfresco.repo.admin.patch; 18 19 import org.alfresco.service.transaction.TransactionService; 20 21 public class SamplePatch extends AbstractPatch 22 { 23 public static final String MSG_SUCCESS = "SamplePatch applied successfully"; 24 public static final String MSG_FAILURE = "SamplePatch failed to apply"; 25 26 private boolean mustFail; 27 28 31 public SamplePatch() 32 { 33 } 34 35 38 @Override 39 public void init() 40 { 41 } 42 43 48 SamplePatch(boolean mustFail, TransactionService transactionService) 49 { 50 this.mustFail = mustFail; 51 setTransactionService(transactionService); 52 setId("SamplePatch"); 53 setDescription("This is a sample patch"); 54 setFixesFromSchema(0); 55 setFixesToSchema(1000); 56 setTargetSchema(1001); 57 } 58 59 64 @Override 65 protected String applyInternal() throws Exception 66 { 67 if (mustFail) 68 { 69 throw new Exception (MSG_FAILURE); 70 } 71 else 72 { 73 return MSG_SUCCESS; 74 } 75 } 76 } 77 | Popular Tags |