CountrycorCountry=trans.createQuery("hql","select c from Country c where c.name like '%"+name+"%' or '"+name+"' member of c.alternativeNames").getResult(Country.class).get(0);
CountrycorCountry=null;
if(!hibernate)
corCountry=trans.createQuery("sql","select distinct c.* from CAMEL_COUNTRY c, CAMEL_COUNTRY_ALTERNATIVENAMES_LIST list where c.name like '%"+name+"%' or (list.cdo_source=c.cdo_id and list.cdo_value='"+name+"')").getResult(Country.class).get(0);
else
corCountry=trans.createQuery("hql","select c from Country c where c.name like '%"+name+"%' or '"+name+"' member of c.alternativeNames").getResult(Country.class).get(0);
GeographicalRegioncorRegion=trans.createQuery("hql","select r from GeographicalRegion r where r.name='"+name+"' or '"+name+"' member of r.alternativeNames").getResult(GeographicalRegion.class).get(0);
GeographicalRegioncorRegion=null;
if(!hibernate)
corRegion=trans.createQuery("sql","select distinct r.* from CAMEL_GEOGRAPHICALREGION r, CAMEL_GEOGRAPHICALREGION_ALTERNATIVENAMES_LIST list where r.name='"+name+"' or (list.cdo_source=r.cdo_id and list.cdo_value='"+name+"')").getResult(GeographicalRegion.class).get(0);
else
corRegion=trans.createQuery("hql","select r from GeographicalRegion r where r.name='"+name+"' or '"+name+"' member of r.alternativeNames").getResult(GeographicalRegion.class).get(0);
DataCenterflexiant=trans.createQuery("hql","select dc from CloudProvider cp, DataCenter dc where cp.name='Flexiant' and dc.cloudProvider=cp").getResult(DataCenter.class).get(0);
DataCentergwdg=trans.createQuery("hql","select dc from CloudProvider cp, DataCenter dc where cp.name='GWDG' and dc.cloudProvider=cp").getResult(DataCenter.class).get(0);
DataCenterflexiant=null;
DataCentergwdg=null;
if(!hibernate){
flexiant=trans.createQuery("sql","select dc.* from CAMEL_ORGANISATION cp, CAMEL_DATACENTER dc, CAMEL_ORGANISATIONMODEL om, CAMEL_ORGANISATIONMODEL_DATACENTRES_LIST list where cp.name='Flexiant' and list.cdo_source=om.cdo_id and list.cdo_value=dc.cdo_id and om.organisation=cp.cdo_id").getResult(DataCenter.class).get(0);
gwdg=trans.createQuery("sql","select dc.* from CAMEL_ORGANISATION cp, CAMEL_DATACENTER dc, CAMEL_ORGANISATIONMODEL om, CAMEL_ORGANISATIONMODEL_DATACENTRES_LIST list where cp.name='GWDG' and list.cdo_source=om.cdo_id and list.cdo_value=dc.cdo_id and om.organisation=cp.cdo_id").getResult(DataCenter.class).get(0);
}
else{
flexiant=trans.createQuery("hql","select dc from Organisation cp, Datacenter dc, OrganisationModel om where cp.name='Flexiant' and dc member of om.dataCentres and om.provider=cp").getResult(DataCenter.class).get(0);
gwdg=trans.createQuery("hql","select dc from Organisation cp, Datacenter dc, OrganisationModel om where cp.name='GWDG' and dc member of om.dataCentres and om.provider=cp").getResult(DataCenter.class).get(0);
}
for(CloudLocationcloc:cloudLocations){
Stringid=cloc.getId();
logger.debug("Checking CloudLocation: "+id);
...
...
@@ -470,7 +501,7 @@ public class ModelImporter {
* according to the model storage guidelines specified in the content of PaaSage WP2
*/
publicvoidcreateRepositoryStructure(){
CDOClientcl=newCDOClient();
//CDOClient cl = new CDOClient("Administrator","0000");
CDOTransactiontrans=cl.openTransaction();
trans.getOrCreateResourceFolder("sec");
...
...
@@ -496,7 +527,7 @@ public class ModelImporter {
logger.error("Something went wrong while creating CDO Repository Structure",e);
}
cl.closeTransaction(trans);
cl.closeSession();
//cl.closeSession();
}
/* This method is used to generate a basic security model through processing a specific
...
...
@@ -518,8 +549,46 @@ public class ModelImporter {
CDOTransactiontrans=cl.openTransaction();
List<Unit>replUnits=newArrayList<Unit>();
for(Unitu:units){
Unitunit=trans.createQuery("hql","select u from Unit u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class).get(0);
replUnits.add(unit);
if(!hibernate){
List<Unit>uns=trans.createQuery("sql","select u.* from CAMEL_COREUNIT u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class);
if(uns!=null&&!uns.isEmpty())
replUnits.add(uns.get(0));
else{
uns=trans.createQuery("sql","select u.* from CAMEL_MONETARYUNIT u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class);
if(uns!=null&&!uns.isEmpty())
replUnits.add(uns.get(0));
else{
uns=trans.createQuery("sql","select u.* from CAMEL_REQUESTUNIT u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class);
if(uns!=null&&!uns.isEmpty())
replUnits.add(uns.get(0));
else{
uns=trans.createQuery("sql","select u.* from CAMEL_STORAGEUNIT u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class);
if(uns!=null&&!uns.isEmpty())
replUnits.add(uns.get(0));
else{
uns=trans.createQuery("sql","select u.* from CAMEL_THROUGHPUTUNIT u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class);
if(uns!=null&&!uns.isEmpty())
replUnits.add(uns.get(0));
else{
uns=trans.createQuery("sql","select u.* from CAMEL_TIMEINTERVALUNIT u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class);
if(uns!=null&&!uns.isEmpty())
replUnits.add(uns.get(0));
else{
uns=trans.createQuery("sql","select u.* from CAMEL_TRANSACTIONUNIT u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class);
if(uns!=null&&!uns.isEmpty())
replUnits.add(uns.get(0));
}
}
}
}
}
}
}
else{
List<Unit>uns=trans.createQuery("hql","select u from Unit u where lower(u.name)='"+u.getName().toLowerCase()+"'").getResult(Unit.class);