use of com.openmeap.model.dto.Deployment in project OpenMEAP by OpenMEAP.
the class ModelServiceImpl method findDeploymentsByApplicationArchive.
@Override
public List<Deployment> findDeploymentsByApplicationArchive(ApplicationArchive archive) {
Query q = entityManager.createQuery("select distinct d " + "from Deployment d " + "inner join fetch d.applicationArchive aa " + "where aa.id=:id");
q.setParameter("id", archive.getId());
try {
@SuppressWarnings(value = { "unchecked" }) List<Deployment> deployments = (List<Deployment>) q.getResultList();
return deployments;
} catch (NoResultException nre) {
return null;
}
}
use of com.openmeap.model.dto.Deployment in project OpenMEAP by OpenMEAP.
the class ModelManagerImplTest method testGetLastDeployment.
@Test
public void testGetLastDeployment() throws Exception {
Application app = modelManager.getModelService().findByPrimaryKey(Application.class, 1L);
Deployment d = modelManager.getModelService().getLastDeployment(app);
Assert.assertTrue(d != null && d.getVersionIdentifier().equals("ApplicationVersion.identifier.2"));
}
use of com.openmeap.model.dto.Deployment in project OpenMEAP by OpenMEAP.
the class ApplicationListingsBacking method process.
public Collection<ProcessingEvent> process(ProcessingContext context, Map<Object, Object> templateVariables, Map<Object, Object> parameterMap) {
List<Application> applications = modelManager.getModelService().findAll(Application.class);
if (applications != null && applications.size() > 0) {
Map<String, Anchor> deplUrls = new HashMap<String, Anchor>();
for (Application app : applications) {
Deployment d = modelManager.getModelService().getLastDeployment(app);
if (d != null) {
deplUrls.put(app.getName(), new Anchor("?bean=addModifyAppVersionPage" + "&applicationId=" + app.getId() + "&versionId=" + d.getId(), d.getVersionIdentifier(), d.getVersionIdentifier()));
}
}
templateVariables.put("applications", applications);
templateVariables.put("deplUrls", deplUrls);
}
return null;
}
use of com.openmeap.model.dto.Deployment in project OpenMEAP by OpenMEAP.
the class ApplicationManagementPortTypeImplTest method testConnectionOpen_verifyNoUpdateIfOnlyInitialVersion.
/**
* Verify that no update is set,
* if there are no deployments
* and the initial version is reported
*/
@Test
public void testConnectionOpen_verifyNoUpdateIfOnlyInitialVersion() throws Exception {
com.openmeap.model.dto.Application app = modelManager.getModelService().findByPrimaryKey(Application.class, 1L);
Iterator<Deployment> i = new ArrayList<Deployment>(app.getDeployments()).iterator();
while (i.hasNext()) {
Deployment d = i.next();
modelManager.delete(d, null);
}
app = modelManager.getModelService().findByPrimaryKey(Application.class, 1L);
Assert.assertTrue(app.getDeployments().size() == 0);
Assert.assertTrue(app.getVersions().size() == 2);
thrown = false;
try {
response = appMgmtSvc.connectionOpen(request);
} catch (WebServiceException wse) {
thrown = true;
}
Assert.assertTrue("If no deployments have been made, it should be ok, providing the initial version is reported by SLIC.", !thrown);
app = modelManager.addModify(app, null);
}
use of com.openmeap.model.dto.Deployment in project OpenMEAP by OpenMEAP.
the class ApplicationVersionListingsBacking method setupMayCreateDeployments.
private Boolean setupMayCreateDeployments(Map<Object, Object> templateVariables, Application app, List<ProcessingEvent> events) {
Deployment authTestDepl = new Deployment();
authTestDepl.setApplication(app);
Boolean mayCreateDeployments = modelManager.getAuthorizer().may(Authorizer.Action.CREATE, authTestDepl);
if (!mayCreateDeployments) {
events.add(new MessagesEvent("NOTE: Current user does not have permissions to create deployments"));
}
authTestDepl = null;
templateVariables.put("mayCreateDeployments", mayCreateDeployments);
return mayCreateDeployments;
}
Aggregations