Search in sources :

Example 6 with Deployment

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;
    }
}
Also used : Query(javax.persistence.Query) Deployment(com.openmeap.model.dto.Deployment) List(java.util.List) NoResultException(javax.persistence.NoResultException)

Example 7 with Deployment

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"));
}
Also used : Deployment(com.openmeap.model.dto.Deployment) Application(com.openmeap.model.dto.Application) Test(org.junit.Test)

Example 8 with Deployment

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;
}
Also used : Anchor(com.openmeap.web.html.Anchor) HashMap(java.util.HashMap) Deployment(com.openmeap.model.dto.Deployment) Application(com.openmeap.model.dto.Application)

Example 9 with Deployment

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);
}
Also used : WebServiceException(com.openmeap.protocol.WebServiceException) Deployment(com.openmeap.model.dto.Deployment) Application(com.openmeap.model.dto.Application) Application(com.openmeap.model.dto.Application) Test(org.junit.Test)

Example 10 with Deployment

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;
}
Also used : MessagesEvent(com.openmeap.event.MessagesEvent) Deployment(com.openmeap.model.dto.Deployment)

Aggregations

Deployment (com.openmeap.model.dto.Deployment)16 Application (com.openmeap.model.dto.Application)8 ApplicationArchive (com.openmeap.model.dto.ApplicationArchive)4 GlobalSettings (com.openmeap.model.dto.GlobalSettings)4 MessagesEvent (com.openmeap.event.MessagesEvent)3 ApplicationVersion (com.openmeap.model.dto.ApplicationVersion)3 Anchor (com.openmeap.web.html.Anchor)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 NoResultException (javax.persistence.NoResultException)3 Query (javax.persistence.Query)3 Test (org.junit.Test)3 AddSubNavAnchorEvent (com.openmeap.admin.web.events.AddSubNavAnchorEvent)2 ProcessingEvent (com.openmeap.event.ProcessingEvent)2 InvalidPropertiesException (com.openmeap.model.InvalidPropertiesException)2 WebServiceException (com.openmeap.protocol.WebServiceException)2 List (java.util.List)2 PersistenceException (javax.persistence.PersistenceException)2 ClusterNotificationException (com.openmeap.cluster.ClusterNotificationException)1 DigestException (com.openmeap.digest.DigestException)1