Skip to content

Commit 2e83678

Browse files
committed
Create annotation to track UtilityActions and Admin Console page to list them
1 parent db741a2 commit 2e83678

File tree

2 files changed

+1
-131
lines changed

2 files changed

+1
-131
lines changed

LDK/src/org/labkey/ldk/LDKController.java

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -889,135 +889,6 @@ public void addNavTrail(NavTree root)
889889
}
890890
}
891891

892-
@RequiresPermission(AdminPermission.class)
893-
public static class MoveWorkbookAction extends ConfirmAction<MoveWorkbookForm>
894-
{
895-
private Container _movedWb = null;
896-
897-
@Override
898-
public void validateCommand(MoveWorkbookForm form, Errors errors)
899-
{
900-
901-
}
902-
903-
@Override
904-
public ModelAndView getConfirmView(MoveWorkbookForm form, BindException errors) throws Exception
905-
{
906-
if (!getContainer().isWorkbook())
907-
{
908-
errors.reject(ERROR_MSG, "This is only supported for workbooks");
909-
return new SimpleErrorView(errors);
910-
}
911-
912-
String sb = "This will move this workbook to the selected folder, renaming this workbook to match the series in that container. Note: there are many reasons this can be problematic, so please do this with great care<p>" +
913-
"<input name=\"targetContainer\" type=\"text\"></input>";
914-
915-
return new HtmlView(sb);
916-
}
917-
918-
@Override
919-
public boolean handlePost(MoveWorkbookForm form, BindException errors) throws Exception
920-
{
921-
Container toMove = getContainer();
922-
if (!toMove.isWorkbook())
923-
{
924-
errors.reject(ERROR_MSG, "This is only supported for workbooks");
925-
return false;
926-
}
927-
928-
if (StringUtils.trimToNull(form.getTargetContainer()) == null)
929-
{
930-
errors.reject(ERROR_MSG, "Must provide target container");
931-
return false;
932-
}
933-
934-
Container target = ContainerManager.getForPath(StringUtils.trimToNull(form.getTargetContainer()));
935-
if (target == null)
936-
{
937-
target = ContainerManager.getForId(StringUtils.trimToNull(form.getTargetContainer()));
938-
}
939-
940-
if (target == null)
941-
{
942-
errors.reject(ERROR_MSG, "Unknown container: " + form.getTargetContainer());
943-
return false;
944-
}
945-
946-
if (target.isWorkbook())
947-
{
948-
errors.reject(ERROR_MSG, "Target cannot be a workbook: " + form.getTargetContainer());
949-
return false;
950-
}
951-
952-
if (ContainerManager.isSystemContainer(target))
953-
{
954-
errors.reject(ERROR_MSG, "Cannot move to system containers: " + form.getTargetContainer());
955-
return false;
956-
}
957-
958-
if (target.equals(toMove.getParent()))
959-
{
960-
errors.reject(ERROR_MSG, "Cannot move the workbook to its current parent: " + form.getTargetContainer());
961-
return false;
962-
}
963-
964-
//NOTE: transaction causing problems for larger sites?
965-
//try (DbScope.Transaction transaction = CoreSchema.getInstance().getSchema().getScope().ensureTransaction())
966-
//{
967-
//first rename workbook to make unique
968-
String tempName = new GUID().toString();
969-
int sortOrder = (int)DbSequenceManager.get(target, ContainerManager.WORKBOOK_DBSEQUENCE_NAME).next();
970-
_log.info("renaming workbook to in preparation for move from: " + toMove.getPath() + " to: " + tempName);
971-
ContainerManager.rename(toMove, getUser(), tempName);
972-
toMove = ContainerManager.getForId(toMove.getId());
973-
974-
//then move parent
975-
_log.info("moving workbook from: " + toMove.getPath() + " to: " + target.getPath());
976-
ContainerManager.move(toMove, target, getUser());
977-
toMove = ContainerManager.getForId(toMove.getId());
978-
979-
//finally move to correct name
980-
_log.info("renaming workbook from: " + toMove.getPath() + " to: " + sortOrder);
981-
ContainerManager.rename(toMove, getUser(), String.valueOf(sortOrder));
982-
toMove.setSortOrder(sortOrder);
983-
new SqlExecutor(CoreSchema.getInstance().getSchema()).execute("UPDATE core.containers SET SortOrder = ? WHERE EntityId = ?", toMove.getSortOrder(), toMove.getId());
984-
toMove = ContainerManager.getForId(toMove.getId());
985-
986-
//transaction.commit();
987-
_log.info("workbook move finished");
988-
989-
_movedWb = toMove;
990-
//}
991-
992-
return true;
993-
}
994-
995-
@NotNull
996-
@Override
997-
public URLHelper getSuccessURL(MoveWorkbookForm moveWorkbookForm)
998-
{
999-
if (_movedWb == null)
1000-
return getContainer().getStartURL(getUser());
1001-
else
1002-
return _movedWb.getStartURL(getUser());
1003-
}
1004-
}
1005-
1006-
public static class MoveWorkbookForm
1007-
{
1008-
private String _targetContainer;
1009-
1010-
public String getTargetContainer()
1011-
{
1012-
return _targetContainer;
1013-
}
1014-
1015-
public void setTargetContainer(String targetContainer)
1016-
{
1017-
_targetContainer = targetContainer;
1018-
}
1019-
}
1020-
1021892
@RequiresNoPermission
1022893
public class RedirectStartAction extends SimpleViewAction<Object>
1023894
{

laboratory/src/org/labkey/laboratory/LaboratoryController.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ public boolean handlePost(EnsureAssayFieldsForm form, BindException errors) thro
294294
}
295295
}
296296

297-
298297
@RequiresPermission(AdminPermission.class)
299298
public class SetTableIncrementValueAction extends ConfirmAction<SetTableIncrementForm>
300299
{
@@ -578,7 +577,7 @@ public void validateCommand(Object form, Errors errors)
578577
@Override
579578
public ModelAndView getConfirmView(Object form, BindException errors) throws Exception
580579
{
581-
return new HtmlView("This action will webparts and tabs for the current folder and all children to the default Laboratory FolderType, if these folders are either Laboratory Folders or Expt Workbooks");
580+
return new HtmlView("This action will reset webparts and tabs for the current folder and all children to the default Laboratory FolderType, if these folders are either Laboratory Folders or Expt Workbooks");
582581
}
583582

584583
@Override

0 commit comments

Comments
 (0)