Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • DM/dm-docs
  • hammonds/dm-docs
  • hparraga/dm-docs
3 results
Show changes
Showing
with 1111 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<title>User Create</title>
<ui:composition template="../../templates/dmViewTemplate.xhtml">
<ui:define name="middleCenter">
<div class="pageTitle">
<h1>Add User</h1>
</div>
<h:form id="addUserInfoForm">
<ui:include src="private/userInfoCreatePanelGrid.xhtml"/>
<p/>
<div class="actionButton">
<p:commandButton action="#{userInfoController.create()}" value="Save" alt="Save" icon="ui-icon-check" update="@form"/>
<p:commandButton action="#{userInfoController.prepareList()}" immediate="true" value="Cancel" alt="Cancel" icon="ui-icon-cancel"/>
</div>
</h:form>
<h:outputScript library="js" name="common/forwardNotLoggedin.js" rendered="#{!loginController.loggedIn}"/>
<h:outputScript library="js" name="common/forwardNotAuthorized.js" rendered="#{!loginController.admin}"/>
</ui:define>
</ui:composition>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<title>Edit User</title>
<ui:composition template="../../templates/dmViewTemplate.xhtml">
<ui:define name="middleCenter">
<h:form id="editUserInfoForm">
<div class="pageTitle">
<h1>Edit User #{userInfoController.current.username}</h1>
</div>
<ui:param name="entityController" value="#{userInfoController}"/>
<ui:param name="userInfoObject" value="#{userInfoController.current}"/>
<p:accordionPanel multiple="true" activeIndex="0,1" >
<p:tab title="User Data">
<div class="middleCenterLeftContent">
<ui:include src="private/userInfoEditPanelGrid.xhtml"/>
<p/>
<div class="actionButton">
<p:commandButton action="#{userInfoController.update()}" value="Save" alt="Save" icon="ui-icon-check" update="@form"/>
<p:commandButton action="#{userInfoController.followBreadcrumbOrPrepareList()}" immediate="true" value="Return" alt="Return" icon="ui-icon-arrowreturnthick-1-w"/>
</div>
</div>
</p:tab>
<p:tab title="User Experiment Roles">
<div class="middleCenterLeftContent">
<ui:include src="private/userExperimentRoleListDataTable.xhtml"/>
</div>
</p:tab>
</p:accordionPanel>
<p/>
<div class="actionButton">
<p:commandButton action="#{userInfoController.followBreadcrumbOrPrepareList()}" value="Return" alt="Return" icon="ui-icon-arrowreturnthick-1-w"/>
</div>
</h:form>
<h:outputScript library="js" name="common/forwardNotLoggedin.js" rendered="#{!loginController.loggedIn}"/>
<h:outputScript library="js" name="common/forwardNotAuthorized.js" rendered="#{!loginController.admin}"/>
<h:outputScript library="js" name="common/forwardHome.js" rendered="#{!userInfoController.entitySelected}"/>
</ui:define>
</ui:composition>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<title>Users List</title>
<ui:composition template="../../templates/dmViewTemplate.xhtml">
<ui:define name="middleCenter">
<div class="pageTitle">
<h1>Registered Users</h1>
</div>
<h:form id="viewUserInfoListForm">
<ui:param name="entityController" value="#{userInfoController}"/>
<ui:include src="../common/commonListActionButtons.xhtml"/>
<h:panelGroup>
<ui:include src="private/userInfoListDataTable.xhtml"/>
</h:panelGroup>
<ui:include src="private/userInfoDestroyDialog.xhtml"/>
</h:form>
<h:outputScript library="js" name="common/forwardNotLoggedIn.js" rendered="#{!loginController.loggedIn}"/>
<h:outputScript library="js" name="userInfo/loadFilters.js"/>
</ui:define>
</ui:composition>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<ui:fragment>
<p:dataTable id="experimentSelectDataTable"
widgetVar="experimentSelectDataTableWidget"
var="experimentObject"
value="#{experimentController.selectDataModel}"
rowKey="#{experimentObject.name}"
selectionMode="single"
selection="#{userInfoController.currentUserExperimentRole.experiment}"
paginator="true"
paginatorAlwaysVisible="true"
rows="#{experimentController.selectNumberOfItemsPerPage}"
emptyMessage="No available records found.">
<p:column sortBy="#{experimentObject.name}" headerText="Name"
filterBy="#{experimentObject.name}">
<h:outputText value="#{experimentObject.name}"/>
</p:column>
<p:column sortBy="#{experimentObject.experimentType.name}" headerText="Type"
filterBy="#{experimentObject.experimentType.name}" filterMatchMode="contains" >
<h:outputText value="#{experimentObject.experimentType.name}"/>
</p:column>
<p:column sortBy="#{experimentObject.experimentStation.name}" headerText="Station"
filterBy="#{experimentObject.experimentStation.name}" filterMatchMode="contains" >
<h:outputText value="#{experimentObject.experimentStation.name}"/>
</p:column>
</p:dataTable>
</ui:fragment>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<p:dialog id="userExperimentRoleAddDialog"
widgetVar="userExperimentRoleAddDialogWidget"
header="Select Experiment"
styleClass="dialog">
<div class="dialog">
<ui:include src="experimentSelectDataTable.xhtml"/>
<f:facet name="footer" class="dialog">
<div class="actionButton" align="center">
<p:commandButton value="Add PI Role" alt="Add PI Role"
action="#{userInfoController.addUserExperimentRolePi()}"
onclick="PF('experimentSelectDataTableWidget').filter()"
oncomplete="PF('userExperimentRoleAddDialogWidget').hide()"
update="@form"
immediate="true"
icon="ui-icon-arrowreturnthick-1-w"
styleClass="dialog">
</p:commandButton>
<p:commandButton value="Add User Role" alt="Add User Role"
action="#{userInfoController.addUserExperimentRoleUser()}"
onclick="PF('experimentSelectDataTableWidget').filter()"
oncomplete="PF('userExperimentRoleAddDialogWidget').hide()"
update="@form"
immediate="true"
icon="ui-icon-arrowreturnthick-1-w"
styleClass="dialog">
</p:commandButton>
<p:commandButton value="Cancel" alt="Cancel"
onclick="PF('userExperimentRoleAddDialogWidget').hide()"
update="@form"
immediate="true"
icon="ui-icon-close"
styleClass="dialog">
</p:commandButton>
</div>
</f:facet>
</div>
</p:dialog>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<div class="actionButton">
<p:commandButton id="userExperimentRoleAddButton"
action="#{userInfoController.prepareAddUserExperimentRole(userInfoObject)}"
oncomplete="PF('userExperimentRoleAddDialogWidget').show()"
rendered="#{loginController.admin}"
value="Add" alt="Add user experiment role." icon="ui-icon-plus">
<p:tooltip for="userExperimentRoleAddButton" value="Add user experiment role."/>
</p:commandButton>
</div>
<ui:include src="userExperimentRoleAddDialog.xhtml"/>
<ui:param name="breadcrumb" value="#{userInfoController.currentViewId}"/>
<ui:param name="breadcrumbObjectId" value="#{userInfoObject.id}"/>
<p:dataTable id="userExperimentRoleListDataTable"
var="userExperimentRoleObject"
value="#{userInfoObject.userExperimentRoleList}"
paginator="true"
paginatorAlwaysVisible="false"
rows="#{userInfoController.displayNumberOfItemsPerPage}"
widgetVar="userExperimentRoleListWidget"
emptyMessage="No experiments found.">
<p:column sortBy="#{userExperimentRoleObject.experiment.name}" headerText="Experiment Name"
filterBy="#{userExperimentRoleObject.experiment.name}" filterMatchMode="contains" >
<h:outputLink value="../experiment/view.xhtml?id=#{userExperimentRoleObject.experiment.id}&amp;breadcrumb=#{breadcrumb}&amp;breadcrumbObjectId=#{breadcrumbObjectId}"
title="Experiment: #{userExperimentRoleObject.experiment.name}">
<h:outputText value="#{userExperimentRoleObject.experiment.name}"/>
</h:outputLink>
</p:column>
<p:column sortBy="#{userExperimentRoleObject.experiment.experimentType.name}" headerText="Experiment Type"
filterBy="#{userExperimentRoleObject.experiment.experimentType.name}" filterMatchMode="contains" >
<h:outputText value="#{userExperimentRoleObject.experiment.experimentType.name}"/>
</p:column>
<p:column sortBy="#{userExperimentRoleObject.experiment.experimentStation.name}" headerText="Experiment Station"
filterBy="#{userExperimentRoleObject.experiment.experimentStation.name}" filterMatchMode="contains" >
<h:outputText value="#{userExperimentRoleObject.experiment.experimentStation.name}"/>
</p:column>
<p:column sortBy="#{userExperimentRoleObject.experimentRoleType.name}" headerText="Role"
filterBy="#{userExperimentRoleObject.experimentRoleType.name}" filterMatchMode="contains" >
<h:outputText value="#{userExperimentRoleObject.experimentRoleType.name}"/>
</p:column>
<p:column headerText="Actions" >
<div class="actionLink">
<p:commandLink action="#{userInfoController.deleteUserExperimentRole(userExperimentRoleObject)}"
styleClass="ui-icon ui-icon-trash" title="Delete"
update="userExperimentRoleListDataTable"
rendered="#{loginController.admin}"
immediate="true"/>
</div>
</p:column>
</p:dataTable>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:param name="userInfoObject" value="#{userInfoController.selected}"/>
<p:panelGrid columns="2" styleClass="createEntityDetails">
<h:outputLabel for="badge" value="Badge" styleClass="entityDataEmphasizedLabel"/>
<h:inputText id="badge" value="#{userInfoObject.badge}" title="Badge" styleClass="entityDataEmphasizedInputText"/>
<h:outputLabel for="username" value="Username" styleClass="entityDataEmphasizedLabel"/>
<h:inputText id="username" value="#{userInfoObject.username}" title="Username" styleClass="entityDataEmphasizedInputText"/>
<h:outputLabel for="lastName" value="Last Name" styleClass="entityDataLabel"/>
<h:inputText id="lastName" value="#{userInfoObject.lastName}" title="Last Name" styleClass="entityDataInputText"/>
<h:outputLabel for="firstName" value="First Name" styleClass="entityDataLabel"/>
<h:inputText id="firstName" value="#{userInfoObject.firstName}" title="First Name" styleClass="entityDataInputText"/>
<h:outputLabel for="middleName" value="Middle Name" styleClass="entityDataLabel"/>
<h:inputText id="middleName" value="#{userInfoObject.middleName}" title="Middle Name" styleClass="entityDataInputText"/>
<h:outputLabel for="email" value="Email" styleClass="entityDataLabel"/>
<h:inputText id="email" value="#{userInfoObject.email}" title="Email" styleClass="entityDataInputText"/>
<h:outputLabel for="password" value="Password" styleClass="entityDataLabel"/>
<p:password id="password" value="#{userInfoController.passwordEntry}" title="Password" feedback="true" styleClass="entityDataInputText"/>
<h:outputLabel for="globusUsername" value="Globus Username" styleClass="entityDataEmphasizedLabel"/>
<h:inputText id="globusUsername" value="#{userInfoObject.globusUsername}" title="Globus Username" styleClass="entityDataEmphasizedInputText"/>
<h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
<h:inputText id="description" value="#{userInfoObject.description}" title="Description" styleClass="entityDataInputText"/>
</p:panelGrid>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<p:confirmDialog id="userInfoDestroyDialog" message="Delete user #{userInfoController.getCurrentEntityInstanceName()}?"
header="Delete User" severity="alert" widgetVar="userInfoDestroyDialogWidget"
styleClass="dialog">
<p:commandButton value="Yes" oncomplete="userInfoDestroyDialogWidget.hide()" action="#{userInfoController.destroy()}"/>
<p:commandButton value="No" onclick="PF('userInfoDestroyDialogWidget').hide()" type="button" />
</p:confirmDialog>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:param name="userInfoObject" value="#{userInfoController.selected}"/>
<ui:param name="isFieldWriteable" value="#{loginController.loggedIn}"/>
<p:panelGrid columns="2" styleClass="editEntityDetails">
<h:outputLabel for="badge" value="Badge" styleClass="entityDataEmphasizedLabel"/>
<h:outputText id="badge" value="#{userInfoObject.badge}" title="Badge" styleClass="entityDataEmphasizedText"/>
<h:outputLabel for="username" value="Username" styleClass="entityDataEmphasizedLabel"/>
<h:inputText id="username" value="#{userInfoObject.username}" rendered="#{isFieldWriteable}" title="Username" styleClass="entityDataEmphasizedInputText"/>
<h:outputText id="usernameOutput" value="#{userInfoObject.username}" rendered="#{!isFieldWriteable}" title="Username" styleClass="entityDataEmphasizedText"/>
<h:outputLabel for="lastName" value="Last Name" styleClass="entityDataLabel"/>
<h:inputText id="lastName" value="#{userInfoObject.lastName}" rendered="#{isFieldWriteable}" title="Last Name" styleClass="entityDataInputText"/>
<h:outputText id="lastNameOutput" value="#{userInfoObject.lastName}" rendered="#{!isFieldWriteable}" title="Last Name" styleClass="entityDataText"/>
<h:outputLabel for="firstName" value="First Name" styleClass="entityDataLabel"/>
<h:inputText id="firstName" value="#{userInfoObject.firstName}" rendered="#{isFieldWriteable}" title="First Name" styleClass="entityDataInputText"/>
<h:outputText id="firstNameOutput" value="#{userInfoObject.firstName}" rendered="#{!isFieldWriteable}" title="First Name" styleClass="entityDataText"/>
<h:outputLabel for="middleName" value="Middle Name" styleClass="entityDataLabel"/>
<h:inputText id="middleName" value="#{userInfoObject.middleName}" title="Middle Name" rendered="#{isFieldWriteable}" styleClass="entityDataInputText"/>
<h:outputText id="middleNameOutput" value="#{userInfoObject.middleName}" title="Middle Name" rendered="#{!isFieldWriteable}" styleClass="entityDataText"/>
<h:outputLabel for="email" value="Email" styleClass="entityDataLabel"/>
<h:inputText id="email" value="#{userInfoObject.email}" title="Email" styleClass="entityDataInputText"/>
<h:outputLabel for="password" value="Password" styleClass="entityDataLabel" rendered="#{userInfoObject.isLocalUser()}"/>
<p:password id="password" rendered="#{userInfoObject.isLocalUser()}" value="#{userInfoController.passwordEntry}" title="Password" feedback="true" styleClass="entityDataInputText"/>
<h:outputLabel for="globusUsername" value="Globus Username" styleClass="entityDataLabel"/>
<h:inputText id="globusUsername" value="#{userInfoObject.globusUsername}" title="Globus Username" styleClass="entityDataInputText"/>
<h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
<h:inputText id="description" value="#{userInfoObject.description}" title="Description" styleClass="entityDataInputText"/>
</p:panelGrid>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<p:dataTable id="userInfoListDataTable"
var="userInfoObject"
value="#{userInfoController.listDataModel}"
filteredValue="#{userInfoController.filteredObjectList}"
paginator="true"
paginatorAlwaysVisible="false"
rows="#{userInfoController.displayNumberOfItemsPerPage}"
widgetVar="userInfoListWidget"
emptyMessage="No users found.">
<p:ajax event="filter" listener="#{userInfoController.onFilterChange}"/>
<p:column sortBy="#{userInfoObject.id}" headerText="Id" >
<h:outputText value="#{userInfoObject.id}"/>
</p:column>
<p:column sortBy="#{userInfoObject.badge}" headerText="ANL Badge"
filterBy="#{userInfoObject.badge}" filterMatchMode="contains"
filterValue="#{userInfoController.filterByBadge}" >
<h:outputText value="#{userInfoObject.badge}"/>
</p:column>
<p:column sortBy="#{userInfoObject.username}" headerText="Username"
filterBy="#{userInfoObject.username}" filterMatchMode="contains"
filterValue="#{userInfoController.filterByUsername}" >
<h:outputText value="#{userInfoObject.username}"/>
</p:column>
<p:column sortBy="#{userInfoObject.lastName}" headerText="Last Name"
filterBy="#{userInfoObject.lastName}" filterMatchMode="contains"
filterValue="#{userInfoController.filterByLastName}" >
<h:outputText value="#{userInfoObject.lastName}"/>
</p:column>
<p:column sortBy="#{userInfoObject.firstName}" headerText="First, Middle Name"
filterBy="#{userInfoObject.firstName}" filterMatchMode="contains"
filterValue="#{userInfoController.filterByFirstName}" >
<h:outputText value="#{userInfoObject.firstName} #{userInfoObject.middleName}"/>
</p:column>
<p:column sortBy="#{userInfoObject.email}" headerText="Email"
filterBy="#{userInfoObject.email}" filterMatchMode="contains"
filterValue="#{userInfoController.filterByEmail}" >
<h:outputText value="#{userInfoObject.email}"/>
</p:column>
<p:column sortBy="#{userInfoObject.globusUsername}" headerText="Globus Username"
filterBy="#{userInfoObject.globusUsername}" filterMatchMode="contains"
filterValue="#{userInfoController.filterByGlobusUsername}" >
<h:outputText value="#{userInfoObject.globusUsername}"/>
</p:column>
<p:column sortBy="#{userInfoObject.description}" headerText="Description"
filterBy="#{userInfoObject.description}" filterMatchMode="contains"
filterValue="#{userInfoController.filterByDescription}" >
<h:outputText value="#{userInfoObject.description}"/>
</p:column>
<p:column headerText="Actions" >
<div class="actionLink">
<p:commandLink action="#{userInfoController.prepareView(userInfoObject)}" styleClass="ui-icon ui-icon-info" title="View">
<f:setPropertyActionListener value="#{userInfoObject}" target="#{userInfoController.current}"/>
</p:commandLink>
<p:commandLink action="#{userInfoController.prepareEdit(userInfoObject)}" rendered="#{loginController.admin}" styleClass="ui-icon ui-icon-pencil" title="Edit"/>
<p:commandLink oncomplete="PF('userInfoDestroyDialogWidget').show()" rendered="#{loginController.admin}" styleClass="ui-icon ui-icon-trash" title="Delete" update="@form">
<f:setPropertyActionListener value="#{userInfoObject}" target="#{userInfoController.current}"/>
</p:commandLink>
</div>
</p:column>
</p:dataTable>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:param name="userInfoObject" value="#{userInfoController.selected}"/>
<p:panelGrid columns="2" styleClass="viewEntityDetails">
<h:outputLabel for="badge" value="Badge" styleClass="entityDataEmphasizedLabel"/>
<h:outputText id="badge" value="#{userInfoObject.badge}" title="Badge" styleClass="entityDataEmphasizedText"/>
<h:outputLabel for="username" value="Username" styleClass="entityDataEmphasizedLabel"/>
<h:outputText id="username" value="#{userInfoObject.username}" title="Username" styleClass="entityDataEmphasizedText"/>
<h:outputLabel for="lastName" value="Last Name" styleClass="entityDataLabel"/>
<h:outputText id="lastName" value="#{userInfoObject.lastName}" title="Last Name" styleClass="entityDataText"/>
<h:outputLabel for="firstName" value="First Name" styleClass="entityDataLabel"/>
<h:outputText id="firstName" value="#{userInfoObject.firstName}" title="First Name" styleClass="entityDataText"/>
<h:outputLabel for="middleName" value="Middle Name" styleClass="entityDataLabel"/>
<h:outputText id="middleName" value="#{userInfoObject.middleName}" title="Middle Name" styleClass="entityDataText"/>
<h:outputLabel for="email" value="Email" styleClass="entityDataLabel"/>
<h:outputText id="email" value="#{userInfoObject.email}" title="Email" styleClass="entityDataText"/>
<h:outputLabel for="globusUsername" value="Globus Username" styleClass="entityDataLabel"/>
<h:outputText id="globusUsername" value="#{userInfoObject.globusUsername}" title="Globus Username" styleClass="entityDataText"/>
<h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
<h:outputText id="description" value="#{userInfoObject.description}" title="Description" styleClass="entityDataText"/>
</p:panelGrid>
</ui:composition>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<f:metadata>
<f:event type="preRenderComponent" listener="#{userInfoController.processViewRequestParams}"/>
</f:metadata>
<title>User View</title>
<ui:composition template="../../templates/dmViewTemplate.xhtml">
<ui:define name="middleCenter">
<h:form id="viewUserInfoForm" rendered="#{userInfoController.entitySelected}">
<div class="pageTitle">
<h1>User #{userInfoController.current.username}</h1>
</div>
<ui:param name="entityController" value="#{userInfoController}"/>
<ui:param name="userInfoObject" value="#{userInfoController.current}"/>
<p:accordionPanel multiple="true" activeIndex="0,1" >
<p:tab title="User Data">
<div class="middleCenterLeftContent">
<ui:include src="private/userInfoViewPanelGrid.xhtml"/>
<p/>
<div class="actionButton">
<p:commandButton action="#{userInfoController.prepareEdit(userInfoObject)}" rendered="#{loginController.admin}" value="Edit" alt="Edit" icon="ui-icon-pencil"/>
<p:commandButton onclick="PF('userInfoDestroyDialogWidget').show();" rendered="#{loginController.admin}" value="Delete" alt="Delete" icon="ui-icon-trash">
<f:setPropertyActionListener value="#{userInfoObject}" target="#{userInfoController.current}"/>
</p:commandButton>
<p:commandButton action="#{userInfoController.followBreadcrumbOrPrepareList()}" value="Return" alt="Return" icon="ui-icon-arrowreturnthick-1-w"/>
</div>
</div>
</p:tab>
<p:tab title="User Experiment Roles">
<div class="middleCenterLeftContent">
<ui:include src="private/userExperimentRoleListDataTable.xhtml"/>
</div>
</p:tab>
</p:accordionPanel>
<p/>
<div class="actionButton">
<p:commandButton action="#{userInfoController.followBreadcrumbOrPrepareList()}" value="Return" alt="Return" icon="ui-icon-arrowreturnthick-1-w"/>
</div>
<ui:include src="private/userInfoDestroyDialog.xhtml"/>
</h:form>
<h:outputScript library="js" name="common/forwardNotLoggedIn.js" rendered="#{!loginController.loggedIn}"/>
<h:outputScript library="js" name="common/forwardHome.js" rendered="#{!userInfoController.entitySelected}"/>
</ui:define>
</ui:composition>
</ui:composition>
TOP = ../..
SUBDIRS = DmWebPortal
include $(TOP)/tools/make/RULES_DM
TOP=../../..
all install: dist
clean clean-all clean-install distclean: pyc-clean
.PHONY: pyc-clean
pyc-clean:
rm -f `find . -name '*.pyc'`
# For compiling from command line, we have to use generic build properties file
.PHONY: dist
dist:
__version__ = "1.1 (2017.03.13)"
__version__ = "1.1 (2017.03.01)"
__version__ = "1.1 (2017.03.01)"
#!/usr/bin/env python
from dm.common.cli.dmCli import DmCli
from dm.common.exceptions.invalidRequest import InvalidRequest
from dm.common.utility.configurationManager import ConfigurationManager
class ApsBeamlineCli(DmCli):
""" Base APS beamline cli class. """
def __init__(self, validArgCount=0):
DmCli.__init__(self, validArgCount)
configManager = ConfigurationManager.getInstance()
self.allowedExperimentTypes = configManager.getAllowedExperimentTypes()
allowedExperimentTypesHelp = ''
if self.allowedExperimentTypes:
allowedExperimentTypesHelp = ' Allowed types: %s' % self.allowedExperimentTypes
self.stationName = configManager.getStationName()
self.beamlineName = configManager.getBeamlineName()
self.beamlineManagers = configManager.getBeamlineManagers()
self.dsServiceHost = configManager.getDsWebServiceHost()
self.dsServicePort = configManager.getDsWebServicePort()
self.daqServiceHost = configManager.getDaqWebServiceHost()
self.daqServicePort = configManager.getDaqWebServicePort()
self.serviceProtocol = configManager.getWebServiceProtocol()
loginGroup = 'Login Options'
self.addOptionGroup(loginGroup, None)
self.addOptionToGroup(loginGroup, '', '--login-file', dest='loginFile', help='DM login file, contains "<dm username>|<dm password>" pair. It may be specified using DM_LOGIN_FILE environment variable.')
self.addOptionToGroup(loginGroup, '', '--bss-login-file', dest='bssLoginFile', help='BSS login file, contains "<bss username>|<bss password>" pair. It may be specified via environment variable DM_BSS_LOGIN_FILE.')
def parseArgs(self, usage=None):
DmCli.parseArgs(self, usage)
(self.loginUsername,self.loginPassword) = self.parseLoginFile(self.getLoginFile())
self.bssLoginFile = self.getBssLoginFile()
return (self.options, self.args)
def getLoginFile(self):
if not self.options.loginFile:
return ConfigurationManager.getInstance().getLoginFile()
return self.options.loginFile
def getBssLoginFile(self):
if not self.options.bssLoginFile:
return ConfigurationManager.getInstance().getBssLoginFile()
return self.options.bssLoginFile
def getStationName(self):
return self.stationName
def parseLoginFile(self,loginFile):
username = None
password = None
try:
# Assume form <username>|<password>
if loginFile:
tokenList = open(loginFile).readline().split('|')
if len(tokenList) == 2:
username = tokenList[0].strip()
password = tokenList[1].strip()
except:
# Ignore invalid login file
pass
return (username,password)
def checkCredentials(self):
if not self.hasCredentials():
raise InvalidRequest('DM login credentials are not specified.')
if not self.hasBssCredentials():
raise InvalidRequest('BSS login credentials are not specified.')
def hasCredentials(self):
return (self.loginUsername != None and self.loginPassword != None)
def hasBssCredentials(self):
return self.bssLoginFile != None
#######################################################################
# Testing
if __name__ == '__main__':
pass
#!/usr/bin/env python
from dm.aps_bss.api.apsBssApi import ApsBssApi
from dm.ds_web_service.api.experimentDsApi import ExperimentDsApi
from dm.ds_web_service.api.userDsApi import UserDsApi
from dm.daq_web_service.api.experimentDaqApi import ExperimentDaqApi
from dm.common.utility.ftpUtility import FtpUtility
from dm.common.exceptions.invalidRequest import InvalidRequest
from dm.common.exceptions.objectNotFound import ObjectNotFound
from dm.common.utility.configurationManager import ConfigurationManager
from dm.aps_beamline_tools.cli.apsBeamlineCli import ApsBeamlineCli
class DaqCli(ApsBeamlineCli):
def __init__(self, validArgCount=ApsBeamlineCli.ANY_NUMBER_OF_POSITIONAL_ARGS):
ApsBeamlineCli.__init__(self, validArgCount)
configManager = ConfigurationManager.getInstance()
self.allowedExperimentTypes = configManager.getAllowedExperimentTypes()
allowedExperimentTypesHelp = ''
self.defaultExperimentType = None
if self.allowedExperimentTypes:
allowedExperimentTypesHelp = ' Allowed types: %s' % self.allowedExperimentTypes
self.defaultExperimentType = self.allowedExperimentTypes.split(',')[0]
self.addOption('', '--experiment', dest='experimentName', help='Experiment name.')
self.addOption('', '--data-directory', dest='dataDirectory', help='Experiment data directory.')
# Experiment options.
expGroup = 'Add/Update Experiment Options'
self.addOptionGroup(expGroup, prepend=True)
self.addOptionToGroup(expGroup, '', '--type', dest='typeName', default=self.defaultExperimentType, help='Experiment type name.%s' % allowedExperimentTypesHelp)
self.addOptionToGroup(expGroup, '', '--description', dest='description', help='Experiment description.')
self.addOptionToGroup(expGroup, '', '--start-date', dest='startDate', help='Experiment start date in format DD-MMM-YY.')
self.addOptionToGroup(expGroup, '', '--end-date', dest='endDate', help='Experiment end date in format DD-MMM-YY.')
self.addOptionToGroup(expGroup, '', '--users', dest='users', help='Comma-separated list of DM usernames to be added to the new experiment as users.')
self.addOptionToGroup(expGroup, '', '--proposal-id', dest='proposalId', help='Beamline proposal id. If specified, all users listed on the proposal will be added to the new experiment.')
self.addOptionToGroup(expGroup, '', '--run', dest='runName', help='Run name. If not specified, current run name is assumed for beamline proposal.')
# Daq Options
daqGroup = 'DAQ Options'
self.addOptionGroup(daqGroup, prepend=True)
self.addOptionToGroup(daqGroup, '', '--dest-directory', dest='destDirectory', help='Destination directory relative to experiment root path.')
self.addOptionToGroup(daqGroup, '', '--duration', dest='duration', help='DAQ duration; it must be specified in hours (h) or days (d). Examples: "8h", "14d".')
self.addOptionToGroup(daqGroup, '', '--upload-data-directory-on-exit', dest='uploadDataDirectoryOnExit', help='Data directory that will be uploaded automatically after DAQ is stopped.')
self.addOptionToGroup(daqGroup, '', '--upload-dest-directory-on-exit', dest='uploadDestDirectoryOnExit', help='Destination directory relative to experiment root path for automatic upload after DAQ is stopped. Requires upload data directory to be specified.')
self.addOptionToGroup(daqGroup, '', '--process-hidden', dest='processHidden', action='store_true', default=False, help='Process hidden source files.')
self.addOptionToGroup(daqGroup, '', '--skip-plugins', dest='skipPlugins', help='Comma-separated list of plugins which should not process files.')
def checkArgs(self):
if self.options.experimentName is None:
raise InvalidRequest('Experiment name must be provided.')
if self.options.dataDirectory is None:
raise InvalidRequest('Experiment data directory must be provided.')
if self.getTypeName() and self.allowedExperimentTypes:
if self.getTypeName() not in self.allowedExperimentTypes.split(','):
raise InvalidRequest('Experiment type %s is not allowed on this station. Allowed types are: %s.' % (self.getTypeName(), self.allowedExperimentTypes))
def updateDaqInfoFromOptions(self, daqInfo):
if self.options.processHidden:
daqInfo['processHiddenFiles'] = True
if self.options.skipPlugins:
daqInfo['skipPlugins'] = self.options.skipPlugins
if self.options.duration:
duration = self.options.duration
if duration.endswith('h'):
daqInfo['maxRunTimeInHours'] = int(duration[0:-1])
elif duration.endswith('d'):
daqInfo['maxRunTimeInHours'] = int(duration[0:-1])*self.HOURS_PER_DAY
else:
raise InvalidRequest('Maximum run time must contain valid unit specifier: "h" for hours or "d" for days.')
if self.options.destDirectory:
daqInfo['destDirectory'] = self.options.destDirectory
if self.options.uploadDataDirectoryOnExit:
daqInfo['uploadDataDirectoryOnExit'] = self.options.uploadDataDirectoryOnExit
if self.options.uploadDestDirectoryOnExit:
if not self.options.uploadDataDirectoryOnExit:
raise InvalidRequest('Upload destination directory on exit requires that upload data directory is specified as well.')
daqInfo['uploadDestDirectoryOnExit'] = self.options.uploadDestDirectoryOnExit
def getExperimentName(self):
return self.options.experimentName
def getTypeName(self):
return self.options.typeName
def getDescription(self):
return self.options.description
def getStartDate(self):
return self.options.startDate
def getEndDate(self):
return self.options.endDate
def getProposalId(self):
proposalId = self.options.proposalId
if proposalId:
proposalId = int(proposalId)
return proposalId
def getUsers(self):
# Return list of users and beamline managers that can access data
users = self.options.users
if users:
users = users.split(',')
else:
users = []
beamlineManagers = self.beamlineManagers
if beamlineManagers:
beamlineManagers = beamlineManagers.split(',')
else:
beamlineManagers = []
# Remove duplicates by converting into set
return list(set(users+beamlineManagers))
def addOrUpdateExperiment(self):
dsExperimentApi = ExperimentDsApi(self.loginUsername, self.loginPassword, self.dsServiceHost, self.dsServicePort, self.serviceProtocol)
dsUserApi = UserDsApi(self.loginUsername, self.loginPassword, self.dsServiceHost, self.dsServicePort, self.serviceProtocol)
description = self.getDescription()
proposalId = self.getProposalId()
experimenters = []
if proposalId:
bssApi = ApsBssApi(loginFile=self.options.bssLoginFile)
proposal = bssApi.getBeamlineProposal(proposalId=proposalId, runName=self.options.runName)
experimenters = proposal.get('experimenters', [])
if not description:
description = '%s (Proposal id: %s)' % (proposal['title'], proposalId)
users = self.getUsers()
pis = []
for experimenter in experimenters:
badge = int(experimenter['badge'])
if not badge:
#print 'Skipping user %s due to invalid badge.' % lastName
continue
username = 'd%s' % badge
# Clasify user
if experimenter.get('piFlag') == 'Y':
if not pis.count(username):
pis.append(username)
if users.count(username):
users.remove(username)
else:
if not users.count(username):
users.append(username)
for username in users+pis:
# Check that user exists
dsUserApi.getUserByUsername(username)
# Everything looks good, add experiment
try:
experiment = dsExperimentApi.getExperimentByName(self.getExperimentName())
experimentStation = experiment.get('experimentStation')
stationName = ''
if experimentStation:
stationName = experimentStation.get('name')
if stationName != self.getStationName():
raise InvalidRequest('Experiment %s already exists for station %s.' % (self.getExperimentName(), stationName))
except ObjectNotFound, ex:
experiment = dsExperimentApi.addExperiment(self.getExperimentName(), self.getStationName(), self.getTypeName(), description, self.getStartDate(), self.getEndDate())
# Add pis.
experimentUsernameList = experiment.get('experimentUsernameList', [])
experimentName = experiment['name']
roleName = 'PI'
for username in pis:
if username not in experimentUsernameList:
dsUserApi.addUserExperimentRole(username, roleName, experimentName)
roleName = 'User'
for username in users:
if username not in experimentUsernameList:
dsUserApi.addUserExperimentRole(username, roleName, experimentName)
if len(users+pis):
experiment = dsExperimentApi.getExperimentByName(experimentName)
return experiment
def startDaq(self):
daqExperimentApi = ExperimentDaqApi(self.loginUsername, self.loginPassword, self.daqServiceHost, self.daqServicePort, self.serviceProtocol)
daqInfo = self.splitArgsIntoDict()
self.updateDaqInfoFromOptions(daqInfo)
daqInfo = daqExperimentApi.startDaq(self.getExperimentName(), self.getDataDirectory(), daqInfo=daqInfo)
return daqInfo
def runCommand(self):
self.parseArgs(usage="""
dm-%s-daq --experiment=EXPERIMENTNAME --data-directory=DATADIRECTORY
[--duration=DURATION]
[--dest-directory=DESTDIRECTORY]
[--upload-data-directory-on-exit=UPLOADDATADIRECTORYONEXIT]
[--upload-dest-directory-on-exit=UPLOADDESTDIRECTORYONEXIT]
[--process-hidden]
[--type=TYPENAME]
[--description=DESCRIPTION]
[--start-date=STARTDATE]
[--end-date=ENDDATE]
[--users=USERS]
[--proposal-id=PROPOSALID]
[--run=RUNNAME]
[key1:value1, key2:value2, ...]
Description:
Run DAQ for experiment on station %s. If experiment does not exist, it will be added to the DM database. If list of users or proposal id is specified, this command will also add roles for all users listed on the proposal.
""" % (self.getStationName().lower(), self.getStationName()))
self.checkArgs()
self.checkCredentials()
experiment = self.addOrUpdateExperiment()
print 'EXPERIMENT INFO'
print experiment.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())
print
daqInfo = self.startDaq()
print 'DAQ INFO'
print daqInfo.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())
#######################################################################
# Run command.
if __name__ == '__main__':
cli = DaqCli()
cli.run()
#!/usr/bin/env python
from dm.aps_bss.api.apsBssApi import ApsBssApi
from dm.ds_web_service.api.experimentDsApi import ExperimentDsApi
from dm.ds_web_service.api.userDsApi import UserDsApi
from dm.daq_web_service.api.experimentDaqApi import ExperimentDaqApi
from dm.common.constants import dmProcessingMode
from dm.common.exceptions.invalidRequest import InvalidRequest
from dm.common.exceptions.objectNotFound import ObjectNotFound
from dm.common.utility.configurationManager import ConfigurationManager
from dm.aps_beamline_tools.cli.apsBeamlineCli import ApsBeamlineCli
class UploadCli(ApsBeamlineCli):
def __init__(self, validArgCount=ApsBeamlineCli.ANY_NUMBER_OF_POSITIONAL_ARGS):
ApsBeamlineCli.__init__(self, validArgCount)
configManager = ConfigurationManager.getInstance()
self.allowedExperimentTypes = configManager.getAllowedExperimentTypes()
allowedExperimentTypesHelp = ''
self.defaultExperimentType = None
if self.allowedExperimentTypes:
allowedExperimentTypesHelp = ' Allowed types: %s' % self.allowedExperimentTypes
self.defaultExperimentType = self.allowedExperimentTypes.split(',')[0]
self.addOption('', '--experiment', dest='experimentName', help='Experiment name.')
self.addOption('', '--data-directory', dest='dataDirectory', help='Experiment data directory.')
# Experiment options.
expGroup = 'Add/Update Experiment Options'
self.addOptionGroup(expGroup, prepend=True)
self.addOptionToGroup(expGroup, '', '--type', dest='typeName', default=self.defaultExperimentType, help='Experiment type name.%s' % allowedExperimentTypesHelp)
self.addOptionToGroup(expGroup, '', '--description', dest='description', help='Experiment description.')
self.addOptionToGroup(expGroup, '', '--start-date', dest='startDate', help='Experiment start date in format DD-MMM-YY.')
self.addOptionToGroup(expGroup, '', '--end-date', dest='endDate', help='Experiment end date in format DD-MMM-YY.')
self.addOptionToGroup(expGroup, '', '--users', dest='users', help='Comma-separated list of DM usernames to be added to the new experiment as users.')
self.addOptionToGroup(expGroup, '', '--proposal-id', dest='proposalId', help='Beamline proposal id. If specified, all users listed on the proposal will be added to the new experiment.')
self.addOptionToGroup(expGroup, '', '--run', dest='runName', help='Run name. If not specified, current run name is assumed for beamline proposal.')
# Upload Options
uploadGroup = 'Upload Options'
self.addOptionGroup(uploadGroup, prepend=True)
self.addOptionToGroup(uploadGroup, '', '--dest-directory', dest='destDirectory', help='Destination directory relative to experiment root path.')
self.addOptionToGroup(uploadGroup, '', '--process-hidden', dest='processHidden', action='store_true', default=False, help='Process hidden source files.')
self.addOptionToGroup(uploadGroup, '', '--reprocess', dest='reprocess', action='store_true', default=False, help='Reprocess source files that are already in storage, even if they have not been modified.')
self.addOptionToGroup(uploadGroup, '', '--processing-mode', dest='processingMode', default=dmProcessingMode.DM_PROCESSING_MODE_FILES, help='Processing mode can be one of %s (default: %s). In the "%s" mode files are processed individually, while in the "%s" mode processing plugins work on directories (if possible).' % (dmProcessingMode.DM_ALLOWED_PROCESSING_MODE_LIST, dmProcessingMode.DM_PROCESSING_MODE_FILES, dmProcessingMode.DM_PROCESSING_MODE_FILES, dmProcessingMode.DM_PROCESSING_MODE_DIRECTORY))
self.addOptionToGroup(uploadGroup, '', '--skip-plugins', dest='skipPlugins', help='Comma-separated list of plugins which should not process files.')
def checkArgs(self):
if self.options.experimentName is None:
raise InvalidRequest('Experiment name must be provided.')
if self.options.dataDirectory is None:
raise InvalidRequest('Experiment data directory must be provided.')
if self.getTypeName() and self.allowedExperimentTypes:
if self.getTypeName() not in self.allowedExperimentTypes.split(','):
raise InvalidRequest('Experiment type %s is not allowed on this station. Allowed types are: %s.' % (self.getTypeName(), self.allowedExperimentTypes))
if self.options.processingMode not in dmProcessingMode.DM_ALLOWED_PROCESSING_MODE_LIST:
raise InvalidRequest('Processing mode must be one of %s.' % dmProcessingMode.DM_ALLOWED_PROCESSING_MODE_LIST)
def updateDaqInfoFromOptions(self, daqInfo):
if self.options.reprocess:
daqInfo['reprocessFiles'] = True
if self.options.processHidden:
daqInfo['processHiddenFiles'] = True
if self.options.skipPlugins:
daqInfo['skipPlugins'] = self.options.skipPlugins
daqInfo['processingMode'] = self.options.processingMode
if self.options.destDirectory:
daqInfo['destDirectory'] = self.options.destDirectory
def getExperimentName(self):
return self.options.experimentName
def getTypeName(self):
return self.options.typeName
def getDescription(self):
return self.options.description
def getStartDate(self):
return self.options.startDate
def getEndDate(self):
return self.options.endDate
def getProposalId(self):
proposalId = self.options.proposalId
if proposalId:
proposalId = int(proposalId)
return proposalId
def getUsers(self):
# Return list of users and beamline managers that can access data
users = self.options.users
if users:
users = users.split(',')
else:
users = []
beamlineManagers = self.beamlineManagers
if beamlineManagers:
beamlineManagers = beamlineManagers.split(',')
else:
beamlineManagers = []
# Remove duplicates by converting into set
return list(set(users+beamlineManagers))
def addOrUpdateExperiment(self):
dsExperimentApi = ExperimentDsApi(self.loginUsername, self.loginPassword, self.dsServiceHost, self.dsServicePort, self.serviceProtocol)
dsUserApi = UserDsApi(self.loginUsername, self.loginPassword, self.dsServiceHost, self.dsServicePort, self.serviceProtocol)
description = self.getDescription()
proposalId = self.getProposalId()
experimenters = []
if proposalId:
bssApi = ApsBssApi(loginFile=self.options.bssLoginFile)
proposal = bssApi.getBeamlineProposal(proposalId=proposalId, runName=self.options.runName)
experimenters = proposal.get('experimenters', [])
if not description:
description = '%s (Proposal id: %s)' % (proposal['title'], proposalId)
users = self.getUsers()
pis = []
for experimenter in experimenters:
badge = int(experimenter['badge'])
if not badge:
#print 'Skipping user %s due to invalid badge.' % lastName
continue
username = 'd%s' % badge
# Clasify user
if experimenter.get('piFlag') == 'Y':
if not pis.count(username):
pis.append(username)
if users.count(username):
users.remove(username)
else:
if not users.count(username):
users.append(username)
for username in users+pis:
# Check that user exists
dsUserApi.getUserByUsername(username)
# Everything looks good, add experiment
try:
experiment = dsExperimentApi.getExperimentByName(self.getExperimentName())
experimentStation = experiment.get('experimentStation')
stationName = ''
if experimentStation:
stationName = experimentStation.get('name')
if stationName != self.getStationName():
raise InvalidRequest('Experiment %s already exists for station %s.' % (self.getExperimentName(), stationName))
except ObjectNotFound, ex:
experiment = dsExperimentApi.addExperiment(self.getExperimentName(), self.getStationName(), self.getTypeName(), description, self.getStartDate(), self.getEndDate())
# Add pis.
experimentUsernameList = experiment.get('experimentUsernameList', [])
experimentName = experiment['name']
roleName = 'PI'
for username in pis:
if username not in experimentUsernameList:
dsUserApi.addUserExperimentRole(username, roleName, experimentName)
roleName = 'User'
for username in users:
if username not in experimentUsernameList:
dsUserApi.addUserExperimentRole(username, roleName, experimentName)
if len(users+pis):
experiment = dsExperimentApi.getExperimentByName(experimentName)
return experiment
def startUpload(self):
daqExperimentApi = ExperimentDaqApi(self.loginUsername, self.loginPassword, self.daqServiceHost, self.daqServicePort, self.serviceProtocol)
daqInfo = self.splitArgsIntoDict()
self.updateDaqInfoFromOptions(daqInfo)
uploadInfo = daqExperimentApi.upload(self.getExperimentName(), self.getDataDirectory(), daqInfo=daqInfo)
return uploadInfo
def runCommand(self):
self.parseArgs(usage="""
dm-%s-daq --experiment=EXPERIMENTNAME --data-directory=DATADIRECTORY
[--dest-directory=DESTDIRECTORY]
[--reprocess]
[--process-hidden]
[--processing-mode=PROCESSINGMODE]
[--skip-plugins=SKIPPLUGINS]
[--type=TYPENAME]
[--description=DESCRIPTION]
[--start-date=STARTDATE]
[--end-date=ENDDATE]
[--users=USERS]
[--proposal-id=PROPOSALID]
[--run=RUNNAME]
[key1:value1, key2:value2, ...]
Description:
Run upload for experiment on station %s. If experiment does not exist, it will be added to the DM database. If list of users or proposal id is specified, this command will also add roles for all users listed on the proposal.
""" % (self.getStationName().lower(), self.getStationName()))
self.checkArgs()
self.checkCredentials()
experiment = self.addOrUpdateExperiment()
print 'EXPERIMENT INFO'
print experiment.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())
print
uploadInfo = self.startUpload()
print 'UPLOAD INFO'
print uploadInfo.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())
#######################################################################
# Run command.
if __name__ == '__main__':
cli = UploadCli()
cli.run()