Skip to content
Snippets Groups Projects
Commit 9a790b94 authored by fedoreno's avatar fedoreno
Browse files

SSDM-3511: reformatted

SVN: 36339
parent 9ba9faa4
No related branches found
No related tags found
No related merge requests found
Showing
with 51 additions and 70 deletions
......@@ -21,8 +21,6 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.entity.ISetEntityRel
import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
/**
*
*
* @author Franz-Josef Elmer
*/
public interface ISetSampleProjectExecutor extends ISetEntityRelationsExecutor<SampleCreation, SamplePE>
......
......@@ -21,8 +21,6 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.entity.IUpdateEntity
import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
/**
*
*
* @author Franz-Josef Elmer
*/
public interface IUpdateSampleProjectExecutor extends IUpdateEntityRelationsExecutor<SampleUpdate, SamplePE>
......
......@@ -22,8 +22,6 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext;
import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
/**
*
*
* @author Franz-Josef Elmer
*/
public interface IVerifySampleProjectExecutor
......
......@@ -40,7 +40,7 @@ import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel;
public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleIdentifier>
{
public static final String CONTAINER_SHORTCUT_ALLOWED_ATTRIBUTE = "container-shortcut-allowed";
private String homeSpaceCodeOrNull;
public ListSampleTechIdByIdentifier(String homeSpaceCodeOrNull)
......@@ -74,7 +74,7 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI
}
return result;
}
private boolean getContainerShortcutAllowed(IOperationContext context)
{
Object value = context.getAttribute(CONTAINER_SHORTCUT_ALLOWED_ATTRIBUTE);
......@@ -101,7 +101,7 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI
return groupedIdentifiers;
}
private List<TechIdStringIdentifierRecord> list(final SampleQuery query, final SampleIdentifierParts key,
private List<TechIdStringIdentifierRecord> list(final SampleQuery query, final SampleIdentifierParts key,
final Collection<String> codes, boolean containerShortcutAllowed)
{
final String[] codesArray = codes.toArray(new String[codes.size()]);
......@@ -174,8 +174,8 @@ public class ListSampleTechIdByIdentifier extends AbstractListTechIdById<SampleI
return query.listProjectSampleTechIdsByContainerCodeAndCodes(spaceCode, projectCode, containerCode, codesArray);
}
private List<TechIdStringIdentifierRecord> listWithoutContainerOrWithSomeContainerAndUniqueCode(SampleQuery query,
String[] codes, IListAction listWithoutContainer, IListAction listWithSomeContainer,
private List<TechIdStringIdentifierRecord> listWithoutContainerOrWithSomeContainerAndUniqueCode(SampleQuery query,
String[] codes, IListAction listWithoutContainer, IListAction listWithSomeContainer,
boolean containerShortcutAllowed)
{
try
......
......@@ -25,8 +25,6 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.TechIdStringI
import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListTechIdByPermId;
/**
*
*
* @author Franz-Josef Elmer
*/
public class ListSampleTechIdByPermId extends AbstractListTechIdByPermId<SamplePermId>
......
......@@ -19,7 +19,9 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.executor.sample;
public final class SampleIdentifierParts
{
private String spaceCodeOrNull;
private String projectCodeOrNull;
private String containerCodeOrNull;
SampleIdentifierParts(String spaceCodeOrNull, String projectCodeOrNull, String containerCodeOrNull)
......@@ -56,23 +58,23 @@ public final class SampleIdentifierParts
return false;
}
SampleIdentifierParts key = (SampleIdentifierParts) obj;
return isEqual(spaceCodeOrNull, key.spaceCodeOrNull)
return isEqual(spaceCodeOrNull, key.spaceCodeOrNull)
&& isEqual(projectCodeOrNull, key.projectCodeOrNull)
&& isEqual(containerCodeOrNull, key.containerCodeOrNull);
}
private boolean isEqual(String str1, String str2)
{
return str1 == null ? str1 == str2 : str1.equals(str2);
}
@Override
public int hashCode()
{
return 37 * (37 * calcHashCode(spaceCodeOrNull) + calcHashCode(projectCodeOrNull))
return 37 * (37 * calcHashCode(spaceCodeOrNull) + calcHashCode(projectCodeOrNull))
+ calcHashCode(containerCodeOrNull);
}
private int calcHashCode(String str)
{
return str == null ? 0 : str.hashCode();
......
......@@ -23,8 +23,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePE;
import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind;
/**
*
*
* @author Franz-Josef Elmer
*/
@Component
......
......@@ -33,13 +33,11 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE;
import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
/**
*
*
* @author Franz-Josef Elmer
*/
@Component
public class SetSampleProjectExecutor extends AbstractSetEntityToOneRelationExecutor<SampleCreation, SamplePE, IProjectId, ProjectPE>
implements ISetSampleProjectExecutor
implements ISetSampleProjectExecutor
{
@Autowired
private IMapProjectByIdExecutor mapProjectByIdExecutor;
......@@ -48,7 +46,7 @@ public class SetSampleProjectExecutor extends AbstractSetEntityToOneRelationExec
protected IProjectId getRelatedId(SampleCreation creation)
{
// TODO: project samples
// return creation.getProjectId();
// return creation.getProjectId();
return null;
}
......
......@@ -60,7 +60,7 @@ public class UpdateSampleExecutor extends AbstractUpdateEntityExecutor<SampleUpd
@Autowired
private IUpdateSampleProjectExecutor updateSampleProjectExecutor;
@Autowired
private IUpdateSampleExperimentExecutor updateSampleExperimentExecutor;
......
......@@ -35,12 +35,10 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE;
import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
/**
*
*
* @author Franz-Josef Elmer
*/
@Component
public class UpdateSampleProjectExecutor extends AbstractUpdateEntityToOneRelationExecutor<SampleUpdate, SamplePE, IProjectId, ProjectPE>
public class UpdateSampleProjectExecutor extends AbstractUpdateEntityToOneRelationExecutor<SampleUpdate, SamplePE, IProjectId, ProjectPE>
implements IUpdateSampleProjectExecutor
{
@Autowired
......@@ -52,30 +50,26 @@ public class UpdateSampleProjectExecutor extends AbstractUpdateEntityToOneRelati
return new ProjectIdentifier(related.getIdentifier());
}
@Override
protected ProjectPE getCurrentlyRelated(SamplePE entity)
{
return entity.getProject();
}
@Override
protected FieldUpdateValue<IProjectId> getRelatedUpdate(SampleUpdate update)
{
// TODO: project samples
// return update.getProjectId();
// return update.getProjectId();
return null;
}
@Override
protected Map<IProjectId, ProjectPE> map(IOperationContext context, List<IProjectId> relatedIds)
{
return mapProjectByIdExecutor.map(context, relatedIds);
}
@Override
protected void check(IOperationContext context, SamplePE entity, IProjectId relatedId, ProjectPE related)
{
......@@ -85,7 +79,6 @@ public class UpdateSampleProjectExecutor extends AbstractUpdateEntityToOneRelati
}
}
@Override
protected void update(IOperationContext context, SamplePE entity, ProjectPE related)
{
......
......@@ -40,7 +40,7 @@ public class VerifySampleExecutor implements IVerifySampleExecutor
@Autowired
private IVerifySampleExperimentExecutor verifySampleExperimentExecutor;
@Autowired
private IVerifySampleContainerExecutor verifySampleContainerExecutor;
......@@ -53,7 +53,7 @@ public class VerifySampleExecutor implements IVerifySampleExecutor
verifyEntityPropertyExecutor.verify(context, samples);
verifySampleExperimentExecutor.verify(context, samples);
// TODO: project samples
// verifySampleProjectExecutor.verify(context, samples);
// verifySampleProjectExecutor.verify(context, samples);
verifySampleContainerExecutor.verify(context, samples);
verifySampleParentsExecutor.verify(context, samples);
}
......
......@@ -20,8 +20,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.id.ISpaceId;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.IMapObjectByIdExecutor;
/**
*
*
* @author Franz-Josef Elmer
*/
public interface IMapSpaceTechIdByIdExecutor extends IMapObjectByIdExecutor<ISpaceId, Long>
......
......@@ -25,8 +25,6 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.TechIdStringI
import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.common.AbstractListTechIdByPermId;
/**
*
*
* @author Franz-Josef Elmer
*/
public class ListSpaceTechIdByPermId extends AbstractListTechIdByPermId<SpacePermId>
......
......@@ -32,7 +32,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectPE;
* @author pkupczyk
*/
@Component
public class UpdateTagDataSetsWithCacheExecutor extends UpdateTagEntitiesWithCacheExecutor<IDataSetId, DataPE> implements IUpdateTagDataSetsWithCacheExecutor
public class UpdateTagDataSetsWithCacheExecutor extends UpdateTagEntitiesWithCacheExecutor<IDataSetId, DataPE> implements
IUpdateTagDataSetsWithCacheExecutor
{
@Override
......
......@@ -35,7 +35,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectPE;
* @author pkupczyk
*/
@Component
public class UpdateTagExperimentsExecutor extends AbstractUpdateEntityMultipleRelationsExecutor<TagUpdate, MetaprojectPE, IExperimentId, ExperimentPE>
public class UpdateTagExperimentsExecutor extends
AbstractUpdateEntityMultipleRelationsExecutor<TagUpdate, MetaprojectPE, IExperimentId, ExperimentPE>
implements IUpdateTagExperimentsExecutor
{
......
......@@ -26,8 +26,6 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.TechIdStringIdentifierRecord;
/**
*
*
* @author Franz-Josef Elmer
*/
public abstract class AbstractListTechIdByPermId<ID extends ObjectPermId> extends AbstractListTechIdById<ID>
......@@ -40,7 +38,7 @@ public abstract class AbstractListTechIdByPermId<ID extends ObjectPermId> extend
for (ID permId : ids)
{
permIds.add(permId.getPermId());
}
}
String[] permIdsAsArray = permIds.toArray(new String[permIds.size()]);
Map<Long, ID> result = new HashMap<>();
List<TechIdStringIdentifierRecord> queryTechIds = queryTechIds(permIdsAsArray);
......@@ -50,9 +48,9 @@ public abstract class AbstractListTechIdByPermId<ID extends ObjectPermId> extend
}
return result;
}
protected abstract List<TechIdStringIdentifierRecord> queryTechIds(String[] permIds);
protected abstract ID createPermId(String permIdAsString);
}
......@@ -59,7 +59,7 @@ public class MapObjectById<ID, OBJECT>
return idClassToIdListMap;
}
private Map mapByIds(IOperationContext context, List<IListObjectById<? extends ID, OBJECT>> listers,
private Map mapByIds(IOperationContext context, List<IListObjectById<? extends ID, OBJECT>> listers,
Map<Class, List> idClassToIdListMap)
{
final Map idToObject = new HashMap();
......@@ -67,7 +67,7 @@ public class MapObjectById<ID, OBJECT>
for (Class idClass : idClassToIdListMap.keySet())
{
List idList = idClassToIdListMap.get(idClass);
IListObjectById listerForIdClass = findLister(listers, idClass, idList);
IListObjectById listerForIdClass = findLister(listers, idClass, idList);
List objects = listerForIdClass.listByIds(context, idList);
if (objects != null)
{
......@@ -94,7 +94,7 @@ public class MapObjectById<ID, OBJECT>
throw new UnsupportedObjectIdException((IObjectId) idList.iterator().next());
}
public Map<ID, OBJECT> map(IOperationContext context, List<IListObjectById<? extends ID, OBJECT>> listers,
public Map<ID, OBJECT> map(IOperationContext context, List<IListObjectById<? extends ID, OBJECT>> listers,
Collection<? extends ID> ids)
{
Map<Class, List> idClassToIdListMap = groupIdsByClass(ids);
......
......@@ -151,7 +151,7 @@ public class Generator extends AbstractGenerator
addModificationDate(gen);
gen.setToStringMethod("\"SampleType \" + code");
gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments",
gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments",
"Property assigments", PropertyAssignmentFetchOptions.class);
return gen;
......@@ -224,7 +224,7 @@ public class Generator extends AbstractGenerator
addModificationDate(gen);
gen.setToStringMethod("\"ExperimentType \" + code");
gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments",
gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments",
"Property assigments", PropertyAssignmentFetchOptions.class);
// TODO add validation script
......@@ -287,7 +287,7 @@ public class Generator extends AbstractGenerator
addModificationDate(gen);
gen.setToStringMethod("\"DataSetType \" + code");
gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments",
gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments",
"Property assigments", PropertyAssignmentFetchOptions.class);
// TODO add validation script
......@@ -548,7 +548,7 @@ public class Generator extends AbstractGenerator
addModificationDate(gen);
gen.setToStringMethod("\"MaterialType \" + code");
gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments",
gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments",
"Property assigments", PropertyAssignmentFetchOptions.class);
return gen;
......
......@@ -97,8 +97,7 @@ public class UltimateJSEntityGenerator
.replaceAll("==", "===")
.replaceAll("!=", "!==")
// Remove Comments
.replaceAll("(?:/\\*(?:[^*]|(?:\\*+[^*/]))*\\*+/)|(?://.*)", "")
;
.replaceAll("(?:/\\*(?:[^*]|(?:\\*+[^*/]))*\\*+/)|(?://.*)", "");
}
private static final void whriteStringAsFile(String filePath, String string) throws IOException
......
......@@ -3,19 +3,22 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.helper.generators.uglify;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class ECMAScriptEngineFactory {
public static ScriptEngine getECMAScriptEngine(){
ScriptEngine engine = null;
ScriptEngineManager manager = new ScriptEngineManager();
engine = manager.getEngineByExtension("js");
if(engine == null){
throw new RuntimeException("the java version do not install ECMAScipt engine, must be above java 1.6");
}
return engine;
}
public class ECMAScriptEngineFactory
{
public static ScriptEngine getECMAScriptEngine()
{
ScriptEngine engine = null;
ScriptEngineManager manager = new ScriptEngineManager();
engine = manager.getEngineByExtension("js");
if (engine == null)
{
throw new RuntimeException("the java version do not install ECMAScipt engine, must be above java 1.6");
}
return engine;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment