{DEV] correct some error in the uopload files
This commit is contained in:
parent
7569516916
commit
ff0bb5743f
28
back/pom.xml
28
back/pom.xml
@ -3,16 +3,10 @@
|
|||||||
<groupId>kar</groupId>
|
<groupId>kar</groupId>
|
||||||
<artifactId>karideo</artifactId>
|
<artifactId>karideo</artifactId>
|
||||||
<version>0.1.0</version>
|
<version>0.1.0</version>
|
||||||
<properties>
|
<properties>
|
||||||
<jaxrs.version>2.1</jaxrs.version>
|
|
||||||
<jersey.version>2.32</jersey.version>
|
|
||||||
<jaxb.version>2.3.1</jaxb.version>
|
|
||||||
<istack.version>3.0.7</istack.version>
|
|
||||||
|
|
||||||
<maven.compiler.version>3.1</maven.compiler.version>
|
<maven.compiler.version>3.1</maven.compiler.version>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
||||||
<maven.dependency.version>3.1.1</maven.dependency.version>
|
<maven.dependency.version>3.1.1</maven.dependency.version>
|
||||||
</properties>
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -25,22 +19,11 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kangaroo-and-rabbit</groupId>
|
<groupId>kangaroo-and-rabbit</groupId>
|
||||||
<artifactId>archidata</artifactId>
|
<artifactId>archidata</artifactId>
|
||||||
<version>0.3.1</version>
|
<version>0.3.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish.jersey</groupId>
|
|
||||||
<artifactId>jersey-bom</artifactId>
|
|
||||||
<version>${jersey.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
@ -62,13 +45,14 @@
|
|||||||
<artifactId>exec-maven-plugin</artifactId>
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
<version>1.4.0</version>
|
<version>1.4.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>io.scenarium.oauth.WebLauncher</mainClass>
|
<mainClass>org.kar.karideo.WebLauncher</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Create the source bundle -->
|
<!-- Create the source bundle -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-sources</id>
|
<id>attach-sources</id>
|
||||||
@ -187,4 +171,4 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</reporting>
|
</reporting>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -10,7 +10,6 @@ import org.kar.karideo.model.Media;
|
|||||||
import org.kar.karideo.model.Season;
|
import org.kar.karideo.model.Season;
|
||||||
import org.kar.karideo.model.Series;
|
import org.kar.karideo.model.Series;
|
||||||
import org.kar.karideo.model.Type;
|
import org.kar.karideo.model.Type;
|
||||||
import org.kar.archidata.GlobalConfiguration;
|
|
||||||
import org.kar.archidata.SqlWrapper;
|
import org.kar.archidata.SqlWrapper;
|
||||||
import org.kar.archidata.UpdateJwtPublicKey;
|
import org.kar.archidata.UpdateJwtPublicKey;
|
||||||
import org.kar.archidata.api.DataResource;
|
import org.kar.archidata.api.DataResource;
|
||||||
@ -90,8 +89,6 @@ public class WebLauncher {
|
|||||||
// enable this to show low level request
|
// enable this to show low level request
|
||||||
//rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, Level.WARNING.getName());
|
//rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, Level.WARNING.getName());
|
||||||
|
|
||||||
System.out.println(" ==> " + GlobalConfiguration.dbConfig);
|
|
||||||
System.out.println("OAuth service " + getBaseURI());
|
|
||||||
HttpServer server = GrizzlyHttpServerFactory.createHttpServer(getBaseURI(), rc);
|
HttpServer server = GrizzlyHttpServerFactory.createHttpServer(getBaseURI(), rc);
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -114,7 +111,6 @@ public class WebLauncher {
|
|||||||
try {
|
try {
|
||||||
server.start();
|
server.start();
|
||||||
System.out.println("Jersey app started at " + getBaseURI());
|
System.out.println("Jersey app started at " + getBaseURI());
|
||||||
System.out.println("Press CTRL^C to exit..");
|
|
||||||
Thread.currentThread().join();
|
Thread.currentThread().join();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("There was an error while starting Grizzly HTTP server.");
|
System.out.println("There was an error while starting Grizzly HTTP server.");
|
||||||
|
@ -11,6 +11,8 @@ import org.kar.karideo.model.Type;
|
|||||||
import org.kar.archidata.SqlWrapper;
|
import org.kar.archidata.SqlWrapper;
|
||||||
import org.kar.archidata.annotation.security.RolesAllowed;
|
import org.kar.archidata.annotation.security.RolesAllowed;
|
||||||
import org.kar.archidata.api.DataResource;
|
import org.kar.archidata.api.DataResource;
|
||||||
|
import org.kar.archidata.exception.FailException;
|
||||||
|
import org.kar.archidata.exception.InputException;
|
||||||
|
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
@ -75,7 +77,7 @@ public class VideoResource {
|
|||||||
@FormDataParam("typeId") String typeId,
|
@FormDataParam("typeId") String typeId,
|
||||||
@FormDataParam("file") InputStream fileInputStream,
|
@FormDataParam("file") InputStream fileInputStream,
|
||||||
@FormDataParam("file") FormDataContentDisposition fileMetaData
|
@FormDataParam("file") FormDataContentDisposition fileMetaData
|
||||||
) {
|
) throws FailException {
|
||||||
try {
|
try {
|
||||||
// correct input string stream :
|
// correct input string stream :
|
||||||
fileName = multipartCorrection(fileName);
|
fileName = multipartCorrection(fileName);
|
||||||
@ -99,10 +101,7 @@ public class VideoResource {
|
|||||||
System.out.println(" - fileMetaData: " + fileMetaData);
|
System.out.println(" - fileMetaData: " + fileMetaData);
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
if (typeId == null) {
|
if (typeId == null) {
|
||||||
return Response.status(406).
|
throw new InputException("typeId", "TypiId is not specified");
|
||||||
entity("Missong Input 'type'").
|
|
||||||
type("text/plain").
|
|
||||||
build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long tmpUID = DataResource.getTmpDataId();
|
long tmpUID = DataResource.getTmpDataId();
|
||||||
@ -116,7 +115,7 @@ public class VideoResource {
|
|||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
DataResource.removeTemporaryFile(tmpUID);
|
DataResource.removeTemporaryFile(tmpUID);
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return Response.notModified("can not create input media").build();
|
throw new FailException("can not create input media (the data model has an internal error");
|
||||||
}
|
}
|
||||||
} else if (data.deleted == true) {
|
} else if (data.deleted == true) {
|
||||||
System.out.println("Data already exist but deleted");
|
System.out.println("Data already exist but deleted");
|
||||||
@ -133,23 +132,26 @@ public class VideoResource {
|
|||||||
Type typeNode = TypeResource.getId(Long.parseLong(typeId));
|
Type typeNode = TypeResource.getId(Long.parseLong(typeId));
|
||||||
if (typeNode == null) {
|
if (typeNode == null) {
|
||||||
DataResource.removeTemporaryFile(tmpUID);
|
DataResource.removeTemporaryFile(tmpUID);
|
||||||
return Response.notModified("TypeId does not exist ...").build();
|
throw new InputException("typeId", "TypeId does not exist ...");
|
||||||
}
|
}
|
||||||
System.out.println(" ==> " + typeNode);
|
System.out.println(" ==> " + typeNode);
|
||||||
System.out.println("Find seriesNode");
|
System.out.println("Find seriesNode");
|
||||||
// get uid of group:
|
// get uid of group:
|
||||||
Series seriesNode = SeriesResource.getOrCreate(series, typeNode.id);
|
Series seriesNode = null;
|
||||||
|
if (series != null) {
|
||||||
|
seriesNode = SeriesResource.getOrCreate(series, typeNode.id);
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println(" ==> " + seriesNode);
|
System.out.println(" ==> " + seriesNode);
|
||||||
System.out.println("Find seasonNode");
|
System.out.println("Find seasonNode");
|
||||||
// get uid of season:
|
// get uid of season:
|
||||||
Season seasonNode = null;
|
Season seasonNode = null;
|
||||||
try {
|
if (seriesNode == null && season != null) {
|
||||||
seasonNode = SeasonResource.getOrCreate(season, seriesNode.id);
|
DataResource.removeTemporaryFile(tmpUID);
|
||||||
} catch (java.lang.NumberFormatException ex) {
|
throw new InputException("season", "Season is set but no seraies is set !!");
|
||||||
// nothing to do ....
|
}
|
||||||
}
|
seasonNode = SeasonResource.getOrCreate(season, seriesNode.id);
|
||||||
|
|
||||||
System.out.println(" ==> " + seasonNode);
|
System.out.println(" ==> " + seasonNode);
|
||||||
System.out.println("add media");
|
System.out.println("add media");
|
||||||
|
|
||||||
@ -160,8 +162,14 @@ public class VideoResource {
|
|||||||
media.name = title;
|
media.name = title;
|
||||||
media.dataId = data.id;
|
media.dataId = data.id;
|
||||||
media.typeId = typeNode.id;
|
media.typeId = typeNode.id;
|
||||||
media.seriesId = seriesNode.id;
|
media.seriesId = null;
|
||||||
media.seasonId = seasonNode.id;
|
if(seriesNode != null) {
|
||||||
|
media.seriesId = seriesNode.id;
|
||||||
|
}
|
||||||
|
media.seasonId = null;
|
||||||
|
if (seasonNode != null) {
|
||||||
|
media.seasonId = seasonNode.id;
|
||||||
|
}
|
||||||
media.episode = null;
|
media.episode = null;
|
||||||
if (episode != null || ! episode.contentEquals("")) {
|
if (episode != null || ! episode.contentEquals("")) {
|
||||||
media.episode = Integer.parseInt(episode);
|
media.episode = Integer.parseInt(episode);
|
||||||
@ -173,19 +181,14 @@ public class VideoResource {
|
|||||||
return Response.ok(creation).build();
|
return Response.ok(creation).build();
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
System.out.println("Catch error:" + ex.getMessage());
|
||||||
|
throw new FailException("Catch SQLerror ==> check server logs");
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.println("Catch an unexpected error ... " + ex.getMessage());
|
System.out.println("Catch an unexpected error ... " + ex.getMessage());
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return Response.status(417).
|
throw new FailException("Catch Exception ==> check server logs");
|
||||||
entity("Back-end error: " + ex.getMessage()).
|
|
||||||
type("text/plain").
|
|
||||||
build();
|
|
||||||
}
|
}
|
||||||
return Response.status(417).
|
|
||||||
entity("Back-end error").
|
|
||||||
type("text/plain").
|
|
||||||
build();
|
|
||||||
}
|
}
|
||||||
@POST
|
@POST
|
||||||
@Path("{id}/add_cover")
|
@Path("{id}/add_cover")
|
||||||
|
@ -29,4 +29,4 @@ public class Season extends GenericTable {
|
|||||||
@SQLComment("List of Id of the sopecific covers")
|
@SQLComment("List of Id of the sopecific covers")
|
||||||
@SQLTableLinkGeneric
|
@SQLTableLinkGeneric
|
||||||
public List<Long> covers = null;
|
public List<Long> covers = null;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user